/* Suomen Sähköopas – tyylit
   Tunnusmerkki: johdinvärit (ruskea vaihe, sininen nolla, keltavihreä suojamaa). */

/* Fontit omalta palvelimelta (SIL Open Font License, ks. fonts/LICENSE-*) */
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --paper: #f5f7f8;
  --surface: #ffffff;
  --ink: #15212b;
  --ink-soft: #4a5966;
  --rule: #d6dde2;
  --phase: #7b4a2b;      /* vaihejohdin, ruskea */
  --neutral: #2f6db5;    /* nollajohdin, sininen */
  --earth-y: #d9cf2c;    /* suojajohdin, keltainen */
  --earth-g: #2e8b4a;    /* suojajohdin, vihreä */
  --ok: #2e7d4a;
  --ok-bg: #e7f3eb;
  --no: #a8321f;
  --no-bg: #f8e9e6;
  --link: #1f5ea3;
  --focus: #f2b705;
  --radius: 6px;
  --measure: 68ch;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Johdinraita: kolme väriä, suojajohdin raidallisena */
.conductor {
  height: 6px;
  background:
    linear-gradient(90deg,
      var(--phase) 0 33.33%,
      var(--neutral) 33.33% 66.66%,
      transparent 66.66%),
    repeating-linear-gradient(115deg, var(--earth-y) 0 10px, var(--earth-g) 10px 20px);
}

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Ylätunniste */
.site-head { background: var(--surface); border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.45rem; letter-spacing: .01em; line-height: 1; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 400; font-size: .72rem; color: var(--ink-soft); letter-spacing: 0; margin-top: 2px; }
.nav { display: flex; gap: .25rem 1.1rem; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; padding: .4rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--neutral); }
.nav a.cta { background: var(--ink); color: #fff; padding: .4rem .8rem; border-radius: var(--radius); border: 0; }
.nav a.cta:hover { background: var(--neutral); }

/* Murupolku */
.crumbs { font-size: .85rem; color: var(--ink-soft); padding-top: 1rem; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.crumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--rule); }
.crumbs a { color: var(--ink-soft); }

/* Otsikot */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; margin: .6rem 0 1rem; letter-spacing: -.005em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.05rem); font-weight: 700; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.35rem; font-weight: 600; margin: 1.8rem 0 .5rem; }

