/* MANSH Solution — floating islands
   Order: fonts · tokens · base · layout · components · states · reduced motion · fallback */

/* ==================================================================
   Fonts (local)
   ================================================================== */
@font-face {
  font-family: "Newsreader";
  src: url("../assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../assets/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ==================================================================
   Tokens
   ================================================================== */
:root {
  /* Sky: a morning sky; the Eumi Tales chapter turns it to night (below, and sky.js) */
  --sky-top: #79aee6;
  --sky-mid: #a7c8ef;
  --sky-low: #f6cdb8;
  --sky-haze: #eecbd0;

  /* World */
  --moss: #f598bf;
  --cream: #fff7f0;
  --star: #fff4cf;

  /* Text */
  --ink: #3e3346;
  --ink-soft: #5f5269;
  --on-sky: #ffffff;
  --sky-shadow: 0 2px 28px rgba(110, 70, 140, 0.5);
  --sky-shadow-sm: 0 1px 14px rgba(110, 70, 140, 0.6);
  --dusk: rgba(62, 47, 92, 0.72); /* glass behind white hub text */

  /* Glass cards */
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: rgba(255, 255, 255, 0.93);
  --card-opaque: #fbf1f7; /* cards with no blur (touch screens, no backdrop-filter): ink 10.8:1, ink-soft 6.6:1, accent inks >= 5.5:1 */
  --card-line: rgba(255, 255, 255, 0.7);
  --card-blur: blur(14px) saturate(1.15);
  --card-shadow: 0 18px 50px -22px rgba(62, 40, 90, 0.5);
  --radius: 24px;
  --radius-sm: 14px;

  /* Products (js/world/products.js) + darker inks for text on light cards */
  --c-eumi: #f0a86f;
  --c-eumi-ink: #96501a;
  --c-apex: #8b6cf0;
  --c-apex-ink: #5737c2;
  --c-tales: #6f9be0;
  --c-tales-ink: #2d5a9c;

  /* Rhythm */
  --gutter: 16px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Night sky while the Eumi Tales chapter is in view */
:root[data-chapter="3"] {
  --sky-top: #0b1433;
  --sky-mid: #1b2556;
  --sky-low: #3a3a75;
  --sky-haze: #2a2c5c;
}

@media (min-width: 768px) {
  :root { --gutter: clamp(24px, 5vw, 72px); --header-h: 72px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--sky-mid);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 48%, var(--sky-low) 82%, var(--sky-haze) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 500; line-height: 1.1; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; }

::selection { background: rgba(245, 152, 191, 0.45); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ==================================================================
   Layout
   ================================================================== */

/* The world sits fixed behind everything. Content sections let pointer
   events through to the canvas wherever they have nothing to show. */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 48%, var(--sky-low) 82%, var(--sky-haze) 100%);
}
#world { display: block; width: 100%; height: 100%; }

main, .site-footer { position: relative; z-index: 1; }
.hub, .island, .site-footer { pointer-events: none; }
.hub__intro > *, .hub__choose > *, .panel > *, .footer-card { pointer-events: auto; }

/* Hub */
.hub {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  padding: calc(var(--header-h) + clamp(28px, 7vh, 64px)) var(--gutter) max(80px, 9vh);
  text-align: center;
}
.hub__intro > *, .hub__choose > * { margin-inline: auto; }
.hub__choose { grid-row: 3; display: grid; justify-items: center; gap: 18px; }

/* Product islands: long sections the camera lingers in */
.island {
  min-height: 220vh;
  padding: calc(var(--header-h) + 14vh) var(--gutter) 30vh;
}
.panel {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

/* Footer */
.site-footer {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 30vh var(--gutter) calc(40px + env(safe-area-inset-bottom));
}

/* Phones: leave the first 55vh of each island empty so the island shows */
@media (max-width: 767.98px) {
  .island { padding-top: 55vh; padding-top: 55svh; padding-bottom: 24vh; }
  .site-footer { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* ==================================================================
   Components
   ================================================================== */

/* ---- Glass card ---- */
.card {
  background: var(--card);
  -webkit-backdrop-filter: var(--card-blur);
  backdrop-filter: var(--card-blur);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: clamp(20px, 3vw, 28px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header, .back-to-hub, .rail ol, .rail__t { background: var(--card-solid); }
  .card, .tale, .tale:hover { background: var(--card-opaque); }
}

/* ---- Header ---- */
.site-header {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 30;
  width: min(1180px, calc(100% - 2 * 16px));
  min-height: 56px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 6px 6px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: var(--card-blur);
  backdrop-filter: var(--card-blur);
  border: 1px solid var(--card-line);
  box-shadow: 0 10px 30px -18px rgba(62, 40, 90, 0.55);
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 8px;
}
.wordmark span { font-weight: 400; color: var(--ink-soft); }

.site-nav ul { display: flex; gap: 4px; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.25s; /* no box-shadow transition: the focus ring must appear at once */
}
.site-nav a:hover { background: rgba(255, 255, 255, 0.7); }
.site-nav a[aria-current="true"] { background: #fff; box-shadow: 0 4px 14px -6px rgba(62, 40, 90, 0.45); }

.dot {
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--moss);
}
.dot--eumi { background: var(--c-eumi); }
.dot--apex { background: var(--c-apex); }
.dot--tales { background: var(--c-tales); }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 600 0.95rem var(--font-body);
  cursor: pointer;
}
.menu-toggle__bars,
.menu-toggle__bars::before,
.menu-toggle__bars::after {
  display: block;
  width: 16px; height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease), background-color 0.25s;
}
.menu-toggle__bars { position: relative; }
.menu-toggle__bars::before, .menu-toggle__bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle__bars::before { transform: translateY(-5px); }
.menu-toggle__bars::after { transform: translateY(5px); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after { transform: rotate(-45deg); }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    display: none;
    padding: 8px;
    border-radius: var(--radius);
    background: #fffafc;
    border: 1px solid var(--card-line);
    box-shadow: var(--card-shadow);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { display: flex; min-height: 52px; padding: 12px 16px; border-radius: 16px; font-size: 1.05rem; }
}

/* ---- Position rail ---- */
.rail { position: fixed; z-index: 20; transition: opacity 0.25s, visibility 0s; }
/* main.js tucks the rail away while it would cover the hub's text or signpost */
.rail.is-tucked:not(:focus-within) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s, visibility 0s linear 0.25s;
}
.rail ol { display: flex; }
.rail a {
  --rail-c: var(--moss);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ink);
  border-radius: 999px;
}
.rail a[data-rail="1"] { --rail-c: var(--c-eumi); }
.rail a[data-rail="2"] { --rail-c: var(--c-apex); }
.rail a[data-rail="3"] { --rail-c: var(--c-tales); }
.rail__dot {
  flex: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1.5px rgba(62, 51, 70, 0.35);
  transition: transform 0.3s var(--ease), background-color 0.3s, box-shadow 0.3s;
}
.rail a:hover .rail__dot { background: var(--rail-c); }
.rail a[aria-current="true"] .rail__dot {
  background: var(--rail-c);
  transform: scale(1.5);
  box-shadow: 0 0 0 1.5px #fff, 0 0 12px 2px var(--rail-c);
}

/* Phones and tablets: a small pill of dots at the bottom */
@media (max-width: 1023.98px) {
  .rail { left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); }
  .rail ol {
    gap: 2px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    border: 1px solid var(--card-line);
    box-shadow: 0 8px 24px -14px rgba(62, 40, 90, 0.6);
  }
  .rail a { width: 32px; height: 32px; }
  .rail__t {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}

/* Desktop: a vertical trail on the right, labels on hover, focus or current */
@media (min-width: 1024px) {
  .rail { right: 24px; top: 50%; transform: translateY(-50%); }
  .rail ol { position: relative; flex-direction: column; align-items: flex-end; gap: 6px; }
  .rail ol::before {
    content: "";
    position: absolute;
    top: 18px; bottom: 18px; right: 16px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.15));
  }
  .rail a { position: relative; gap: 12px; min-height: 36px; padding-left: 8px; }
  .rail__dot { order: 2; margin: 0 11px; }
  .rail__t {
    order: 1;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.3s, transform 0.3s var(--ease);
  }
  .rail:hover .rail__t,
  .rail:focus-within .rail__t,
  .rail a[aria-current="true"] .rail__t { opacity: 1; transform: none; }
}

