/* Cowboy Machines: storybook at night.
   Colours come from the hero painting: night sky, glowing ocean floor, honey lamps,
   coral, cream paper. Fonts are self-hosted (see scripts/fetch_fonts.py). */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night-950: #050817;
  --night-900: #080d26;
  --night-800: #0c1436;
  --night-700: #131d4b;
  --night-600: #1d2a66;
  --ocean-500: #2f86ff;
  --ocean-400: #53aaff;
  --glow: #8fe0ff;
  --honey-300: #ffd28a;
  --honey-400: #ffc15c;
  --honey-500: #f2a43a;
  --coral-400: #ff8f78;
  --coral-500: #f26e5c;
  --cream-50: #fffaf1;
  --cream-100: #fff3df;
  --cream-200: #f7e6c9;
  --ink-900: #1b1a33;
  --ink-700: #3b3a5c;
  --ink-500: #67658a;
  --text: #f4efe5;
  --text-muted: #bcc3e6;
  --line: rgba(188, 195, 230, 0.16);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-s: 12px;
  --radius-m: 20px;
  --radius-l: 28px;
  --gutter: clamp(16px, 4.5vw, 44px);
  --wrap: 1160px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night-900);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0875rem);
  line-height: 1.65;
  font-weight: 450;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, video, picture { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--honey-400); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 100;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 3.1rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.55rem); line-height: 1.2; }
