/* kowoma.de – GPS-Referenz
   Ein Stylesheet für alle Seiten. Keine Frameworks, keine externen Aufrufe.
   Schriften liegen selbst gehostet unter /assets/fonts/ (SIL Open Font License). */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-var.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Spectral";
  src: url("/assets/fonts/spectral-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Spectral";
  src: url("/assets/fonts/spectral-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Spectral";
  src: url("/assets/fonts/spectral-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper:      #f5f7f6;
  --paper-deep: #e9ece9;
  --panel:      #0e1a22;
  --panel-line: #1f3644;
  --ink:        #101b24;
  --ink-soft:   #4f5f6b;
  --rule:       #ccd4d1;
  --signal:     #0a6d61;
  --signal-lit: #37c9b0;
  --caution:    #a75f0e;
  --measure:    66ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #101619;
    --paper-deep: #161e22;
    --panel:      #0a1218;
    --panel-line: #223a48;
    --ink:        #e6ece9;
    --ink-soft:   #96a5ad;
    --rule:       #29343a;
    --signal:     #3fbfa8;
    --caution:    #d59146;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Spectral, Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.68;
}

/* ---------- Kopf ---------- */

.masthead { border-bottom: 1px solid var(--rule); background: var(--paper-deep); }

.masthead-inner {
  max-width: 74rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.75rem;
}

.wordmark {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark span { color: var(--signal); }

.masthead nav {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}
.masthead nav a { color: var(--ink-soft); text-decoration: none; }
.masthead nav a:hover { color: var(--signal); }
.masthead nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- Gerüst ---------- */

.page { max-width: 74rem; margin: 0 auto; padding: 2.25rem 1.5rem 4rem; }

.breadcrumb {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}
.breadcrumb a { color: var(--ink-soft); }

.layout { display: block; }

@media (min-width: 62rem) {
  .layout {
    display: grid;
    grid-template-columns: 1fr 14rem;
    gap: 0 3.5rem;
    align-items: start;
  }
  .contents { position: sticky; top: 2rem; }
}

article > * { max-width: var(--measure); }
article > .wide { max-width: none; }

/* ---------- Typografie ---------- */

h1 {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: clamp(2.1rem, 1.3rem + 3vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
  max-width: 20ch;
}

.standfirst {
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 2rem;
}

h2 {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: 1.42rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 3.2rem 0 0.85rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  max-width: none;
  scroll-margin-top: 1.5rem;
}

h3 {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 2.1rem 0 0.85rem;
  max-width: none;
}

p { margin: 0 0 1.15rem; }
ul, ol { margin: 0 0 1.3rem; padding-left: 1.2rem; }
li { margin-bottom: 0.4rem; }
strong { font-weight: 600; }

a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

/* ---------- Dunkles Figurenpanel ----------
   Basis für alle interaktiven Grafiken: Skyplot, Datumsversatz,
   Diagramme, NMEA-Zerleger. .skyplot bleibt als Alias erhalten. */

.skyplot, .figpanel {
  max-width: none;
  background: var(--panel);
  border-radius: 4px;
  padding: 1.5rem;
  margin: 0 0 0.85rem;
  display: grid;
  gap: 1.5rem 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 44rem) {
  .skyplot, .figpanel { grid-template-columns: 17rem 1fr; align-items: center; }
}

.skyplot svg, .figpanel svg { width: 100%; height: auto; display: block; }

.sky-ring { fill: none; stroke: var(--panel-line); stroke-width: 1; }
.sky-cross { stroke: var(--panel-line); stroke-width: 1; }
.sky-label { fill: #6d8695; font-family: Archivo, sans-serif; font-size: 11px; }
.sky-sat { fill: var(--signal-lit); transition: transform 0.35s ease, opacity 0.35s ease; }
.sky-sat.dim { fill: #4a6472; }

.sky-read, .panel-read { color: #cfe0e6; font-family: Archivo, "Helvetica Neue", Arial, sans-serif; }

.sky-switch, .panel-switch { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

.sky-switch button, .panel-switch button {
  font: inherit;
  font-size: 0.85rem;
  color: #9db4bf;
  background: transparent;
  border: 1px solid var(--panel-line);
  border-radius: 3px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.sky-switch button:hover, .panel-switch button:hover { color: #dff2f5; border-color: #35576a; }
.sky-switch button[aria-pressed="true"], .panel-switch button[aria-pressed="true"] {
  color: var(--panel);
  background: var(--signal-lit);
  border-color: var(--signal-lit);
  font-weight: 600;
}

.sky-figures, .panel-figures { display: flex; gap: 2.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sky-figure strong, .panel-figure strong {
  display: block;
  font-size: 2rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--signal-lit);
}
.sky-figure span, .panel-figure span { font-size: 0.8125rem; color: #7f97a3; }

.sky-note, .panel-note { font-size: 0.9rem; line-height: 1.55; color: #a8bec8; margin: 0; max-width: 40ch; }

.figcaption {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 2.75rem;
  max-width: 62ch;
}

/* ---------- Fehlerbudget ---------- */

.budget {
  margin: 0 0 1rem;
  border-top: 2px solid var(--ink);
  max-width: none;
}

.budget-row {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) 4.5rem 1fr;
  align-items: center;
  gap: 0 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}

.budget-row.total { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 600; }

.budget-name { font-family: Archivo, "Helvetica Neue", Arial, sans-serif; font-size: 0.9rem; }

.budget-value {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink-soft);
}
.budget-row.total .budget-value { color: var(--ink); }

.budget-bar { height: 0.5rem; background: var(--signal); border-radius: 1px; }
.budget-row.total .budget-bar { background: var(--ink); }

/* ---------- Tabellen ---------- */

.table-scroll { overflow-x: auto; margin: 0 0 1.6rem; max-width: none; }

table {
  border-collapse: collapse;
  width: 100%;
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
}

th, td { text-align: left; padding: 0.55rem 1.1rem 0.55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { border-bottom: 1px solid var(--ink); font-weight: 600; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Merksatz ---------- */

.note {
  border-left: 3px solid var(--caution);
  padding: 0.1rem 0 0.1rem 1.1rem;
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
}
.note p:last-child { margin-bottom: 0; }

/* ---------- Seiteninhalt ---------- */

.contents {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
  line-height: 1.4;
  border-top: 2px solid var(--ink);
  padding-top: 0.9rem;
  margin: 3rem 0 0;
}

@media (min-width: 62rem) { .contents { margin-top: 0; } }

.contents h2 {
  font-size: 0.85rem;
  font-weight: 600;
  border: 0;
  padding: 0;
  margin: 0 0 0.7rem;
  letter-spacing: 0;
}

.contents ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.contents li { margin-bottom: 0.55rem; }
.contents a { color: var(--ink-soft); text-decoration: none; }
.contents a:hover { color: var(--signal); text-decoration: underline; }

/* ---------- Weiterführend ---------- */

.related { margin-top: 3.5rem; padding-top: 1.1rem; border-top: 1px solid var(--rule); max-width: none; }
.related h2 { border-top: 0; padding-top: 0; margin: 0 0 1rem; font-size: 1.05rem; }

.related ul, .linkgrid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem 2.5rem;
}
.related li, .linkgrid li { margin: 0; }
.related a, .linkgrid a { font-family: Archivo, "Helvetica Neue", Arial, sans-serif; font-size: 0.92rem; }
.related .desc, .linkgrid .desc {
  display: block;
  color: var(--ink-soft);
  font-family: Spectral, Georgia, serif;
  font-size: 0.875rem;
  line-height: 1.45;
  margin-top: 0.15rem;
}

/* ---------- Fuß ---------- */

.sitefoot {
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}
.sitefoot-inner { max-width: 74rem; margin: 0 auto; padding: 1.75rem 1.5rem 2.5rem; }
.sitefoot p { margin: 0 0 0.5rem; max-width: 70ch; }
.sitefoot a { color: var(--ink-soft); }

@media (max-width: 34rem) {
  .budget-row { grid-template-columns: 1fr 4rem; row-gap: 0.3rem; }
  .budget-bar { grid-column: 1 / -1; }
}


/* ---------- Panel in voller Breite ----------
   Grafik oben, Ablesewerte darunter statt daneben. */

.figpanel.stacked { grid-template-columns: 1fr; }
@media (min-width: 44rem) { .figpanel.stacked { grid-template-columns: 1fr; } }

/* ---------- Diagramme im Panel ---------- */

.plot-grid  { stroke: var(--panel-line); stroke-width: 1; }
.plot-axis  { stroke: #46606d; stroke-width: 1; }
.plot-line  { fill: none; stroke: var(--signal-lit); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.plot-line.second { stroke: #d59146; stroke-dasharray: 5 4; stroke-width: 2; }
.plot-fill  { fill: var(--signal-lit); opacity: 0.1; }
.plot-dot   { fill: var(--signal-lit); }
.plot-label { fill: #7f97a3; font-family: Archivo, sans-serif; font-size: 11px; }
.plot-key   { fill: #cfe0e6; font-family: Archivo, sans-serif; font-size: 12px; }
.plot-bar   { fill: var(--signal-lit); }
.plot-bar.muted { fill: #3d5766; }

/* ---------- Datumsversatz ---------- */

.datum-grid  { stroke: var(--panel-line); stroke-width: 1; }
.datum-true  { fill: none; stroke: #cfe0e6; stroke-width: 1.5; }
.datum-mark  { fill: var(--signal-lit); transition: transform 0.4s ease; }
.datum-trace { stroke: var(--signal-lit); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; transition: all 0.4s ease; }
.datum-scale { stroke: #7f97a3; stroke-width: 1; }

/* ---------- NMEA-Zerleger ---------- */

.nmea-line {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 2.1;
  color: #8fa8b4;
  word-break: break-all;
  margin: 0 0 1.25rem;
}

.nmea-field {
  font: inherit;
  color: #cfe0e6;
  background: transparent;
  border: 0;
  border-bottom: 2px solid #2c4a5a;
  padding: 0.1rem 0.15rem;
  cursor: pointer;
  border-radius: 2px 2px 0 0;
}
.nmea-field:hover { background: #17313d; color: #ffffff; }
.nmea-field[aria-pressed="true"] {
  background: var(--signal-lit);
  border-bottom-color: var(--signal-lit);
  color: var(--panel);
  font-weight: 600;
}

.nmea-out { min-height: 7.5rem; }
.nmea-out h3 {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--signal-lit);
  margin: 0 0 0.4rem;
}
.nmea-out p { color: #a8bec8; font-size: 0.95rem; line-height: 1.55; margin: 0 0 0.6rem; max-width: 52ch; }
.nmea-out .raw {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: #cfe0e6;
}

/* ---------- Themenblöcke auf der Übersicht ---------- */

.linkgrid { max-width: none; margin: 0 0 1.9rem; }

.raw {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.panel-figure.text strong { font-size: 1.3rem; }
.section-lead { color: var(--ink-soft); margin: 0 0 1.4rem; max-width: var(--measure); }

.factstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem 2.75rem;
  margin: 0 0 2rem;
  padding: 1.1rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  max-width: none;
}
.factstrip div { }
.factstrip strong {
  display: block;
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.factstrip span {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

/* ---------- Formelzeile ---------- */

.formula {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.05rem;
  background: var(--paper-deep);
  border-left: 3px solid var(--signal);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.5rem;
  overflow-x: auto;
}
.formula em { font-style: italic; font-family: Spectral, Georgia, serif; }
.formula .where {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  font-family: Archivo, sans-serif;
}

/* ---------- Trilateration ---------- */

.tri-circle { fill: none; stroke: var(--signal-lit); stroke-width: 1.5; opacity: 0.8; }
.tri-sat    { fill: #cfe0e6; }
.tri-point  { fill: var(--signal-lit); }
.tri-region { fill: #d59146; fill-opacity: 0.2; stroke: #d59146; stroke-width: 1; stroke-dasharray: 3 3; }

/* ---------- Ablaufdiagramm ---------- */

.flow-box   { fill: #16303c; stroke: #2c4a5a; stroke-width: 1; rx: 3; }
.flow-box.lit { stroke: var(--signal-lit); }
.flow-title { fill: #cfe0e6; font-family: Archivo, sans-serif; font-size: 12px; font-weight: 600; }
.flow-sub   { fill: #7f97a3; font-family: Archivo, sans-serif; font-size: 10.5px; }
.flow-arrow { stroke: var(--signal-lit); stroke-width: 1.5; fill: none; }
.flow-arrow.faint { stroke: #46606d; }

/* ---------- Umrechner im Panel ---------- */

.conv { display: grid; gap: 1.25rem 2rem; grid-template-columns: 1fr; }
@media (min-width: 44rem) { .conv { grid-template-columns: 15rem 1fr; } }

.panel-label { display: block; font-size: 0.8125rem; color: #7f97a3; margin-bottom: 0.25rem; }

.panel-input {
  display: block;
  width: 100%;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  color: #e6f2f5;
  background: #0f222c;
  border: 1px solid var(--panel-line);
  border-radius: 3px;
  padding: 0.5rem 0.65rem;
  margin: 0 0 0.9rem;
}
.panel-input:focus { border-color: var(--signal-lit); outline: none; }
.panel-input[aria-invalid="true"] { border-color: #d59146; }

.conv-hint { font-size: 0.8125rem; line-height: 1.5; color: #7f97a3; margin: 0; }
.conv-error { font-size: 0.85rem; color: #d59146; min-height: 1.3rem; margin: 0 0 0.6rem; }

.conv-out { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.5rem 1rem; margin: 0; font-size: 0.9rem; }
.conv-out dt { color: #7f97a3; }
.conv-out dd {
  margin: 0;
  color: #e6f2f5;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  word-break: break-word;
}
@media (max-width: 30rem) { .conv-out { grid-template-columns: 1fr; } .conv-out dd { margin-bottom: 0.4rem; } }

/* ---------- Kompass ---------- */

.needle      { stroke-width: 2.5; stroke-linecap: round; transition: transform 0.4s ease; }
.needle.true { stroke: #cfe0e6; }
.needle.mag  { stroke: #d59146; }
.needle.grid { stroke: var(--signal-lit); }
.compass-ring { fill: none; stroke: var(--panel-line); stroke-width: 1; }
.compass-tick { stroke: #2c4a5a; stroke-width: 1; }

/* ---------- Glossar ---------- */

.glossary { margin: 0 0 1.5rem; max-width: var(--measure); }
.glossary dt {
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 1.1rem;
  scroll-margin-top: 1rem;
}
.glossary dd { margin: 0.25rem 0 0; color: var(--ink); }
.glossary dd a { font-family: Archivo, "Helvetica Neue", Arial, sans-serif; font-size: 0.85rem; white-space: nowrap; }
.glossary dt:target, .glossary dt:target + dd { background: var(--paper-deep); }

/* ---------- Codeblock ---------- */

pre.code {
  background: var(--paper-deep);
  border-left: 3px solid var(--rule);
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.5rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  max-width: none;
}
pre.code code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }


/* ---------- Archivhinweis ---------- */

.note.archive { border-left-color: #a75f0e; background: var(--paper-deep); }
.note.archive strong { font-family: Archivo, "Helvetica Neue", Arial, sans-serif; letter-spacing: 0.01em; }
