/* ==========================================================================
   ÄLLIÄ ja TEKOÄLLIÄ – yhteinen tyylitiedosto
   ========================================================================== */

/* --- Fontti (itse isännöity, ei kolmannen osapuolen pyyntöjä) --- */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("../fonts/nunito-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("../fonts/nunito-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Värit ja muuttujat --- */
:root {
  --brand: #1a7a3c;          /* Eduks-vihreä, AA-kontrasti valkoisen kanssa */
  --brand-strong: #13602e;
  --brand-bright: #4cd137;
  --brand-soft: #e6f5ea;
  --tile: #ffffff;
  --page-bg: radial-gradient(60vmax 45vmax at 0% 0%, rgba(76, 209, 55, .16), transparent 70%), radial-gradient(55vmax 45vmax at 100% 35%, rgba(41, 182, 246, .14), transparent 70%), radial-gradient(50vmax 40vmax at 30% 100%, rgba(249, 180, 45, .08), transparent 70%), linear-gradient(165deg, #f1faf3 0%, #e1f3e7 45%, #e6f5ef 100%);
  --cta: linear-gradient(135deg, #34c06c 0%, #1f8a46 55%, #17703a 100%);
  --headline: linear-gradient(90deg, #13602e, #1a7a3c, #0277bd, #1b8a6b, #13602e);
  --stripe: linear-gradient(90deg, #13602e, #1a7a3c 30%, #4cd137 70%, #29b6f6);
  --accent: #0277bd;         /* sininen, AA valkoisella */
  --accent-bright: #29b6f6;
  --accent-soft: #e3f3fc;
  --warm: #f9a825;
  --warm-soft: #fff6dc;

  --bg: #f7faf7;
  --surface: #ffffff;
  --surface-2: #eef5ef;
  --text: #15261a;
  --text-muted: #4a5e4e;
  --border: #d9e6dc;
  --shadow-sm: 0 1px 2px rgba(16, 60, 30, .06), 0 2px 8px rgba(16, 60, 30, .05);
  --shadow-md: 0 4px 12px rgba(16, 60, 30, .08), 0 16px 40px rgba(16, 60, 30, .08);

  --radius: 18px;
  --radius-sm: 10px;
  --max: 1160px;
  --gutter: clamp(16px, 4vw, 32px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: only light;
}


/* --- Pohja --- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  background: var(--bg);
  background-image: var(--page-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; font-weight: 900; text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-weight: 800; text-decoration: none; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* --- Ylätunniste --- */
.site-header { background: var(--surface); background-image: linear-gradient(90deg, rgba(76, 209, 55, .07), rgba(41, 182, 246, .07)); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 900; font-size: 1.12rem; letter-spacing: -.01em; }
.brand img { width: 40px; height: 40px; }
.brand span b { color: var(--brand); font-weight: 900; }
h1.brand { margin: 0; }
.header-inner { gap: 8px 20px; flex-wrap: wrap; padding-block: 10px; }
.tagline { color: var(--text-muted); font-size: .98rem; }

/* --- Painikkeet --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px;
  font: inherit; font-weight: 800; font-size: .98rem; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); background-image: var(--cta); color: #fff; box-shadow: 0 4px 12px rgba(26, 122, 60, .25), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 6px 16px rgba(26, 122, 60, .32), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-secondary { background: transparent; color: var(--brand); border-color: currentColor; }
.btn-secondary:hover { background: var(--brand-soft); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--brand-soft); }

/* --- Etusivun otsikko ja osiot --- */
.section { padding: clamp(28px, 5vw, 48px) 0; }
.section-title { font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin-bottom: 18px; }
.section-title, .page-hero h1, .choose-title {
  width: fit-content; background: var(--headline); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: headline-flow 14s ease-in-out infinite alternate;
}
@keyframes headline-flow { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.tag {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent);
}
.tag-green { background: var(--brand-soft); color: var(--brand); }

/* --- Kortit --- */
.cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.card-media { position: relative; aspect-ratio: 16 / 10; background: var(--tile); }
.home .header-inner { min-height: 56px; padding-block: 6px; }
.home-section { padding: clamp(16px, 2.5vh, 36px) 0 0; }
.home-section .section-title { font-size: 1.4rem; margin-bottom: 14px; }
@media (min-width: 900px) { .home .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.home main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: clamp(20px, 3vh, 40px); }
.card-media::after, .material-media::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--stripe); opacity: .3; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 7% 10%; }
.card-media.pad img { padding: 9% 14%; }
.guides .card-media { aspect-ratio: 4 / 3; }
.card-media.cover img { padding: 5% 8%; filter: drop-shadow(0 8px 14px rgba(16, 40, 24, .22)) drop-shadow(0 1px 2px rgba(16, 40, 24, .15)); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 22px; flex: 1; }
.card-body h2, .card-body h3 { font-size: 1.22rem; text-wrap: pretty; }
.card-body .tag { align-self: flex-start; }
.card-body p { color: var(--text-muted); font-size: .98rem; }
.card-body .meta { font-size: .86rem; color: var(--text-muted); font-style: italic; }
.card-cta {
  margin-top: auto; align-self: center; display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 999px;
  font-weight: 800; font-size: .95rem; color: #fff; background: var(--brand); background-image: linear-gradient(135deg, #3cc274, #1f8a46);
  box-shadow: 0 2px 6px rgba(26, 122, 60, .18); transition: filter .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover .card-cta { filter: brightness(1.08); box-shadow: 0 3px 10px rgba(26, 122, 60, .26); }
.card-body > p:last-of-type { margin-bottom: 8px; }
.card-foot { margin-top: auto; position: relative; display: flex; justify-content: center; }
.cards:has(.card-foot) .card-body { padding-bottom: 40px; }
.card-foot .card-cta { margin-top: 0; white-space: nowrap; }
.card-foot .file-chip { position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px; text-align: center; background: none; padding: 0; font-weight: 600; font-size: .8rem; }
.file-chip b { display: inline-block; margin-right: 3px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); font-size: .64rem; font-weight: 800; letter-spacing: .07em; vertical-align: 1px; }
.file-chip { font-size: .8rem; font-weight: 700; color: var(--text-muted); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.card-cta svg { width: 16px; height: 16px; }
/* Koko kortti klikattavaksi otsikkolinkin kautta */
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.card-link:focus-visible { outline: none; }
.card-body p a { position: relative; z-index: 3; }
.card:has(.card-link:focus-visible) { outline: 3px solid var(--accent-bright); outline-offset: 3px; }
.ext-icon { width: 14px; height: 14px; display: inline-block; vertical-align: -1px; margin-left: 4px; opacity: .6; }
.tag-new { background: var(--warm-soft); color: #7a4f00; }
.level-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Sivun otsake (alasivut) --- */
.page-hero { padding: clamp(24px, 4vw, 40px) 0 8px; }
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 14px 0 8px; }
.page-hero p { color: var(--text-muted); font-size: 1.08rem; max-width: 62ch; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: clamp(20px, 3vw, 32px) clamp(18px, 3.4vw, 40px); }
.page-hero .panel h1 { margin-top: 10px; }
.back-link { display: inline-block; font-weight: 800; text-decoration: none; color: var(--brand); }
.back-link:hover { text-decoration: underline; }

/* --- Materiaalikortit (lataukset) --- */
.material {
  display: grid; grid-template-columns: 220px 1fr; gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.material-list { display: grid; gap: 18px; }
.material-media { position: relative; background: var(--tile); }
.material-media::after { left: auto; top: 0; width: 3px; height: auto; background: linear-gradient(180deg, #13602e, #1a7a3c 30%, #4cd137 70%, #29b6f6); }
.material-media img { width: 100%; height: 100%; object-fit: contain; aspect-ratio: 1; padding: 14%; }
.material-body { padding: 22px 26px; display: flex; flex-direction: column; gap: 8px; }
.material-body h2, .material-body h3 { font-size: 1.35rem; }
.material-body p { color: var(--text-muted); }
.level { align-self: flex-start; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 12px; }
.file-meta { font-weight: 600; font-size: .85rem; opacity: .8; padding-left: 10px; margin-left: 2px; border-left: 1px solid currentColor; }
@media (max-width: 640px) {
  .material { grid-template-columns: 1fr; }
  .material-media::after { left: 0; top: auto; width: auto; height: 3px; background: var(--stripe); }
  .material-media img { aspect-ratio: 16 / 9; padding: 6% 10%; }
  .downloads .btn { flex: 1 1 100%; }
}


/* --- Ohjesivu --- */
.prose { max-width: 72ch; }
.prose.panel { max-width: calc(72ch + 80px); }
.prose > * + * { margin-top: 1rem; }
.prose h2 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); margin-top: 3.2rem; padding-top: .4rem; scroll-margin-top: 16px; }
.prose h2:first-child { margin-top: 0; }
.prose ol, .prose ul { padding-left: 1.4rem; }
.prose li + li { margin-top: .4rem; }
.prose li::marker { color: var(--brand); font-weight: 800; }
.callout { border-radius: var(--radius-sm); padding: 18px 22px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); }
.callout.info { border-left-color: var(--accent); }
.callout > * + * { margin-top: .7rem; }
.callout .callout-title { font-weight: 900; font-size: 1.15rem; color: var(--brand); }

.prompt { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.prompt-head span { font-weight: 800; font-size: .9rem; color: var(--text-muted); }
.copy-btn { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.copy-btn.copied { background: var(--brand); color: #fff; }
.prompt pre {
  margin: 0; padding: 18px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88rem; line-height: 1.6; color: var(--text);
}

/* Apuopen tyylin valinta */
.ohje-wrap { display: grid; gap: 24px; }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: center; }
.intro-text h2 { font-size: 1.3rem; color: var(--brand); margin-bottom: 12px; }
.intro-text p + p { margin-top: .8rem; }
.video-label { font-weight: 800; margin-bottom: 10px; }
@media (max-width: 860px) { .intro-grid { grid-template-columns: 1fr; } }
.choose-title { font-size: clamp(1.3rem, 2.4vw, 1.6rem); }
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 28px; }
@media (max-width: 960px) { .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .choices { grid-template-columns: 1fr; } }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text); background: var(--surface); padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--border); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.choice:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); }
.choice[aria-selected="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow-sm); }
.choice strong { font-size: 1.05rem; font-weight: 900; }
.choice-desc { color: var(--text-muted); font-size: .9rem; line-height: 1.4; }
.choice-tag { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.choice[aria-selected="true"] .choice-tag::after { content: " · valittu"; color: var(--brand); }
.tabpanel { max-width: 76ch; padding-top: 4px; }
.tabpanel:focus-visible { outline-offset: 8px; }
.tabpanel h3 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); }
.tabpanel > * + * { margin-top: 1rem; }

/* Videon lataus vasta klikkauksesta (yksityisyys + nopeus) */
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #0b1a10; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-facade {
  position: absolute; inset: 0; width: 100%; border: 0; cursor: pointer; color: #fff; font: inherit;
  display: grid; place-items: center; align-content: center; gap: 12px; padding: 20px; text-align: center;
  background: linear-gradient(135deg, #13602e, #0277bd);
}
.video-facade .play { width: 72px; height: 72px; border-radius: 999px; background: rgba(255, 255, 255, .95); display: grid; place-items: center; transition: transform .2s var(--ease); }
.video-facade .play svg { width: 30px; height: 30px; color: #13602e; margin-left: 4px; }
.video-facade:hover .play { transform: scale(1.08); }
.video-facade strong { font-size: 1.1rem; }
.video-facade small { opacity: .85; max-width: 46ch; }

/* --- Alatunniste --- */
.site-footer { margin-top: auto; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .88rem; padding: 10px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.footer-logos { display: flex; align-items: center; gap: 18px; }
.footer-logos img { width: 38px; height: 38px; }
.footer-logos img.oph { width: 44px; height: auto; border-radius: 6px; }
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  .section-title, .page-hero h1, .choose-title { animation: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* --- 404 --- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 64px 0; }
.notfound .big { font-size: clamp(4rem, 14vw, 8rem); font-weight: 1000; line-height: 1; background: linear-gradient(90deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notfound p { color: var(--text-muted); margin: 12px auto 24px; max-width: 40ch; }

/* --- Tulostus --- */
@media print {
  .site-header, .site-footer, .copy-btn, .video, .choices { display: none !important; }
  .tabpanel[hidden] { display: block !important; }
  .prompt pre { max-height: none; }
  body { background: #fff; color: #000; }
}