p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 800; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--honey-400);
  margin-bottom: 0.9rem;
}
.lead { font-size: clamp(1.08rem, 1rem + 0.4vw, 1.3rem); line-height: 1.6; color: var(--text-muted); max-width: 38rem; }
.muted { color: var(--text-muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--honey-400); color: var(--night-900); padding: 10px 16px; border-radius: 999px;
  font-weight: 800; text-decoration: none; transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------ buttons */
.btn {
  --btn-bg: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0.7em 1.4em;
  border-radius: 999px; border: 1.5px solid transparent;
  background: var(--btn-bg);
  font-weight: 800; font-size: 1rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  --btn-bg: var(--honey-400);
  color: var(--night-900);
  box-shadow: 0 8px 28px -10px rgba(255, 193, 92, 0.75), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}
.btn--primary:hover { --btn-bg: var(--honey-300); box-shadow: 0 12px 36px -10px rgba(255, 193, 92, 0.9); }
.btn--ghost { color: var(--text); border-color: rgba(244, 239, 229, 0.42); background: rgba(8, 13, 38, 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn--ghost:hover { border-color: var(--text); background: rgba(8, 13, 38, 0.45); }
.btn--ocean { --btn-bg: var(--ocean-500); color: #fff; box-shadow: 0 10px 30px -12px rgba(47, 134, 255, 0.9); }
.btn--ocean:hover { --btn-bg: var(--ocean-400); }
.btn--ink { --btn-bg: var(--ink-900); color: var(--cream-50); }
.btn--ink:hover { --btn-bg: var(--night-600); }
.btn--outline-ink { color: var(--ink-900); border-color: rgba(27, 26, 51, 0.3); }
.btn--outline-ink:hover { border-color: var(--ink-900); }
.btn .arrow { transition: transform 0.25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.text-link {
  font-weight: 800; color: var(--honey-400); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor); background-size: 0 2px;
  background-position: 0 100%; background-repeat: no-repeat; transition: background-size 0.3s var(--ease);
}
.text-link:hover { background-size: 100% 2px; }

/* ------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(8, 13, 38, 0.86);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s, border-color 0.3s;
}
.site-header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand img { width: 42px; height: 42px; transition: transform 0.4s var(--ease); }
.brand:hover img { transform: rotate(-6deg) scale(1.05); }
.brand__name {
  font-family: var(--font-display); font-weight: 600; font-variation-settings: "SOFT" 100;
  font-size: 1.22rem; letter-spacing: -0.01em; line-height: 1;
}
.brand__name span { display: inline; }
.nav { display: flex; align-items: center; gap: clamp(4px, 1.5vw, 10px); }
.nav a {
  position: relative;
  padding: 8px clamp(8px, 1.4vw, 14px);
  border-radius: 999px;
  text-decoration: none; font-weight: 700; font-size: 0.98rem; color: var(--text); white-space: nowrap;
  opacity: 0.86; transition: opacity 0.2s, background-color 0.2s;
}
.nav a:hover { opacity: 1; background: rgba(244, 239, 229, 0.08); }
.nav a[aria-current="page"] { opacity: 1; color: var(--honey-400); }

/* Home: the header floats over the painting until you scroll. */
.page-home .site-header { position: fixed; left: 0; right: 0; background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.page-home .site-header.is-scrolled { background: rgba(8, 13, 38, 0.86); border-color: var(--line); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }

@media (max-width: 479px) {
  :root { --header-h: 62px; }
  .brand img { width: 36px; height: 36px; }
  .brand { gap: 8px; }
  .brand__name { font-size: 0.98rem; line-height: 1.02; }
  .brand__name span { display: block; }
  .nav { gap: 0; }
  .nav a { font-size: 0.92rem; padding: 8px 8px; }
}

/* ------------------------------------------------------------ hero (home) */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-start;
  overflow: hidden;
  background: var(--night-900);
  isolation: isolate;
}
.hero__art, .hero__art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.hero__art { z-index: -2; }
/* Anchored left: on screens narrower than the painting the crop comes off the right,
   so Theo stays clear of the words in the dark corner. */
.hero__art img { object-fit: cover; object-position: 0% 60%; max-width: none; }
.hero::before {
  /* Night settles over the calm upper-left of the painting, where the words sit. */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 8, 23, 0.6) 0%, rgba(5, 8, 23, 0) 16%),
    radial-gradient(ellipse 58% 78% at 0% 0%, rgba(5, 8, 23, 0.9) 0%, rgba(5, 8, 23, 0.74) 42%, rgba(5, 8, 23, 0) 100%),
    linear-gradient(90deg, rgba(5, 8, 23, 0.5) 0%, rgba(5, 8, 23, 0) 40%),
    linear-gradient(0deg, rgba(8, 13, 38, 0.95) 0%, rgba(8, 13, 38, 0) 14%);
}
.hero__content {
  width: 100%;
  padding-top: calc(var(--header-h) + clamp(12px, 3vh, 72px));
  padding-bottom: 48px;
}
/* The words sit in the calm, dark upper-left of the painting, aligned to the viewport edge
   (not the content column) and narrow enough to stay left of Theo at every landscape
   size from 3:2 up (checked against Theo's head at 1200x800 to 1920x1080; re-check if the
   painting changes). */
.hero .wrap, .page-home .site-header .wrap { max-width: none; padding-left: clamp(24px, 4vw, 72px); padding-right: clamp(24px, 4vw, 72px); }
.hero__copy { max-width: 20.5rem; }
.hero__copy .btn-row { flex-wrap: nowrap; gap: 10px; }
.hero__copy .btn { min-height: 44px; padding: 0.6em 1.1em; font-size: 0.95rem; }
.hero__dev { margin: 14px 0 0; font-size: 0.95rem; text-shadow: 0 1px 10px rgba(5, 8, 23, 0.9); }
.hero__dev .text-link { color: var(--honey-300); }
.hero__copy .eyebrow { color: var(--honey-300); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5); }
.hero h1 {
  font-size: clamp(2.4rem, 1.2rem + 2.5vw, 3.6rem);
  margin-bottom: 0.4em;
  text-shadow: 0 2px 30px rgba(5, 8, 23, 0.55);
}
.hero h1 em { font-style: normal; color: var(--honey-400); }
.hero__lead {
  font-size: clamp(1.02rem, 0.98rem + 0.25vw, 1.15rem);
  color: #f1f3ff; max-width: none; margin-bottom: 1.1rem; font-size: 1rem;
  text-shadow: 0 1px 2px rgba(5, 8, 23, 0.7), 0 2px 18px rgba(5, 8, 23, 0.9);
}
.hero__scroll {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid rgba(244, 239, 229, 0.5); border-radius: 14px;
}
.hero__scroll::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--text); animation: scrollcue 2.2s var(--ease) infinite;
}
@keyframes scrollcue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 80% { opacity: 0; transform: translateY(12px); } 100% { opacity: 0; } }

