/* =====================================================================
   DUOBOTIT — tyylit (WebGL-versio)
   WebGL-canvas hoitaa karusellin/3D:n. Tämä tiedosto = overlay-UI:
   lataus, intro, brändi, vihjeet, sarjakuvamaailma (modaali).
   Suunniteltu työpöytäselaimelle.
   ===================================================================== */
:root {
  --bg-0: #05060c;          /* lähes musta pohja */
  --bg-1: #131428;          /* keskuksen hehku */
  --cream: #f4ead7;
  --muted: #9a93ad;
  --marigold: #ffb24c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-0);
  color: var(--cream);
  font-family: "Nunito", system-ui, sans-serif;
  /* WebGL omistaa ruudun → ei sivun scrollia */
  overflow: hidden;
  overscroll-behavior: none;
}
body.modal-open { overflow: hidden; }

/* ====== WEBGL-CANVAS (täysruutu, taustalla) ====== */
#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  touch-action: none;
}

/* ====== LATAUS ====== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(110% 90% at 50% 45%, var(--bg-1), var(--bg-0) 65%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.02em;
}
.loader-bar {
  width: min(280px, 60vw);
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.loader-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--marigold), #ff7ab0);
  transition: width 0.25s ease;
}
.loader-text {
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ====== INTRO-PORTTI (robotti) ====== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(110% 90% at 50% 45%, rgba(19,20,40,0.65), rgba(5,6,12,0.85) 65%);
  backdrop-filter: blur(2px);
  transition: opacity 0.6s ease;
}
.intro[hidden] { display: none; }
.intro-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 24px;
  border-radius: 24px;
  transition: transform 0.3s ease;
}
.intro-btn:hover { transform: translateY(-4px); }
.intro-btn:focus-visible { outline: 2px solid var(--marigold); outline-offset: 4px; }
.intro-frame {
  width: min(460px, 80vw);
  aspect-ratio: 600 / 440;
  object-fit: contain;
  filter: drop-shadow(0 12px 50px rgba(255,178,76,0.22));
}
.intro-hint {
  font-family: "Caveat", cursive;
  font-size: 1.7rem;
  color: var(--marigold);
}

/* ====== UI-OVERLAY ====== */
/* ====== YLÄPALKKI (topbar) ====== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 48px);
  padding: 15px clamp(8px, 1.5vw, 20px);
  /* palkki itse ei nappaa klikkejä → canvas-scroll toimii tyhjän kohdalta */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}
body.entered .topbar { opacity: 1; }

/* etusivulla topbar kelluu hero-valokuvan päällä → läpikuultava, sumennettu tausta */
body.page-home .topbar {
  background: rgba(5, 6, 12, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* topbar-nav täyttää jäljellä olevan tilan brandin ja nav-rightin välissä ja keskittää
   nav-linkit + erotinviivan + some-ikonit siihen tilaan (oma, brandista irrallinen ryhmä) */
.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: clamp(10px, 1.2vw, 20px);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.9vw, 14px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-sep {
  color: rgba(244, 234, 215, 0.3);
  font-size: 1rem;
  line-height: 1;
}
/* Oikean reunan ryhmä (Pelaa demoa + kielivalitsin): kiinteä leveys, sama reunaetäisyys kuin brandilla vasemmalla */
.nav-right {
  display: flex;
  align-items: center;
  gap: clamp(7px, 1vw, 15px);
  flex: 0 0 auto;
}
.nav-links a {
  pointer-events: auto;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  color: var(--cream);
  text-decoration: none;
  padding: 6px 2px;
  position: relative;
  opacity: 0.85;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--marigold);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s ease;
}
.nav-links a:hover,
.nav-links a:focus-visible { opacity: 1; }
.nav-links a:hover::after,
.nav-links a:focus-visible::after { transform: scaleX(1); }

/* GitHub / Discord -ikonit (Tietoa ja Pelaa demoa välissä) */
.nav-social {
  display: flex;
  align-items: center;
  gap: 10px;
}
.social-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--cream);
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(244, 234, 215, 0.14);
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.social-btn:hover,
.social-btn:focus-visible {
  opacity: 1;
  color: var(--marigold);
  background: rgba(255, 178, 76, 0.12);
  transform: translateY(-1px);
}

