/* Caldera frame (charcoal + volcanic orange) around Petri's world (dark teal + mint). */
:root {
  --caldera-bg: #141110;
  --caldera-text: #f2e8e0;
  --caldera-muted: #a8988c;
  --caldera-orange: #e66500;

  --petri-bg: #07100d;
  --petri-surface: #0e1a16;
  --petri-surface-2: #14261f;
  --petri-text: #e6f3ee;
  --petri-muted: #7e9a90;
  --petri-primary: #37c9a0;
  --petri-accent: #5ef2c4;
  --petri-ink: #04342c;
  --danger: #ff8a8a;

  /* Topple's "toy table" world: the game's walnut table, cream text, candy dominoes. */
  --topple-bg: #1f1611;
  --topple-surface: #2b1f17;
  --topple-surface-2: #362719;
  --topple-text: #fbf3e6;
  --topple-muted: #b9a593;
  --topple-primary: #c6f24a;
  --topple-primary-hover: #d8f77a;
  --topple-ink: #1f2a05;
  --topple-pink: #ff4fa3;
  --topple-yellow: #ffd84a;
  --topple-cyan: #4fd6e8;
  --topple-violet: #9a7bff;
  --topple-orange: #ff8a4f;

  --font-wordmark: 'Fredoka', 'Bricolage Grotesque', system-ui, sans-serif;
  --font-heading: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-topple-body: 'Manrope', system-ui, sans-serif;

  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease-spring: cubic-bezier(0.34, 1.42, 0.64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--petri-bg);
  color: var(--petri-text);
  font: 400 1.0625rem/1.65 var(--font-body);
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: var(--petri-accent); text-underline-offset: 3px; }
a:hover { color: var(--petri-text); }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.1; margin: 0; }
:focus-visible { outline: 2px solid var(--petri-accent); outline-offset: 3px; }
a:focus-visible { border-radius: 6px; }

.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 10; background: var(--petri-accent); color: var(--petri-ink); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

.wrap { width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.wrap--narrow { width: min(640px, 100% - 2 * var(--gutter)); }

/* ---- Caldera frame ---- */
.frame { background: var(--caldera-bg); color: var(--caldera-muted); }
.frame--top { border-bottom: 2px solid var(--caldera-orange); position: sticky; top: 0; z-index: 5; }
.frame--bottom { border-top: 2px solid var(--caldera-orange); font-size: 0.9375rem; }
.frame__inner {
  width: min(1120px, 100% - 2 * var(--gutter)); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  min-height: 64px;
}
.frame--bottom .frame__inner { min-height: 80px; }
.frame p { margin: 0; }
.brand img { height: 32px; width: auto; }
.nav { display: flex; gap: clamp(16px, 3vw, 28px); }
.nav a { color: var(--caldera-text); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--caldera-orange); }

