/* ==========================================================================
   PARKSIDE-käyttöohjeet — case study
   Väripaletti on luettu PARKSIDEn omista design-tokeneista (parkside-diy.com),
   ei silmämääräisesti näytteistetty. Sama valinta kuin itse tuotteessa.
   ========================================================================== */

:root {
  /* --- vaalea teema (perusta) --- */
  --paper:        #f2f3f4;   /* PARKSIDE grey */
  --paper-2:      #fafafa;
  --surface:      #ffffff;
  --sunken:       #edeff0;
  --ink:          #1c1c1c;   /* PARKSIDE dark grey */
  --ink-2:        #3d4245;
  --muted:        #626262;   /* PARKSIDE grey 626262 */
  --faint:        #8b9094;
  --line:         #dee2e4;
  --line-2:       #cccfd1;

  --brand:        #1e4b32;   /* PARKSIDE primary green */
  --brand-deep:   #143c28;
  --brand-ink:    #ffffff;
  --volt:         #00ff99;   /* PARKSIDE power green */
  --volt-ink:     #10261c;
  --alert:        #cd2828;   /* PARKSIDE red */
  --alert-soft:   #fbeaea;

  /* rautalankamallit */
  --wire-line:    #b6bcc0;
  --wire-fill:    #e4e7e9;
  --wire-ghost:   #f0f2f3;
  --wire-ink:     #6b7276;
  --wire-accent:  #1e4b32;

  --shadow:       0 1px 2px rgba(20,32,26,.05), 0 8px 24px -12px rgba(20,32,26,.18);
  --shadow-lift:  0 2px 4px rgba(20,32,26,.07), 0 18px 40px -16px rgba(20,32,26,.28);

  --page:         1400px;
  --rail:         260px;
  --gap:          40px;
  --measure:      60ch;

  /* Tyyppiasteikon kerroin. Yksi luku mitoittaa koko sivun, joten mikään
     yksittäinen sääntö ei tarvitse omaa kokoversiotaan. Perusarvo on
     mitoitettu projektorille — sivu on luettava huoneen perältä ilman
     erillistä tilaa, jonka joku muistaa kytkeä päälle. Kapeammilla
     ruuduilla kerrointa lasketaan alempana. */
  --ts:           1.32;

  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body:    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #141816;
    --paper-2:    #191e1b;
    --surface:    #1c2220;
    --sunken:     #101412;
    --ink:        #edeff0;
    --ink-2:      #c3c9c6;
    --muted:      #939b97;
    --faint:      #6c7570;
    --line:       #2b3330;
    --line-2:     #3a4440;

    --brand:      #48f2bf;   /* PARKSIDE hover green — kantaa tummalla pohjalla */
    --brand-deep: #1e4b32;
    --brand-ink:  #10261c;
    --volt:       #00ff99;
    --volt-ink:   #10261c;
    --alert:      #ff6b6b;
    --alert-soft: #2a1a1a;

    --wire-line:  #4a5450;
    --wire-fill:  #242b28;
    --wire-ghost: #1e2422;
    --wire-ink:   #8b9490;
    --wire-accent:#48f2bf;

    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 18px 40px -16px rgba(0,0,0,.7);
  }
}

:root[data-theme="dark"] {
  --paper:      #141816;
  --paper-2:    #191e1b;
  --surface:    #1c2220;
  --sunken:     #101412;
  --ink:        #edeff0;
  --ink-2:      #c3c9c6;
  --muted:      #939b97;
  --faint:      #6c7570;
  --line:       #2b3330;
  --line-2:     #3a4440;

  --brand:      #48f2bf;
  --brand-deep: #1e4b32;
  --brand-ink:  #10261c;
  --volt:       #00ff99;
  --volt-ink:   #10261c;
  --alert:      #ff6b6b;
  --alert-soft: #2a1a1a;

  --wire-line:  #4a5450;
  --wire-fill:  #242b28;
  --wire-ghost: #1e2422;
  --wire-ink:   #8b9490;
  --wire-accent:#48f2bf;

  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.45), 0 18px 40px -16px rgba(0,0,0,.7);
}

