/* Tietoa AI-koulutus — sivuston tyylit.
   Pohjana Tietoa Design System v2 (tokens.css). Vain vaalea teema. */

:root {
  --t-red: #F93838;
  --t-dark: #242528;

  --red-50: #FFF1F1;   --red-100: #FEE2E2;  --red-200: #FCC7C7;
  --red-300: #FBA0A0;  --red-400: #F96868;  --red-500: #F93838;
  --red-600: #E02828;  --red-700: #BA1E1E;  --red-800: #8E1616;
  --red-900: #691010;

  --n-0: #FFFFFF;  --n-25: #FAFAF9;  --n-50: #F4F4F2;  --n-100: #EAEAE6;
  --n-150: #DCDCD6; --n-200: #C7C7C0; --n-300: #A8A8A2; --n-500: #6B6E74;
  --n-600: #52555A; --n-700: #3D3F43; --n-800: #2B2D30; --n-900: #242528;
  --n-950: #141518;

  --success-50: #EDFBF3; --success-500: #1D9A5B; --success-700: #0F6B3C;
  --warning-50: #FFF8E6; --warning-500: #E8A317; --warning-700: #9A6B04;
  --info-50: #EEF4FB;    --info-500: #2668B8;    --info-700: #184780;
  --danger-50: #FFF1F1;  --danger-500: #F93838;  --danger-700: #BA1E1E;

  /* Vain valkoinen teema: sivu on valkoinen, kortit erottuvat viivalla. */
  --surface-page: var(--n-0);
  --surface-card: var(--n-0);
  --surface-sunken: var(--n-25);
  --surface-inverse: var(--n-900);

  --text-primary: var(--n-900);
  --text-secondary: var(--n-700);
  --text-tertiary: var(--n-500);
  --text-disabled: var(--n-300);
  --text-inverse: var(--n-0);
  --text-accent: var(--red-500);
  --text-link: var(--red-600);

  --border-subtle: var(--n-100);
  --border-default: var(--n-150);
  --border-strong: var(--n-300);
  --border-focus: var(--red-500);

  --font-display: 'Century Gothic', 'CenturyGothic', 'URW Gothic', 'AppleGothic', 'Futura', sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', 'Consolas', monospace;

  --text-2xs: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);
  --text-xs:  clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm:  clamp(0.875rem, 0.84rem + 0.2vw, 0.9375rem);
  --text-md:  clamp(1rem, 0.96rem + 0.25vw, 1.0625rem);
  --text-lg:  clamp(1.125rem, 1.08rem + 0.3vw, 1.25rem);
  --text-xl:  clamp(1.375rem, 1.3rem + 0.5vw, 1.625rem);
  --text-2xl: clamp(1.75rem, 1.6rem + 0.8vw, 2.125rem);
  --text-3xl: clamp(2.25rem, 2rem + 1.2vw, 2.875rem);
  --text-4xl: clamp(2.875rem, 2.4rem + 2vw, 4rem);
  --text-5xl: clamp(3.5rem, 2.8rem + 3.5vw, 5.5rem);

  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px; --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px; --space-24: 96px;
  --space-32: 128px;

  --radius-xs: 2px; --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px;
  --radius-xl: 12px; --radius-2xl: 16px; --radius-full: 9999px;

  --elev-1: 0 1px 2px rgba(20,21,24,.04), 0 1px 3px rgba(20,21,24,.06);
  --elev-2: 0 2px 4px rgba(20,21,24,.04), 0 4px 12px rgba(20,21,24,.06);
  --elev-3: 0 4px 8px rgba(20,21,24,.05), 0 12px 24px rgba(20,21,24,.08);
  --elev-focus: 0 0 0 3px rgba(249,56,56,0.25);

  --dur-fast: 160ms; --dur-base: 240ms; --dur-slow: 400ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-brand: cubic-bezier(0.2, 0.8, 0.2, 1);

  --wrap: 1120px;
  --measure: 65ch;
}