/* Portrait tablets: the portrait painting fills the screen, words over its calm top. */
@media (orientation: portrait) and (max-width: 1024px) {
  .hero::before {
    background:
      linear-gradient(180deg, rgba(5, 8, 23, 0.86) 0%, rgba(5, 8, 23, 0.62) 26%, rgba(5, 8, 23, 0) 52%),
      linear-gradient(0deg, rgba(8, 13, 38, 1) 0%, rgba(8, 13, 38, 0.6) 9%, rgba(8, 13, 38, 0) 24%);
  }
  .hero__art img { object-position: 55% 100%; }
  .hero__copy { max-width: 34rem; }
  .hero__copy .btn-row { flex-wrap: wrap; }
}

/* Phones: the title sits over the top of the painting; the rest follows below it. */
@media (max-width: 599px) and (orientation: portrait) {
  .hero { display: block; min-height: 0; }
  .hero__art { position: relative; inset: auto; height: auto; aspect-ratio: 3 / 4; max-height: 92svh; }
  .hero__art img { position: absolute; }
  .hero::before { bottom: auto; height: calc(min(133.33vw, 92svh) + 2px); }
  .hero__content { position: absolute; top: 0; left: 0; right: 0; padding-top: calc(var(--header-h) + 22px); padding-bottom: 0; }
  .hero__copy { max-width: none; }
  .hero h1 { font-size: clamp(2.35rem, 1.2rem + 6vw, 3rem); margin-bottom: 0; }
  .hero__below { position: relative; margin-top: -12px; padding-bottom: 40px; }
  .hero__below .hero__lead { color: var(--text-muted); text-shadow: none; }
  .hero__scroll { display: none; }
  .hero__desktop-only { display: none; }
}
@media (min-width: 600px), (orientation: landscape) {
  .hero__below { display: none; }
}

/* Squarer or short landscape screens (1024x768 tablets, phones on their side): no column
   fits left of Theo, so the painting shows whole and the words follow below it. */
@media (orientation: landscape) and (max-aspect-ratio: 3/2), (orientation: landscape) and (max-height: 559px) {
  .hero { display: block; min-height: 0; }
  .hero__art { position: relative; inset: auto; height: auto; aspect-ratio: 1672 / 941; }
  .hero__art img { position: absolute; object-position: 50% 50%; }
  .hero::before {
    bottom: auto; height: calc(100vw * 941 / 1672 + 2px);
    background:
      linear-gradient(180deg, rgba(5, 8, 23, 0.65) 0%, rgba(5, 8, 23, 0) 18%),
      linear-gradient(0deg, rgba(8, 13, 38, 1) 0%, rgba(8, 13, 38, 0) 22%);
  }
  .hero__content { padding-top: 8px; padding-bottom: 56px; }
  .hero__copy { max-width: 60rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 48px; align-items: start; }
  .hero__copy .eyebrow, .hero__copy h1 { grid-column: 1; }
  .hero__copy .hero__desktop-only { grid-column: 2; grid-row: 1 / span 2; padding-top: 6px; }
  .hero h1, .hero__lead, .hero__dev { text-shadow: none; }
  .hero__scroll { display: none; }
}
@media (orientation: landscape) and (max-aspect-ratio: 3/2) and (max-width: 699px), (orientation: landscape) and (max-height: 559px) and (max-width: 699px) {
  .hero__copy { display: block; }
}

