/* Vilma & Anssi – kiitossivu: yhteiset osat ja versio A (Tunturiyö).
   Versiot B ja C vaihtavat tokenit ja omat osionsa tiedostoissa theme-b.css ja theme-c.css.
   Kuvaajien tunnusvärit tulevat site.json-tiedostosta (--c). */

:root {
  --bg: #0d151d;
  --bg-2: #142029;
  --text: #ece4d5;
  --muted: #9eacb5;
  --line: rgba(236, 228, 213, 0.14);
  --line-strong: rgba(236, 228, 213, 0.32);
  --solid-bg: #ece4d5;
  --solid-text: #0d151d;
  --paper: #ece4d5;
  --ink: #241812;
  --ink-soft: #5e4a3b;
  --overlay-bg: #080d12;
  --error: #f4b6a6;

  --display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: "Hanken Grotesk", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --display-weight: 300;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1480px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-locked-scroll {
  overflow: hidden;
}

/* Suljettu soitin tai ruudukko ei saa jäädä näkymättömänä sivun päälle */
[hidden] {
  display: none !important;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(3rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.015em;
}

/* ── Painikkeet ───────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 46px;
  padding: 0 1.35em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  border-color: var(--text);
}

.btn--solid {
  border-color: var(--solid-bg);
  background: var(--solid-bg);
  color: var(--solid-text);
}

.btn--solid:hover {
  border-color: var(--solid-bg);
  filter: brightness(1.06);
}

.btn--small {
  min-height: 36px;
  padding: 0 1em;
  font-size: 0.85rem;
}

.btn svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--overlay-bg) 55%, transparent);
  color: var(--text);
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.icon-btn:hover {
  background: color-mix(in srgb, var(--text) 16%, transparent);
}

.icon-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.tag:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.tag svg {
  width: 14px;
  height: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Salasanasivu (sama kaikissa versioissa) ──────────── */

body[data-page="lock"] {
  --bg: #0d151d;
  --text: #ece4d5;
  --muted: #9eacb5;
  --line-strong: rgba(236, 228, 213, 0.32);
  --solid-bg: #ece4d5;
  --solid-text: #0d151d;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Hanken Grotesk", system-ui, sans-serif;
  background: #0d151d;
  color: #ece4d5;
}

.lock {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
}

.lock__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}

@media (orientation: portrait) {
  .lock__bg {
    object-position: 50% 30%;
  }
}

.lock::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(13, 21, 29, 0.96) 8%, rgba(13, 21, 29, 0.55) 46%, rgba(13, 21, 29, 0.15) 75%);
}

.lock__inner {
  padding-top: 30vh;
  padding-bottom: clamp(40px, 9vh, 96px);
}

.lock__names {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  font-style: italic;
}

.lock__title {
  margin: -0.08em 0 0.25em -0.04em;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(5.5rem, 19vw, 15rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.lock__form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 520px;
}

.lock__field {
  flex: 1 1 240px;
}

.lock__field input {
  width: 100%;
  min-height: 50px;
  padding: 0 1.2em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(13, 21, 29, 0.6);
  font-size: 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lock__field input::placeholder {
  color: var(--muted);
}

.lock__field input:focus {
  outline: none;
  border-color: var(--text);
}

.lock__form .btn {
  min-height: 50px;
}

.lock__hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.lock__hint[data-state="error"] {
  color: var(--error);
}

/* ── Ylävalikko ───────────────────────────────────────── */

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  transform: translateY(-100%);
  transition: transform 0.35s ease;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.topbar.is-visible {
  transform: none;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
}

.topbar__brand {
  font-family: var(--display);
  font-size: 1.3rem;
  font-style: italic;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  gap: clamp(14px, 3vw, 30px);
  font-size: 0.9rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
}

.topbar nav a:hover {
  color: var(--text);
}

/* ── A: hero ──────────────────────────────────────────── */

.hero {
  position: relative;
}

.hero__photo {
  position: relative;
  height: min(90svh, 1040px);
  min-height: 440px;
  overflow: hidden;
  background: var(--bg);
}

.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.hero__photo img.is-loaded {
  opacity: 1;
}

.hero__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0, var(--bg) 4px, rgba(13, 21, 29, 0.45) 20%, transparent 42%);
}

.hero__title {
  position: relative;
  z-index: 2;
  margin: -0.62em -0.045em 0 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(6rem, 23vw, 22rem);
  line-height: 0.82;
  letter-spacing: -0.025em;
  text-align: right;
}

.hero__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 24px clamp(24px, 6vw, 96px);
  padding-top: clamp(18px, 3vw, 36px);
  padding-bottom: clamp(56px, 9vw, 120px);
}

.hero__who {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-style: italic;
  line-height: 1.2;
}