/* ---- Hero ---- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: min(88vh, 820px);
  min-height: min(88svh, 820px);
  display: grid; place-items: center; text-align: center;
  padding: 96px var(--gutter) 72px;
}
.hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; background: var(--petri-bg); }
.hero__shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at center, rgb(7 16 13 / 0.35) 0%, rgb(7 16 13 / 0.75) 60%, var(--petri-bg) 100%),
    linear-gradient(to bottom, transparent 70%, var(--petri-bg));
}
.hero__content { max-width: 560px; }
.motion-toggle {
  position: absolute; right: var(--gutter); bottom: 20px; z-index: 1; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; font-size: 0.8125rem;
  background: rgb(14 26 22 / 0.8); border: 1px solid rgb(94 242 196 / 0.3); color: var(--petri-text);
}
.motion-toggle:hover { border-color: var(--petri-accent); }
.motion-toggle[aria-pressed="true"] { border-color: var(--petri-accent); color: var(--petri-accent); }
.badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px;
  padding: 6px 14px; border-radius: 999px; font-size: 0.875rem; font-weight: 500;
  background: rgb(14 26 22 / 0.8); border: 1px solid rgb(94 242 196 / 0.3); color: var(--petri-text);
}
.badge__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--petri-accent); box-shadow: 0 0 10px var(--petri-accent); }
.wordmark {
  font-family: var(--font-wordmark); font-weight: 600;
  font-size: clamp(4.5rem, 18vw, 10rem); line-height: 0.95; letter-spacing: -0.02em;
  color: var(--petri-text);
  text-shadow: 0 0 24px rgb(94 242 196 / 0.45), 0 0 64px rgb(55 201 160 / 0.35);
}
.hero__tagline { font-family: var(--font-heading); font-size: clamp(1.25rem, 3.5vw, 1.625rem); margin: 4px 0 28px; color: var(--petri-text); }

/* ---- Forms ---- */
input, textarea, button { font: inherit; color: inherit; }
input, textarea {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  background: rgb(14 26 22 / 0.85); border: 1px solid rgb(126 154 144 / 0.35);
  transition: border-color 160ms;
}
input::placeholder, textarea::placeholder { color: var(--petri-muted); }
input:focus, textarea:focus { border-color: var(--petri-accent); outline: none; box-shadow: 0 0 0 3px rgb(94 242 196 / 0.2); }
textarea { resize: vertical; min-height: 140px; }
button[type="submit"] {
  cursor: pointer; border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 600;
  background: var(--petri-accent); color: var(--petri-ink);
  transition: transform 300ms var(--ease-spring), background 160ms;
}
button[type="submit"]:hover { background: #8ff7d6; transform: translateY(-1px) scale(1.02); }
button[type="submit"]:active { transform: scale(0.97); }
button[aria-busy="true"] { opacity: 0.7; cursor: progress; }

.signup__row { display: flex; gap: 8px; }
.signup__row input { border-radius: 999px; }
.signup__row button { white-space: nowrap; }
.signup__note { margin: 10px 0 0; font-size: 0.875rem; color: var(--petri-muted); }
.ts-slot.is-visible { margin-top: 12px; display: flex; justify-content: center; }
.form-status { margin: 10px 0 0; min-height: 1.5em; font-weight: 500; }
.form-status[data-tone="ok"] { color: var(--petri-accent); }
.form-status[data-tone="error"] { color: var(--danger); }
.form-done { padding: 18px 20px; border-radius: var(--radius); background: rgb(14 26 22 / 0.85); border: 1px solid rgb(94 242 196 / 0.35); color: var(--petri-text); font-weight: 500; }

/* ---- Sections ---- */
.glimpses, .about, .contact { padding: clamp(64px, 10vw, 120px) 0; }
.about { background: var(--petri-surface); }
.section-title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; letter-spacing: -0.01em; }
.section-title span { color: var(--petri-accent); }
.section-lede { color: var(--petri-muted); max-width: 60ch; margin: 12px 0 0; }

/* Glimpses in two tiers: the clips you can still make out are big; the deep, blurred ones sit
   below as a smaller row of three. Mobile first, then 600px and 900px. */
.glimpses__clear, .glimpses__veiled { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.glimpses__clear { margin-top: 40px; grid-template-columns: 1fr; }
.glimpses__veiled { margin-top: 16px; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 2vw, 16px); }
.tile {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  background: var(--petri-surface-2); border: 1px solid rgb(126 154 144 / 0.18); border-radius: var(--radius);
  transition: transform 300ms var(--ease-spring), border-color 160ms, box-shadow 300ms;
}
.glimpses__veiled .tile { border-radius: clamp(8px, 1.5vw, var(--radius)); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Soft inner vignette so each clip reads as a window. */
.tile::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 36px rgb(7 16 13 / 0.55);
}
.tile:hover { transform: translateY(-4px); border-color: rgb(94 242 196 / 0.5); box-shadow: 0 0 28px rgb(94 242 196 / 0.16); }