/* ========================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: calc(16.5px * var(--ts));
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--volt); color: var(--volt-ink); }

a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brand); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: -0.018em;
  text-wrap: balance;
  margin: 0;
  line-height: 1.12;
}

p { margin: 0 0 1.05em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--ink); }

code, .mono { font-family: var(--f-mono); font-size: .88em; font-variant-ligatures: none; }

code {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .08em .34em;
  white-space: nowrap;
}

.num { font-variant-numeric: tabular-nums; }

/* ============================ SKIP LINK ================================== */

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: var(--brand-ink);
  padding: .7rem 1.1rem; font-weight: 600;
}
.skip:focus { left: 8px; top: 8px; }

/* ============================ NAV ======================================== */

/* Navigaatio on kromia, ei luettavaa sisältöä, joten se ajaa yhtä pykälää
   sisällön asteikkoa alempana: kaikki yhdeksän osionumeroa mahtuvat riville
   läppärin leveydellä sen sijaan että kaksi viimeistä piiloutuisi vierityksen
   taakse. Sama token, eri arvo — mikään sääntö tämän alla ei muutu. */
.nav {
  --ts: 1.14;
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: var(--page); margin: 0 auto;
  padding: 9px 28px;
  display: flex; align-items: center; gap: 18px;
}
.nav-mark {
  font-family: var(--f-display); font-weight: 800; font-size: calc(13px * var(--ts));
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.nav-mark::before {
  content: ""; width: 4px; height: 15px; background: var(--alert);
  display: block; border-radius: 1px;
}
/* Navigaatio lainaa tuotteen omaa fasettisirua — sivu liikkuu kuten kohde */
.nav-chips {
  display: flex; gap: 6px; overflow-x: auto; flex: 1;
  /* Flex-kohteen oletus min-width:auto antaisi nowrap-sirujen leventää
     rivin sisällön mittaiseksi, jolloin koko sivu vierii sivusuunnassa
     sen sijaan että sirurivi vierisi omassa laatikossaan. */
  min-width: 0;
  scrollbar-width: none; -ms-overflow-style: none;
}
.nav-chips::-webkit-scrollbar { display: none; }
.nav-chip {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); font-weight: 500;
  letter-spacing: .02em;
  padding: 5px 10px; border-radius: 2px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
  text-decoration: none; white-space: nowrap;
  transition: color .14s, border-color .14s, background .14s;
}
.nav-chip:hover { color: var(--ink); border-color: var(--muted); }
.nav-chip[aria-current="true"] {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink);
}

/* Osionumero on hyppyosoite, ei koriste: esittäjä sanoo "viitonen" ja
   koneen ääressä oleva painaa 5. Siksi se näkyy sekä navigaatiossa
   että marginaalikiskossa. */
.nav-chip b, .rail-tag b {
  font-weight: 700; font-variant-numeric: tabular-nums;
  display: inline-block; margin-right: .55em;
  color: var(--brand);
}
.nav-chip[aria-current="true"] b { color: var(--brand-ink); }

/* ---- Näppäinohje ---- */
.keys {
  position: fixed; z-index: 60; right: 20px; bottom: 20px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lift); padding: 18px 22px 16px;
  max-width: 300px;
}
.keys h2 {
  font-family: var(--f-mono); font-size: calc(11px * var(--ts));
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 12px; font-weight: 600;
}
.keys dl {
  margin: 0; display: grid; grid-template-columns: auto 1fr;
  gap: 7px 16px; align-items: baseline;
}
.keys dt {
  font-family: var(--f-mono); font-size: calc(12.5px * var(--ts));
  font-weight: 600; color: var(--ink); white-space: nowrap;
}
.keys dd {
  margin: 0; font-size: calc(13px * var(--ts)); color: var(--muted); line-height: 1.35;
}
.keys p {
  margin: 14px 0 0; font-family: var(--f-mono);
  font-size: calc(11px * var(--ts)); color: var(--faint);
}

/* ============================ DOC GRID =================================== */

.doc { max-width: var(--page); margin: 0 auto; padding: 0 28px 120px; }