/* Etusivun hero: hakulista */
.hero { padding: 2.5rem 0 2rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 2.5rem; align-items: start; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); margin-top: 0; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 46ch; }
.checker { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem; }
.checker label { font-weight: 700; display: block; margin-bottom: .4rem; }
.checker input[type="search"] {
  width: 100%; font: inherit; padding: .7rem .85rem; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff;
}
.checker-list { list-style: none; margin: 1rem 0 0; padding: 0; max-height: 26rem; overflow: auto; }
.checker-list li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: .6rem 0; border-top: 1px solid var(--rule); }
.checker-list li[hidden] { display: none; }
.checker-empty { margin: 1rem 0 0; color: var(--ink-soft); }
.verdict { flex: none; font-size: .82rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.no { background: var(--no-bg); color: var(--no); }
.checker-note { font-size: .85rem; color: var(--ink-soft); margin: .8rem 0 0; }

/* Osiot */
.band { padding: 2.5rem 0; }
.band.alt { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.band h2 { margin-top: 0; }

.guide-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 2rem; list-style: none; padding: 0; margin: 0; }
.guide-list li { border-top: 3px solid var(--ink); padding: .9rem 0 1.2rem; }
.guide-list a { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.15; }
.guide-list a:hover { color: var(--neutral); }
.guide-list p { margin: .35rem 0 0; color: var(--ink-soft); font-size: .97rem; }

/* Artikkeli */
.article { display: grid; grid-template-columns: minmax(0, var(--measure)) 260px; gap: 3rem; padding-bottom: 3rem; }
.article-body { min-width: 0; }
.article-meta { color: var(--ink-soft); font-size: .9rem; margin: 0 0 1.5rem; }
.answer {
  background: var(--surface); border-left: 6px solid var(--neutral); padding: 1rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1.1rem; margin: 0 0 2rem;
}
.answer p { margin: 0; }
.article-body p, .article-body li { max-width: var(--measure); }
.article-body ul, .article-body ol { padding-left: 1.3rem; }
.article-body li { margin: .25rem 0; }
.warning { background: var(--no-bg); border-left: 6px solid var(--no); padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; }
.warning p { margin: 0; }
.tip { background: var(--ok-bg); border-left: 6px solid var(--ok); padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; }
.tip p { margin: 0; }

.table-scroll { overflow-x: auto; margin: 1.2rem 0 1.6rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { background: var(--ink); color: #fff; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
td.ok { color: var(--ok); font-weight: 700; }
td.no { color: var(--no); font-weight: 700; }
caption { caption-side: bottom; text-align: left; padding: .6rem .8rem; font-size: .85rem; color: var(--ink-soft); }

.toc { position: sticky; top: 1rem; align-self: start; font-size: .92rem; }
.toc h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.toc ol { padding-left: 1.1rem; margin: 0; }
.toc li { margin: .3rem 0; }
.toc a { color: var(--ink-soft); }
.toc a.button { color: #fff; }
.toc .toc-cta { margin-top: 1.5rem; padding: 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.toc .toc-cta p { margin: 0 0 .6rem; color: var(--ink); }

.faq details { border-top: 1px solid var(--rule); padding: .8rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: .5rem 0 0; }

.sources { font-size: .92rem; color: var(--ink-soft); border-top: 1px solid var(--rule); margin-top: 2.5rem; padding-top: 1rem; }
.sources h2 { font-size: 1.2rem; margin: 0 0 .5rem; }

/* Napit ja lomake */
.button { display: inline-block; background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; padding: .65rem 1.1rem; border-radius: var(--radius); border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.button:hover { background: var(--neutral); color: #fff; }

.form { display: grid; gap: 1rem; max-width: 560px; }
.form label { font-weight: 700; display: block; margin-bottom: .25rem; }
.form input, .form select, .form textarea { width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid #9aa7b1; border-radius: var(--radius); background: #fff; }
.form textarea { min-height: 8rem; }
.form .hint { font-size: .85rem; color: var(--ink-soft); margin: .25rem 0 0; }

/* Video: YouTube ladataan vasta klikkauksesta */
.video { margin: 1.5rem 0 2rem; max-width: var(--measure); }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: var(--ink); border-radius: var(--radius); overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play {
  position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  background: var(--ink); color: #fff; border: 0; font: inherit; cursor: pointer; padding: 1rem; text-align: center;
}
.video-play:hover .video-icon { background: var(--neutral); }
.video-icon { width: 64px; height: 64px; border-radius: 50%; background: #fff2; display: grid; place-items: center; }
.video-icon svg { width: 26px; height: 26px; margin-left: 4px; }
.video-title { font-weight: 700; font-size: 1.05rem; max-width: 40ch; }
.video-note { font-size: .82rem; color: #c9d2d9; }
.video figcaption { font-size: .88rem; color: var(--ink-soft); margin-top: .5rem; }

/* Alatunniste */
.site-foot { background: var(--ink); color: #d7dee4; margin-top: 3rem; }
.site-foot .wrap { padding: 2rem 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; font-size: .92rem; }
.site-foot a { color: #fff; }
.site-foot h2 { color: #fff; font-size: 1.15rem; margin: 0 0 .5rem; }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot li { margin: .3rem 0; }

@media (max-width: 860px) {
  .hero-grid, .article { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .toc { position: static; }
  .toc ol { display: none; }
  .toc h2 { display: none; }
  .toc .toc-cta { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .site-head, .site-foot, .toc, .conductor { display: none; } }