.hero__when {
  margin: 6px 0 0;
  color: var(--muted);
}

.hero__lead {
  margin: 0 0 26px;
  max-width: 33em;
  font-family: var(--display);
  font-size: clamp(1.25rem, 1.9vw, 1.55rem);
  line-height: 1.45;
}

/* ── A: kiitoskirje ───────────────────────────────────── */

.letter {
  background: var(--paper);
  color: var(--ink);
}

.letter__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 24px clamp(24px, 6vw, 96px);
  padding-top: clamp(64px, 10vw, 140px);
  padding-bottom: clamp(64px, 10vw, 140px);
}

.letter__photo {
  align-self: start;
  margin: 0;
  max-width: 420px;
  transform: rotate(-1.6deg);
  background: #fffaf0;
  padding: 12px 12px 44px;
  box-shadow: 0 1px 2px rgba(36, 24, 18, 0.12), 0 18px 40px -18px rgba(36, 24, 18, 0.4);
}

.letter__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #ddd3c2;
}

.letter__photo figcaption {
  margin-top: 12px;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  text-align: center;
}

.letter__text {
  max-width: 34em;
  font-family: var(--display);
  font-size: clamp(1.22rem, 1.7vw, 1.42rem);
  line-height: 1.6;
}

.letter__text p {
  margin: 0 0 1em;
}

.letter-greeting {
  font-style: italic;
  font-size: 1.25em;
}

.letter-sign {
  margin-top: 1.6em !important;
  font-style: italic;
  font-size: 1.6em;
  line-height: 1.1;
}

/* ── Päivä kuvina (yhteinen kehys) ────────────────────── */

.day {
  padding-top: clamp(72px, 10vw, 140px);
}

.day__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px 40px;
  margin-bottom: 28px;
}

.day__intro {
  margin: 0;
  max-width: 34em;
  color: var(--muted);
}

.day__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.day__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: -4px;
  padding: 4px;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chip[aria-pressed="true"] {
  border-color: var(--solid-bg);
  background: var(--solid-bg);
  color: var(--solid-text);
}

.chip__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.chip__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

/* Yksittäinen kuvanappi vaiheiden esikatseluissa */
.shot {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg-2);
  cursor: zoom-in;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}

.shot img.is-loaded {
  opacity: 1;
}

.shot:hover img {
  transform: scale(1.03);
}

/* ── A: päivän vaiheet karusellina ────────────────────── */

.rail {
  display: flex;
  gap: clamp(12px, 1.6vw, 20px);
  margin: 26px calc(var(--gutter) * -1) 0;
  padding: 0 var(--gutter) 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  display: none;
}

.a-card {
  flex: none;
  width: clamp(240px, 22.5vw, 330px);
  scroll-snap-align: start;
}

.a-card__cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg-2);
  color: #ece4d5;
  text-align: left;
  cursor: pointer;
}

.a-card__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease, transform 1s ease;
}

.a-card__cover img.is-loaded {
  opacity: 1;
}

.a-card__cover:hover img {
  transform: scale(1.035);
}

.a-card__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13, 21, 29, 0.85) 0%, rgba(13, 21, 29, 0.15) 42%, transparent 58%);
}

.a-card__cover span {
  position: absolute;
  left: 20px;
  right: 20px;
  z-index: 1;
}

.a-card__title {
  bottom: 46px;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.1;
}

.a-card__meta {
  bottom: 22px;
  overflow: hidden;
  color: rgba(236, 228, 213, 0.72);
  font-size: 0.85rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.a-card__thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.a-card__thumb {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg-2);
  cursor: zoom-in;
}

.a-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.a-card__thumb img.is-loaded {
  opacity: 1;
}

.a-card__thumb:hover img {
  filter: brightness(1.08);
}

.a-card__more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(13, 21, 29, 0.66);
  color: #ece4d5;
  font-family: var(--display);
  font-size: 1.45rem;
  font-variant-numeric: lining-nums;
  transition: background-color 0.2s ease;
}

.a-card__thumb:hover .a-card__more {
  background: rgba(13, 21, 29, 0.5);
}

.rail__nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.rail__hint {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.88rem;
}

.rail__nav .icon-btn {
  border: 1px solid var(--line-strong);
  background: transparent;
}

/* ── Jakaminen ────────────────────────────────────────── */

.share {
  padding-top: clamp(96px, 12vw, 170px);
  padding-bottom: clamp(64px, 9vw, 120px);
}

.share__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 32px clamp(24px, 6vw, 96px);
}

.share__text {
  max-width: 30em;
}

.share__text p {
  margin: 18px 0 0;
  color: var(--muted);
}

.share__text strong {
  color: var(--text);
  font-weight: 500;
}

