/* Revontulien ohjesivu — docs/specs/revontulet.md RT-81, ulkoasu
   ui-design.md 3A. Infosivu: luettavaa tekstiä, taulukoita ja kuvia.

   Kuvien värit: häiriötasot (--taso-*) ja NOAA:n luokat (--g0…--g5)
   asettaa ohje.js samoista lähteistä kuin palvelun sivu, joten väri
   tarkoittaa ohjeessa samaa kuin kartalla. Ilman niitä kuvat ovat
   harmaasävyisiä mutta luettavia: portaiden kirkkausjärjestys on sama
   kuin väreillä, ja nimi kulkee aina mukana (RT-49). */

.ohje-paluu {
  display: inline-block;
  margin-bottom: var(--space-3);
  color: var(--color-accent);
  text-decoration: none;
}

.ohje h2 {
  font-size: var(--text-lg);
  margin: var(--space-6) 0 var(--space-3);
}

.ohje h3 {
  font-size: var(--text-base);
  margin: var(--space-4) 0 var(--space-2);
}

.ohje [id] { scroll-margin-top: var(--space-3); }

.ohje p,
.ohje ul,
.ohje ol,
.ohje dl { max-width: 62ch; }

.ohje p { margin: 0 0 var(--space-3); }
.ohje a { color: var(--color-accent); }
.ohje-pieni { color: var(--color-text-muted); font-size: var(--text-sm); }
.ohje-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Sanaston termi: avaa selitteen tekstin kohdalle. Pisteviiva erottaa
   sen tavallisesta linkistä, joka vie toiseen kohtaan. */
.ohje .termi {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: var(--color-text-muted);
  text-underline-offset: 3px;
  cursor: help;
}

/* ── Sisällys ja kysymykset ────────────────────────────────────── */

.ohje-sisallys {
  margin: var(--space-4) 0;
  padding: var(--space-3) 0;
  border-block: 1px solid var(--color-hairline);
}

.ohje-sisallys ol {
  margin: 0;
  padding-left: 1.75em;
  columns: 2 8.5rem;
  column-gap: var(--space-4);
  max-width: none;
}

.ohje-sisallys li { break-inside: avoid; }

.ohje-sisallys a {
  display: inline-block;
  padding-block: 2px;
  color: var(--color-text);
  text-decoration: none;
}

.ohje-sisallys a:hover { color: var(--color-accent); }

.ohje-kysymykset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.ohje .ohje-kysymykset { max-width: none; }

.ohje-kysymykset a {
  display: block;
  height: 100%;
  box-sizing: border-box;
  padding: var(--space-3);
  border: 1px solid #2A2A2A;
  border-radius: 6px;
  color: var(--color-text);
  text-decoration: none;
}

.ohje-kysymykset a:hover { border-color: var(--color-text-muted); }
.ohje-kysymykset strong { display: block; color: var(--color-text-strong); }
.ohje-kysymykset span { color: var(--color-text-muted); font-size: var(--text-sm); }

.ohje-huomio {
  max-width: 62ch;
  padding: var(--space-3);
  border: 1px solid #2A2A2A;
  border-left: 3px solid var(--color-text);
  border-radius: 4px;
}

.ohje-huomio strong { color: var(--color-text-strong); }

/* ── Sivun osat: kuva ja numeroitu lista vierekkäin leveällä
   näytöllä; kuva pysyy näkyvissä listaa luettaessa. */
.ohje-osat {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 640px) {
  .ohje-osat { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .kuva-osat { position: sticky; top: var(--space-3); }
}

.ohje-osalista { margin: 0; padding-left: 1.75em; }
.ohje-osalista li { margin-bottom: var(--space-3); }
.ohje-osalista li > a:last-child::after { content: " →"; }

.ohje-kirjaimet li,
.ohje-rajoitukset li { margin-bottom: var(--space-2); }

.ohje-selitteet dt,
.ohje-sanasto dt {
  margin-top: var(--space-3);
  color: var(--color-text-strong);
  font-weight: 600;
}

.ohje-selitteet dd,
.ohje-sanasto dd { margin: 0; }

.ohje-esimerkkirivi {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3);
  border: 1px solid #2A2A2A;
  border-radius: 4px;
  font-size: var(--text-sm);
}

/* Sovelluskuvake tekstin rinnalla (RT-82): sama esikatselu kuin
   asennusvihjeessä, iOS:n kuvakepyöristyksellä. */
