:root {
  --tausta: #fdfcf9;
  --teksti: #1d1d1b;
  --heikko: #5b5b57;
  --viiva: #d9d6cc;
  --korostus: #2f6b4f;
  --kortti: #f3f1ea;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tausta: #1b1c1a;
    --teksti: #e8e6df;
    --heikko: #a9a69c;
    --viiva: #3b3c37;
    --korostus: #8fcfad;
    --kortti: #252622;
  }
}
html { font-size: 100%; }
*, *::before, *::after { box-sizing: border-box; }
/* Kuvat, upotukset ja soittimet eivät koskaan levennä sivua. */
img, iframe, video, audio, table { max-width: 100%; }
img { height: auto; }
main { overflow-wrap: break-word; }
/* Varmistus: muutaman pikselin pyöristyserot (esim. Firefox) eivät tuota vaakavierityspalkkia. */
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--tausta);
  color: var(--teksti);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}
main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
h1, h2, h3, h4, h5 {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.25;
}
h1 { font-size: 2rem; margin: 1rem 0 1.5rem; }
h2 { font-size: 1.5rem; margin: 3rem 0 1rem; border-bottom: 1px solid var(--viiva); padding-bottom: 0.3rem; }
h3 { font-size: 1.2rem; margin: 0 0 0.75rem; }
h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; color: var(--heikko); text-transform: uppercase; letter-spacing: 0.05em; }
h5 { font-size: 0.9rem; margin: 0 0 0.4rem; color: var(--heikko); }
a { color: var(--korostus); }
p { margin: 0 0 0.9rem; }
.paiva {
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--viiva);
  scroll-margin-top: 1rem;
}
.tiedot {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  color: var(--heikko);
}
.huomautus { font-size: 0.9rem; color: var(--heikko); font-style: italic; }
.aani {
  background: var(--kortti);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem 0.25rem;
  margin: 0 0 1rem;
}
.aani p { font-size: 0.95rem; }
audio { display: block; width: 100%; margin: 0 0 0.6rem; }
.taulukko { overflow-x: auto; margin: 0 0 1.5rem; }
table {
  border-collapse: collapse;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.85rem;
}
th, td { white-space: nowrap; border-bottom: 1px solid var(--viiva); padding: 0.3rem 0.6rem; text-align: left; vertical-align: top; }
thead th { border-bottom: 2px solid var(--viiva); }
tfoot th, tfoot td { font-weight: 600; }

/* varustetaulukon kommentit saavat rivittyä */
.varusteet td { white-space: normal; }
.varusteet td:first-child { min-width: 9rem; }

/* Päivän kuvat */
.kuva { margin: 0 0 1.25rem; }
.kuva a { display: block; }
.kuva img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.4rem;
  background: var(--kortti);
}
.kuva figcaption { margin-top: 0.3rem; font-size: 0.85rem; color: var(--heikko); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

/* Päiväsivut */
.selaus {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}
.selaus:last-child { margin: 2.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--viiva); }
.reitti { font-size: 1.25rem; margin: -0.75rem 0 1.25rem; color: var(--heikko); }
.piilo {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tilastot { margin: 0 0 1.5rem; }
.tilastot table { width: 100%; font-size: 0.9rem; }
.tilastot th { font-weight: 400; color: var(--heikko); font-size: 0.8rem; }
.tilastot td { font-weight: 600; font-size: 1rem; }
.tilastot .luku { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 30em) {
  .tilastot th, .tilastot td { padding: 0.25rem 0.15rem; }
  .tilastot th, .tilastot td:last-child { white-space: normal; }
  .tilastot td { font-size: 0.8rem; }
  .tilastot th { font-size: 0.65rem; hyphens: auto; }
}
.kartta { margin: 0 0 1.5rem; }
.kartta img { display: block; width: 100%; height: auto; border-radius: 0.4rem; }
.kartta figcaption { margin-top: 0.3rem; font-size: 0.85rem; color: var(--heikko); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.video { aspect-ratio: 16 / 9; margin: 0 0 1rem; }
.video iframe { width: 100%; height: 100%; border: 0; border-radius: 0.4rem; }
.videolista { padding-left: 1.2rem; font-size: 0.95rem; }
.videolista li { margin-bottom: 0.25rem; }
main > h2 { margin-top: 2.5rem; }

/* Hakemiston päivälista */
.paivalista { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.paivalista li { margin: 0 0 0.75rem; }
.paivakortti {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.6rem;
  border-radius: 0.5rem;
  background: var(--kortti);
  color: inherit;
  text-decoration: none;
}
.paivakortti:hover, .paivakortti:focus-visible { outline: 2px solid var(--korostus); }
.paivakortti img {
  flex: none;
  width: 8rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 0.35rem;
}
.paivakortti-teksti { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.paivakortti-teksti strong { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--korostus); }
.paivakortti-reitti { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 0.9rem; color: var(--heikko); }
.paivakortti-avaus { font-size: 0.95rem; }
@media (max-width: 30em) {
  .paivakortti img { width: 5.5rem; height: 4.5rem; }
  .paivakortti-avaus { display: none; }
}