/* ------------------------------------------------------------ sections */
.section { position: relative; padding: clamp(72px, 10vw, 140px) 0; }
.section--tight { padding: clamp(56px, 7vw, 96px) 0; }
.section h2 { max-width: 20ch; }
.section--paper {
  background: var(--cream-100);
  color: var(--ink-900);
  color-scheme: light;
}
.section--paper .lead, .section--paper .muted { color: var(--ink-700); }
.section--paper .eyebrow { color: var(--coral-500); }
.section--paper .text-link { color: var(--ocean-500); }
.section--deep { background: linear-gradient(180deg, var(--night-900) 0%, var(--night-800) 100%); }
.section--ocean {
  background:
    radial-gradient(70% 60% at 85% 20%, rgba(47, 134, 255, 0.22), transparent 70%),
    radial-gradient(60% 50% at 10% 90%, rgba(143, 224, 255, 0.10), transparent 70%),
    var(--night-800);
}
.section--stars {
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1px 1px at 27% 72%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 42% 30%, rgba(255, 236, 200, 0.85), transparent 60%),
    radial-gradient(1px 1px at 58% 12%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(2px 2px at 71% 64%, rgba(255, 220, 160, 0.8), transparent 60%),
    radial-gradient(1px 1px at 84% 26%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1.5px 1.5px at 92% 82%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1px 1px at 6% 88%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(80% 70% at 50% 110%, rgba(47, 134, 255, 0.28), transparent 70%),
    linear-gradient(180deg, var(--night-900), var(--night-950));
}

.split { display: grid; gap: clamp(36px, 6vw, 88px); align-items: center; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split--wide-text { grid-template-columns: 1.15fr 0.85fr; }
  .split--reverse > :first-child { order: 2; }
}
.prose p { max-width: 36rem; }
.prose p + p { margin-top: -0.2em; }

.panel {
  margin: 0;
  border-radius: var(--radius-l);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 30px 60px -30px rgba(27, 26, 51, 0.45), 0 0 0 1px rgba(27, 26, 51, 0.06);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.6s var(--ease);
}
.panel:hover { transform: rotate(0deg) scale(1.01); }
.panel img { width: 100%; height: auto; }
.panel--dark { box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 80px -20px rgba(83, 170, 255, 0.35); }
.caption { margin-top: 14px; font-size: 0.9rem; color: var(--ink-500); text-align: center; }

/* The book on the home page */
.book {
  display: block; position: relative; max-width: 380px; margin: 0 auto;
  border-radius: 10px 18px 18px 10px; overflow: hidden;
  box-shadow: -10px 0 0 -4px rgba(255, 255, 255, 0.06), 0 40px 80px -30px rgba(0, 0, 0, 0.9), 0 0 120px -30px rgba(255, 193, 92, 0.45);
  transform: perspective(1400px) rotateY(10deg) rotateZ(-1.5deg);
  transition: transform 0.7s var(--ease);
}
.book:hover { transform: perspective(1400px) rotateY(0deg) rotateZ(0deg); }
.book::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), transparent); }
.book img { width: 100%; height: auto; }