section {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 var(--gap);
  padding: 74px 0 0;
  scroll-margin-top: 62px;
}
section > .rail { grid-column: 1; }
section > .body { grid-column: 2; min-width: 0; }

/* Marginaalikisko: kuten huoltokäsikirjan reunamerkinnät */
.rail { padding-top: 5px; }
.rail-tag {
  font-family: var(--f-mono); font-size: calc(15px * var(--ts)); font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-2);
  border-top: 3px solid var(--ink); padding-top: 10px;
  display: block;
}
.rail-note {
  font-family: var(--f-mono); font-size: calc(14.5px * var(--ts)); line-height: 1.55;
  color: var(--muted); margin-top: 18px;
  border-left: 2px solid var(--line-2); padding-left: 13px;
}
.rail-note b {
  color: var(--ink); font-weight: 600; display: block;
  font-size: calc(16px * var(--ts)); letter-spacing: -.01em; margin-bottom: 3px;
}

h2 {
  font-size: calc(clamp(26px, 3.4vw, 36px) * var(--ts));
  margin: 0 0 6px;
  letter-spacing: -0.026em;
}
.dek {
  font-size: calc(17px * var(--ts)); color: var(--muted); max-width: var(--measure);
  margin: 0 0 26px;
}
h3 {
  font-size: calc(18px * var(--ts)); letter-spacing: -0.012em;
  margin: 34px 0 8px;
}
h4 {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 9px;
}

/* ============================ HERO ======================================= */

.hero {
  display: block; padding: 0;
  border-bottom: 1px solid var(--line);
}
.hero-in { max-width: var(--page); margin: 0 auto; padding: 76px 28px 0; }

.eyebrow {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px; background: var(--line); max-width: 220px;
}

.hero h1 {
  font-size: calc(clamp(40px, 8.2vw, 88px) * var(--ts));
  font-weight: 800;
  letter-spacing: -0.042em;
  line-height: .96;
  margin: 0 0 4px;
  max-width: 15ch;
}
.hero h1 .thin {
  font-weight: 600; color: var(--muted); display: block;
  font-size: .5em; letter-spacing: -0.03em; line-height: 1.06;
  margin-top: .22em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(to top, var(--volt) 0 .11em, transparent .11em);
  padding: 0 .05em .04em;
}

.hero-lede {
  font-size: calc(clamp(17px, 2.1vw, 20px) * var(--ts));
  color: var(--ink-2); max-width: 56ch; margin: 26px 0 0;
  line-height: 1.55;
}

.hero-meta {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); color: var(--muted);
  margin: 30px 0 0; padding-top: 18px; border-top: 1px solid var(--line);
}
.hero-meta span { display: flex; gap: 7px; }
.hero-meta b { color: var(--ink); font-weight: 500; }

/* mittarinauha */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line);
  margin: 42px 0 0;
}
.stat { background: var(--paper); padding: 18px 16px 16px; }
.stat b {
  display: block; font-family: var(--f-display); font-weight: 700;
  font-size: calc(clamp(24px, 3.4vw, 32px) * var(--ts)); letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
  color: var(--ink);
}
.stat span {
  display: block; font-family: var(--f-mono); font-size: calc(10.5px * var(--ts));
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  margin-top: 8px; line-height: 1.4;
}
.stat.is-key b { color: var(--brand); }

/* ============================ FIGURES ==================================== */

figure { margin: 26px 0 0; }
figure svg { display: block; width: 100%; height: auto; }

.fig {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 22px;
  overflow-x: auto;
}
.fig-wide { padding: 26px 22px; }

figcaption {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); line-height: 1.55;
  color: var(--muted); margin-top: 11px;
  display: flex; gap: 9px;
}
figcaption b {
  color: var(--ink); font-weight: 600; white-space: nowrap;
  letter-spacing: .04em;
}