/* "Pelaa demoa" -painike (korostettu) */
.nav-demo {
  pointer-events: auto;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--bg-0);
  text-decoration: none;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--marigold), #ff7ab0);
  box-shadow: 0 6px 22px rgba(255, 178, 76, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.nav-demo:hover,
.nav-demo:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(255, 178, 76, 0.38);
}

/* Kielikytkin FI / EN */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(244, 234, 215, 0.18);
  background: rgba(255, 255, 255, 0.05);
}
.lang-btn {
  pointer-events: auto;
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.lang-btn:hover { color: var(--cream); }
.lang-btn.is-active {
  color: var(--bg-0);
  background: var(--marigold);
}
.lang-sep {
  color: rgba(244, 234, 215, 0.3);
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
}

/* ====== BRÄNDI (logo palkin vasemmassa reunassa) ====== */
.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.brand {
  display: block;
  width: clamp(36px, 5.5vw, 52px);   /* logon koko palkissa: mahtuu palkin sisään */
  pointer-events: auto;
  text-decoration: none;
}

/* "Duobotit" nimi logon oikealla puolella: sama tyyli kuin logo-nauhan teksti, ilman keinunta-animaatiota */
.brand-name {
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(15px, 1.8vw, 20px);
  letter-spacing: 0.02em;
  line-height: 1;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  pointer-events: none;
}

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



.ui {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}
body.entered .ui { opacity: 1; }

/* Etukortin otsikko (vaihtuu pyöriessä) */
.card-label {
  position: fixed;
  left: 50%;
  bottom: clamp(78px, 14vh, 130px);
  transform: translateX(-50%) translateY(8px);
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 4px 30px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  white-space: nowrap;
}
.card-label.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.scroll-hint {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  animation: hintPulse 2.4s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

.credit {
  position: fixed;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 0.72rem;
  color: rgba(154,147,173,0.55);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
body.entered .credit { opacity: 1; }
@media (max-width: 720px) { .credit { display: none; } }

/* ====== MODAALI: sarjakuvamaailma (DOM) ====== */
.modal {
  --world-opacity: 0;
  display: none;
}
.modal:not([hidden]) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 70;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 42%, rgba(19,20,40,0.96), rgba(5,6,12,0.985) 70%),
    var(--bg-0);
  opacity: var(--world-opacity);
}

/* Maailma = täysruudun selattava sarjakuva. Feidaa esiin sukelluksen lopussa. */
.world {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: var(--world-opacity);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(var(--world-theme, 120,200,255), 0.18), transparent 60%),
    var(--bg-0);
}
.modal.opened .world { opacity: 1; transition: opacity 0.3s ease; }

.world-scroll { display: flex; flex-direction: column; align-items: center; padding-bottom: 120px; }

