/* mvpig.app
   Tokens follow the game's design system (MVPig/DesignSystem/Tokens.swift): the farm palette as
   primitives, semantic roles on top. Deliberate deviations from the Memorisely defaults, same as
   the app: earthy farm palette instead of Slate/Violet, pixel-stepped frames instead of radii,
   the game's own pixel icons instead of Lucide. Every pixel image is drawn at whole texels. */

@font-face {
  font-family: "Nunito";
  src: url(/fonts/nunito-latin.woff2) format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* one texel of UI art, and one texel of the hero race (JS snaps it to whole device pixels) */
  --px: 2px;
  --scene-px: 2px;

  /* primitives: the game's palette (Art/Palette.swift) */
  --ink: #2B1D14;
  --wood-deep: #4A2C1A;
  --wood-dark: #6B4127;
  --wood: #925C33;
  --wood-light: #BE8048;
  --paper-dark: #D9B07A;
  --paper-shade: #EDCB92;
  --paper: #F9E3B4;
  --paper-light: #FFF3D6;
  --sky: #8DD3F3;
  --night: #1C2452;
  --night-deep: #141A3E;
  --gold: #EDBB45;
  --gold-light: #FFE07E;
  --gold-dark: #B07F22;
  --leaf: #3B7A30;
  --leaf-dark: #24521D;
  --rare: #2C64A0;
  --epic: #5A2D86;

  /* semantic roles */
  --background: var(--paper-light);
  --foreground: var(--ink);
  --muted-foreground: var(--wood-dark);
  --tint: #FCEBC5;            /* half paper, half paper-light: section bands */
  --sky-color: var(--sky);
  --card-foreground: var(--ink);
  --card-muted: var(--wood-dark);
  --ring: #1F5C86;
  --success: #2B6326;
  --danger: #9A2C26;
  --hairline: rgb(107 65 39 / .25);

  --font: ui-rounded, "Nunito", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  --gutter: 16px;
  --container: 1160px;

  /* motion (transitions.dev tokens) */
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-slow: 400ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* transitions.dev recipes: accordion, error shake, success check, texts reveal */
  --acc-expand: 250ms;
  --acc-collapse: 250ms;
  --acc-chevron: 250ms;
  --acc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shake-distance: 6px;
  --shake-overshoot: 4px;
  --shake-dur-a: 80ms;
  --shake-dur-b: 60ms;
  --shake-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --revert-dur: 280ms;
  --check-opacity-dur: 500ms;
  --check-rotate-dur: 500ms;
  --check-rotate-from: 80deg;
  --check-bob-dur: 500ms;
  --check-y-amount: 10px;      /* tuned down from 40px: the check is a 22px inline icon */
  --check-blur-dur: 500ms;
  --check-blur-from: 4px;
  --check-path-dur: 500ms;
  --check-path-delay: 80ms;
  --check-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --check-ease-opacity: cubic-bezier(0.22, 1, 0.36, 1);
  --check-ease-rotate: cubic-bezier(0.22, 1, 0.36, 1);
  --check-ease-bob: cubic-bezier(0.34, 1.35, 0.64, 1);
  --check-ease-path: cubic-bezier(0.22, 1, 0.36, 1);
  --stagger-dur: 500ms;
  --stagger-distance: 12px;
  --stagger-stagger: 40ms;
  --stagger-blur: 3px;
  --stagger-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 768px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }
@media (min-width: 1280px) { :root { --gutter: 40px; } }

/* night: the ranch after dark. The sky goes navy; parchment cards stay lit, as in the game. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: var(--night-deep);
    --foreground: var(--paper-light);
    --muted-foreground: #C9D6EA;
    --tint: #19204A;
    --sky-color: var(--night);
    --ring: var(--gold-light);
    --success: #A6D763;
    --danger: #F4A3AE;
    --hairline: rgb(201 214 234 / .2);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: var(--night-deep);
  --foreground: var(--paper-light);
  --muted-foreground: #C9D6EA;
  --tint: #19204A;
  --sky-color: var(--night);
  --ring: var(--gold-light);
  --success: #A6D763;
  --danger: #F4A3AE;
  --hairline: rgb(201 214 234 / .2);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 500 17px/1.55 var(--font);
  text-transform: lowercase;   /* the copy is written lowercase; this keeps any stray capital out */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