/* ---- Hub ---- */
/* White hub text sits on dusk glass: at 72% it keeps 4.5:1 for white text
   even if pure white (cloud, glow, moon) is behind it. */
.hub__intro,
.hub__nudge,
.hub__hint {
  background: var(--dusk);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 40px -22px rgba(40, 25, 70, 0.7);
}
.hub__intro {
  max-width: 100%;
  padding: clamp(16px, 3vw, 26px) clamp(20px, 4vw, 40px) clamp(18px, 3vw, 28px);
  border-radius: 28px;
}
.hub__title {
  font-size: clamp(2.9rem, 8vw, 5.75rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--on-sky);
  text-shadow: var(--sky-shadow);
}
.hub__lede {
  max-width: 30ch;
  margin-top: 0.6em;
  font-size: clamp(1.08rem, 1.7vw, 1.3rem);
  font-weight: 500;
  color: var(--on-sky);
  text-shadow: var(--sky-shadow-sm);
}
.hub__nudge, .hub__hint {
  padding: 6px 18px;
  border-radius: 999px;
  color: var(--on-sky);
  text-shadow: 0 1px 8px rgba(30, 20, 50, 0.5);
}
.hub__nudge {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}
.hub__hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}
.hub__hint-mark {
  width: 10px; height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  animation: hint-bob 2.4s var(--ease) infinite;
}
@keyframes hint-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 4px; }
}

