@font-face {
  font-family: "Figtree";
  src: url("figtree-latin-wght-normal.woff2") format("woff2-variations"), url("figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-display: swap;
}

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #141a26;
  --muted: #586174;
  --line: #dde2ec;
  --soft: #eceff6;
  --accent: #2448b8;
  --accent-soft: #e4eafb;
  --ok: #17734a;
  --ok-soft: #e1f3ea;
  --warm: #9a5b00;
  --warm-soft: #fbefdc;
  --bad: #a3302c;
  --focus: #1f5fd1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e121a; --card: #161b26; --ink: #e8ebf2; --muted: #a2abbd; --line: #283043; --soft: #1d2331;
    --accent: #8fa8ff; --accent-soft: #1b2546; --ok: #6fd3a2; --ok-soft: #12301f; --warm: #f2b25c; --warm-soft: #33270f;
    --bad: #f19a9a; --focus: #7aa7ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.55;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 16px; }
.hiljainen { color: var(--muted); }
.pieni { font-size: .86rem; }
small { font-size: .84em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Ylätunniste */
.yla { border-bottom: 1px solid var(--line); background: var(--card); }
.yla .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.1rem; text-decoration: none; letter-spacing: -0.01em; }
.logo svg { width: 28px; height: 28px; flex: none; }
.logo .l-bg { fill: var(--accent); }
.logo .l-fg { fill: var(--card); }
.yla nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .95rem; }
.yla nav a { color: var(--muted); text-decoration: none; }
.yla nav a:hover, .yla nav a[aria-current] { color: var(--ink); text-decoration: underline; }

/* Otsikkoalue */
.hero { padding: 26px 0 4px; max-width: 820px; }
.hero h1 { font-weight: 820; font-size: clamp(1.85rem, 5.4vw, 2.9rem); line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 12px; text-wrap: balance; }
.hero-pieni h1 { font-size: clamp(1.7rem, 4.6vw, 2.4rem); }
.ingressi { font-size: 1.1rem; color: var(--muted); margin: 0 0 8px; max-width: 66ch; }

.osio { margin: 38px 0; }
.osio > h2, .laatikko > h2 { font-size: 1.42rem; letter-spacing: -0.015em; margin: 0 0 10px; line-height: 1.2; }
.osio h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.osio p { max-width: 72ch; }
.faktat { padding-left: 1.15em; margin: 0; max-width: 76ch; }
.faktat li { margin: 0 0 7px; }

.laatikko { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 18px 0 8px; }

/* IP-testi */
.ip-ruudukko { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); margin: 4px 0 12px; }
.ip-kortti { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; min-width: 0; }
.ip-kortti .ots { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.ip-kortti b { display: block; font-size: 1.18rem; line-height: 1.3; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ip-kortti small { display: block; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.ip-kortti.tila-koti { border-color: var(--line); }
.ip-kortti.tila-konesali, .ip-kortti.tila-cloudflare { background: var(--ok-soft); border-color: var(--ok); }
.ip-kortti.tila-konesali b, .ip-kortti.tila-cloudflare b { color: var(--ok); }
.webrtc { border-left: 5px solid var(--line); padding: 8px 12px; background: var(--bg); border-radius: 0 10px 10px 0; margin: 0 0 12px; }
.webrtc.ok { border-left-color: var(--ok); }
.webrtc.varoitus { border-left-color: var(--warm); background: var(--warm-soft); }
.webrtc p { margin: 2px 0 0; }
.nappi { font: inherit; font-weight: 700; font-size: .95rem; background: var(--accent); color: var(--card); border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer; }
.nappi:hover { filter: brightness(1.08); color: var(--card); }

/* Valitsin */
.kentat { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.kentat label { display: flex; flex-direction: column; gap: 4px; font-weight: 650; font-size: .92rem; }
.kentat select {
  font: inherit; font-weight: 500; font-size: 1rem; padding: 10px 11px; border-radius: 10px;
  border: 1.5px solid var(--muted); background: var(--bg); color: var(--ink); width: 100%; min-height: 46px;
}
.vinkki { margin: 12px 0 0; padding: 10px 12px; background: var(--accent-soft); border-radius: 10px; font-size: .95rem; }
.vinkki p { margin: 0 0 4px; }
.vinkki p:last-child { margin: 0; }
.tulosotsikko { margin: 16px 0 6px; font-weight: 700; }
.tulosotsikko small { font-weight: 500; color: var(--muted); }
.lista { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; counter-reset: sija; }
.rivi { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; counter-increment: sija; }
.r-nimi b { display: block; font-size: 1.03rem; line-height: 1.3; }
.r-nimi b::before { content: counter(sija) ". "; color: var(--muted); font-weight: 650; }
.r-nimi small { color: var(--muted); display: block; }
.r-hinta { text-align: right; }
.r-eur { font-size: 1.28rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-hinta small { display: block; color: var(--muted); line-height: 1.35; }
.r-linkki { text-align: right; white-space: nowrap; }
.jarjestys { margin: 8px 0 0; }
.linkki { font-weight: 700; color: var(--accent); }
.mainos { display: inline-block; font-size: .72rem; color: var(--muted); margin-left: 6px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; vertical-align: 1px; }

/* Taulukot */
.taulukko { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--soft); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
tbody th { font-weight: 650; white-space: nowrap; }
td small, th small { color: var(--muted); font-weight: 400; display: block; }
.hinnat td { font-variant-numeric: tabular-nums; }
.hinnat tr.ryhma td { background: var(--soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.tyhja { color: var(--muted); }
.hinnat td.toiminto { white-space: nowrap; }

details { margin: 4px 0 0; }
summary { cursor: pointer; color: var(--muted); font-size: .86rem; }

/* Alatunniste */
.ala { border-top: 1px solid var(--line); margin-top: 44px; padding: 20px 0 30px; color: var(--muted); font-size: .88rem; background: var(--card); }
.ala p { margin: 0 0 6px; max-width: 82ch; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .laatikko { padding: 13px; }
  .rivi { grid-template-columns: minmax(0, 1fr) minmax(0, 42%); }
  .r-linkki { grid-column: 1 / -1; text-align: left; }
  .r-eur { white-space: normal; }
  .hinnat th[scope=row] { position: sticky; left: 0; background: var(--card); z-index: 1; box-shadow: 1px 0 0 var(--line); white-space: normal; min-width: 7.5em; }
}