img { image-rendering: pixelated; }
.phone img, .phone video { image-rendering: auto; }
h1, h2, h3 { margin: 0; font-weight: 900; line-height: 1.08; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6.2vw, 5rem); line-height: 1.02; letter-spacing: -0.025em; }
h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); }
h3 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.005em; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 3px; }
strong { font-weight: 800; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
input { text-transform: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

.skip { position: absolute; left: 12px; top: -100px; z-index: 50; padding: 10px 14px; background: var(--paper-light); color: var(--ink); font-weight: 800; }
.skip:focus { top: 12px; }

.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }
.narrow { max-width: calc(760px + 2 * var(--gutter)); }

.eyebrow { font-size: .95rem; font-weight: 800; color: var(--muted-foreground); margin-bottom: 10px; letter-spacing: .01em; }
.lead { font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.5; font-weight: 600; }
.note { margin-top: 28px; color: var(--muted-foreground); text-align: center; }

.section { padding-block: 56px; }
@media (min-width: 768px) { .section { padding-block: 80px; } }
@media (min-width: 1024px) { .section { padding-block: 104px; } }
.section-tint { background: var(--tint); }
.section-head { max-width: 720px; margin: 0 auto 40px; text-align: center; }
.section-head .lead { margin-top: 16px; }

/* ---------- pixel frames (9-slice art from the app) ---------- */

.card {
  border-style: solid;
  border-width: calc(4 * var(--px)) calc(4 * var(--px)) calc(6 * var(--px));
  border-image: url(/art/frames/card.png) 4 4 6 fill / calc(4 * var(--px)) calc(4 * var(--px)) calc(6 * var(--px)) stretch;
  image-rendering: pixelated;
  color: var(--card-foreground);
  padding: 16px 18px 14px;
}
.card p { color: var(--card-muted); }
.card h3 { color: var(--card-foreground); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 2px 18px 0;
  border-style: solid;
  border-width: calc(5 * var(--px)) calc(5 * var(--px)) calc(6 * var(--px));
  border-image: url(/art/frames/button-primary.png) 5 5 6 fill / calc(5 * var(--px)) calc(5 * var(--px)) calc(6 * var(--px)) stretch;
  image-rendering: pixelated;
  background: none;
  color: var(--paper-light);
  font-weight: 800; font-size: 1.05rem; line-height: 1;
  text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: filter var(--duration-quick) var(--ease-smooth-out);
}
.btn:hover { filter: brightness(1.07); }
.btn:active, .btn.is-pressed {
  border-width: calc(6 * var(--px)) calc(5 * var(--px)) calc(5 * var(--px));
  border-image: url(/art/frames/button-primary-pressed.png) 6 5 5 fill / calc(6 * var(--px)) calc(5 * var(--px)) calc(5 * var(--px)) stretch;
}
.btn[disabled], .btn[aria-busy="true"] { cursor: progress; filter: saturate(.7); }
.btn-small { min-height: 44px; padding: 2px 14px 0; font-size: .95rem; }
.btn-quiet {
  color: var(--ink);
  border-image: url(/art/frames/button-quiet.png) 5 5 6 fill / calc(5 * var(--px)) calc(5 * var(--px)) calc(6 * var(--px)) stretch;
}
.btn-quiet:active, .btn-quiet.is-pressed {
  border-image: url(/art/frames/button-quiet-pressed.png) 6 5 5 fill / calc(6 * var(--px)) calc(5 * var(--px)) calc(5 * var(--px)) stretch;
}

.field {
  width: 100%;
  min-height: 52px;
  padding: 0 10px;
  border-style: solid;
  border-width: calc(4 * var(--px));
  border-image: url(/art/frames/field.png) 4 fill / calc(4 * var(--px)) stretch;
  image-rendering: pixelated;
  background: none;
  color: var(--ink);
  font-weight: 600; font-size: 1.05rem;
}
.field::placeholder { color: #8A6A4E; opacity: 1; }
.field[aria-invalid="true"] { border-image-source: url(/art/frames/field-error.png); }
.field:focus-visible { outline-offset: 2px; }

/* ---------- sprites ---------- */

.sprite {
  --w: 32; --h: 24; --frames: 4; --dur: .32s; --s: var(--px);
  display: inline-block;
  width: calc(var(--w) * var(--s));
  height: calc(var(--h) * var(--s));
  background-image: var(--strip);
  background-repeat: no-repeat;
  background-size: calc(var(--w) * var(--frames) * var(--s)) 100%;
  image-rendering: pixelated;
  animation: sprite var(--dur) steps(4, jump-none) infinite;
}
/* frame k of n sits at background-position k/(n-1); steps(n, jump-none) lands on exactly those */
@keyframes sprite { from { background-position-x: 0%; } to { background-position-x: 100%; } }
.pig-run { --dur: .3s; }
.pig-idle, .pig-eat { --frames: 2; --dur: 1s; animation-timing-function: steps(2, jump-none); }
.pig-eat { --dur: .66s; }
.pig-happy { --frames: 1; animation: hop 1.4s var(--ease-smooth-out) infinite; background-size: 100% 100%; }
.idol { --w: 36; --h: 44; --frames: 8; --dur: 2.4s; animation-timing-function: steps(8, jump-none); }
.critter.chicken { --w: 16; --h: 16; --dur: .36s; }
.critter.cow { --w: 32; --h: 24; --dur: 1.2s; }
.critter.portal { --w: 28; --h: 76; --dur: .5s; }
.puff { --w: 16; --h: 16; --dur: .9s; }
.elder { --frames: 2; --dur: 2.2s; animation-timing-function: steps(2, jump-none); }
.wild-pig { --frames: 2; --dur: 1.2s; animation-timing-function: steps(2, jump-none); }
.piglet { --dur: .3s; }
@keyframes hop {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(calc(-5 * var(--px))); }
}

/* ---------- nav ---------- */

.nav {
  position: relative; z-index: 3;
  display: flex; align-items: center; gap: 20px;
  width: 100%; max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto; padding: 14px var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.3rem; text-decoration: none; letter-spacing: -0.02em; }
.brand img { border-radius: 8px; image-rendering: auto; }
.nav-links { display: none; gap: 4px; margin-left: auto; }
.nav-links a { display: inline-block; padding: 10px 12px; font-weight: 700; text-decoration: none; border-radius: 6px; transition: background-color var(--duration-quick) var(--ease-smooth-out); }
.nav-links a:hover { background: rgb(43 29 20 / .08); }
.nav .btn { margin-left: auto; }
@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav .btn { margin-left: 8px; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 100svh;
  background: var(--sky-color);
  color: var(--ink);
  overflow: hidden;
}
.sky { position: absolute; inset: 0; pointer-events: none; }
.cloud { position: absolute; width: calc(var(--w) * var(--px)); height: auto; animation: drift 90s linear infinite; }
.cloud-1 { --w: 72; top: 16%; left: -10%; }
.cloud-2 { --w: 52; top: 30%; left: 30%; animation-duration: 120s; animation-delay: -50s; }
.cloud-3 { --w: 40; top: 9%; left: 62%; animation-duration: 105s; animation-delay: -20s; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(110vw); } }
.moon { display: none; position: absolute; top: 12%; right: 12%; width: calc(22 * var(--px)); height: auto; }