@media (min-width: 600px) {
  .glimpses__clear { grid-template-columns: repeat(2, 1fr); }
  .tile--main { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  /* The dish fills the left, two rows tall; the two side clips set the row height at 16:9. */
  .glimpses__clear { grid-template-columns: 3fr 2fr; }
  .tile--main { grid-column: 1; grid-row: 1 / 3; aspect-ratio: auto; }
}

/* A question mark over each blurred clip, growing and brightening as the blur deepens. */
.tile__q {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; pointer-events: none;
  font: 600 var(--q-size, 3rem)/1 var(--font-wordmark); color: var(--petri-text);
  opacity: var(--q-opacity, 0.5);
  text-shadow: 0 0 18px rgb(94 242 196 / 0.6), 0 0 48px rgb(55 201 160 / 0.4);
}
.tile--veil-2 { --q-size: clamp(1.5rem, 4vw, 2.5rem); --q-opacity: 0.5; }
.tile--veil-3 { --q-size: clamp(2rem, 5.5vw, 3.5rem); --q-opacity: 0.7; }
.tile--veil-4 { --q-size: clamp(2.5rem, 7vw, 4.5rem); --q-opacity: 0.92; }
.tile--veil-4 .tile__q { animation: q-breathe 3.2s ease-in-out infinite; }
@keyframes q-breathe {
  50% { text-shadow: 0 0 28px rgb(94 242 196 / 0.9), 0 0 80px rgb(55 201 160 / 0.6); }
}

.about__grid { display: grid; gap: 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: center; }
.about p { max-width: 58ch; }
.about__note { margin-top: 20px; color: var(--petri-muted); font-size: 0.9375rem; }

/* Studio: a band of the Caldera frame inside the page, so it reads as "who made this". */
.studio {
  background: var(--caldera-bg); color: var(--caldera-muted);
  border-block: 2px solid var(--caldera-orange);
  padding: clamp(56px, 8vw, 96px) 0;
}
.studio__grid { display: grid; gap: clamp(24px, 5vw, 64px); grid-template-columns: auto 1fr; align-items: center; }
.studio__mark { width: clamp(120px, 18vw, 220px); height: auto; }
.studio .section-title { color: var(--caldera-text); }
.studio .section-title span { color: var(--caldera-orange); }
.studio p { max-width: 60ch; margin: 16px 0 0; }
.studio__first { color: var(--caldera-text); font-weight: 600; }
@media (max-width: 600px) {
  .studio__grid { grid-template-columns: 1fr; }
}
.gallery { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gallery button { padding: 0; border: 0; background: var(--petri-surface-2); border-radius: 10px; overflow: hidden; cursor: zoom-in; aspect-ratio: 16 / 9; width: 100%; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-spring); }
.gallery button:hover img { transform: scale(1.04); }

.contact-form { margin-top: 32px; display: grid; gap: 18px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.contact-form button { justify-self: start; }

/* ---- Lightbox ---- */
.lightbox { padding: 0; border: 0; background: transparent; max-width: min(1280px, 94vw); }
.lightbox::backdrop { background: rgb(4 10 8 / 0.88); }
.lightbox img { border-radius: 10px; max-height: 86vh; width: auto; }
.lightbox form { position: absolute; top: 8px; right: 8px; margin: 0; }
.lightbox__close { width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; line-height: 1; background: rgb(14 26 22 / 0.9); color: var(--petri-text); }

.nav a[aria-current="page"] { color: var(--caldera-orange); }

/* ---- Topple ---- */
/* Buttons. */
.t-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.t-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 24px; border-radius: 999px;
  font: 700 1rem/1.2 var(--font-topple-body); text-decoration: none; white-space: nowrap;
  transition: transform 300ms var(--ease-spring), background 160ms, border-color 160ms, color 160ms;
}
.t-btn:hover { transform: translateY(-1px) scale(1.02); }
.t-btn:active { transform: scale(0.97); }
.t-btn--primary { background: var(--topple-primary); color: var(--topple-ink); }
.t-btn--primary:hover { background: var(--topple-primary-hover); color: var(--topple-ink); }
.t-btn--ghost { border: 1.5px solid rgb(251 243 230 / 0.5); color: var(--topple-text); background: rgb(31 22 17 / 0.45); }
.t-btn--ghost:hover { border-color: var(--topple-primary); color: var(--topple-primary); }

/* The /topple page: the shared components, recoloured for the walnut world. */
body.topple { background: var(--topple-bg); color: var(--topple-text); font-family: var(--font-topple-body); }
.topple a:not(.t-btn) { color: var(--topple-primary); }
.topple a:not(.t-btn):hover { color: var(--topple-text); }
/* The Caldera frame keeps its own font, so the header and footer match every other page. */
.topple .frame { font-family: var(--font-body); }
.topple .frame .nav a { color: var(--caldera-text); }
.topple .frame .nav a:hover, .topple .frame .nav a[aria-current="page"] { color: var(--caldera-orange); }
.topple :focus-visible { outline-color: var(--topple-primary); }
.topple a.skip { background: var(--topple-primary); color: var(--topple-ink); }
.topple .hero__video { background: var(--topple-bg); }
.topple .hero__shade {
  background:
    radial-gradient(ellipse at center, rgb(31 22 17 / 0.3) 0%, rgb(31 22 17 / 0.72) 62%, var(--topple-bg) 100%),
    linear-gradient(to bottom, transparent 70%, var(--topple-bg));
}
.topple .hero__content { max-width: 640px; }
.topple .hero .t-actions { justify-content: center; margin-top: 28px; }
.topple .badge { background: rgb(43 31 23 / 0.85); border-color: rgb(251 243 230 / 0.22); color: var(--topple-text); }
/* The badge's dot becomes a little domino. */
.topple .badge__dot { width: 6px; height: 13px; border-radius: 2px; background: var(--topple-pink); box-shadow: none; transform: rotate(18deg); }
.topple .motion-toggle { background: rgb(43 31 23 / 0.85); border-color: rgb(251 243 230 / 0.25); color: var(--topple-text); }
.topple .motion-toggle:hover, .topple .motion-toggle[aria-pressed="true"] { border-color: var(--topple-primary); color: var(--topple-primary); }
.topple .hero__tagline { color: var(--topple-text); text-wrap: balance; }
.topple .section-title span { color: var(--topple-primary); }
.topple .section-lede { color: var(--topple-muted); }

/* Wordmark: the last letters tip over like falling dominoes, each with a candy shadow. They
   fall into place once on load (reduced motion skips straight to the end pose). */
.t-wordmark {
  font: 800 clamp(4rem, 16vw, 9rem)/0.95 var(--font-heading); letter-spacing: -0.035em;
  color: var(--topple-text); margin: 0 0 6px; white-space: nowrap;
}
.t-wordmark span {
  display: inline-block; transform-origin: 85% 95%; transform: rotate(var(--tilt, 0deg));
  text-shadow: 0.045em 0.055em 0 var(--shade);
  animation: t-tip 900ms var(--ease-spring) both; animation-delay: var(--delay, 0ms);
}
.t-wordmark span:nth-child(1) { --shade: var(--topple-pink); }
.t-wordmark span:nth-child(2) { --shade: var(--topple-yellow); }
.t-wordmark span:nth-child(3) { --shade: var(--topple-cyan); }
.t-wordmark span:nth-child(4) { --shade: var(--topple-violet); --tilt: 5deg; --delay: 350ms; }
.t-wordmark span:nth-child(5) { --shade: var(--topple-orange); --tilt: 13deg; --delay: 470ms; }
.t-wordmark span:nth-child(6) { --shade: var(--topple-primary); --tilt: 26deg; --delay: 590ms; }
@keyframes t-tip { from { transform: rotate(0deg); } }

/* How it plays: four clips with a numbered domino each, two by two from 700px. */
.t-steps { padding: clamp(64px, 10vw, 120px) 0; }
.t-steps__list { list-style: none; padding: 0; margin: 40px 0 0; display: grid; gap: clamp(28px, 4vw, 32px); counter-reset: step; }
.t-step h3 { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; font-size: 1.375rem; }
.t-step h3::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 26px; height: 38px; border-radius: 5px; flex: none;
  font: 800 1rem/1 var(--font-heading); background: var(--step, var(--topple-pink)); color: var(--topple-bg);
  transform: rotate(-8deg);
}
.t-step:nth-child(2) { --step: var(--topple-yellow); }
.t-step:nth-child(3) { --step: var(--topple-cyan); }
.t-step:nth-child(4) { --step: var(--topple-violet); }
.t-step p { margin: 0; color: var(--topple-muted); max-width: 46ch; }
@media (min-width: 700px) {
  .t-steps__list { grid-template-columns: repeat(2, 1fr); }
}
.topple .tile { background: var(--topple-surface-2); border-color: rgb(251 243 230 / 0.12); }
.topple .tile::after { box-shadow: inset 0 0 30px rgb(20 14 10 / 0.45); }
.topple .tile:hover { border-color: rgb(198 242 74 / 0.6); box-shadow: 0 14px 32px rgb(0 0 0 / 0.35); }