.credits {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.credit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.credit__who {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.credit__who::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}

.credit__handle {
  grid-column: 1;
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.4vw, 2.2rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.credit__handle:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.credit__note {
  grid-column: 1;
  margin: 0;
  font-family: var(--display);
  font-size: 1.3rem;
}

.credit .btn {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.downloads {
  padding-bottom: clamp(64px, 9vw, 120px);
}

.archive__wait {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--muted);
  font-size: 0.85rem;
}

.fs-btn {
  border-color: transparent;
}

.show__controls .fs-btn {
  min-height: 42px;
  color: #ece4d5;
}

.howto {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.howto li {
  margin-top: 8px;
}

/* ── Diashow-nosto ────────────────────────────────────── */

.feature {
  position: relative;
  display: grid;
  align-items: end;
  min-height: min(82svh, 860px);
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-2);
  color: #ece4d5;
}

.feature img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
}

.feature::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to right, rgba(13, 21, 29, 0.9) 0%, rgba(13, 21, 29, 0.62) 42%, rgba(13, 21, 29, 0) 72%),
    linear-gradient(to top, rgba(13, 21, 29, 0.7), transparent 40%);
}

.feature__inner {
  padding-top: 120px;
  padding-bottom: clamp(48px, 8vw, 110px);
}

.feature__text {
  max-width: 28em;
  margin: 18px 0 26px;
  font-family: var(--display);
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  line-height: 1.45;
}

.feature__meta {
  display: block;
  margin-top: 8px;
  color: #c3ccd1;
  font-family: var(--body);
  font-size: 0.9rem;
}

.feature .btn--solid {
  border-color: #ece4d5;
  background: #ece4d5;
  color: #0d151d;
}

/* ── Alatunniste ──────────────────────────────────────── */

.footer {
  padding: 48px 0 calc(48px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.88rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
}

.footer__sign {
  color: var(--text);
  font-family: var(--display);
  font-size: 1.35rem;
  font-style: italic;
}

/* ── Versiovalitsin (vain testivaiheessa) ─────────────── */

.switcher {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: #1b1b1b;
  color: #cfcfcf;
  font: 500 12px/1 "Hanken Grotesk", system-ui, sans-serif;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.switcher span {
  margin-right: 6px;
}

.switcher a {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #cfcfcf;
  text-decoration: none;
}

.switcher a[aria-current="true"] {
  background: #f2f0eb;
  color: #111;
}

/* ── Kuvasoitin ───────────────────────────────────────── */

.player {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: var(--overlay-bg);
  color: var(--text);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.player.is-open {
  opacity: 1;
}

.player__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(8px, env(safe-area-inset-top)) 10px 4px calc(18px + env(safe-area-inset-left));
}

.player__where {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  min-width: 0;
}

.player__chapter {
  font-family: var(--display);
  font-size: 1.35rem;
}

.player__time {
  color: var(--muted);
  font-size: 0.85rem;
}

.player__tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.player__count {
  margin-right: 6px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.player__stage {
  position: relative;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}

.player__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px clamp(0px, 5vw, 80px);
  transition: opacity 0.35s ease;
}

.player__img--low {
  filter: blur(6px);
}

.player__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  margin-top: -22px;
}

.player__nav--prev {
  left: 10px;
}

.player__nav--next {
  right: 10px;
}

.player__timeline {
  padding: 6px calc(18px + env(safe-area-inset-right)) 0 calc(18px + env(safe-area-inset-left));
}

.player__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 24px;
  padding: 10px calc(16px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
}

.player__credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  min-width: 0;
}

.player__name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-size: 1.3rem;
  line-height: 1.2;
}

.player__name::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}

.player__actions {
  display: flex;
  gap: 8px;
}

/* ── Aikajana ─────────────────────────────────────────── */