/* ---- Rautalankamallien selitteet ----
   Nämä ovat SVG:n käyttäjäyksiköitä, eivät CSS-pikseleitä: ne skaalautuvat
   säiliön mukana, joten leveämpi sivu suurentaa ne itsestään ilman että
   yhtäkään koordinaattia kosketaan. Siksi --ts EI kerro näitä — kerroin
   kasvattaisi tekstiä piirretyn geometrian sisällä, jolloin selitepari
   menisi päällekkäin 14 yksikön riviväliin ja pisimmät rivit leikkautuisivat
   viewBoxin reunaan. Koko on mitoitettu piirrokseen; sivun leveys hoitaa loput. */
.wf-callout text { font-size: 11px; }
.wf-callout .wf-detail { opacity: .7; }

.nav-btn {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts));
  letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  padding: 5px 11px; border-radius: 2px; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
  transition: color .14s, border-color .14s, background .14s;
}
.nav-btn:hover { color: var(--ink); border-color: var(--muted); }

/* ============================ DECISIONS ================================== */

.decisions {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); margin-top: 8px;
  /* Sama sääntö kuin navigaatiossa: ruudukkokohde on oletuksena
     min-width:auto, joten pitkä koodimerkintä tai taulukon min-width
     leventäisi koko sivua sen sijaan että vierittäisi omaa laatikkoaan. */
  grid-template-columns: minmax(0, 1fr);
}

.dec { background: var(--paper); padding: 24px 26px 26px; min-width: 0; }
.dec-h {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.dec-h h3 { margin: 0; font-size: calc(19px * var(--ts)); }
.dec-ref {
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); font-weight: 500;
  letter-spacing: .1em; color: var(--faint); text-transform: uppercase;
  border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 2px;
  white-space: nowrap;
}
.dec p { font-size: calc(15.5px * var(--ts)); }

.verdicts { display: grid; gap: 10px; margin-top: 14px; }
.verdict {
  display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 14px;
  font-size: calc(14.8px * var(--ts)); line-height: 1.55;
  padding-top: 10px; border-top: 1px dashed var(--line-2);
}
.verdict > b {
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  padding-top: 3px;
}
.verdict.pick > b { color: var(--brand); }
.verdict.drop > b { color: var(--alert); }
.verdict.drop { color: var(--muted); }
.verdict.cost > b { color: var(--muted); }
.verdict.cost { color: var(--muted); }

/* ============================ TABLE ====================================== */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); margin-top: 22px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: calc(14.5px * var(--ts)); min-width: 480px; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); }
thead th {
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  background: var(--sunken); border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.was { color: var(--muted); font-family: var(--f-mono); font-size: calc(12.5px * var(--ts)); }
.gain { color: var(--brand); font-weight: 600; font-family: var(--f-mono); font-size: calc(13px * var(--ts)); white-space: nowrap; }

/* ============================ PERF BARS ================================== */

.perf { display: grid; grid-template-columns: minmax(0,1fr); gap: 20px; margin-top: 24px; }
.perf-row { border-top: 1px solid var(--line); padding-top: 14px; min-width: 0; }
.perf-row > h4 { margin-bottom: 12px; color: var(--ink); }
.bar-line { display: grid; grid-template-columns: 118px minmax(0,1fr) 82px; gap: 12px; align-items: center; margin-bottom: 7px; }
.bar-line > span:first-child {
  font-family: var(--f-mono); font-size: calc(11px * var(--ts)); letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.bar-track { background: var(--sunken); height: 15px; border: 1px solid var(--line); position: relative; }
.bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  transition: width .85s cubic-bezier(.2,.7,.3,1);
}
.bar-line.before .bar-fill { background: var(--line-2); }
.bar-line.after  .bar-fill { background: var(--brand); }
.bar-val {
  font-family: var(--f-mono); font-size: calc(12.5px * var(--ts)); font-variant-numeric: tabular-nums;
  color: var(--ink); text-align: right;
}
.bar-line.before .bar-val { color: var(--muted); }

/* ============================ DEMO (facets) ============================== */

.demo {
  border: 1px solid var(--line); background: var(--surface);
  margin-top: 24px; min-width: 0;
}
.demo-bar {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: var(--sunken);
  display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 10px 14px;
  align-items: start;
}
.demo-bar + .demo-bar { border-top: 0; }
.demo-lab {
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding-top: 6px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

.chip {
  font-family: var(--f-body); font-size: calc(13px * var(--ts)); font-weight: 500;
  padding: 4px 9px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: border-color .13s, background .13s, color .13s;
}
.chip:hover { border-color: var(--muted); }
.chip .c {
  font-family: var(--f-mono); font-size: calc(11px * var(--ts)); font-variant-numeric: tabular-nums;
  color: var(--muted);
}
/* Valittu siru ottaa power greenin: brändivihreä brändivihreällä katoaisi */
.chip[aria-pressed="true"] {
  background: var(--volt); border-color: var(--volt); color: var(--volt-ink);
  font-weight: 600;
}
.chip[aria-pressed="true"] .c { color: var(--volt-ink); opacity: .72; }
/* Nollasiru himmentää sisältönsä, ei omaa läpinäkyvyyttään */
.chip.zero { cursor: default; }
.chip.zero, .chip.zero .c { color: var(--faint); }

.demo-status {
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); color: var(--muted);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--paper-2);
}
.demo-status b { color: var(--ink); font-weight: 600; }
.demo-reset {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); background: none;
  border: 0; border-bottom: 1px solid var(--line-2); color: var(--muted);
  cursor: pointer; padding: 0 0 1px;
}
.demo-reset:hover { color: var(--ink); border-color: var(--ink); }