.world-hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 14vh;
  background-size: cover;
  background-position: center;
}
.world-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5,6,12,0.05) 30%, rgba(5,6,12,0.9));
}
.world-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.4rem);
  text-align: center;
  text-shadow: 0 4px 30px rgba(0,0,0,0.6);
}
.world-cue {
  position: relative;
  z-index: 1;
  font-family: "Space Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  animation: cuePulse 2s ease-in-out infinite;
}
@keyframes cuePulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* Sarjakuvaruudut (webtoon-pystyscroll) – feidaavat sisään vieritettäessä. */
.panel {
  position: relative;
  width: min(720px, 92vw);
  margin-top: 28px;
  border-radius: 14px;
  overflow: hidden;
  background: #0c0d18;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.panel.in { opacity: 1; transform: none; }
.panel img { width: 100%; display: block; }
.panel-text {
  margin: 0;
  padding: 16px 18px 20px;
  font-family: "Nunito", sans-serif;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  line-height: 1.5;
  color: var(--cream);
}

.modal-close {
  position: fixed;
  top: clamp(14px, 3vh, 28px); right: clamp(14px, 3vw, 28px);
  z-index: 4;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: #1a1b30;
  color: var(--cream);
  font-size: 1.6rem; line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease 0.15s, background 0.2s ease;
}
.modal.open .modal-close { opacity: 1; }
.modal-close:hover { background: #242641; }
.modal-close:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }

/* ====== REDUCED MOTION ====== */
body.reduced .panel { opacity: 1; transform: none; transition: none; }
body.reduced .world-cue,
body.reduced .scroll-hint { animation: none; }

/* =====================================================================
   ETUSIVU (2D, index.html) — kevyt sivu ilman WebGL:ää
   ===================================================================== */
body.page-home {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: auto;
  position: relative;
  isolation: isolate; /* oma pinoamiskonteksti taustatähdille (z-index: -1) */
}
/* lukitse scroll niin kauan kun aloitusanimaatio (.intro) on näkyvissä */
body.page-home:not(.entered) { overflow: hidden; }

/* ---- hero (taustakuva: väliaikainen placeholder, ei efektejä/parallaksia) ---- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;   /* fallback vanhoille selaimille */
  min-height: 100svh;  /* pieni viewport (mobiilin selainpalkit huomioiden) */
  background:
    linear-gradient(180deg, rgba(5,6,12,0.3), rgba(5,6,12,0.72)),
    url("assets/hero/rausku-hero.png") center / cover no-repeat;
}

/* Hero-tekstipino: keskitetty vaakasuunnassa, ylhäällä taivaan/vuorten rauhallisella
   alueella (n. 18-22% korkeudelta) — EI pystykeskellä, jotta teksti ei kilpaile
   taustakuvan oikean alakulman liekin kanssa. Napit lisätään myöhemmin subtitlen alle
   (flex-column jättää niille luontevasti tilaa). */
.hero-content {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 900px;
  padding: 0 20px;
}
.hero-title {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(56px, 8vw, 96px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;   /* estää "DuBaRa":n katkeamisen kahdelle riville kapealla ruudulla */
  text-shadow: 0 4px 26px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.35);
}
.hero-subtitle {
  margin: 14px 0 0;
  font-family: "Nunito", sans-serif;
  font-weight: 400;
  font-size: clamp(16px, 2vw, 20px);
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 2px 14px rgba(0,0,0,0.4);
}

/* ---- hahmot (tumma violetti hehkutausta + 5 tyhjää korttipaikkaa aaltomuodossa;
   kuvat/liike lisätään näihin kortteihin myöhemmin, nyt vain paikka + ulkoasu) ---- */
.characters {
  position: relative;
  z-index: 1;
  scroll-margin-top: 90px; /* nav-ankkuri: ei jää kiinteän topbarin alle */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: clamp(64px, 10vh, 120px) 20px clamp(48px, 8vh, 96px);
  background:
    radial-gradient(70% 65% at 50% 25%, rgba(107, 63, 160, 0.55), transparent 72%),
    radial-gradient(85% 60% at 50% 100%, rgba(255, 122, 176, 0.12), transparent 70%),
    linear-gradient(180deg, #1c1230 0%, var(--bg-0) 75%);
  overflow: hidden;
}
.characters-title {
  flex: 0 0 auto;
  margin: 0 0 clamp(16px, 3vw, 32px);
  text-align: center;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--cream);
}
/* Infokenttä: täyttää tilan otsikon ja korttien välissä, kortit pysyvät
   sivun/section-alueen alareunassa vaikka infoteksti vaihtuu pituudeltaan */