/* Colour swatches (Trick-E page) */
.swatches { display: flex; flex-wrap: wrap; gap: 14px; margin: 2rem 0 0.8rem; padding: 0; list-style: none; }
.swatches li { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 700; color: var(--ink-700); }
.swatches span {
  width: 56px; height: 56px; border-radius: 50%;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.12), 0 6px 16px -8px rgba(27, 26, 51, 0.5);
}
.sw-cream { background: #f7ecd7; }
.sw-sky { background: #48a6f0; }
.sw-orange { background: #f0782f; }
.sw-honey { background: #e9a23f; }
.sw-charcoal { background: #34343c; }
.hat-note { font-family: var(--font-display); font-weight: 600; font-variation-settings: "SOFT" 100; font-size: 1.2rem; color: var(--ink-900); }

/* ------------------------------------------------------------ page heroes */
.page-hero { padding: clamp(56px, 8vw, 110px) 0 clamp(48px, 6vw, 90px); position: relative; overflow: hidden; }
.page-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 80% at 90% 0%, rgba(47, 134, 255, 0.24), transparent 70%);
}
.page-hero { isolation: isolate; }
.page-hero h1 { margin-bottom: 0.35em; }

/* ------------------------------------------------------------ Trick-E's face */
.face {
  --w: 104px;
  position: relative;
  width: var(--w); height: calc(var(--w) * 0.66);
  border-radius: calc(var(--w) * 0.2);
  background: radial-gradient(120% 120% at 30% 20%, #1c2448, #0c1128 70%);
  border: calc(var(--w) * 0.05) solid var(--ocean-500);
  box-shadow: 0 0 0 calc(var(--w) * 0.03) rgba(83, 170, 255, 0.25), 0 0 40px -6px rgba(83, 170, 255, 0.6), inset 0 0 14px rgba(83, 170, 255, 0.25);
  display: flex; align-items: center; justify-content: center; gap: calc(var(--w) * 0.17);
  flex-shrink: 0;
}
.face__eye {
  width: calc(var(--w) * 0.17); height: calc(var(--w) * 0.25);
  border-radius: calc(var(--w) * 0.07);
  background: #b6f1ff;
  box-shadow: 0 0 12px rgba(143, 224, 255, 0.9);
  transform: translate(var(--lx, 0px), var(--ly, 0px));
  transition: transform 0.18s ease-out, height 0.25s var(--ease), border-radius 0.25s;
  animation: blink 5.5s infinite;
}
.face__eye + .face__eye { animation-delay: 0.04s; }
.face__cheek {
  position: absolute; bottom: calc(var(--w) * 0.06); width: calc(var(--w) * 0.08); height: calc(var(--w) * 0.08);
  border-radius: 50%; background: var(--honey-400); opacity: 0.35; transition: opacity 0.4s, box-shadow 0.4s;
}
.face__cheek--l { left: calc(var(--w) * 0.09); }
.face__cheek--r { right: calc(var(--w) * 0.09); }
@keyframes blink { 0%, 93%, 100% { transform: translate(var(--lx, 0px), var(--ly, 0px)) scaleY(1); } 95% { transform: translate(var(--lx, 0px), var(--ly, 0px)) scaleY(0.08); } }
/* Happy: eyes become little arches, cheeks glow. */
.face--happy .face__eye {
  height: calc(var(--w) * 0.12); background: transparent; box-shadow: none;
  border: calc(var(--w) * 0.05) solid #b6f1ff; border-bottom: 0;
  border-radius: calc(var(--w) * 0.1) calc(var(--w) * 0.1) 0 0;
  filter: drop-shadow(0 0 6px rgba(143, 224, 255, 0.9));
  animation: none;
}
.face--happy .face__cheek { opacity: 1; box-shadow: 0 0 14px 2px rgba(255, 193, 92, 0.85); }
.face--happy { animation: hop 0.7s var(--ease) 1; }
@keyframes hop { 0% { transform: translateY(0); } 35% { transform: translateY(-10px) rotate(-3deg); } 70% { transform: translateY(0) rotate(1deg); } 100% { transform: none; } }
.face--lost .face__eye { animation: blink 5.5s infinite, lookaround 6s ease-in-out infinite; }
@keyframes lookaround { 0%, 100% { translate: 0 0; } 25% { translate: -7px -2px; } 50% { translate: 6px 2px; } 75% { translate: 0 -4px; } }

/* ------------------------------------------------------------ sign-up */
.signup-section .wrap { display: grid; gap: clamp(32px, 5vw, 64px); align-items: center; }
@media (min-width: 900px) { .signup-section .wrap { grid-template-columns: 1fr minmax(0, 520px); } }
.signup-intro h2 { max-width: 14ch; }
.signup-intro .face { margin-bottom: 26px; --w: 116px; }

.signup {
  position: relative;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, rgba(29, 42, 102, 0.65), rgba(12, 20, 54, 0.75));
  border: 1px solid rgba(143, 224, 255, 0.2);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 0 80px -30px rgba(83, 170, 255, 0.5);
}
.signup__grid { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > span, .signup legend { font-weight: 800; font-size: 0.9rem; color: var(--text); letter-spacing: 0.01em; }
.input, .select {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: 14px; border: 1.5px solid rgba(188, 195, 230, 0.28);
  background: rgba(5, 8, 23, 0.55); color: var(--text);
  font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.input::placeholder { color: rgba(188, 195, 230, 0.55); }
.input:hover, .select:hover { border-color: rgba(188, 195, 230, 0.5); }
.input:focus, .select:focus { outline: none; border-color: var(--honey-400); box-shadow: 0 0 0 4px rgba(255, 193, 92, 0.18); background: rgba(5, 8, 23, 0.75); }
.input[aria-invalid="true"] { border-color: var(--coral-400); box-shadow: 0 0 0 4px rgba(255, 143, 120, 0.15); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1.5 1.5 7 7l5.5-5.5' fill='none' stroke='%23ffc15c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.select option { background: var(--night-800); color: var(--text); }
.signup fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.signup legend { padding: 0; margin-bottom: 8px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px;
  padding: 8px 16px; border-radius: 999px;
  border: 1.5px solid rgba(188, 195, 230, 0.28); background: rgba(5, 8, 23, 0.35);
  font-weight: 700; font-size: 0.95rem; color: var(--text-muted); white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
  user-select: none; -webkit-user-select: none;
}
.choice:hover span { border-color: rgba(188, 195, 230, 0.55); color: var(--text); }
.choice input:checked + span { background: var(--honey-400); border-color: var(--honey-400); color: var(--night-900); }
.choice input:focus-visible + span { outline: 3px solid var(--honey-300); outline-offset: 2px; }
.choice--check span::before {
  content: ""; width: 14px; height: 14px; border-radius: 5px; border: 1.5px solid currentColor; opacity: 0.7;
  transition: background-color 0.2s;
}
.choice--check input:checked + span::before {
  opacity: 1; border-color: var(--night-900);
  background: var(--night-900) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.6 2.6L9 1' fill='none' stroke='%23ffc15c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px 8px no-repeat;
}
.signup__submit { width: 100%; margin-top: 6px; min-height: 54px; font-size: 1.05rem; }
.signup__submit[disabled] { opacity: 0.7; cursor: progress; transform: none; }
/* Consent tick: unticked by default and required (GDPR consent must be an active choice). */
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 0; font-size: 0.88rem; line-height: 1.45; color: var(--text-muted); cursor: pointer; }
.consent input {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0;
  border: 1.5px solid rgba(188, 195, 230, 0.7); border-radius: 5px; background: transparent; cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.consent:hover input { border-color: var(--text); }
.consent input:checked {
  border-color: var(--honey-400);
  background: var(--honey-400) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.6 2.6L9 1' fill='none' stroke='%230b1230' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px 8px no-repeat;
}
.consent input:focus-visible { outline: 3px solid var(--honey-300); outline-offset: 2px; }
.consent input[aria-invalid="true"] { border-color: var(--coral-400); box-shadow: 0 0 0 3px rgba(255, 143, 120, 0.25); }
.consent a { color: inherit; text-decoration: underline; text-decoration-color: rgba(188, 195, 230, 0.4); text-underline-offset: 3px; }
.consent a:hover { color: var(--text); text-decoration-color: currentColor; }
.signup--compact .consent { margin-top: 12px; }
.signup__error { margin: 12px 0 0; color: var(--coral-400); font-weight: 700; font-size: 0.95rem; text-align: center; }
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.signup__done { display: none; text-align: center; padding: 18px 0 8px; }
.signup__done .face { margin: 0 auto 22px; --w: 120px; }
.signup__done h3 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem); margin-bottom: 0.3em; }
.signup__done p { color: var(--text-muted); max-width: 26rem; margin-left: auto; margin-right: auto; }
.signup.is-done .signup__grid, .signup.is-done .signup__error { display: none; }
.signup.is-done .signup__done { display: block; animation: fadeup 0.5s var(--ease); }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Compact: email + button in a row, the rest folded away. */
.signup--compact { max-width: 640px; }
.signup--compact .signup__row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup--compact .signup__row .input { flex: 1 1 220px; }
.signup--compact .signup__row .btn { flex: 0 0 auto; min-height: 52px; }
@media (max-width: 479px) { .signup--compact .signup__row .btn { flex: 1 1 100%; } }
.signup__more { margin-top: 14px; }
.signup__more summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 0.92rem; color: var(--text-muted);
}
.signup__more summary::-webkit-details-marker { display: none; }
.signup__more summary::before {
  content: "+"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid currentColor; font-weight: 800; font-size: 0.9rem; line-height: 1; transition: transform 0.25s var(--ease);
}
.signup__more[open] summary::before { transform: rotate(45deg); }
.signup__more summary:hover { color: var(--text); }
.signup__more .signup__grid { margin-top: 16px; }
.signup--compact .signup__error { text-align: left; }
.signup--compact .signup__done { text-align: left; display: none; align-items: center; gap: 20px; padding: 4px 0; }
.signup--compact.is-done .signup__done { display: flex; }
.signup--compact .signup__done .face { margin: 0; --w: 92px; }
.signup--compact .signup__done h3 { font-size: 1.5rem; }
.signup--compact .signup__done p { margin: 0; }

/* ------------------------------------------------------------ stories page */
.episode {
  display: grid; gap: clamp(28px, 5vw, 64px);
  padding: clamp(20px, 4vw, 44px);
  border-radius: calc(var(--radius-l) + 8px);
  background: linear-gradient(160deg, rgba(29, 42, 102, 0.6), rgba(12, 20, 54, 0.4));
  border: 1px solid var(--line);
}
@media (min-width: 900px) { .episode { grid-template-columns: minmax(260px, 0.8fr) 1.2fr; align-items: start; } }
.episode__cover { position: relative; }
.episode__cover .book { transform: none; max-width: 420px; }
.episode__cover .book:hover { transform: translateY(-4px); }
.episode h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.5rem); max-width: none; }
.episode__actions { margin: 1.6rem 0 2rem; }
/* Audio language: a two-way pill next to Listen. Hidden until stories.js wires it up. */
.audio-lang { display: inline-flex; align-items: center; padding: 3px; gap: 2px; border-radius: 999px; border: 1.5px solid rgba(188, 195, 230, 0.3); }
.audio-lang[hidden] { display: none; }
.audio-lang button {
  min-width: 44px; height: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent;
  color: var(--text-muted); font: inherit; font-weight: 800; font-size: 0.85rem; cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.audio-lang button:hover { color: var(--text); }
.audio-lang button[aria-pressed="true"] { background: var(--honey-400); color: var(--night-900); }
.audio-lang button:focus-visible { outline: 3px solid var(--honey-300); outline-offset: 2px; }
.chapters { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.chapter {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.chapter__n {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; color: var(--night-900); background: var(--honey-400);
}
.chapter__title { font-weight: 800; line-height: 1.3; }
.chapter__title a { text-decoration: none; }
.chapter__title a:hover { color: var(--honey-300); }
.chapter__de { display: block; font-weight: 600; font-size: 0.88rem; color: var(--text-muted); }
.chapter__actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid rgba(188, 195, 230, 0.3); background: transparent; color: var(--text);
  font-weight: 800; font-size: 0.85rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.is-playing { background: var(--honey-400); color: var(--night-900); border-color: var(--honey-400); }
@media (max-width: 479px) {
  .chapter { grid-template-columns: auto 1fr; }
  .chapter__actions { grid-column: 2; }
}

.player {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 60;
  width: min(560px, calc(100% - 24px));
  transform: translate(-50%, 140%); transition: transform 0.45s var(--ease);
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 10px 14px 10px 10px; border-radius: 22px;
  background: rgba(12, 20, 54, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(143, 224, 255, 0.22); box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.9);
}
.player.is-open { transform: translate(-50%, 0); }
.player__play {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--honey-400); color: var(--night-900); display: grid; place-items: center;
}
.player__play svg { width: 18px; height: 18px; }
.player__meta { min-width: 0; }
.player__title { font-weight: 800; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__bar { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.player__bar input { flex: 1; min-width: 0; accent-color: var(--honey-400); height: 4px; }
.player__close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.3rem; line-height: 1; }
.player__close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.credit { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid rgba(27, 26, 51, 0.12); font-weight: 700; color: var(--ink-700); }

/* ------------------------------------------------------------ contact */
.email-big {
  display: inline-block; margin: 0.6rem 0 2.4rem;
  font-family: var(--font-display); font-weight: 600; font-variation-settings: "SOFT" 100;
  font-size: clamp(1.25rem, 0.6rem + 3.2vw, 3rem); letter-spacing: -0.01em; line-height: 1.15;
  color: var(--honey-400); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor); background-size: 0 3px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size 0.4s var(--ease);
}
.email-big:hover { background-size: 100% 3px; }
.subjects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin: 1.4rem 0 2.6rem; }
.subject {
  display: block; text-decoration: none; padding: 24px; border-radius: var(--radius-m);
  background: linear-gradient(180deg, rgba(29, 42, 102, 0.55), rgba(19, 29, 75, 0.35)); border: 1px solid rgba(83, 170, 255, 0.18);
  transition: transform 0.4s var(--ease), border-color 0.3s;
}
.subject:hover { transform: translateY(-4px); border-color: var(--honey-400); }
.subject strong { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; color: var(--honey-400); margin-bottom: 6px; }
.subject span { color: var(--text-muted); font-size: 0.98rem; }
.subject em { display: block; margin-top: 14px; font-style: normal; font-weight: 800; font-size: 0.88rem; color: var(--text); }

/* ------------------------------------------------------------ legal + plain pages */
.legal { background: var(--cream-100); color: var(--ink-900); color-scheme: light; padding: clamp(48px, 7vw, 96px) 0; }
.legal .wrap { max-width: 780px; }
.legal h1 { font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3.4rem); }
.legal h2 { font-size: 1.35rem; margin-top: 2.2em; max-width: none; }
.legal p, .legal li { color: var(--ink-700); }
.legal a { color: var(--ocean-500); }
.legal address { font-style: normal; color: var(--ink-700); line-height: 1.7; }
.legal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0; }
.legal dt { font-weight: 800; color: var(--ink-900); }
.legal dd { margin: 0; color: var(--ink-700); }
@media (max-width: 599px) { .legal dl { grid-template-columns: 1fr; } .legal dd { margin-bottom: 10px; } }
.legal .updated { margin-top: 3em; font-size: 0.9rem; color: var(--ink-500); }