/* About Topple. */
.topple .about { background: var(--topple-surface); }
.topple .about__note { color: var(--topple-muted); }
.topple .about .t-actions { margin-top: 20px; }
.t-features { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 8px; }
.t-features li { position: relative; padding-left: 26px; }
.t-features li::before {
  content: ''; position: absolute; left: 4px; top: 0.4em; width: 7px; height: 15px; border-radius: 2px;
  background: var(--dot, var(--topple-pink)); transform: rotate(14deg);
}
.t-features li:nth-child(5n + 2) { --dot: var(--topple-yellow); }
.t-features li:nth-child(5n + 3) { --dot: var(--topple-cyan); }
.t-features li:nth-child(5n + 4) { --dot: var(--topple-violet); }
.t-features li:nth-child(5n + 5) { --dot: var(--topple-orange); }
.topple .gallery button { background: var(--topple-surface-2); }
.topple .lightbox::backdrop { background: rgb(15 10 8 / 0.9); }
.topple .lightbox__close { background: rgb(43 31 23 / 0.92); color: var(--topple-text); }

/* ---- Simple pages (privacy, 404) ---- */
.page { padding: clamp(56px, 9vw, 104px) 0; min-height: 60vh; }
.page h1 { font-size: clamp(2.25rem, 6vw, 3.25rem); margin-bottom: 20px; }
.page h2 { font-size: 1.375rem; margin: 32px 0 8px; }
.page p, .page li { color: var(--petri-muted); max-width: 64ch; }
.page strong { color: var(--petri-text); }

@media (max-width: 520px) {
  .signup__row { flex-direction: column; }
  .signup__row button { width: 100%; }
  .gallery { grid-template-columns: 1fr; }
  .brand img { height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .motion-toggle { display: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