.character-info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
}
.character-info-name {
  margin: 0 0 8px;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--cream);
}
.character-info-desc {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.5;
}
.characters-row {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--char-card-gap);
  /* kiinteä leveys = tasan 5 näkyvää korttia + välit; kaikki tämän ulkopuolelle
     asettuvat kortit (haamut, data-slot -3/3) rajautuvat pois näkyvistä juuri
     nuolten kohdalta eivätkä siis mene niitä pidemmälle */
  width: calc(5 * var(--char-card-w) + 4 * var(--char-card-gap));
  max-width: 100%;
  /* puskuri ylös/alas, ettei aaltomuodon pystysiirtymä (--wave-y) leikkaudu
     overflow: hidden -rajauksessa */
  padding: clamp(50px, 6vw, 64px) 0 clamp(36px, 5vw, 44px);
  overflow: hidden;
}
.characters-carousel {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 28px);
  margin: 0 auto;
  /* korttien ja rivin yhteiset mitat: yksi totuuden lähde .char-card-leveydelle
     ja väleille, jotta .characters-row voi laskea tarkan näkyvyysalueen levey */
  --char-card-w: clamp(120px, 13.5vw, 200px);
  --char-card-gap: clamp(12px, 2vw, 28px);
  /* nosto n. kortin korkeuden verran ylemmäs sivun alareunasta */
  margin-bottom: clamp(144px, 16.2vw, 240px);
}
.carousel-arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(244, 234, 215, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.carousel-arrow svg {
  width: 20px;
  height: 20px;
}
.carousel-arrow:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(244, 234, 215, 0.5);
}
.carousel-arrow:active {
  transform: scale(0.92);
}
.carousel-arrow:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 3px;
}
.char-card {
  flex: 0 0 auto;
  position: relative;
  width: var(--char-card-w);
  aspect-ratio: 5 / 6; /* referenssikuvan mukaan hieman neliömäisempi (oli 4/5) */
  border-radius: 20px;
  /* tasapaksu 2px reuna, jonka väri vain vaihtuu ympäri korttia (border-box/
     padding-box background-clip -tekniikka; EI mask-composite, joka aiheutti
     pikselöityneen/rosoisen reunan pyöristetyissä kulmissa) */
  border: 2px solid transparent;
  background-origin: padding-box, padding-box, padding-box, border-box;
  background-clip: padding-box, padding-box, padding-box, border-box;
  /* väritys + himmeä tasainen viistovalo, joka kulkee samaa 135deg-akselia
     kuin reunan väri (OIKEA ALAKULMA -> VASEN YLÄKULMA), ei keskeltä
     pullistuva "blobi"; lisäksi pehmeä "valospotti" kortin yläosassa
     (referenssikuvan hahmon takana näkyvä hehku, ilman itse hahmoa) */
  background-image:
    radial-gradient(58% 42% at 50% 38%, rgba(178, 150, 230, 0.28), transparent 72%),
    linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.07) 100%),
    linear-gradient(160deg, #2a2440 0%, #16121f 100%),
    linear-gradient(135deg, rgba(206, 199, 224, 0.55) 0%, rgba(255, 255, 255, 1) 100%);
  box-shadow: 0 24px 48px rgba(0,0,0,0.45);
  cursor: pointer;
  /* --wave-y ja järjestys tulevat data-slot-attribuutista (ks. säännöt alla).
     JS asettaa data-slot:n karusellin pyöriessä/klikatessa ja käyttää
     FLIP-tekniikkaa (vanha sijainti -> uusi), joten transform-transition
     tässä on se, mikä tekee liikkeestä sulavan/lerp-tyylisen (kesto puolitettu
     hitaammaksi/pehmeämmäksi käyttäjän pyynnöstä). */
  --wave-y: 0px;
  transform: translateY(var(--wave-y));
  /* HUOM: JS:n FLIP-animaatio (hahmot.html) asettaa tämän suoraan (korvaa koko
     transformin) siirtymän ajaksi - se laskee --wave-y:n pystysiirtymän MUKAAN
     dx/dy-arvoihinsa (lukemalla senhetkisen translateY-komponentin ennen
     korvaamista), jotta aaltomuodon korkeusero ei katoa/litisty kesken
     siirtymän. EI käytetä custom property -pohjaista yhdistämistä
     transform-arvon sisällä (translate(var(--a),var(--b)) translateY(var(--c)))
     - todettu epäluotettavaksi: selain ei aina invalidoi/animoi transformia
     luotettavasti kun vain sen sisällä oleva custom property muuttuu
     attribuuttiselektorin kautta (havaittu Playwright-testeissä: transitio
     ei animoinut ollenkaan, hyppäsi suoraan lopputilaan). */
  transition: transform 900ms cubic-bezier(0.22, 0.61, 0.36, 1), filter 150ms ease, box-shadow 150ms ease;
  /* HUOM: kortin klikkaus liikuttaa karusellia VAIN kun klikattu kortti on keskikortin
     välittömästi vieressä (yksi slotti) - siis aina täsmälleen yhden slotin siirtymä,
     sama kesto/käyrä kuin nuolinäppäimellä, ei erillistä ylikirjoitusta. Kauempana
     olevien (uloimpien) korttien klikkaus ei tee mitään (ks. hahmot.html selectCard). */
}
.char-card--ghost {
  pointer-events: none;
}
.char-card:focus-visible {
  outline: 2px solid var(--marigold);
  outline-offset: 4px;
}
/* aaltomuoto + järjestys data-slot-arvon mukaan: keskikortti (0) ylimpänä,
   viereinen pari (±1) hieman alempana, uloin pari (±2) vielä alempana.
   Slotit -3/3 ovat haamukorttien pysyvä piilopaikka rivin näkyvyysalueen
   ulkopuolella (ks. .characters-row overflow: hidden). Slotit -4/4 ovat
   VÄLIAIKAINEN piilopaikka sille oikealle kortille joka on juuri kiertymässä
   pois näkyvistä (ei sama slotti kuin pysyvä haamu, jotta ne eivät koskaan
   ole samassa order-arvossa yhtä aikaa – kaksi samaa order-arvoa saavaa
   elementtiä asettuisivat vierekkäin, ei päällekkäin). JS päivittää
   data-slot:n kun karuselli pyörii tai korttia klikataan. */