/* ── Perusta ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.locked { overflow: hidden; }
::selection { background: var(--red-500); color: #fff; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--red-500); outline-offset: 2px; border-radius: var(--radius-sm); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  text-wrap: pretty;
}
h1 { font-size: var(--text-3xl); line-height: 1.1; letter-spacing: -.02em; }
h2 { font-size: var(--text-2xl); line-height: 1.15; letter-spacing: -.015em; }
h3 { font-size: var(--text-xl); line-height: 1.25; }
h4 { font-size: var(--text-lg); line-height: 1.3; }
p { margin: 0 0 var(--space-4); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25em; max-width: var(--measure); }
li { margin-bottom: var(--space-2); }
li::marker { color: var(--text-tertiary); }
strong { font-weight: 600; }

/* Kursiivi on tämän sivuston tehokeino: ingressit, "kenelle", sitaatit. */
em, .ital { font-style: italic; }
.lead {
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
  font-weight: 400;
}
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 var(--space-3);
}
.eyebrow b { color: var(--text-accent); font-weight: 600; }
.caption { font-size: var(--text-xs); font-weight: 500; letter-spacing: .02em; color: var(--text-tertiary); }
.muted { color: var(--text-tertiary); }
.accent { color: var(--text-accent); }
.mono { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .02em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--space-5); }
@media (min-width: 720px) { .wrap { padding: 0 var(--space-8); } }

/* ── Header ──────────────────────────────────────────────────────── */
header.site {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
}
.head-inner { display: flex; align-items: center; gap: var(--space-4); height: 64px; }
.brand { display: flex; align-items: center; gap: var(--space-3); color: inherit; text-decoration: none; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand .logo { height: 22px; width: auto; fill: var(--red-500); flex: none; }
.brand .divider { width: 1px; height: 24px; background: var(--border-default); flex: none; }
.brand .prod { font-family: var(--font-display); font-weight: 700; font-size: var(--text-md); line-height: 1.1; white-space: nowrap; }
.brand .prod small { display: block; font-family: var(--font-body); font-weight: 500; font-size: var(--text-2xs); color: var(--text-tertiary); letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }

nav.main { display: flex; gap: var(--space-1); margin-left: var(--space-4); }
nav.main a {
  color: var(--text-secondary); font-size: var(--text-sm); font-weight: 500;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
}
nav.main a:hover { background: var(--surface-sunken); text-decoration: none; color: var(--text-primary); }
nav.main a[aria-current="page"] { color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--red-500); border-radius: 0; }
@media (max-width: 719px) {
  /* Kapealla näytöllä navigaatio omalle riville logon alle */
  .head-inner { flex-wrap: wrap; height: auto; padding-top: var(--space-3); row-gap: 0; }
  nav.main { order: 3; flex-basis: 100%; margin: var(--space-1) -9px 0; gap: 0; overflow-x: auto; scrollbar-width: none; }
  nav.main a { padding: 10px 9px; font-size: var(--text-sm); border-radius: 0; }
  nav.main a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red-500); }
  body .tabs { top: 92px; }
  aside.note { position: static; }
}

.head-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.user-chip { display: none; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.user-chip.on { display: flex; }
.user-chip .name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 719px) { .user-chip .name { display: none; } }
.av {
  width: 30px; height: 30px; border-radius: var(--radius-full);
  background: var(--n-900); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex: none; letter-spacing: .02em;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--surface-card); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary); padding: 0;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Painikkeet ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: var(--text-sm); font-weight: 600; cursor: pointer; text-decoration: none;
  line-height: 1.2; min-height: 44px; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--red-500); color: #fff; }
.btn-primary:hover { background: var(--red-600); }
.btn-secondary { background: var(--surface-card); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--n-900); }
.btn-dark { background: var(--n-900); color: #fff; }
.btn-dark:hover { background: var(--n-800); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding-inline: 10px; }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text-primary); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 14px 24px; font-size: var(--text-md); }

/* ── Kirjautumisportti ───────────────────────────────────────────── */
.auth-gate {
  position: fixed; inset: 0; z-index: 50; background: var(--n-0);
  display: grid; place-items: center; padding: var(--space-6);
}
.auth-gate[hidden] { display: none; }
.auth-card { max-width: 440px; width: 100%; text-align: left; }
.auth-card .logo { height: 28px; width: auto; fill: var(--red-500); margin-bottom: var(--space-8); }
.auth-card h1 { margin-bottom: var(--space-3); }
.auth-card p { color: var(--text-secondary); margin-bottom: var(--space-6); }
.auth-card .btn { width: 100%; justify-content: center; }
.auth-err { color: var(--danger-700); font-size: var(--text-sm); margin-top: var(--space-3); min-height: 1.4em; }
.auth-loading { color: var(--text-tertiary); font-size: var(--text-sm); }