.hero-copy {
  position: relative; z-index: 2;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; max-width: calc(780px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 8px var(--gutter) 28px;
  text-align: center;
}
.logo { width: calc(144 * var(--px)); height: auto; margin-bottom: 18px; }
.hero .eyebrow { color: var(--wood-dark); }
.hero h1 span { display: inline-block; }
.hero .lead { max-width: 34em; margin-top: 18px; color: var(--wood-deep); }

.beta-form { width: 100%; max-width: 520px; margin-top: 26px; text-align: left; }
.beta-form label { display: block; font-weight: 800; margin-bottom: 8px; }
.beta-row { display: flex; flex-direction: column; gap: 10px; }
.beta-row .btn { width: 100%; }
@media (min-width: 560px) {
  .beta-row { flex-direction: row; }
  .beta-row .btn { width: auto; flex: none; }
}
.beta-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-height: 1.5em; }
.beta-note { font-size: .95rem; font-weight: 600; color: var(--wood-dark); }
.beta-status .t-success-check { display: none; flex: none; }
.beta-form.is-done .t-success-check { display: inline-block; }
.t-success-check circle { fill: var(--leaf); }
.t-success-check path { fill: none; stroke: var(--paper-light); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* transitions.dev success check */
.t-success-check {
  display: inline-block;
  transform-origin: center;
  opacity: 0;
  will-change: transform, opacity, filter;
}
.t-success-check svg { display: block; overflow: visible; }
.t-success-check svg path {
  stroke-dasharray: 17;        /* path.getTotalLength() = 15.77, rounded up */
  stroke-dashoffset: 17;
}
.t-success-check[data-state="in"] {
  animation:
    t-check-fade   var(--check-opacity-dur) var(--check-ease-opacity) forwards,
    t-check-rotate var(--check-rotate-dur)  var(--check-ease-rotate)  forwards,
    t-check-blur   var(--check-blur-dur)    var(--check-ease-out)     forwards,
    t-check-bob    var(--check-bob-dur)     var(--check-ease-bob)     forwards;
}
.t-success-check[data-state="in"] svg path {
  animation: t-check-draw var(--check-path-dur) var(--check-ease-path) var(--check-path-delay, 0ms) forwards;
}
@keyframes t-check-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes t-check-rotate {
  from { transform: rotate(var(--check-rotate-from)); }
  to   { transform: rotate(0deg); }
}
@keyframes t-check-blur {
  from { filter: blur(var(--check-blur-from)); }
  to   { filter: blur(0); }
}
@keyframes t-check-bob {
  from { translate: 0 var(--check-y-amount); }
  to   { translate: 0 0; }
}
@keyframes t-check-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .t-success-check { animation: none !important; opacity: 1; }
  .t-success-check svg path { animation: none !important; stroke-dashoffset: 0 !important; }
}

