/* =========================================================================
   Sompasauna — "Ajopuu & meri"
   Paletti + typografia + layout. Ks. docs/kehitysmuistio.md ja CONTRIBUTING.md
   ========================================================================= */

:root {
  --ground:    #F7F5EF;
  --surface:   #FFFFFF;
  --ink:       #22282B;
  --ink-soft:  #3F484B;
  --driftwood: #6B7078;
  --line:      #E7E2D4;
  --brack:     #356E72;
  --brack-deep:#2A575A;
  --ember:     #BC5A38;
  --focus:     #356E72;

  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:    #161A1B;
    --surface:   #1E2426;
    --ink:       #E9E5DC;
    --ink-soft:  #C4C1B8;
    --driftwood: #909799;
    --line:      #2E3639;
    --brack:     #74B4B2;
    --brack-deep:#93C7C4;
    --ember:     #E28C66;
    --focus:     #74B4B2;
  }
}
:root[data-theme="dark"] {
  --ground:    #161A1B;
  --surface:   #1E2426;
  --ink:       #E9E5DC;
  --ink-soft:  #C4C1B8;
  --driftwood: #909799;
  --line:      #2E3639;
  --brack:     #74B4B2;
  --brack-deep:#93C7C4;
  --ember:     #E28C66;
  --focus:     #74B4B2;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.4rem;
}

a { color: var(--brack); text-underline-offset: 3px; }
a:hover { color: var(--brack-deep); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; display: block; }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--brack);
  color: #fff;
  padding: .5rem .8rem;
  border-radius: 3px;
}

/* ---- header ---- */
.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1.4rem;
  padding-block: 1.4rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand img { width: 26px; height: 28px; flex: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img { filter: invert(1) brightness(.92); }
}
:root[data-theme="dark"] .brand img { filter: invert(1) brightness(.92); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem 1.3rem;
  font-size: .95rem;
}
.site-nav > a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav > a:hover { color: var(--ink); }
.site-nav > a[aria-current="page"] {
  color: var(--brack);
  border-bottom: 2px solid var(--brack);
}

/* ---- segmented control: kieli- ja teemavalitsin ---- */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.seg > * {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .32rem;
  padding: .3rem .6rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--driftwood);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.seg > * + * { border-left: 1px solid var(--line); }
.seg > *:hover { color: var(--ink); }
.seg [aria-current="true"],
.seg [aria-pressed="true"] { color: var(--ink); }
.seg [aria-current="true"]::after,
.seg [aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: .55rem;
  right: .55rem;
  bottom: .15rem;
  height: 2px;
  background: var(--brack);
}
.seg svg { width: 15px; height: 15px; display: block; }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.theme-toggle svg .fill { fill: currentColor; stroke: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- content ---- */
.content {
  padding-block: 2.4rem 4rem;
}
.content > :first-child { margin-top: 0; }

.content h1 {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -.02em;
  text-wrap: balance;
  margin: 0 0 1rem;
}
.content h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: 1.55rem;
  letter-spacing: -.01em;
  margin: 2.4rem 0 .8rem;
}
.content h3 {
  font-size: 1.1rem;
  margin: 1.8rem 0 .4rem;
}
.content p,
.content ul,
.content ol { margin: 0 0 1.1rem; }
.content li { margin: .3rem 0; }
.content li > strong:first-child { display: block; }

.content a { text-decoration: underline; }

.lead {
  font-size: 1.18rem;
  color: var(--ink-soft);
  max-width: 34rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0 1.4rem;
  display: block;
  overflow-x: auto;
}
.content th,
.content td {
  text-align: left;
  padding: .55rem .65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

blockquote {
  margin: 1.4rem 0;
  padding: .2rem 0 .2rem 1.1rem;
  border-left: 3px solid var(--line);
  color: var(--ink-soft);
}

/* nappilinkki */
.button {
  display: inline-block;
  background: var(--brack);
  color: #fff;
  padding: .65rem 1.15rem;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
}
.button:hover { background: var(--brack-deep); color: #fff; }
:root[data-theme="dark"] .button,
:root:not([data-theme="light"]) .button { color: var(--ground); }

/* toissijainen nappi (ääriviiva) */
.button-ghost {
  background: transparent;
  color: var(--brack);
  box-shadow: inset 0 0 0 1px var(--brack);
}
.button-ghost:hover { background: transparent; color: var(--brack-deep); box-shadow: inset 0 0 0 1px var(--brack-deep); }
:root[data-theme="dark"] .button-ghost,
:root:not([data-theme="light"]) .button-ghost { color: var(--brack); }

/* lahjoitussivun ensisijaiset napit */
.give-primary {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin: 1.2rem 0 1.4rem;
}
.give-primary .button { padding-inline: 1.4rem; }

/* pienpräntti (lupanumero ym.) */
.fine {
  font-size: .85rem;
  color: var(--driftwood);
}

/* huomiolaatikko — sivuston ainoa lämmin aksentti (löyly-status ym.) */
.note {
  margin: 1.6rem 0;
  padding: .9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ember);
  border-radius: 0 4px 4px 0;
  color: var(--ink-soft);
}
.note strong { color: var(--ink); }

/* etusivun hero-kuva */
.hero-figure {
  margin: 2.2rem 0;
}
.hero-figure img { border-radius: 3px; width: 100%; }
.hero-figure figcaption {
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--driftwood);
}

/* etusivun sääntölista: numerot Fraunces-antiikvalla meren värissä */
.content ol.rules {
  list-style: none;
  counter-reset: rule;
  padding: 0;
  margin: 1.4rem 0;
}
.content ol.rules > li {
  counter-increment: rule;
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0 1rem;
  padding-block: 1.05rem;
  margin: 0;
  border-top: 1px solid var(--line);
}
.content ol.rules > li::before {
  content: counter(rule);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--brack);
}

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--driftwood);
  font-size: .9rem;
}
.site-footer .wrap { padding-block: 2rem 3rem; }
.site-footer p { margin: .35rem 0; }
.site-footer a { color: var(--driftwood); }
.site-footer a:hover { color: var(--ink); }

/* ---- motion ---- */
@media (prefers-reduced-motion: no-preference) {
  a, .button, .seg > * { transition: color .12s ease, background-color .12s ease; }
  body { transition: background-color .16s ease, color .16s ease; }
}