.char-card[data-slot="-4"] { --wave-y: clamp(18px, 3vw, 34px); z-index: 0; order: 0; }
.char-card[data-slot="-3"] { --wave-y: clamp(18px, 3vw, 34px); z-index: 0; order: 1; }
.char-card[data-slot="-2"] { --wave-y: clamp(18px, 3vw, 34px); z-index: 1; order: 2; }
.char-card[data-slot="-1"] { --wave-y: 0px; z-index: 2; order: 3; }
.char-card[data-slot="0"]  { --wave-y: clamp(-46px, -6vw, -26px); z-index: 3; order: 4; }
.char-card[data-slot="1"]  { --wave-y: 0px; z-index: 2; order: 5; }
.char-card[data-slot="2"]  { --wave-y: clamp(18px, 3vw, 34px); z-index: 1; order: 6; }
.char-card[data-slot="3"]  { --wave-y: clamp(18px, 3vw, 34px); z-index: 0; order: 7; }
.char-card[data-slot="4"]  { --wave-y: clamp(18px, 3vw, 34px); z-index: 0; order: 8; }

@media (max-width: 640px) {
  .characters-carousel {
    --char-card-w: 84px;
    --char-card-gap: 10px;
  }
  .char-card[data-slot="0"] { --wave-y: -20px; }
  .char-card[data-slot="-2"],
  .char-card[data-slot="2"],
  .char-card[data-slot="-3"],
  .char-card[data-slot="3"],
  .char-card[data-slot="-4"],
  .char-card[data-slot="4"] { --wave-y: 14px; }
}

