/* erityisryhmienkoulutus.fi: oma ilme "Polkumerkki".
   Retkeilyreitin opastus: metsänvihreä kenttä, puutolpan viitat, puuhun maalattu savenvärinen merkki ja katkoviivalla kulkeva reitti.
   Fontti: Atkinson Hyperlegible Next (SIL OFL 1.1), itse hostattu. Ei jaettua pohjaa. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  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: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  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;
}
@font-face {
  font-family: "Atkinson Vara";
  src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}

:root {
  --metsa: #1E3A2B;
  --metsa-syva: #142A1E;
  --metsa-pinta: #2B4D3A;
  --maa: #EDF1E9;
  --maa-2: #DFE8D9;
  --valkoinen: #FBFCF9;
  --teksti: #16221B;
  --himmea: #38483E;
  --linkki: #1D4A32;
  --savi: #A8714A;
  --savi-vaalea: #E3B58A;
  --savi-tausta: #EBDCC8;
  --savi-teksti: #2A1B10;
  --reuna: #8A9C8F;
  --vaarin: #8E1A12;
  --vaarin-tausta: #FBEAE8;

  --fontti: "Atkinson Hyperlegible Next", "Atkinson Vara", system-ui, sans-serif;
  --sade: 10px;
  --ulos: cubic-bezier(0.23, 1, 0.32, 1);
  --rytmi: 3.5rem;

  --pohja: var(--maa);
  --linja: var(--savi);
  --fokus: var(--metsa);
  --fokus-2: #FFFFFF;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
  scrollbar-color: #5E7D69 var(--maa-2);
}
html.iso-teksti { font-size: 125%; }
::selection { background: #B5D3BC; color: #0E2217; }

body {
  margin: 0;
  background: var(--maa);
  color: var(--teksti);
  font-family: var(--fontti);
  font-size: 1.1875rem;
  line-height: 1.7;
  letter-spacing: 0.005em;
  caret-color: var(--metsa);
}

h1, h2, h3 { color: inherit; font-weight: 800; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 9.4vw, 4.4rem); line-height: 1.04; letter-spacing: -0.022em; margin: 0 0 1.25rem; }
h2 { font-size: clamp(1.6rem, 5.6vw, 2rem); line-height: 1.18; letter-spacing: -0.01em; margin: 0 0 1.1rem; }
h3 { font-size: 1.3rem; line-height: 1.3; font-weight: 750; margin: 2.25rem 0 0.6rem; }
p { margin: 0 0 1.1rem; }
ul, ol { margin: 0 0 1.25rem; padding-left: 1.4rem; }
li { margin-bottom: 0.5rem; }
li::marker { color: var(--savi); font-weight: 800; }
strong { font-weight: 750; }

a { color: var(--linkki); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 3px; }

/* Tumma kenttä: metsänvihreä */
.tumma {
  --pohja: var(--metsa);
  --linja: #6F9680;
  --fokus: #FFFFFF;
  --fokus-2: var(--metsa-syva);
  background: var(--metsa);
  color: #F1F5EC;
}
.tumma a { color: #F1F5EC; }

:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--fokus-2);
  border-radius: 6px;
}

.sisalto { max-width: 66rem; margin: 0 auto; padding: 0 20px; position: relative; }

.ohita {
  position: absolute; left: 12px; top: -80px; z-index: 10; padding: 14px 20px; border-radius: var(--sade);
  background: #FFFFFF; color: var(--metsa); font-weight: 750;
}
.ohita:focus { top: 12px; }