.scrubber {
  position: relative;
  display: flex;
  gap: 3px;
  height: 36px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.scrubber:focus-visible {
  outline-offset: 2px;
}

.scrubber__seg {
  position: relative;
  flex: var(--n) 1 0;
  min-width: 14px;
}

.scrubber__seg::before {
  content: "";
  position: absolute;
  inset: 8px 0 auto;
  height: 3px;
  border-radius: 2px;
  background: var(--line-strong);
  transition: background-color 0.2s ease;
}

.scrubber__seg.is-current::before {
  background: var(--text);
}

.scrubber__seg span {
  position: absolute;
  left: 0;
  bottom: 0;
  max-width: 100%;
  overflow: hidden;
  padding-left: 1px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.72rem;
  pointer-events: none;
}

.scrubber__seg.is-current span {
  color: var(--text);
}

.scrubber__knob {
  position: absolute;
  top: 4px;
  left: 0;
  width: 11px;
  height: 11px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 3px var(--overlay-bg);
  pointer-events: none;
  transition: left 0.15s ease;
}

/* ── Ruudukko ─────────────────────────────────────────── */

.gridview {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gridview.is-open {
  opacity: 1;
}

.gridview__bar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.gridview__bar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gridview__filters {
  flex: 1;
  min-width: 0;
}

.gridview .scrubber {
  margin: 6px 0 6px;
}

.gridview .scrubber__knob {
  box-shadow: 0 0 0 3px var(--bg);
}

.gridview__body {
  padding-bottom: 80px;
}

.clock {
  flex: none;
  text-align: right;
  line-height: 1.15;
}

.clock__date {
  font-family: var(--display);
  font-size: 1.45rem;
  font-variant-numeric: lining-nums tabular-nums;
}

.clock__chapter {
  color: var(--muted);
  font-size: 0.8rem;
}

.clock__short {
  display: none;
}

.chapter {
  padding-top: clamp(36px, 5vw, 64px);
}

.chapter__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: baseline;
  column-gap: clamp(16px, 2.5vw, 32px);
  margin-bottom: 18px;
}

.chapter__title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 400;
  line-height: 1.1;
}

.chapter__meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.rows {
  display: flex;
  flex-direction: column;
  gap: var(--gap, 6px);
}

.row {
  display: flex;
  gap: var(--gap, 6px);
}

.tile {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--bg-2);
  cursor: zoom-in;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.tile img.is-loaded {
  opacity: 1;
}

.tile::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--c);
  opacity: 0.9;
}

.tile__by {
  position: absolute;
  left: 7px;
  bottom: 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: rgba(13, 21, 29, 0.62);
  color: #ece4d5;
  font-size: 0.72rem;
  line-height: 1.3;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tile__by::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
}

/* ── Diashow-soitin ───────────────────────────────────── */

.show {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: #070605;
  color: #ece4d5;
  cursor: none;
}

.show.is-awake {
  cursor: default;
}

.show__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.012);
  transition: opacity var(--fade, 1.35s) ease, transform calc(var(--fade, 1.35s) * 1.7) ease;
}

.show__slide.is-active {
  opacity: 1;
  transform: none;
}

.show__brand {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  z-index: 2;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  transition: opacity 1.2s ease;
}

.show__brand.is-hidden {
  opacity: 0;
}

.show__brand p {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.show__controls {
  position: absolute;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(18, 16, 15, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(-50%);
  transition: opacity 0.35s ease;
}

.show:not(.is-awake) .show__controls {
  opacity: 0;
  pointer-events: none;
}

.show__controls .icon-btn {
  width: 42px;
  height: 42px;
  background: transparent;
  color: #ece4d5;
}

.show__count {
  min-width: 84px;
  color: #a9a39a;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ── Ilmoitus ─────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--solid-bg);
  color: var(--solid-text);
  font-size: 0.92rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Kapeat näytöt ────────────────────────────────────── */

@media (max-width: 860px) {
  .hero__body,
  .letter__inner,
  .share__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .letter__photo {
    max-width: 300px;
    margin: 0 auto 12px;
  }
}

@media (max-width: 640px) {
  .topbar nav a[data-optional] {
    display: none;
  }

  .hero__photo {
    height: 70svh;
  }

  .hero__photo img {
    object-position: 38% 60%;
  }

  .hero__title {
    margin-top: -0.55em;
  }

  .a-card {
    width: 76vw;
  }

  .day__actions {
    width: 100%;
  }

  .day__actions .btn {
    flex: 1;
  }

  .clock__chapter,
  .clock__long {
    display: none;
  }

  .clock__short {
    display: inline;
  }

  .clock__date {
    font-size: 1.2rem;
  }

  .scrubber__seg span {
    display: none;
  }

  .scrubber {
    height: 20px;
  }

  .tile__by {
    left: 5px;
    bottom: 7px;
    padding: 2px 7px 2px 5px;
    font-size: 0.66rem;
  }

  .player__nav {
    display: none;
  }

  .player__img {
    padding: 4px 0;
  }

  .player__bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .player__actions .btn {
    flex: 1;
  }

  .player__actions .btn--solid {
    flex: 2;
  }

  .credit {
    grid-template-columns: minmax(0, 1fr);
  }

  .credit .btn,
  .archive__wait {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: 8px;
  }

  .player__fs span {
    display: none;
  }

  .player__fs {
    padding: 0 10px;
  }

  .feature::before {
    background: linear-gradient(to top, rgba(13, 21, 29, 0.95) 10%, rgba(13, 21, 29, 0.45) 55%, rgba(13, 21, 29, 0.1));
  }

  .switcher span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