.page-plain { min-height: 100vh; display: grid; place-items: center; background: var(--night-900); }
.plain-reply { text-align: center; padding: 24px; max-width: 32rem; }

.lost { min-height: calc(100svh - var(--header-h)); display: grid; place-items: center; text-align: center; padding: 64px 0; }
.lost .face { margin: 0 auto 32px; --w: 150px; }
.lost h1 { margin-bottom: 0.3em; }

/* ------------------------------------------------------------ footer */
.site-footer { background: var(--night-950); border-top: 1px solid var(--line); padding: 56px 0 calc(40px + env(safe-area-inset-bottom)); font-size: 0.95rem; }
.footer__grid { display: grid; gap: 32px; }
@media (min-width: 800px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; align-items: start; } }
.footer__brand p { color: var(--text-muted); margin-top: 14px; }
.footer__brand a { color: var(--text); }
.site-footer h2 { font-family: var(--font-body); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.footer__links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer__links a { text-decoration: none; color: var(--text); opacity: 0.85; }
.footer__links a:hover { opacity: 1; color: var(--honey-400); }
.footer__sign { display: flex; align-items: center; gap: 14px; margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); flex-wrap: wrap; justify-content: space-between; }
.footer__sign .tidy { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 600; font-variation-settings: "SOFT" 100; font-size: 1.15rem; color: var(--honey-300); }
.footer__sign .face { --w: 44px; box-shadow: 0 0 20px -4px rgba(83, 170, 255, 0.5); }
.footer__legal { display: flex; gap: 18px; color: var(--text-muted); font-size: 0.88rem; }
.footer__legal a { color: inherit; text-decoration: none; }
.footer__legal a:hover { color: var(--text); }

/* ------------------------------------------------------------ reveal on scroll */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .book, .panel { transform: none; }
  .face__eye { animation: none; }
}

/* ------------------------------------------------------------ small additions */
.tilt-r { --tilt: 1.4deg; }
.tilt-l { --tilt: -1.4deg; }
.lost .lead { margin: 0 auto 1.8rem; }
.footer__sign .face--happy { animation: none; }
.h-sub { font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; line-height: 1.5; color: var(--text-muted); max-width: 34rem; letter-spacing: 0; }
.contact-sign { display: flex; align-items: center; gap: 20px; margin: 0 0 1.4rem; max-width: 40rem; }
.contact-sign .face { --w: 72px; }
.contact-sign p { font-size: 1.08rem; }
.page-hero .split .panel { max-width: 560px; justify-self: center; }
[hidden] { display: none !important; }
.section--paper + .section--paper { padding-top: 0; }
.section h3.reveal { margin-top: 2.4rem; }
@media (max-width: 379px) {
  .brand img { width: 32px; height: 32px; }
  .brand__name { font-size: 0.9rem; }
  .nav a { font-size: 0.86rem; padding: 8px 6px; }
}
.nobr { white-space: nowrap; }