.demo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
  gap: 1px; background: var(--line); padding: 1px;
  min-height: 150px;
}
.pcard {
  background: var(--surface); padding: 13px 14px 14px;
  display: flex; flex-direction: column; gap: 5px;
  animation: pop .22s ease both;
}
@keyframes pop { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .pcard { animation: none; }
  .bar-fill { transition: none; }
  html { scroll-behavior: auto; }
}
.pcard-name { font-size: calc(13.5px * var(--ts)); font-weight: 600; line-height: 1.3; }
.pcard-was {
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); color: var(--faint);
  text-decoration: line-through; line-height: 1.35;
}
.pcard-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 5px 8px;
  margin-top: auto; padding-top: 8px;
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* Rivin katkeaminen kesken päivämäärän näyttää vialta — merkki putoaa mieluummin
   omalle rivilleen kuin antaa "2022-10" katketa kahtia. */
.pcard-foot > span:first-child { white-space: nowrap; }
.pcard-tag {
  font-family: var(--f-mono); font-size: calc(10px * var(--ts)); letter-spacing: .05em;
  padding: 2px 5px; border-radius: 2px; align-self: flex-start;
  background: var(--sunken); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.pcard-tag.perf { background: var(--alert-soft); border-color: var(--alert); color: var(--alert); }
.pcard-ians { border: 1px solid var(--line-2); padding: 1px 5px; border-radius: 2px; flex: none; white-space: nowrap; }
.demo-empty {
  grid-column: 1/-1; background: var(--surface); padding: 40px 18px;
  text-align: center; color: var(--muted); font-family: var(--f-mono); font-size: calc(12.5px * var(--ts));
}

/* ---- Kuva 6: laskentamatriisi. Tyhjä lävistäjä ON koko sääntö, joten se
   erottuu poissulkevana (punainen), ei valittuna (vihreä). ---- */
.matrix { border-collapse: collapse; width: 100%; min-width: 540px; font-family: var(--f-mono); font-size: calc(12px * var(--ts)); }
.matrix caption {
  caption-side: top; text-align: left;
  font-size: calc(10.5px * var(--ts)); letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); padding-bottom: 12px;
}
.matrix thead th {
  font-size: calc(10px * var(--ts)); font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); padding: 6px 8px; text-align: center;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.matrix thead th:first-child { text-align: left; padding-left: 0; }