/* ---- Signpost: HTML mirror of the 3D sign arms ---- */
.signpost ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 22px;
}
.signpost__arm {
  --arm-c: var(--moss);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 20px 10px 16px;
  border-radius: 12px 4px 4px 12px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  filter: drop-shadow(0 8px 14px rgba(90, 50, 110, 0.3));
  transition: transform 0.3s var(--ease), background-color 0.3s;
}
/* the pointed end of the board */
.signpost__arm::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -11px;
  width: 30px; height: 30px;
  border-radius: 3px;
  background: inherit;
  transform: translateY(-50%) scaleX(0.75) rotate(45deg);
  z-index: -1;
}
.signpost__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--arm-c);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 12px 2px var(--arm-c);
}
.signpost__arm--eumi { --arm-c: var(--c-eumi); }
.signpost__arm--apex { --arm-c: var(--c-apex); }
.signpost__arm--tales { --arm-c: var(--c-tales); }
.signpost__arm:hover { background: #fff; transform: translateX(4px); }

/* Phones: stack the arms like a real signpost, alternating directions */
@media (max-width: 600px) {
  .signpost { position: relative; }
  .signpost::before {
    content: "";
    position: absolute;
    left: 50%; top: -12px; bottom: -14px;
    width: 10px;
    margin-left: -5px;
    border-radius: 5px 5px 2px 2px;
    background: linear-gradient(90deg, #9c7a65, #c4a189 45%, #a8846d);
    box-shadow: 0 6px 14px -6px rgba(90, 50, 110, 0.6);
  }
  .signpost ul { flex-direction: column; align-items: center; gap: 12px; }
  .signpost li { position: relative; }
  .signpost li:nth-child(odd) { transform: translateX(14px); }
  .signpost li:nth-child(even) { transform: translateX(-14px); }
  .signpost li:nth-child(even) .signpost__arm { padding: 10px 16px 10px 20px; border-radius: 4px 12px 12px 4px; }
  .signpost li:nth-child(even) .signpost__arm::after { right: auto; left: -11px; }
  .signpost li:nth-child(even) .signpost__arm:hover { transform: translateX(-4px); }
}

/* Short screens (phones in landscape, small laptop windows): a compact
   plaque, no scroll hint, so the whole signpost fits on the first screen
   and clears the bottom rail. */
@media (max-height: 560px) {
  .hub {
    padding-top: calc(var(--header-h) + 10px);
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .hub__intro { padding: 10px 24px 12px; border-radius: 22px; }
  .hub__title { font-size: clamp(2.1rem, 10vh, 3.4rem); }
  .hub__lede { margin-top: 0.3em; font-size: 1rem; line-height: 1.4; }
  .hub__choose { gap: 10px; }
  .hub__nudge { padding: 4px 16px; font-size: 1.05rem; }
  .hub__hint { display: none; }
  .signpost ul { gap: 10px 20px; }
  .signpost__arm { min-height: 44px; padding-block: 8px; font-size: 1.05rem; }
}

/* ---- Product panels ---- */
.island--eumi { --accent: var(--c-eumi); --accent-ink: var(--c-eumi-ink); }
.island--apex { --accent: var(--c-apex); --accent-ink: var(--c-apex-ink); }
.island--tales { --accent: var(--c-tales); --accent-ink: var(--c-tales-ink); }

.back-to-hub {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 18px 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: var(--card-blur);
  backdrop-filter: var(--card-blur);
  border: 1px solid var(--card-line);
  box-shadow: 0 8px 22px -14px rgba(62, 40, 90, 0.6);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.25s, transform 0.3s var(--ease);
}
.back-to-hub::before {
  content: "";
  width: 8px; height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 4px;
}
.back-to-hub:hover { background: #fff; transform: translateX(-3px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.eyebrow::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 1px var(--accent);
}
/* In the page the eyebrow follows the title, so a screen reader that lands on the title (goTo()
   focuses it) reads the eyebrow next; on screen it still sits above the title. */
.card--head { display: flex; flex-direction: column; }
/* min-height: the body's line (1rem x 1.6) the eyebrow used to sit in, so the spacing is unchanged. */
.card--head > .eyebrow { order: -1; align-self: flex-start; min-height: 1.6rem; }
.panel__title {
  margin: 0.2em 0 0.45em;
  font-size: clamp(2.3rem, 4.6vw, 3.3rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--ink);
}
/* A product whose title is its app icon and logo image (Eumi); sized with the title's font size. */
.panel__title--logo { display: flex; align-items: center; gap: 0.3em; }
.panel__title--logo .app-icon {
  width: 1.5em; height: 1.5em;
  border-radius: 0.34em;
  /* The background of Reference/icon_bg.svg (Figma draws it with an HTML conic gradient, which
     not every browser renders inside an SVG image), so the plain icon.svg sits on it here. */
  background: conic-gradient(from 180deg, #ffdcd4, #ffded2 11deg, #fbf2e0 139deg, #ffe7cd 226deg, #ffd7d6 336deg, #ffdcd4);
  box-shadow: 0 6px 16px -8px rgba(62, 40, 90, 0.45);
}
.panel__title--logo .logo { width: auto; height: 1em; }
.tagline {
  margin-bottom: 0.5em;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  line-height: 1.25;
  color: var(--ink);
}
.card--head > p:not(.eyebrow):not(.tagline) { color: var(--ink-soft); font-size: 1.05rem; }
.card--prose { display: grid; gap: 0.9em; font-size: 1.05rem; line-height: 1.65; }

/* ---- Media ---- */
.media { margin: 0 0 18px; }
.product-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: #f8ece4;
  box-shadow: 0 10px 26px -16px rgba(62, 40, 90, 0.7);
  object-fit: cover;
}

/* ---- Screenshot strips ---- */
.shots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 42%;
  gap: 12px;
  margin: 0 -6px;
  padding: 6px 6px 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 6px;
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  scrollbar-color: rgba(62, 51, 70, 0.35) transparent;
}
.shots li { scroll-snap-align: start; }
.shots img {
  width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 22px -14px rgba(62, 40, 90, 0.75);
  background: #f6efe9;
}
/* Apex: real screenshots, so give them a phone frame */
.shots--phones { grid-auto-columns: 40%; }
.shots--phones li {
  max-width: 230px;
  padding: 7px;
  border-radius: 26px;
  background: linear-gradient(160deg, #2b2344, #15112a);
  box-shadow: 0 0 0 1px rgba(139, 108, 240, 0.35), 0 14px 26px -14px rgba(40, 20, 80, 0.8);
}
.shots--phones img { border-radius: 19px; box-shadow: none; background: #120f24; }
/* Eumi: wide store feature graphics, one at a time with the next peeking in */
.shots--wide { grid-auto-columns: 84%; margin-bottom: 6px; }

@media (max-width: 767.98px) {
  .shots { grid-auto-columns: 60%; }
  .shots--phones { grid-auto-columns: 52%; }
  .shots--wide { grid-auto-columns: 90%; }
}

/* ---- Feature cards ---- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}
.feature { padding: 20px 20px 22px; }
.feature::before {
  content: "";
  display: block;
  width: 28px; height: 4px;
  margin-bottom: 14px;
  border-radius: 4px;
  background: var(--accent);
}
.feature h3 { text-wrap: pretty; margin-bottom: 0.4em; font-size: 1.22rem; font-weight: 600; color: var(--ink); }
.feature p { font-size: 0.97rem; line-height: 1.6; color: var(--ink-soft); }
.feature--wide { grid-column: 1 / -1; }

/* ---- Store buttons and small links ---- */
.stores { display: flex; flex-wrap: wrap; gap: 10px; }
.store {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 22px 8px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 22px -14px rgba(40, 20, 60, 0.9);
  transition: transform 0.3s var(--ease), background-color 0.25s;
}
.store:hover { background: #2e2536; transform: translateY(-2px); }
.store__icon { flex: none; width: 24px; height: 24px; color: var(--accent); }
.store__text { display: flex; flex-direction: column; font-size: 1.05rem; font-weight: 600; line-height: 1.15; }
.store__small { font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em; opacity: 0.82; }
.store--youtube .store__text { justify-content: center; }

.small-links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; }
.small-links a, .footer-card a {
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent, var(--moss));
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  border-radius: 4px;
}
.small-links a { display: inline-flex; align-items: center; min-height: 44px; }
.small-links a:hover, .footer-card a:hover { text-decoration-color: currentColor; }

/* ---- Eumi Tales thumbnails ---- */
.tales {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 359.98px) {
  .tales { grid-template-columns: 1fr; }
}
.tale {
  display: block;
  height: 100%;
  padding: 8px 8px 14px;
  border-radius: 20px;
  background: var(--card);
  -webkit-backdrop-filter: var(--card-blur);
  backdrop-filter: var(--card-blur);
  border: 1px solid var(--card-line);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.35s var(--ease), background-color 0.25s;
}
.tale__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 13px;
  background: #e9dcef;
}
.tale__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
/* centred play icon */
.tale__thumb::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 48px; height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 18px -6px rgba(40, 30, 70, 0.6);
  z-index: 1;
  transition: background-color 0.25s, transform 0.35s var(--ease);
}
.tale__thumb::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  margin: -9px 0 0 -5px;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent var(--c-tales-ink);
  z-index: 2;
}
.tale__title {
  display: block;
  padding: 10px 6px 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}