/* Yläpalkki */
.ylapalkki { border-bottom: 1px solid rgba(241, 245, 236, 0.22); }
.ylapalkki .sisalto { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.sanamerkki {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 1.15rem; line-height: 1.2; letter-spacing: -0.005em; text-decoration: none;
}
.sanamerkki::before {
  content: ""; flex: none; width: 0.6rem; height: 2.2rem; border-radius: 3px; background: var(--savi-vaalea);
}
.sanamerkki:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.tekstikoko {
  min-height: 48px; padding: 0 18px; border: 2px solid #F1F5EC; border-radius: var(--sade);
  background: transparent; color: #F1F5EC; font: inherit; font-size: 1rem; font-weight: 750; cursor: pointer;
  transition: background-color 160ms var(--ulos), color 160ms var(--ulos), transform 160ms var(--ulos);
}
.tekstikoko:active { transform: scale(0.98); }
.tekstikoko[aria-pressed="true"] { background: #F1F5EC; color: var(--metsa); }

/* Kärki */
.karki { padding: 2.75rem 0 3.5rem; overflow: hidden; }
.karki-ruudukko { display: grid; gap: 3rem; }
.lede { font-size: 1.3rem; line-height: 1.6; max-width: 36rem; color: #F1F5EC; }
.paiva { font-size: 1rem; line-height: 1.6; color: #D3DED4; max-width: 36rem; margin: 1.5rem 0 0; }
.karki-yksi { padding: 3rem 0 2rem; }
.karki-yksi h1 { color: var(--teksti); }

/* Viitat: puutolppa ja kaksi kylttiä */
.viitat { position: relative; display: grid; gap: 1rem; padding: 0.75rem 0; }
.viitat::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 14px; margin-left: -7px;
  background: #3F6350; border-radius: 3px;
}
.viitta {
  position: relative; width: 94%; padding: 1.1rem 3.4rem 1.2rem 1.4rem; color: var(--teksti);
  background: var(--maa-2);
  clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 50%, calc(100% - 30px) 100%, 0 100%);
}
.viitta--vasen {
  margin-left: auto; padding: 1.1rem 1.4rem 1.2rem 3.4rem; background: var(--savi-vaalea); color: var(--savi-teksti);
  clip-path: polygon(30px 0, 100% 0, 100% 100%, 30px 100%, 0 50%);
}
.viitta-nimi { display: block; font-size: 1rem; font-weight: 750; color: var(--himmea); }
.viitta--vasen .viitta-nimi { color: var(--savi-teksti); }
.viitta strong { display: block; font-size: 1.5rem; line-height: 1.2; font-weight: 800; margin: 0.15rem 0 0.45rem; }
.viitta p { margin: 0; font-size: 1.05rem; line-height: 1.55; }

@media (prefers-reduced-motion: no-preference) {
  .viitta--oikea { animation: viitta-vasemmalta 800ms var(--ulos) 150ms backwards; }
  .viitta--vasen { animation: viitta-oikealta 800ms var(--ulos) 300ms backwards; }
}
@keyframes viitta-vasemmalta { from { opacity: 0; transform: translateX(-36px) rotate(-1.2deg); } }
@keyframes viitta-oikealta { from { opacity: 0; transform: translateX(36px) rotate(1.2deg); } }

/* Napit */
.nappi {
  display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 28px;
  border: 0; border-radius: var(--sade); background: var(--metsa); color: #FFFFFF;
  font: inherit; font-size: 1.1875rem; font-weight: 750; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color 160ms var(--ulos), transform 160ms var(--ulos);
}
.tumma .nappi { color: #FFFFFF; }
.nappi:active { transform: scale(0.98); }
.nappi[disabled] { background: var(--himmea); cursor: progress; }
.nappi--savi { background: var(--savi-vaalea); color: var(--savi-teksti); }
.tumma .nappi--savi { color: var(--savi-teksti); }
@media (hover: hover) {
  .nappi:hover { background: var(--metsa-pinta); }
  .nappi--savi:hover { background: #EFC9A3; }
  .tumma .nappi--savi:hover { color: var(--savi-teksti); }
  .tekstikoko:hover { background: rgba(241, 245, 236, 0.14); }
  .tekstikoko[aria-pressed="true"]:hover { background: #FFFFFF; }
}

/* Osiot: reitti kulkee vasemmassa laidassa, jokaisella pysähdyksellä on maalattu merkki */
.osio { --pohja: var(--maa); padding: var(--rytmi) 0; background: var(--pohja); position: relative; }
.osio-tausta { --pohja: var(--maa-2); }
.osio-loppu { --pohja: var(--metsa); }
.osio h2::before {
  content: ""; display: block; width: 0.7rem; height: 2.4rem; margin-bottom: 0.9rem; border-radius: 3px; background: var(--savi);
}
.osio-loppu h2::before { background: var(--savi-vaalea); }
.runko { max-width: 42rem; min-width: 0; }
.runko > :last-child { margin-bottom: 0; }

@media (min-width: 900px) {
  .karki { padding: 4.5rem 0 5rem; }
  .karki-ruudukko { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 4rem; align-items: center; }
  .osio .sisalto { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); column-gap: 4rem; align-items: start; }
  .osio h2 { position: sticky; top: 1.5rem; margin: 0; }
  .osio h2::before { box-shadow: 0 0 0 7px var(--pohja); }
  .osio .sisalto::before {
    content: ""; position: absolute; left: 0.2rem; width: 3px; top: calc(var(--rytmi) * -1); bottom: calc(var(--rytmi) * -1);
    background: repeating-linear-gradient(to bottom, var(--linja) 0 7px, transparent 7px 15px);
  }
}

/* Sisältö */
.huom {
  margin: 1.75rem 0 0; padding: 1.25rem 1.4rem; border-radius: var(--sade);
  background: var(--savi-tausta); color: var(--savi-teksti);
}
.huom p:last-child { margin-bottom: 0; }

.ruutu { margin: 0 0 0.5rem; }
.ruutu h3 { margin-top: 2rem; }
.ruutu:first-of-type h3 { margin-top: 1.5rem; }

/* Alueluettelo */
.alueet { margin: 1.5rem 0; padding: 0; display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.alue { padding: 0.9rem 0; border-bottom: 1px solid var(--reuna); }
.alue dt { font-weight: 800; line-height: 1.3; }
.alue dd { margin: 0.2rem 0 0; font-size: 1.05rem; line-height: 1.55; overflow-wrap: anywhere; }

/* Lomake */
.osio-loppu .runko { max-width: 40rem; }
.osio-loppu a { text-decoration-color: currentColor; }
.lomake { margin-top: 1.75rem; padding: 1.5rem 1.25rem; border-radius: var(--sade); background: var(--valkoinen); color: var(--teksti); }
.lomake a, .kiitos a { color: var(--linkki); }
.kentta { margin-bottom: 1.5rem; }
.kentta label { display: block; font-weight: 750; line-height: 1.35; margin-bottom: 0.35rem; }
.vihje { display: block; font-weight: 400; font-size: 1rem; color: var(--himmea); line-height: 1.5; margin: 0 0 0.5rem; }
.lomake input[type="email"], .lomake input[type="text"], .lomake select {
  width: 100%; min-height: 56px; padding: 10px 14px; border: 2px solid #4B5C51; border-radius: var(--sade);
  background: #FFFFFF; color: var(--teksti); font: inherit; font-size: 1.1875rem;
}
.lomake input:focus-visible, .lomake select:focus-visible { border-color: var(--metsa); }
.lomake [aria-invalid="true"] { border-color: var(--vaarin); border-width: 3px; background: var(--vaarin-tausta); }
.virhe { margin: 0.45rem 0 0; color: var(--vaarin); font-weight: 750; font-size: 1.05rem; line-height: 1.5; }
.virhe:empty { display: none; }
.rasti { display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; padding: 14px; border: 2px solid var(--reuna); border-radius: var(--sade); background: var(--maa); }
.rasti input { width: 32px; height: 32px; margin: 4px 0 0; accent-color: var(--metsa); }
.rasti label { margin: 0; font-weight: 500; font-size: 1.1rem; line-height: 1.55; }
.pikku { font-size: 1rem; line-height: 1.6; color: var(--himmea); }
.tumma .pikku { color: #D3DED4; }
.lomake .pikku, .kiitos .pikku { color: var(--himmea); }
.ansa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.kiitos { margin-top: 1.75rem; padding: 1.4rem 1.25rem; border-radius: var(--sade); background: var(--valkoinen); color: var(--teksti); }
.kiitos h3 { margin-top: 0; }
.kiitos p:last-child { margin-bottom: 0; }
.kiitos[hidden], .lomake[hidden] { display: none; }

/* Usein kysyttyä */
details { border-bottom: 1px solid var(--reuna); }
.runko > details:first-of-type { border-top: 1px solid var(--reuna); }
summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 14px 4px;
  font-weight: 750; line-height: 1.4; cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; flex: none; width: 1.25rem; height: 1.25rem;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 3px no-repeat,
    linear-gradient(currentColor, currentColor) center / 3px 100% no-repeat;
  transition: transform 220ms var(--ulos);
}
details[open] summary::after { transform: rotate(90deg); background: linear-gradient(currentColor, currentColor) center / 100% 3px no-repeat; }
details > div { padding: 0 4px 10px; max-width: 38rem; }
@media (hover: hover) { summary:hover { color: var(--linkki); } }

.lahteet { padding-left: 1.2rem; }
.lahteet li { overflow-wrap: anywhere; font-size: 1.05rem; line-height: 1.6; }

/* Alatunniste */
.alatunniste { margin-top: 0; padding: 2.5rem 0 3rem; font-size: 1.05rem; }
.alatunniste p { margin-bottom: 0.6rem; }
.alatunniste .pikku { color: #D3DED4; }

@media (min-width: 720px) {
  .lomake { padding: 2rem; }
}

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

@media (forced-colors: active) {
  .nappi, .tekstikoko { border: 2px solid ButtonText; }
  .viitta { clip-path: none; border: 2px solid CanvasText; }
}

/* Lomakkeet piilossa ennen tallennusta (22.10. 19:44). */
[hidden] { display: none !important; }