.ohje-tunnus {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.ohje-tunnus img {
  flex-shrink: 0;
  border-radius: 22.5%;
}

/* ── Taulukot ──────────────────────────────────────────────────── */

.ohje-taulukko {
  width: 100%;
  max-width: 40rem;
  margin: var(--space-3) 0 var(--space-4);
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ohje-taulukko caption {
  padding-bottom: var(--space-2);
  color: var(--color-text-strong);
  font-weight: 600;
  text-align: left;
}

.ohje-taulukko th,
.ohje-taulukko td {
  padding: var(--space-2) var(--space-3) var(--space-2) 0;
  border-bottom: 1px solid var(--color-hairline);
  text-align: left;
  vertical-align: top;
}

.ohje-taulukko th:last-child,
.ohje-taulukko td:last-child { padding-right: 0; }
.ohje-taulukko thead th { color: var(--color-text-muted); font-weight: 400; vertical-align: bottom; }
.ohje-taulukko tbody th { font-weight: 600; }
.ohje-merkit tbody th { width: 64px; vertical-align: middle; }
.ohje-kynnykset td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.tasonappi {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: var(--space-2);
  border-radius: 2px;
  vertical-align: -0.1em;
}

.tasonappi.is-rauhallinen { background: var(--taso-rauhallinen, #2A2A2A); }
.tasonappi.is-heikkoja { background: var(--taso-heikkoja, #B0B0B0); }
.tasonappi.is-kirkkaita { background: var(--taso-kirkkaita, #707070); }

/* ── Kuvat ─────────────────────────────────────────────────────── */

.kuva { margin: var(--space-4) 0; }

.kuva svg {
  display: block;
  width: 100%;
  max-width: 26rem;
  height: auto;
  overflow: visible;
}

.kuva-leve svg { max-width: 34rem; }
.kuva-osat { margin: 0; }
.kuva-osat svg { max-width: 22rem; }

.kuva figcaption {
  max-width: 62ch;
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.merkki { display: block; width: 64px; height: 28px; overflow: visible; }

.ohje svg text {
  fill: var(--color-text);
  font-family: var(--font-display);
  font-size: 12px;
}

.ohje svg .k-pieni { font-size: 10.5px; }
.ohje svg .k-mono { font-family: var(--font-mono); }
.ohje svg .k-himmea { fill: var(--color-text-muted); }
.ohje svg .k-lihava { font-weight: 600; }
.ohje svg .k-tumma { fill: #000; }
.ohje svg .k-vanha { fill: var(--color-alert); }
.ohje svg .k-sina { fill: var(--here-blue); }
.ohje svg .k-g2-teksti { fill: var(--g2, var(--color-text)); }
.ohje svg .k-heikkoja-teksti { fill: var(--taso-heikkoja, var(--color-text)); }
.ohje svg .k-halo { paint-order: stroke; stroke: #000; stroke-width: 3px; stroke-linejoin: round; }

/* Häiriötasot (RT-20) ja "ei tietoa" kuten kartalla. */
.k-rauhallinen { fill: var(--taso-rauhallinen, #2A2A2A); }
.k-heikkoja { fill: var(--taso-heikkoja, #B0B0B0); }
.k-kirkkaita { fill: var(--taso-kirkkaita, #707070); }
.k-eitietoa { fill: #3A3A3A; }
.k-palkki { opacity: 0.55; }
.k-asema { stroke: #000; stroke-width: 1.5; }

/* NOAA:n luokat (RT-58): merkki on koodi luokan värisellä pohjalla. */
.k-g0 { fill: var(--g0, #555); }
.k-g1 { fill: var(--g1, #555); }
.k-g2 { fill: var(--g2, #555); }
.k-g3 { fill: var(--g3, #555); }
.k-g4 { fill: var(--g4, #555); }
.k-g5 { fill: var(--g5, #555); }
.ohje svg .k-g-merkki text { fill: #000; font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.ohje svg .k-g-merkki.is-vaalea text { fill: #fff; }
.is-tuleva { opacity: 0.4; }

/* Pinnat ja viivat */
.k-pinta,
.k-kortti { fill: #050505; stroke: #2A2A2A; }
.k-alue { fill: #0A0A0A; }
.k-alue.is-paino { fill: #171717; }
.k-ura { fill: #111; }
.k-hius { stroke: #2A2A2A; }
.k-viiva { stroke: #333; stroke-width: 1.5; }
.k-raja { stroke: var(--color-text); }
.k-raja-viiva { stroke: #444; stroke-dasharray: 2 2; }
.k-leveyspiiri { fill: none; stroke: var(--color-text-muted); stroke-dasharray: 2 3; }
.k-nuoli,
.k-hakanen { fill: none; stroke: var(--color-text); stroke-width: 1.2; }
.k-osoitin { stroke: var(--color-text-muted); }
.k-kynnys { stroke: var(--color-text); stroke-width: 1.5; stroke-dasharray: 3 2; }
.k-kynnys-heikkoja { stroke: var(--taso-heikkoja, #B0B0B0); stroke-dasharray: 4 3; }
.k-kynnys-kirkkaita { stroke: var(--taso-kirkkaita, #707070); stroke-dasharray: 4 3; }
.k-kentta,
.k-sarja { fill: none; stroke: var(--color-text); stroke-width: 1.5; stroke-linejoin: round; }
.k-kentta.is-toinen { stroke: var(--color-text-muted); }
.k-sarja.is-heikkoja { stroke: var(--taso-heikkoja, #B0B0B0); }
.k-sarja.is-kirkkaita { stroke: var(--taso-kirkkaita, #707070); }
.k-asema-pinta { fill: #8A8A8A; fill-opacity: 0.16; }
.k-muutos { stroke: var(--color-text-muted); stroke-width: 2; }
.k-porras { stroke: var(--color-text); stroke-width: 2; }
.k-aikajana { stroke: #444; stroke-width: 2; }
.k-piste { fill: var(--color-text-muted); }
.k-piste.is-ilmoitus { fill: var(--color-text); }
.k-etelaraja { stroke: var(--color-text); stroke-width: 1.5; stroke-dasharray: 4 3; }
.k-etelaraja-viiva { fill: none; stroke: #fff; stroke-width: 2; }
.k-ey { fill: var(--color-text-muted); }
.k-ey-raja { stroke: var(--color-text); stroke-dasharray: 4 3; }
.k-alimyrsky { stroke: var(--color-text); stroke-dasharray: 2 2; }
.k-alimyrsky-merkki { fill: var(--color-text); }
.k-nyt { stroke: var(--color-text); stroke-width: 1.5; }
/* Aurinkotuuli (RT-89): portaiden värit ovat kiinteät kuten palvelussa,
   eivät tila-vastauksen häiriötasoista. */
.ohje svg .k-tuuli-teksti { fill: #FFB000; }
.k-tuuli-kuori { fill: var(--color-text); opacity: 0.1; }
.k-tuuli-matkalla { fill: #fff; opacity: 0.045; }
.k-tuuli-nolla { stroke: #4A4A4A; }
.k-tuuli-raja { stroke: #FFB000; stroke-dasharray: 4 3; opacity: 0.55; }
.k-tuuli-etela { fill: #FFB000; opacity: 0.42; }
.k-tuuli-piste { fill: #FFB000; }
.k-tuuli-nauha { fill: #FFB000; opacity: 0.85; }
.k-tuuli-nauha.is-tavallinen { fill: #5A5A5A; }
.k-porras-1 { fill: #333; }
.k-porras-2 { fill: #5A5A5A; }
.k-porras-3 { fill: #8A8A8A; }
.k-porras-4 { fill: var(--color-text); }

/* Revontulivyöhyke kuten kartalla (RT-22): Heikkoja-portaan amber,
   kirkkaiden rajan pohjoispuolella magenta, pehmeät reunat. */
.k-vyohyke { fill: var(--taso-heikkoja, #B0B0B0); fill-opacity: 0.3; }
.k-vyohyke-kirkas { fill: var(--taso-kirkkaita, #707070); fill-opacity: 0.3; }
.k-vyohyke-reuna { stroke: var(--taso-heikkoja, #B0B0B0); stroke-width: 6; stroke-opacity: 0.85; }
.k-kirkkaiden-reuna { stroke: var(--taso-kirkkaita, #707070); stroke-width: 6; stroke-opacity: 0.85; }
.k-rengas { fill: none; stroke: #F2F2ED; stroke-width: 2; opacity: 0.9; }

/* Käyttäjän sijainti (RT-78): kartalla ilmavoimien kokardi, viivoina
   sinivalkoinen katkoviiva. */
.k-kokardi-sininen { fill: var(--here-kokardi-sininen); }
.k-kokardi-valkoinen { fill: var(--here-kokardi-valkoinen); }
.k-sina-sininen { stroke: var(--here-blue); stroke-width: 1.5; stroke-dasharray: 4 4; }
.k-sina-valkoinen { stroke: var(--here-white); stroke-width: 1.5; stroke-dasharray: 4 4; stroke-dashoffset: 4; }
.k-suomi { fill: var(--here-white); stroke: #000; }

.k-kello { fill: #000; stroke: #333; }
.k-kuvake path { fill: none; stroke: var(--g2, var(--color-text)); stroke-linecap: round; stroke-linejoin: round; }

/* Aurinkotuuli ja ovaali */
.k-aurinko { fill: #F2F2ED; }
.k-sateet { stroke: #F2F2ED; stroke-width: 2; stroke-linecap: round; }
.k-tuuli { stroke: var(--color-text-muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.k-katko { stroke: var(--color-text-muted); stroke-width: 1.2; }
.k-satelliitti { fill: var(--color-text); }
.k-satelliitti-paneeli { stroke: var(--color-text-muted); stroke-width: 4; }
.k-maa { fill: #1B2A3A; stroke: var(--color-text-muted); }
.k-paiva { fill: #161616; }
.k-yo { fill: #050505; }
.k-ovaali { fill: none; stroke: #3FA34D; stroke-width: 16; stroke-opacity: 0.45; }
.k-napa { stroke: var(--color-text); stroke-width: 1.5; }
.k-magneettinen-napa { fill: none; stroke: var(--color-text-muted); stroke-width: 1.5; }
.k-geomagneettinen-napa { fill: var(--color-text); }

/* Horisontti ja tuntinauha */
.k-maa-pinta { fill: #111; stroke: #333; }
.k-revontuli path { stroke: #3FA34D; stroke-width: 3; stroke-linecap: round; opacity: 0.8; }
.k-nakolinja { stroke: var(--color-text-muted); stroke-dasharray: 3 3; }
.k-havaitsija { fill: var(--color-text); }
.k-havaitsija-vartalo { fill: none; stroke: var(--color-text); stroke-width: 1.5; }
.k-tahti { fill: #fff; }
.k-ruutu use { color: var(--color-text); }
.ohje svg .k-ruutu.is-vaalea text { fill: #000; }
.k-ruutu.is-vaalea use { color: #000; }

/* Kuvan merkit: numerot (sivun osat) ja kirjaimet (asemalistan rivi).
   Vaaleat, jotta ne eivät sekoitu häiriötasojen väreihin. */
.ohje a.k-nro { text-decoration: none; cursor: pointer; }
.k-nro circle,
.k-kirjain circle { fill: var(--color-text); }
.ohje svg .k-nro text,
.ohje svg .k-kirjain text { fill: #000; font-size: 11px; font-weight: 700; }
.k-nro:focus-visible { outline: none; }
.k-nro:focus-visible circle { stroke: var(--color-accent); stroke-width: 3; }

/* ── Selite (popover) ──────────────────────────────────────────── */

/* Ilman popover-tukea selite pysyy piilossa, ja termi vie sanastoon. */
.selite { display: none; }

.selite:popover-open {
  display: block;
  /* Skripti asettaa kohdan termin alle; absoluuttinen sijainti vierii
     sivun mukana eikä jää ruudun päälle. */
  position: absolute;
  inset: auto;
  box-sizing: border-box;
  width: min(22rem, calc(100vw - 2 * var(--space-3)));
  max-height: 60vh;
  margin: 0;
  padding: var(--space-3);
  overflow: auto;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0D0D0D;
  color: var(--color-text);
  font-size: var(--text-sm);
  line-height: var(--leading-base);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.6);
}

.selite::backdrop { background: transparent; }

.selite-otsikko {
  margin: 0 2.5rem var(--space-2) 0;
  font-size: var(--text-base);
}

.selite-sulje {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.selite-teksti > :last-child { margin-bottom: 0; }
.selite a { color: var(--color-accent); }

.selite .termi {
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* ── Puhelin (ui-design.md 4.3, 4.4) ───────────────────────────── */

@media (pointer: coarse) {
  .ohje-paluu,
  .ohje-sisallys a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

.ohje-paluu:active,
.ohje-sisallys a:active,
.ohje-kysymykset a:active,
.selite-sulje:active { opacity: 0.55; }

/* Kapealla näytöllä taulukot tiivistyvät, jotta kolme saraketta mahtuu
   ilman vaakavieritystä (RT-48). Pisimmissä yhdyssanoissa on
   tavutusvihje (&shy;). */
@media (max-width: 480px) {
  .ohje-taulukko { font-size: 0.8125rem; }
  .ohje-taulukko th,
  .ohje-taulukko td { padding-right: var(--space-2); }
}