.matrix tbody th {
  text-align: left; font-weight: 600; font-size: calc(12px * var(--ts)); color: var(--ink);
  padding: 7px 14px 7px 0; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.matrix tbody td {
  text-align: center; padding: 7px 8px; color: var(--brand);
  border-bottom: 1px solid var(--line);
}
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.matrix td.self {
  background: var(--alert-soft); color: var(--alert); font-weight: 700;
}

/* ---- Demon hakukenttä ja laskutavan valinta ---- */
.demo-search {
  width: 100%; font-family: var(--f-mono); font-size: calc(12.5px * var(--ts));
  padding: 7px 10px; border-radius: 2px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
}
.demo-search::placeholder { color: var(--faint); }
.demo-hint {
  font-family: var(--f-mono); font-size: calc(11px * var(--ts)); line-height: 1.45;
  color: var(--muted); margin: 7px 0 0; max-width: none;
}
.demo-hint.on   { color: var(--brand); }
.demo-hint.warn { color: var(--alert); }

.demo-modes { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.demo-mode {
  font-family: var(--f-mono); font-size: calc(11px * var(--ts)); cursor: pointer;
  padding: 2px 8px; border-radius: 2px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
}
.demo-mode:hover { color: var(--ink); border-color: var(--muted); }
.demo-mode[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600;
}

.pcard-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pcard-tag.alt { background: transparent; border-style: dashed; }

/* ============================ THEME DEMO ================================= */

.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 14px; margin-top: 24px; }

/* Teemademo: paikallinen token-joukko, ei sivun globaali tila */
.tdemo {
  border: 1px solid var(--line); padding: 16px;
  background: var(--t-bg); color: var(--t-ink);
  transition: background .2s, color .2s;
}
.tdemo[data-t="plain"]       { --t-bg:#ffffff; --t-ink:#111111; --t-mut:#666666; --t-line:#dddddd; --t-head:#111111; --t-head-ink:#ffffff; --t-on:#111111; --t-on-ink:#ffffff; --t-card:#ffffff; }
.tdemo[data-t="parkside"]    { --t-bg:#f2f3f4; --t-ink:#1c1c1c; --t-mut:#626262; --t-line:#dee2e4; --t-head:#1e4b32; --t-head-ink:#ffffff; --t-on:#00ff99; --t-on-ink:#10261c; --t-card:#ffffff; }
.tdemo[data-t="performance"] { --t-bg:#1c1c1c; --t-ink:#f2f3f4; --t-mut:#9a9a9a; --t-line:#333333; --t-head:#232d32; --t-head-ink:#f2f3f4; --t-on:#cd2828; --t-on-ink:#ffffff; --t-card:#232323; }

.tdemo-head {
  background: var(--t-head); color: var(--t-head-ink);
  margin: -16px -16px 12px; padding: 9px 14px;
  font-family: var(--f-display); font-weight: 800; font-size: calc(12px * var(--ts));
  letter-spacing: .12em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}
.tdemo-head span { font-family: var(--f-mono); font-size: calc(9.5px * var(--ts)); font-weight: 400; letter-spacing: .05em; opacity: .78; }
.tdemo-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.tdemo-chip {
  font-size: calc(11px * var(--ts)); padding: 3px 7px; border-radius: 2px;
  border: 1px solid var(--t-line); background: var(--t-card); color: var(--t-ink);
}
.tdemo-chip.on { background: var(--t-on); border-color: var(--t-on); color: var(--t-on-ink); font-weight: 600; }
.tdemo-card {
  background: var(--t-card); border: 1px solid var(--t-line); padding: 10px;
  font-size: calc(12px * var(--ts)); line-height: 1.4;
}
.tdemo-card b { display: block; font-weight: 600; margin-bottom: 3px; }
.tdemo-card i { font-style: normal; font-family: var(--f-mono); font-size: calc(10px * var(--ts)); color: var(--t-mut); }
.tdemo-name {
  font-family: var(--f-mono); font-size: calc(10.5px * var(--ts)); letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-top: 10px;
}
.tdemo-name b { color: var(--ink); font-weight: 600; }

/* ============================ CALLOUT ==================================== */

.callout {
  border-left: 3px solid var(--brand);
  background: var(--surface);
  padding: 16px 20px; margin: 26px 0 0;
  font-size: calc(15.5px * var(--ts));
}
.callout h4 { color: var(--brand); margin-bottom: 6px; }
.callout p { max-width: none; }

.pull {
  font-family: var(--f-display); font-weight: 600;
  font-size: calc(clamp(19px, 2.6vw, 25px) * var(--ts)); line-height: 1.28;
  letter-spacing: -0.02em;
  margin: 32px 0 0; padding: 0 0 0 22px;
  border-left: 3px solid var(--volt);
  max-width: 34ch; color: var(--ink);
}

ul.plain { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 11px; max-width: var(--measure); }
ul.plain li {
  padding-left: 22px; position: relative; font-size: calc(15.5px * var(--ts)); line-height: 1.55;
}
ul.plain li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 9px; height: 1px; background: var(--brand);
}
ul.plain li b { font-weight: 600; }
/* Listan jälkeen tuleva kappale tarvitsee oman välinsä — p:llä on vain
   alamarginaali, joten ilman tätä se liimautuu viimeiseen kohtaan kiinni. */
ul.plain + p, ul.plain + h3 { margin-top: 1.15em; }

/* ============================ TOGGLE ===================================== */

.toggle {
  display: inline-flex; border: 1px solid var(--line-2); border-radius: 2px;
  overflow: hidden; margin-bottom: 16px; background: var(--surface);
}
.toggle button {
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); letter-spacing: .06em;
  text-transform: uppercase; padding: 6px 14px;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.toggle button + button { border-left: 1px solid var(--line-2); }
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 600; }

/* ============================ FOOTER ===================================== */

.foot {
  display: block; border-top: 1px solid var(--line); margin-top: 90px;
  padding: 34px 0 0;
}
.foot-in {
  max-width: var(--page); margin: 0 auto; padding: 0 28px;
  display: flex; flex-wrap: wrap; gap: 14px 34px; justify-content: space-between;
  font-family: var(--f-mono); font-size: calc(11.5px * var(--ts)); color: var(--muted);
}
.foot-in b { color: var(--ink); font-weight: 600; }

/* ============================ NARROW ===================================== */

@media (max-width: 900px) {
  /* Projektorikokoa ei tarvita kädessä pidettävällä ruudulla: sama kerroin
     lasketaan takaisin lukuetäisyyteen, eikä yksikään muu sääntö muutu. */
  :root { --ts: 1.16; }
  section { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 58px; }
  section > .rail, section > .body { grid-column: 1; }
  .rail { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: baseline; margin-bottom: 20px; padding-top: 0; }
  .rail-tag { border-top: 0; border-left: 3px solid var(--ink); padding: 0 0 0 10px; }
  .rail-note { margin-top: 0; border-left: 2px solid var(--line-2); }
  .rail-note b { display: inline; margin-right: 6px; }
  .doc, .hero-in, .foot-in, .nav-in { padding-left: 20px; padding-right: 20px; }
  .verdict { grid-template-columns: minmax(0,1fr); gap: 3px; }
  .demo-bar { grid-template-columns: minmax(0,1fr); }
  .demo-lab { padding-top: 0; }
  .bar-line { grid-template-columns: 92px minmax(0,1fr) 68px; gap: 8px; }
}

/* Rautalankamallit eivät saa kutistua lukukelvottomiksi. Ne pitävät
   vähimmäisleveytensä ja vierivät omassa laatikossaan (.fig, overflow-x:auto)
   sen sijaan että sivu vierisi tai kuva muuttuisi tuhruksi. */
@media (max-width: 760px) {
  .fig-wide svg { min-width: 640px; }
  .fig-wide { padding: 16px 14px; }
  figcaption { font-size: calc(11px * var(--ts)); }
}

@media (max-width: 560px) {
  :root { --ts: 1.04; }
  body { font-size: calc(16px * var(--ts)); }
  .hero-in { padding-top: 52px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dec { padding: 20px; }
  .fig { padding: 14px; }
  .bar-line { grid-template-columns: 76px minmax(0,1fr) 60px; }
  .bar-line > span:first-child { font-size: calc(10px * var(--ts)); }
}

@media print {
  .nav, .demo-reset, .toggle { display: none; }
  body { background: #fff; color: #000; }
}