/* ── Sivun osiot ─────────────────────────────────────────────────── */
main { flex: 1; }
section.block { padding: var(--space-16) 0; }
section.block + section.block { border-top: 1px solid var(--border-subtle); }
section.block.first { padding-top: 0; }
@media (max-width: 719px) { section.block { padding: var(--space-12) 0; } }
.block-head { margin-bottom: var(--space-8); }
.block-head h2 { max-width: 22ch; }
.block-head .lead { margin-top: var(--space-3); }

/* Hero */
.hero { padding: var(--space-12) 0 var(--space-8); position: relative; }
.hero .wrap { position: relative; }
.hero h1 {
  font-size: var(--text-3xl); line-height: 1.08; letter-spacing: -.02em;
  max-width: 20ch; margin-bottom: var(--space-4);
}
.hero h1 em { font-style: italic; font-weight: 400; color: var(--text-accent); }
.hero .lead { max-width: 56ch; margin-bottom: 0; }
.hero .facts { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-8); }
.hero .facts span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red-500); margin-right: 8px; vertical-align: 1px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
@media (max-width: 719px) { .hero { padding: var(--space-8) 0 var(--space-6); } }

/* Osat (koulutuksen 4 osaa) */
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-4); }
.part {
  position: relative; display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-6); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  background: var(--surface-card); color: inherit; text-decoration: none; min-height: 300px;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
a.part:hover { text-decoration: none; border-color: var(--n-900); box-shadow: var(--elev-2); transform: translateY(-2px); }
a.part.primary { border-color: var(--n-900); box-shadow: var(--elev-1); }
.part .cta { margin-top: var(--space-2); }
.part .cta .btn { width: 100%; justify-content: center; }
.part .num {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: var(--text-3xl); line-height: 1; color: var(--text-accent); letter-spacing: -.02em;
}
.part.locked .num { color: var(--text-disabled); }
.part h3 { font-size: var(--text-lg); line-height: 1.25; }
.part .who { font-style: italic; color: var(--text-secondary); font-size: var(--text-sm); }
.part p { font-size: var(--text-sm); color: var(--text-secondary); }
.part .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--text-xs); font-weight: 500; color: var(--text-tertiary); padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.part .foot .go { color: var(--text-primary); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.part .foot .go svg { width: 14px; height: 14px; }
.part.locked { background: var(--surface-sunken); border-style: dashed; color: var(--text-secondary); }
.part.locked h3 { color: var(--text-secondary); }
.part .lock { position: absolute; top: var(--space-5); right: var(--space-5); color: var(--text-disabled); }
.part .lock svg { width: 18px; height: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--radius-sm);
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; line-height: 1.4;
  background: var(--n-100); color: var(--text-secondary); width: max-content;
}
.badge.red { background: var(--red-50); color: var(--red-700); }
.badge.green { background: var(--success-50); color: var(--success-700); }
.badge.amber { background: var(--warning-50); color: var(--warning-700); }
.badge.dark { background: var(--n-900); color: #fff; }

/* Aikajana */
.timeline { list-style: none; padding: 0; margin: 0; max-width: none; display: grid; gap: 0; border-left: 2px solid var(--border-default); }
.timeline li { position: relative; padding: 0 0 var(--space-5) var(--space-6); margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: var(--space-2) var(--space-5); align-items: baseline; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .45em; width: 12px; height: 12px; border-radius: 50%; background: var(--n-0); border: 2px solid var(--n-900); }
.timeline li.key::before { background: var(--red-500); border-color: var(--red-500); }
.timeline li.past { color: var(--text-tertiary); }
.timeline li.past::before { border-color: var(--n-300); background: var(--n-300); }
.timeline .when { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .02em; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .what { font-size: var(--text-md); }
.timeline .what small { display: block; color: var(--text-tertiary); font-size: var(--text-sm); font-style: italic; }
@media (max-width: 600px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* Linkkikortit (materiaalit) */
.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.link-card {
  display: block; padding: var(--space-5) var(--space-6); border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  color: inherit; text-decoration: none; transition: border-color var(--dur-fast), box-shadow var(--dur-base) var(--ease-out);
}
.link-card:hover { text-decoration: none; border-color: var(--n-900); box-shadow: var(--elev-2); }
.link-card h4 { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.link-card h4 svg { width: 16px; height: 16px; color: var(--text-tertiary); flex: none; }
.link-card p { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }
.link-card .ext { font-size: var(--text-2xs); color: var(--text-tertiary); font-family: var(--font-mono); margin-top: var(--space-3); display: block; }

/* Sitaatti */
.pull {
  margin: var(--space-8) 0; padding-left: var(--space-5); border-left: 3px solid var(--red-500);
  font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: var(--text-xl); line-height: 1.3; max-width: 30ch;
}

/* ── Osasivu ─────────────────────────────────────────────────────── */
.page-head { padding: var(--space-12) 0 var(--space-8); }
.page-head .crumbs { font-size: var(--text-sm); color: var(--text-tertiary); margin-bottom: var(--space-5); display: flex; gap: var(--space-2); align-items: center; }
.page-head .crumbs a { color: var(--text-secondary); }
.page-head h1 { max-width: 20ch; margin: var(--space-2) 0 var(--space-4); }
.page-head h1 em { font-style: italic; font-weight: 400; color: var(--text-accent); }
.page-head .facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); font-size: var(--text-sm); color: var(--text-secondary); margin-top: var(--space-5); }
.page-head .facts span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red-500); margin-right: 8px; vertical-align: 1px; }