.tale:hover { background: rgba(255, 255, 255, 0.86); transform: translateY(-3px); }
.tale:hover .tale__thumb img { transform: scale(1.04); }
.tale:hover .tale__thumb::before { transform: scale(1.08); }

/* ---- Footer ---- */
.footer-card {
  --accent: var(--moss);
  width: 100%;
  max-width: 900px;
  padding: clamp(24px, 4vw, 44px);
}
.footer-card__title { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.01em; }
.footer-card__lede { margin-top: 0.6em; font-size: 1.08rem; color: var(--ink-soft); }
.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 22px 28px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(62, 51, 70, 0.14);
}
.footer-cols h3 {
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.footer-cols li { padding: 4px 0; }
.footer-cols a { display: inline-block; padding: 6px 0; }
.legal { margin-top: 28px; font-size: 0.82rem; color: var(--ink-soft); }

/* ==================================================================
   States
   ================================================================== */

/* Gentle reveal: main.js adds .is-in when an element scrolls into view */
.js .rise {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .rise.is-in { opacity: 1; transform: none; }

/* Menu open on phones: keep the header readable over content */
.menu-open .site-header { background: rgba(255, 255, 255, 0.85); }

/* Keyboard focus: a two-tone ring, a white band (0–3px) inside an ink band
   (3–7px), so it reads on light glass cards and on the darker sky alike.
   !important because components set their own decorative box-shadow. */
:focus-visible {
  outline: 3px solid #fff !important;
  outline-offset: 0 !important;
  box-shadow: 0 0 0 7px var(--ink) !important;
}
/* Headings that goTo() focuses programmatically get no ring */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible { outline: none !important; box-shadow: none !important; }

/* ==================================================================
   Touch screens: no backdrop blur
   ================================================================== */
/* A product section stacks about ten glass cards over a canvas that redraws
   every frame; blurring behind each of them is too heavy for phones. Cards
   get an opaque pastel instead and the small glass pieces a near-solid white,
   so text contrast never depends on what the world shows behind them. */
@media (pointer: coarse) {
  .card, .tale, .site-header, .back-to-hub, .rail ol, .rail__t,
  .hub__intro, .hub__nudge, .hub__hint {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .card, .tale, .tale:hover { background: var(--card-opaque); }
  .site-header, .back-to-hub, .rail ol, .rail__t { background: var(--card-solid); }
}

/* ==================================================================
   Reduced motion
   ================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .js .rise { opacity: 1; transform: none; }
  .signpost__arm:hover, .back-to-hub:hover, .store:hover, .tale:hover,
  .tale:hover .tale__thumb img, .tale:hover .tale__thumb::before { transform: none; }
  .signpost li:nth-child(even) .signpost__arm:hover { transform: none; }
}

/* ==================================================================
   Fallback backdrop (no WebGL, or the context was lost)
   ================================================================== */
.stage__fallback {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 40% at 20% 72%, rgba(255, 214, 196, 0.45), transparent 70%),
    radial-gradient(ellipse 60% 35% at 85% 60%, rgba(245, 152, 191, 0.25), transparent 70%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 76%, var(--sky-haze) 100%);
}
.no-webgl .stage__fallback { display: block; }
.no-webgl #world { display: none; }

/* Fine star dust: three tiled layers at different scales so no grid shows */
.fb-stars {
  position: absolute;
  inset: 0 0 12%;
  background-image:
    radial-gradient(circle at 23% 31%, #fff 0 1px, transparent 1.6px),
    radial-gradient(circle at 71% 64%, rgba(255, 255, 255, 0.85) 0 1px, transparent 1.6px),
    radial-gradient(circle at 47% 12%, rgba(255, 244, 207, 0.95) 0 1.3px, transparent 2px),
    radial-gradient(circle at 88% 83%, rgba(255, 255, 255, 0.7) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 9% 77%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.6px);
  background-size: 173px 151px, 229px 197px, 311px 263px, 137px 119px, 283px 241px;
  -webkit-mask-image: linear-gradient(#000 70%, transparent);
  mask-image: linear-gradient(#000 70%, transparent);
}
/* Stars and sparkles come out only for the night chapter */
.fb-stars, .fb-sparkles { opacity: 0; transition: opacity 1.2s ease; }
:root[data-chapter="3"] .fb-stars,
:root[data-chapter="3"] .fb-sparkles { opacity: 1; }

/* Golden four-point sparkles, softly twinkling */
.fb-sparkles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 4px rgba(255, 236, 180, 0.95));
}
.fb-sparkles g { animation: twinkle 4.5s ease-in-out infinite alternate; }
@keyframes twinkle {
  from { opacity: 0.65; }
  to { opacity: 1; }
}

/* The morning sun, upper right; a crescent moon in the same spot at night */
.fb-moon {
  position: absolute;
  top: calc(var(--header-h) + 6vh);
  right: 14%;
  width: 1em; height: 1em;
  font-size: clamp(46px, 7vw, 86px);
  border-radius: 50%;
  background: radial-gradient(circle, #fffaf0 0 55%, #ffe9c4 75%, #ffdcae);
  box-shadow: 0 0 0.35em 0.12em rgba(255, 226, 176, 0.75), 0 0 1.4em 0.5em rgba(255, 214, 160, 0.4);
  transition: background 1.2s ease, box-shadow 1.2s ease, filter 1.2s ease;
}
:root[data-chapter="3"] .fb-moon {
  background: transparent;
  box-shadow: inset -0.26em 0.12em 0 0 var(--star);
  transform: rotate(-18deg);
  filter: drop-shadow(0 0 0.22em rgba(255, 238, 196, 0.9));
}
/* Phones: the hub title fills the top, so the moon rests in the open middle */
@media (max-width: 767.98px) {
  .fb-moon { top: 36%; right: 12%; }
}

/* Cotton clouds, three layers rising from the horizon */
.fb-cloud {
  position: absolute;
  left: -15%; right: -15%;
  pointer-events: none;
  animation: drift 60s ease-in-out infinite alternate;
  transition: filter 1.2s ease;
}
/* Moonlit clouds */
:root[data-chapter="3"] .fb-cloud { filter: brightness(0.45) saturate(0.7); }
.fb-cloud--far {
  bottom: 20%;
  height: 22%;
  opacity: 0.75;
  background:
    radial-gradient(ellipse 13% 42% at 8% 70%, #f6dbe9 0 55%, transparent 72%),
    radial-gradient(ellipse 16% 55% at 26% 66%, #f3d6ea 0 55%, transparent 72%),
    radial-gradient(ellipse 12% 40% at 47% 74%, #f7dde9 0 55%, transparent 72%),
    radial-gradient(ellipse 18% 58% at 70% 64%, #f2d4e8 0 55%, transparent 72%),
    radial-gradient(ellipse 14% 45% at 92% 72%, #f6dbe9 0 55%, transparent 72%);
}
.fb-cloud--mid {
  bottom: 4%;
  height: 26%;
  opacity: 0.9;
  animation-duration: 75s;
  animation-direction: alternate-reverse;
  background:
    radial-gradient(ellipse 17% 52% at 4% 72%, #fde8f0 0 55%, transparent 72%),
    radial-gradient(ellipse 15% 46% at 22% 62%, #fbe2ee 0 55%, transparent 72%),
    radial-gradient(ellipse 20% 60% at 41% 70%, #fde9f1 0 55%, transparent 72%),
    radial-gradient(ellipse 14% 44% at 60% 60%, #f9e0ee 0 55%, transparent 72%),
    radial-gradient(ellipse 19% 58% at 80% 70%, #fde8f0 0 55%, transparent 72%),
    radial-gradient(ellipse 12% 40% at 98% 64%, #fbe2ee 0 55%, transparent 72%);
}
.fb-cloud--near {
  bottom: -9%;
  height: 28%;
  animation-duration: 90s;
  background:
    radial-gradient(ellipse 18% 55% at 10% 55%, #fff6fa 0 55%, transparent 72%),
    radial-gradient(ellipse 22% 62% at 33% 62%, #fff3f8 0 55%, transparent 72%),
    radial-gradient(ellipse 17% 52% at 55% 52%, #fff7fb 0 55%, transparent 72%),
    radial-gradient(ellipse 21% 60% at 76% 60%, #fff3f8 0 55%, transparent 72%),
    radial-gradient(ellipse 16% 50% at 97% 54%, #fff6fa 0 55%, transparent 72%),
    linear-gradient(transparent 62%, #fff4f8 62%);
}
@keyframes drift {
  from { transform: translateX(-2.5%); }
  to { transform: translateX(2.5%); }
}