/* transitions.dev error shake (the message stays until the field is edited) */
.t-input { will-change: transform; }
.t-input.is-shaking {
  animation: t-input-shake calc(
      var(--shake-dur-a) * 2 + var(--shake-dur-b) * 2
    ) linear;
}
@keyframes t-input-shake {
  0%      { transform: translateX(0);                                 animation-timing-function: var(--shake-ease); }
  28.57%  { transform: translateX(var(--shake-distance));             animation-timing-function: var(--shake-ease); }
  57.14%  { transform: translateX(calc(var(--shake-distance) * -1)); animation-timing-function: var(--shake-ease); }
  78.57%  { transform: translateX(var(--shake-overshoot));            animation-timing-function: var(--shake-ease); }
  100%    { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .t-input { animation: none !important; transform: none !important; }
}
.beta-note.is-error { color: var(--danger); }
.beta-note.is-success { color: var(--success); }
.beta-form.is-done .beta-row { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* transitions.dev texts reveal, for the hero copy on load */
.js .t-stagger-line {
  opacity: 0;
  transform: translateY(var(--stagger-distance));
  filter: blur(var(--stagger-blur));
  transition:
    opacity   var(--stagger-dur) var(--stagger-ease),
    transform var(--stagger-dur) var(--stagger-ease),
    filter    var(--stagger-dur) var(--stagger-ease);
  will-change: transform, opacity, filter;
}
.js .t-stagger-line--2 { transition-delay: var(--stagger-stagger); }
.js .t-stagger-line--3 { transition-delay: calc(var(--stagger-stagger) * 2); }
.js .t-stagger-line--4 { transition-delay: calc(var(--stagger-stagger) * 3); }
.js .t-stagger-line--5 { transition-delay: calc(var(--stagger-stagger) * 4); }
.js .t-stagger.is-shown .t-stagger-line {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}
@media (prefers-reduced-motion: reduce) {
  .t-stagger-line { transition: none !important; }
}

/* the race at the bottom of the hero */
.track { position: relative; z-index: 1; height: calc(276 * var(--scene-px)); overflow: hidden; }
.track-scene {
  position: absolute; left: 50%; bottom: 0;
  width: calc(1600 * var(--scene-px)); height: calc(276 * var(--scene-px));
  transform: translateX(-50%);
}
.track-scene .layer { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.crowd-1 { animation: crowd 1.1s linear infinite; }
@keyframes crowd { 0%, 49.9% { opacity: 0; } 50%, 100% { opacity: 1; } }
.racers { pointer-events: none; }
.racer {
  position: absolute; left: 0; top: 0;
  width: calc(32 * var(--scene-px)); height: calc(24 * var(--scene-px));
  background-repeat: no-repeat;
  background-size: calc(128 * var(--scene-px)) 100%;
  image-rendering: pixelated;
  animation: sprite .3s steps(4, jump-none) infinite;
  will-change: transform;
}
.gas {
  position: absolute; left: 0; top: 0;
  width: calc(16 * var(--scene-px)); height: calc(16 * var(--scene-px));
  background-repeat: no-repeat;
  background-size: calc(64 * var(--scene-px)) 100%;
  image-rendering: pixelated;
  animation: sprite .7s steps(4, jump-none) forwards;
}
.track-toggle {
  position: absolute; z-index: 4; right: var(--gutter); bottom: 14px;
  min-height: 44px; padding: 0 12px;
  border-style: solid; border-width: calc(4 * var(--px));
  border-image: url(/art/frames/hud.png) 4 fill / calc(4 * var(--px)) stretch;
  image-rendering: pixelated;
  background: none; color: var(--paper-light);
  font-weight: 800; font-size: .85rem; cursor: pointer;
}
.hero.is-paused .racer, .hero.is-paused .crowd-1, .hero.is-paused .gas, .hero.is-paused .cloud { animation-play-state: paused; }

/* ---------- phone frames ---------- */

.phone { margin: 0 auto; width: min(100%, 320px); }
.phone-screen {
  position: relative;
  padding: 10px;
  border-radius: 46px;
  background: #16100C;
  box-shadow: 0 0 0 2px #4A2C1A, 0 24px 48px -24px rgb(43 29 20 / .5);
}
.phone-screen > img, .phone-screen > video { width: 100%; height: auto; aspect-ratio: 590 / 1282; border-radius: 36px; background: #2B1D14; object-fit: cover; }
.phone figcaption { margin-top: 14px; font-size: .9rem; color: var(--muted-foreground); text-align: center; }
.video-toggle {
  position: absolute; right: 20px; bottom: 20px;
  width: 44px; height: 44px;
  border: 0; border-radius: 22px;
  background: rgb(22 16 12 / .7) url(/art/icons/soundOff.png) center / 24px no-repeat;
  cursor: pointer; opacity: .85;
}
.video-toggle::before, .video-toggle::after {
  content: ""; position: absolute; top: 14px; width: 5px; height: 16px; background: var(--paper-light); border-radius: 1px;
}
.video-toggle { background-image: none; }
.video-toggle::before { left: 15px; }
.video-toggle::after { right: 15px; }
.video-toggle.is-paused::before { left: 17px; width: 0; height: 0; background: none; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent var(--paper-light); border-radius: 0; top: 13px; }
.video-toggle.is-paused::after { display: none; }

/* ---------- split layouts ---------- */

.split { display: grid; gap: 40px; align-items: center; }
.split-text { max-width: 560px; }
.split-text .lead { margin-top: 18px; }
.split-text > p + p { margin-top: 14px; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; gap: 64px; }
  .split .phone { width: min(100%, 340px); }
  .split-reverse .phone { order: 2; }
}

/* ---------- a day at the ranch ---------- */

.steps { display: grid; gap: 16px; counter-reset: step; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.step { display: flex; flex-direction: column; }
.step-art { position: relative; display: grid; place-items: center; height: 96px; margin-bottom: 12px; }
.step-art .sprite { --s: calc(var(--px) * 1.5); }
@supports (width: calc(1px * 3)) { .step-art .sprite { --s: calc(var(--px) * 2); } }
.heart-pop { position: absolute; top: 4px; left: calc(50% + 28px); width: 32px; animation: float-up 1.4s var(--ease-smooth-out) infinite; }
@keyframes float-up { 0% { transform: translateY(8px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-10px); opacity: 0; } }
.step h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 14px; background: var(--leaf); color: var(--paper-light); font-size: .95rem; }
.diary { max-width: 560px; margin: 36px auto 0; text-align: center; }
.diary blockquote { margin: 0; font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 800; }
.diary blockquote::before { content: "“"; }
.diary blockquote::after { content: "”"; }
.diary figcaption { margin-top: 8px; color: var(--muted-foreground); }

/* ---------- the road ---------- */

.road { display: grid; gap: 16px; }
@media (min-width: 640px) { .road { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .road { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.region { display: flex; flex-direction: column; padding: 10px 10px 14px; }
.postcard { position: relative; height: 200px; overflow: hidden; background: var(--sky); margin-bottom: 14px; border: 2px solid rgb(43 29 20 / .5); }
.postcard img { position: absolute; left: 50%; bottom: -26px; width: 352px; max-width: none; height: 240px; transform: translateX(-50%); }
.postcard-pig { position: absolute; left: 0; bottom: 30px; --s: 1px; animation: sprite .3s steps(4, jump-none) infinite, lap 7s linear infinite; }
.region:nth-child(2) .postcard-pig { animation-delay: 0s, -2.2s; }
.region:nth-child(3) .postcard-pig { animation-delay: 0s, -4.1s; }
.region:nth-child(4) .postcard-pig { animation-delay: 0s, -1.3s; }
.region:nth-child(5) .postcard-pig { animation-delay: 0s, -5.4s; }
.region:nth-child(6) .postcard-pig { animation-delay: 0s, -3.3s; }
@keyframes lap { from { transform: translateX(-40px); } to { transform: translateX(420px); } }
.region h3, .region p { padding-inline: 8px; }
.region h3 { margin-bottom: 4px; }
.region .prize { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; font-weight: 700; color: var(--card-foreground); }
.region .prize img { width: 24px; }
.region-gold { border-image-source: url(/art/frames/button-gold.png); border-image-slice: 5 5 6 fill; border-width: calc(5 * var(--px)) calc(5 * var(--px)) calc(6 * var(--px)); border-image-width: calc(5 * var(--px)) calc(5 * var(--px)) calc(6 * var(--px)); }
.region-gold p { color: var(--ink); }

/* ---------- items and surprises ---------- */

.items { display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.items li { display: grid; grid-template-columns: 36px 1fr; gap: 2px 14px; align-items: start; }
.items img { grid-row: span 2; width: 36px; margin-top: 2px; }
.items p { color: var(--muted-foreground); }
.extras { display: grid; gap: 16px; margin-top: 48px; }
@media (min-width: 900px) { .extras { grid-template-columns: 3fr 2fr; gap: 20px; } }
.extra { padding: 22px 22px 18px; }
.extra h3 { margin-bottom: 14px; }
.surprises { display: grid; gap: 12px; }
.surprises li { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 14px; color: var(--card-muted); }
.surprises strong { color: var(--card-foreground); }
.surprises .sprite, .surprises .icon-art { justify-self: center; }
.critter.portal { --s: 1px; }
.icon-art img { width: 36px; }
.farts { position: relative; height: 80px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.fart-pig { position: relative; z-index: 1; }
.farts .puff { position: absolute; left: calc(50% - 72px); top: 22px; --s: calc(var(--px) * 1.5); }

/* ---------- victory live (night band) ---------- */

.section-night {
  color: var(--paper-light);
  background: var(--night) url(/art/sky/stars.png) 0 0 / calc(160 * var(--px)) calc(120 * var(--px)) repeat;
  image-rendering: pixelated;
}
.section-night .eyebrow { color: var(--gold-light); }
.section-night .phone figcaption { color: #C9D6EA; }
.idols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 16px; margin-top: 30px; }
@media (min-width: 640px) { .idols { grid-template-columns: repeat(4, 1fr); } }
.idols li { text-align: center; }
.idols .sprite { --s: calc(var(--px) * 1.5); margin: 0 auto 8px; display: block; }
.idols li:nth-child(2) .sprite { animation-delay: -.6s; }
.idols li:nth-child(3) .sprite { animation-delay: -1.2s; }
.idols li:nth-child(4) .sprite { animation-delay: -1.8s; }
.idols h3 { font-size: 1.1rem; }
.idols p { font-size: .92rem; color: #C9D6EA; margin-top: 4px; }

/* ---------- the pigs ---------- */

.breeds { position: relative; }
.tabs {
  position: relative;
  display: flex; gap: 4px;
  width: max-content; max-width: 100%;
  margin: 0 auto 26px; padding: 4px;
  background: rgb(43 29 20 / .07);
  border-radius: 12px;
}
:root[data-theme="dark"] .tabs { background: rgb(255 243 214 / .08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs { background: rgb(255 243 214 / .08); } }
.tab {
  position: relative; z-index: 1;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 8px; background: none;
  font-weight: 800; cursor: pointer;
  color: var(--muted-foreground);
  transition: color var(--duration-fast) ease-in-out;
}
.tab span { font-weight: 700; opacity: .7; margin-left: 2px; }
.tab[aria-selected="true"] { color: var(--paper-light); }
.tabs-pill {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0;
  width: var(--pill-w, 0); transform: translateX(var(--pill-x, 0));
  border-radius: 8px; background: var(--leaf);
  transition: transform var(--duration-fast) var(--ease-smooth-out), width var(--duration-fast) var(--ease-smooth-out);
}
.breed-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.breed-grid[hidden] { display: none; }
.breed {
  display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center;
  padding: 12px 14px 12px 12px;
  border-style: solid; border-width: calc(4 * var(--px));
  border-image: url(/art/frames/slot.png) 4 fill / calc(4 * var(--px)) stretch;
  image-rendering: pixelated;
  color: var(--ink);
}
.breed-art { width: 96px; height: 96px; }
.breed-art img { width: 96px; height: 96px; }
.breed h3 { font-size: 1.1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.breed p { font-size: .95rem; color: var(--wood-dark); margin-top: 4px; line-height: 1.45; }
.breed .breed-move { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--ink); }
.breed-move img { width: 24px; }
.rarity { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: .75rem; font-weight: 800; letter-spacing: .02em; color: var(--paper-light); background: var(--wood-dark); }
.rarity-rare { background: var(--rare); }
.rarity-epic { background: var(--epic); }
.rarity-legendary { background: var(--gold-dark); }
.ways { display: grid; gap: 14px; max-width: 920px; margin: 34px auto 0; }
@media (min-width: 768px) { .ways { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
.ways li { display: flex; gap: 12px; align-items: flex-start; }
.ways img { width: 36px; flex: none; margin-top: 2px; }
.ways p { color: var(--muted-foreground); }
.ways strong { color: var(--foreground); }

/* trading card (tilt + glare, transitions.dev "card hover tilt") */
.cards-feature { margin-top: 72px; }
.pig-card-wrap { perspective: 900px; display: grid; place-items: center; }
.pig-card {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 30%;
  position: relative;
  width: 300px;
  padding: 10px;
  background: linear-gradient(160deg, #FFE07E, #EDBB45 40%, #B07F22);
  border: 3px solid #6E4410;
  border-radius: 14px;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform var(--duration-slow) var(--ease-smooth-out);
  box-shadow: 0 30px 50px -28px rgb(43 29 20 / .7);
}
.pig-card.is-tilting { transition: transform 80ms linear; }
.pig-card-inner { background: var(--paper-light); border: 2px solid #6E4410; border-radius: 8px; padding: 12px; color: var(--ink); }
.pig-card-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 900; font-size: 1.25rem; }
.pig-card-rarity { font-size: .75rem; font-weight: 800; padding: 2px 8px; border-radius: 9999px; background: var(--gold-dark); color: var(--paper-light); }
.pig-card-art { display: grid; place-items: center; height: 160px; margin: 10px 0; background: linear-gradient(#8DD3F3 62%, #5A9E3E 62%); border: 2px solid #6E4410; border-radius: 4px; }
.pig-card-art img { width: 144px; height: 144px; }
.pig-card-breed { font-size: .85rem; font-weight: 700; color: var(--wood-dark); padding: 6px 8px; background: var(--paper); border-radius: 4px; }
.pig-card-stats { margin: 10px 0 0; display: grid; gap: 6px; }
.pig-card-stats div { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; font-size: .85rem; }
.pig-card-stats dt { color: var(--wood-dark); font-weight: 700; }
.pig-card-stats dd { margin: 0; font-weight: 800; display: grid; grid-template-columns: 1fr 60px; gap: 6px; align-items: center; }
.meter { display: block; height: 8px; background: var(--paper-shade); border: 1px solid #925C33; position: relative; }
.meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); background: var(--gold); }
.pig-card-quote { margin-top: 10px; font-size: .9rem; font-weight: 700; font-style: italic; color: var(--wood-deep); }
.pig-card-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: .75rem; font-weight: 700; color: var(--wood-dark); }
.pig-card-glare {
  position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  background: radial-gradient(circle at var(--gx) var(--gy), rgb(255 255 255 / .45), rgb(255 255 255 / 0) 55%);
  mix-blend-mode: soft-light; opacity: 0; transition: opacity var(--duration-slow) var(--ease-smooth-out);
}
.pig-card.is-tilting .pig-card-glare { opacity: 1; }
.h3-large { font-size: clamp(1.6rem, 2.8vw, 2.25rem); }
.cards-feature .split-text p { margin-top: 14px; color: var(--muted-foreground); }

/* ---------- the ranch ---------- */

.buildings { margin: 28px 0 22px; }
.buildings h3 { font-size: 1rem; color: var(--muted-foreground); margin-bottom: 10px; }
.buildings ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; margin-bottom: 18px; }
@media (min-width: 560px) { .buildings ul { grid-template-columns: repeat(6, 1fr); } }
.buildings li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; font-size: .85rem; font-weight: 700; line-height: 1.2; }
.buildings img { width: 96px; max-width: 100%; height: auto; }

.grows { margin: 4px 0 26px; }
.grows-row { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.grows-row img { height: auto; image-rendering: pixelated; }
.grows-row img:nth-child(1) { width: 96px; }
.grows-row img:nth-child(2) { width: 128px; }
.grows-row img:nth-child(3) { width: 160px; }
.grows figcaption { margin-top: 8px; font-size: .9rem; color: var(--muted-foreground); }
@media (max-width: 559px) {
  .grows-row { gap: 12px; flex-wrap: nowrap; }
  .grows-row img:nth-child(1) { width: 72px; }
  .grows-row img:nth-child(2) { width: 96px; }
  .grows-row img:nth-child(3) { width: 120px; }
}
.buildings ul + .grows { margin-top: -4px; }
.buildings-more { margin: -6px 0 18px; font-size: .9rem; color: var(--muted-foreground); }

/* ---------- family and wild ---------- */

.two { display: grid; gap: 16px; }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; gap: 20px; } }
.story { padding: 22px 24px 20px; }
.story h3 { font-size: 1.4rem; margin-bottom: 10px; }
.story p + p { margin-top: 12px; }
.story-art { display: flex; align-items: flex-end; justify-content: center; gap: 18px; height: 110px; margin-bottom: 16px; }
.story-art .sprite { --s: calc(var(--px) * 2); }
.story-art .piglet { --s: var(--px); margin-bottom: 4px; }
.story-art img { width: 64px; height: auto; }

/* ---------- festivals ---------- */

.festivals { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (min-width: 1024px) { .festivals { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.festivals li { display: flex; flex-direction: column; padding: 18px 20px 16px; }
.festivals img { height: 96px; width: auto; object-fit: contain; object-position: left bottom; margin-bottom: 12px; }
.festivals .when { font-size: .85rem; font-weight: 800; color: var(--leaf); margin-bottom: 2px; }
.festivals h3 { margin-bottom: 6px; }

/* ---------- about: the maker and the idea ---------- */

.about { display: grid; gap: 32px; align-items: start; }
@media (min-width: 900px) { .about { grid-template-columns: 1fr minmax(280px, 340px); gap: 64px; } }
.maker { padding: 22px 22px 18px; text-align: center; }
@media (min-width: 900px) { .maker { position: sticky; top: 24px; } }
.maker-photo { width: 160px; height: 160px; margin: 0 auto 14px; border-radius: 9999px; object-fit: cover; image-rendering: auto; border: 3px solid var(--wood-dark); background: var(--paper); }
.maker h3 { font-size: 1.35rem; }
.maker-role { margin-top: 2px; font-weight: 700; color: var(--leaf) !important; }
.maker > p:not(.maker-role) { margin-top: 12px; text-align: left; }
.maker-links { display: grid; gap: 2px; margin-top: 14px; text-align: left; }
.maker-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; color: var(--ink); }
.about-text { max-width: 620px; }
.about-text .lead { margin-top: 18px; }
.about-text > p + p { margin-top: 14px; }
.signoff { margin-top: 22px !important; font-weight: 800; }

/* ---------- faq (transitions.dev accordion) ---------- */

.faq { display: grid; gap: 10px; }
.faq-item {
  border-style: solid; border-width: calc(4 * var(--px)) calc(4 * var(--px)) calc(6 * var(--px));
  border-image: url(/art/frames/note.png) 4 4 6 fill / calc(4 * var(--px)) calc(4 * var(--px)) calc(6 * var(--px)) stretch;
  image-rendering: pixelated;
  color: var(--ink);
}
.faq-q { font-size: 1.08rem; }
.t-acc-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  width: 100%; min-height: 56px; padding: 10px 16px;
  border: 0; background: none; text-align: left;
  font-weight: 800; font-size: inherit; line-height: 1.35; color: var(--ink);
  cursor: pointer;
}
.t-acc-chevron { flex: none; color: var(--wood-dark); }
.t-acc-chevron svg { width: 16px; height: 16px; }
.t-acc-chevron path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.t-acc-panel-inner p { padding: 0 16px 16px; color: var(--wood-dark); max-width: 60ch; }

/* grid-template-rows 0fr -> 1fr gives a clean height animation
   with no JS measurement; the inner element clips overflow. */
.t-acc-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--acc-collapse) var(--acc-ease);
}
.t-acc[data-open="true"] .t-acc-panel {
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--acc-expand) var(--acc-ease);
}
.t-acc-panel-inner {
  overflow: hidden;
  opacity: 0;
  filter: blur(2px);
  transition:
    opacity var(--acc-collapse) var(--acc-ease),
    filter var(--acc-collapse) var(--acc-ease);
}
.t-acc[data-open="true"] .t-acc-panel-inner {
  opacity: 1;
  filter: blur(0);
  transition:
    opacity var(--acc-expand) var(--acc-ease),
    filter var(--acc-expand) var(--acc-ease);
}
/* Flip the chevron vertically to turn the "v" into a "^". */
.t-acc-chevron {
  display: inline-flex;
  transform: scaleY(1);
  transform-origin: center;
  transition: transform var(--acc-chevron) var(--acc-ease);
}
.t-acc-chevron path { vector-effect: non-scaling-stroke; }
.t-acc[data-open="true"] .t-acc-chevron {
  transform: scaleY(-1);
}

.faq.is-init .t-acc-panel, .faq.is-init .t-acc-panel-inner, .faq.is-init .t-acc-chevron { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .t-acc-panel, .t-acc-panel-inner, .t-acc-chevron {
    transition: none !important;
  }
}

/* ---------- final cta ---------- */

.cta { background: var(--sky-color); color: var(--ink); text-align: center; position: relative; overflow: hidden; }
.cta-inner { display: flex; flex-direction: column; align-items: center; }
.cta-pigs { display: flex; gap: 18px; margin-bottom: 18px; }
.cta-pigs .sprite { --s: calc(var(--px) * 2); }
.cta-pigs .sprite:nth-child(2) { animation-delay: -.5s; }
.cta-pigs .sprite:nth-child(3) { animation-delay: -.2s; }
.cta .lead { margin-top: 14px; max-width: 30em; color: var(--wood-deep); }
.cta .beta-form { margin-top: 26px; }

/* ---------- footer ---------- */

.footer { padding: 44px 0 36px; border-top: 1px solid var(--hairline); }
.footer-inner { display: grid; gap: 22px; }
@media (min-width: 900px) { .footer-inner { grid-template-columns: 1fr auto auto; align-items: center; gap: 32px; } }
.footer-brand p { margin-top: 6px; color: var(--muted-foreground); font-size: .95rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.footer-links a { display: inline-block; padding: 10px 10px; font-weight: 700; text-decoration: none; border-radius: 6px; }
.footer-links a:hover { text-decoration: underline; }
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgb(43 29 20 / .07); width: max-content; }
:root[data-theme="dark"] .theme-switch { background: rgb(255 243 214 / .08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-switch { background: rgb(255 243 214 / .08); } }
.theme-switch button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 7px; background: none; font-weight: 800; font-size: .9rem; color: var(--muted-foreground); cursor: pointer; }
.theme-switch button[aria-checked="true"] { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px rgb(0 0 0 / .15); }
.footer-small { color: var(--muted-foreground); font-size: .85rem; }
@media (min-width: 900px) { .footer-small { grid-column: 1 / -1; } }

/* ---------- night: sky, stars and moonlit race ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero,
  :root:not([data-theme="light"]) .cta { color: var(--paper-light); background: var(--night) url(/art/sky/stars.png) 0 0 / calc(160 * var(--px)) calc(120 * var(--px)) repeat; }
  :root:not([data-theme="light"]) .hero .eyebrow,
  :root:not([data-theme="light"]) .hero .lead,
  :root:not([data-theme="light"]) .cta .lead,
  :root:not([data-theme="light"]) .beta-note { color: #E1E6F5; }
  :root:not([data-theme="light"]) .cloud { display: none; }
  :root:not([data-theme="light"]) .moon { display: block; }
  :root:not([data-theme="light"]) .track-scene,
  :root:not([data-theme="light"]) .postcard { filter: brightness(.72) saturate(.85) hue-rotate(-8deg); }
  :root:not([data-theme="light"]) .nav-links a:hover { background: rgb(255 243 214 / .1); }
  :root:not([data-theme="light"]) .beta-note.is-error { color: var(--danger); }
  :root:not([data-theme="light"]) .beta-note.is-success { color: var(--success); }
}
:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .cta { color: var(--paper-light); background: var(--night) url(/art/sky/stars.png) 0 0 / calc(160 * var(--px)) calc(120 * var(--px)) repeat; }
:root[data-theme="dark"] .hero .eyebrow,
:root[data-theme="dark"] .hero .lead,
:root[data-theme="dark"] .cta .lead,
:root[data-theme="dark"] .beta-note { color: #E1E6F5; }
:root[data-theme="dark"] .cloud { display: none; }
:root[data-theme="dark"] .moon { display: block; }
:root[data-theme="dark"] .track-scene,
:root[data-theme="dark"] .postcard { filter: brightness(.72) saturate(.85) hue-rotate(-8deg); }
:root[data-theme="dark"] .nav-links a:hover { background: rgb(255 243 214 / .1); }
:root[data-theme="dark"] .beta-note.is-error { color: var(--danger); }
:root[data-theme="dark"] .beta-note.is-success { color: var(--success); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .postcard-pig { transform: translateX(150px); }
}

/* ---------- sub pages ---------- */

.page-head { background: var(--sky-color); color: var(--ink); padding-bottom: 48px; }
:root[data-theme="dark"] .page-head { color: var(--paper-light); background: var(--night) url(/art/sky/stars.png) 0 0 / calc(160 * var(--px)) calc(120 * var(--px)) repeat; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .page-head { color: var(--paper-light); background: var(--night) url(/art/sky/stars.png) 0 0 / calc(160 * var(--px)) calc(120 * var(--px)) repeat; } }
.page-head h1 { font-size: clamp(2.4rem, 5vw, 3.75rem); margin-top: 24px; }
.page-head .lead { margin-top: 14px; max-width: 36em; }
.prose { padding-block: 48px 72px; }
.prose h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 40px 0 12px; }
.prose h3 { margin: 24px 0 8px; }
.prose p, .prose li { color: var(--muted-foreground); max-width: 64ch; }
.prose p + p { margin-top: 12px; }
.prose ul { list-style: disc; padding-left: 1.2em; display: grid; gap: 6px; margin-top: 10px; }
.prose a { color: var(--foreground); font-weight: 700; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin-top: 16px; }
.facts dt { font-weight: 800; }
.facts dd { margin: 0; color: var(--muted-foreground); }
.downloads { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 16px; }
.downloads a { text-decoration: none; }
.downloads .card { display: flex; gap: 14px; align-items: center; height: 100%; }
.downloads img { width: 64px; height: 64px; object-fit: contain; }
.downloads strong { display: block; color: var(--ink); }
.downloads span { color: var(--wood-dark); font-size: .9rem; }
.shots-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 16px; }
.shots-grid img { border-radius: 18px; image-rendering: auto; border: 2px solid #4A2C1A; }