/* Välilehdet (DS 8.8) */
.tabs { position: sticky; top: 64px; z-index: 10; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-default); }
.tabs .wrap { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.tabs .wrap::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 14px var(--space-4); font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--text-primary); border-bottom-color: var(--red-500); font-weight: 600; }
.tab .n { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-tertiary); }
.tab .done { width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); }
.panel { display: none; padding: var(--space-12) 0 var(--space-16); }
.panel.active { display: block; }
.panel h2 { margin-bottom: var(--space-4); }
.panel h3 { margin: var(--space-10) 0 var(--space-3); }
.panel h3:first-child { margin-top: 0; }
.panel > .wrap > .lead { margin-bottom: var(--space-10); }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-12); align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; gap: var(--space-8); } }
aside.note { padding: var(--space-5); border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--surface-sunken); font-size: var(--text-sm); position: sticky; top: 128px; }
aside.note h4 { margin-bottom: var(--space-3); font-size: var(--text-md); }
aside.note p, aside.note li { color: var(--text-secondary); }
aside.note ul { padding-left: 1.1em; margin: 0; }
aside.note .btn { margin-top: var(--space-4); width: 100%; justify-content: center; }

/* Taulukko (DS 8.6) */
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); margin: var(--space-4) 0 var(--space-6); }
th, td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border-subtle); }
th { font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary); }
td.when { font-family: var(--font-mono); white-space: nowrap; color: var(--text-secondary); font-variant-numeric: tabular-nums; width: 1%; padding-right: var(--space-5); }
td b { font-weight: 600; }
table.kv td:first-child { color: var(--text-tertiary); width: 160px; }
aside.note table.kv td:first-child { width: 84px; padding-right: var(--space-3); }
aside.note table { margin: var(--space-2) 0 var(--space-5); }

/* Askeleet */
.steps { list-style: none; padding: 0; margin: 0 0 var(--space-6); counter-reset: s; max-width: none; display: grid; gap: var(--space-4); }
.steps > li { counter-increment: s; display: grid; grid-template-columns: 56px 1fr; gap: var(--space-4); padding: var(--space-5) 0; border-top: 1px solid var(--border-subtle); margin: 0; }
.steps > li:last-child { border-bottom: 1px solid var(--border-subtle); }
.steps > li::before {
  content: counter(s); font-family: var(--font-display); font-style: italic; font-size: var(--text-3xl); line-height: 1; color: var(--text-accent); font-weight: 400;
}
.steps > li.done::before { content: "✓"; color: var(--success-500); font-style: normal; }
.steps h4 { margin-bottom: var(--space-2); }
.steps p { color: var(--text-secondary); font-size: var(--text-md); }
.steps .field { margin-top: var(--space-4); }

/* Liikennevalot */
.lights { display: grid; gap: var(--space-3); margin: var(--space-4) 0 var(--space-6); max-width: 720px; }
.light { display: grid; grid-template-columns: 18px 1fr; gap: var(--space-4); align-items: start; padding: var(--space-4) var(--space-5); border: 1px solid var(--border-default); border-radius: var(--radius-lg); font-size: var(--text-sm); }
.light::before { content: ""; width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; }
.light.g::before { background: var(--success-500); }
.light.y::before { background: var(--warning-500); }
.light.r::before { background: var(--red-500); }
.light b { display: block; font-weight: 600; margin-bottom: 2px; }

/* Lomake (DS 8.2) */
.form { max-width: 640px; display: grid; gap: var(--space-6); }
.field label, .field legend { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-2); padding: 0; }
.field .hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-2); }
.field input[type=text], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-md);
  font: inherit; font-size: var(--text-sm); color: var(--text-primary); background: var(--surface-card);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--red-500); box-shadow: var(--elev-focus); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choices label {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--border-default); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500; cursor: pointer; margin: 0; min-height: 44px; user-select: none;
}
.choices label:has(input:checked) { border-color: var(--n-900); background: var(--n-900); color: #fff; }
.choices input { accent-color: var(--red-500); margin: 0; }
.choices label:has(input:checked) input { accent-color: #fff; }
.form-foot { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.form-msg { font-size: var(--text-sm); color: var(--danger-700); }

.banner { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); font-size: var(--text-sm); margin: var(--space-4) 0; border: 1px solid; max-width: 720px; }
.banner.ok { background: var(--success-50); border-color: #bfe8cf; color: var(--success-700); }
.banner.warn { background: var(--warning-50); border-color: #f3dca0; color: var(--warning-700); }
.banner.info { background: var(--info-50); border-color: #c9dbf2; color: var(--info-700); }
.banner b { font-weight: 600; }

.thanks { max-width: 640px; padding: var(--space-8); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.thanks h3 { margin: 0 0 var(--space-3); }
.thanks .big { font-family: var(--font-display); font-style: italic; font-size: var(--text-2xl); line-height: 1.2; margin-bottom: var(--space-5); }

/* Tulokset (vain vetäjä) */
.results { margin-top: var(--space-12); padding-top: var(--space-8); border-top: 1px dashed var(--border-strong); }
.results[hidden] { display: none; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); margin: var(--space-4) 0 var(--space-8); max-width: 720px; }
.stat { padding: var(--space-4) var(--space-5); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.stat .v { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 6px; }
.dist { display: grid; gap: 6px; max-width: 520px; margin-bottom: var(--space-8); font-size: var(--text-sm); }
.dist div { display: grid; grid-template-columns: 110px 1fr 36px; gap: var(--space-3); align-items: center; }
.dist .bar { height: 10px; background: var(--n-100); border-radius: 2px; overflow: hidden; }
.dist .bar i { display: block; height: 100%; background: var(--n-900); }
.free { list-style: none; padding: 0; margin: 0 0 var(--space-8); max-width: 720px; display: grid; gap: var(--space-2); }
.free li { padding: var(--space-3) var(--space-4); background: var(--surface-sunken); border-radius: var(--radius-md); font-size: var(--text-sm); margin: 0; }
.free li .tag { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-tertiary); margin-right: 8px; }

/* Tyhjä tila (yhteenveto) */
.empty { padding: var(--space-10) var(--space-6); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); max-width: 720px; }
.empty h3 { margin: 0 0 var(--space-2); }
.empty p { color: var(--text-secondary); font-size: var(--text-sm); }

/* ── Footer ──────────────────────────────────────────────────────── */
footer.site { border-top: 1px solid var(--border-subtle); padding: var(--space-8) 0; font-size: var(--text-xs); color: var(--text-tertiary); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); justify-content: space-between; }
footer.site a { color: inherit; }

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