:root {
  /* Brand book palette: Rose Gold Loot */
  --purple: #6B4A7F;
  --rose: #E8A08C;
  --dark: #2A1E2E;
  --paper: #FBF1EE;
  --gold: #F2C14E;
  --ink: #2A1E2E;
  --muted: #6E5F72;
  --muted-dark: #C9B8CC;
  --line: #E9D9D4;
  /* Radius: cards are outer, everything inside a card is inner (outer radius minus the gap between them, floored) */
  --r-outer: 18px;
  --r-inner: 6px;
  --display: "VT323", monospace;
  --body: "Anybody", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--dark);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--gold); color: var(--dark); }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
/* Brand book: display is VT323 (pixel). It runs small, so font-size-adjust sizes it by x-height like the old serif */
h1, h2, h3 { font-family: var(--display); font-weight: 400; font-size-adjust: .5; margin: 0; line-height: 1.05; text-wrap: balance; }
p { text-wrap: pretty; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding-block: 24px; color: var(--paper); }
.top.overlay { position: absolute; inset: 0 0 auto; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 64px; height: 64px; image-rendering: pixelated; } /* 64px sprite at 1x: keep whole-number scales */
.wordmark { display: grid; line-height: 1; }
.wordmark b { font: 400 1.25rem var(--display); font-size-adjust: .5; }
.wordmark small { font-size: 11px; letter-spacing: .32em; margin-top: 4px; color: var(--muted-dark); }
.top nav { display: flex; gap: 24px; font-weight: 500; font-size: .95rem; }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--gold); }
.top nav a[aria-current="page"] { color: var(--gold); text-decoration: underline; text-decoration-thickness: 2px; }

/* Buttons */
.btn {
  display: inline-block; padding: 13px 26px; border: 0; border-radius: var(--r-inner);
  transition: background-color .15s ease-out, transform .1s ease-out;
  background: var(--rose); color: var(--dark); text-decoration: none;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--gold); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .7; cursor: progress; transform: none; }
.btn-lg { padding: 16px 34px; font-size: 1.1rem; }
/* rose on rose: a dark outline keeps the button visible */
.on-rose .btn { box-shadow: inset 0 0 0 2px var(--dark); }

/* ---------- The reveal: a suspicious closed chest that opens as you scroll ---------- */
/* One pinned scene. The script sets:
   --p  0..1  the lid opening
   --c  0..1  the chest sinking to make room once the loot starts flying out
   Without JS, or with reduced motion, the scene is "static": chest open, cards stacked below. */
.reveal { --p: 0; --c: 0; position: relative; background: var(--dark); color: var(--paper); }
.reveal-stage {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  display: grid; place-items: center;
}
.reveal[data-mode="loot"] .reveal-stage { position: sticky; top: 0; height: 100vh; height: 100svh; }

/* Outlined line stack behind the chest; rows drift apart as it opens */
.stack {
  position: absolute; inset: 0; display: grid; align-content: center; gap: 0;
  pointer-events: none; user-select: none; opacity: calc(1 - var(--c) * .7);
}
.stack span {
  font: 400 clamp(5.6rem, 18vw, 16.8rem)/.85 var(--display); white-space: nowrap; text-align: center; /* pixel font, ~1.4x to match the old size */
  color: transparent; -webkit-text-stroke: 1px rgba(251, 241, 238, .14);
  transform: translateX(calc(var(--p) * var(--dir, 1) * 14vw));
}
.stack span:nth-child(even) { --dir: -1; }
.stack span.lit { -webkit-text-stroke-color: rgba(232, 160, 140, .45); }

/* Treasure light grows as the lid lifts, then follows the chest down */
.reveal-stage::before {
  content: ""; position: absolute; width: 90vmin; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(242, 193, 78, .55), rgba(232, 160, 140, .18) 55%, transparent);
  opacity: var(--p); transform: translateY(calc(var(--c) * 34vh)) scale(calc(.6 + var(--p) * .6));
}

.chest {
  position: relative; z-index: 1; width: min(70vw, 540px, 48vh); margin-top: -10vh;
  transform: translateY(calc(var(--p) * -6vh + var(--c) * 38vh)) scale(calc(1 + var(--p) * .12 - var(--c) * .56));
}
/* Sprite layers stack on one 64x64 grid; percentages below are sprite pixels / 64 */
.chest .sprite { position: relative; aspect-ratio: 1; }
.chest .sprite img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
/* Hinged at the back-left corner of the lid (x 8, y 30), then lifts open */
.chest .lid { transform-origin: 12.5% 46.875%; transform: rotate(calc(var(--p) * -28deg)); }
/* Tongue: an 11-frame strip; the script picks the frame (--f, 0-10) from how far the lid is open */
.chest .tongue {
  position: absolute; inset: 0; image-rendering: pixelated;
  background: url(img/chest-tongue.png) calc(var(--f, 0) * 10%) 0 / 1100% 100% no-repeat;
  filter: drop-shadow(0 0 6px var(--rose));
}
.chest .shine { position: absolute; inset: 0; opacity: var(--p); }
/* Mouth: columns 10-54, row 30 */
.chest .shine-mouth { position: absolute; left: 15.625%; width: 70.3%; top: 46.875%; height: 1.6%; background: radial-gradient(closest-side, #FFE7A3, #F2C14E 60%, #E8A08C); }
.chest .shine-beam {
  position: absolute; left: 3%; right: 3%; bottom: 53.125%; height: 75%;
  background: linear-gradient(to top, rgba(242, 193, 78, .75), rgba(242, 193, 78, 0));
  clip-path: polygon(19% 100%, 81% 100%, 100% 0, 0 0);
  transform-origin: 50% 100%; mix-blend-mode: screen;
}
@media (prefers-reduced-motion: no-preference) {
  .chest .shine-mouth { animation: embers 2.2s ease-in-out infinite; }
  .chest .shine-beam { animation: shimmer 3.2s ease-in-out infinite; }
}
@keyframes embers { 0%, 100% { opacity: .8; } 50% { opacity: 1; } 70% { opacity: .65; } }
@keyframes shimmer { 0%, 100% { opacity: .55; transform: scaleY(.92); } 50% { opacity: .9; transform: scaleY(1.04); } }

.intro {
  position: absolute; left: 0; right: 0; bottom: 7vh; z-index: 2; text-align: center;
  opacity: calc(1 - var(--p) * 3);
}
.intro h1 { font-size: clamp(2.6rem, 6.5vw, 5.2rem); line-height: 1; }
.intro p { margin: 12px auto 24px; color: var(--muted-dark); max-width: 40ch; }
/* ---------- Loot cards: each page comes out of the chest, pauses, then flies past ---------- */
/* Trading-card bezel: corners at 3mm on a 63mm card (4.76% of width), a see-through dark frame
   over the card's own colour. --cw tracks the card width so both scale with it. */
.card {
  --cw: min(880px, 100vw - 32px);
  --px: 6px; /* one "pixel" of the frame: the tuning knob for how chunky it looks */
  width: var(--cw); padding: clamp(28px, 5vw, 56px);
  /* Pixel frame: a 9x9 grid sliced 3/3/3, dark outer rows over the card's colour and a light inner bevel */
  border: calc(var(--px) * 3) solid transparent;
  border-image: url(img/card-frame.svg) 3 / calc(var(--px) * 3) stretch;
  /* Stepped corners: cut the three grid cells the frame leaves empty at each corner */
  clip-path: polygon(
    0 calc(var(--px) * 2), var(--px) calc(var(--px) * 2), var(--px) var(--px), calc(var(--px) * 2) var(--px), calc(var(--px) * 2) 0,
    calc(100% - var(--px) * 2) 0, calc(100% - var(--px) * 2) var(--px), calc(100% - var(--px)) var(--px), calc(100% - var(--px)) calc(var(--px) * 2), 100% calc(var(--px) * 2),
    100% calc(100% - var(--px) * 2), calc(100% - var(--px)) calc(100% - var(--px) * 2), calc(100% - var(--px)) calc(100% - var(--px)), calc(100% - var(--px) * 2) calc(100% - var(--px)), calc(100% - var(--px) * 2) 100%,
    calc(var(--px) * 2) 100%, calc(var(--px) * 2) calc(100% - var(--px)), var(--px) calc(100% - var(--px)), var(--px) calc(100% - var(--px) * 2), 0 calc(100% - var(--px) * 2));
}
.card h2 { font-size: clamp(2.4rem, 6vw, 4.6rem); margin-bottom: 16px; text-wrap: wrap; text-align: center; }
.card .lede { font-size: 1.15rem; max-width: 46ch; margin: 0 0 24px; }
/* static: cards sit under the open chest */
.reveal[data-mode="static"] .reveal-stage { display: flex; flex-direction: column; align-items: center; padding-top: 120px; }
.reveal[data-mode="static"] .stack { bottom: auto; height: 100vh; }
.reveal[data-mode="static"] .intro { position: relative; bottom: auto; margin: 24px 0 72px; padding-inline: 16px; }
.reveal[data-mode="static"] .cards { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 32px; width: 100%; padding-bottom: 96px; }

/* loot: cards are stacked in the middle of the pinned stage; the script moves them */
/* no z-index on .cards, so each card can sit behind the chest while it climbs out, and in front once free */
.reveal[data-mode="loot"] .cards { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; pointer-events: none; }
.reveal[data-mode="loot"] .chest { z-index: 5; }
.reveal[data-mode="loot"] .card {
  grid-area: 1 / 1; max-height: calc(100svh - 140px); overflow: hidden;
  visibility: hidden; will-change: transform, opacity; pointer-events: auto;
}

.on-purple { background: var(--purple); color: var(--paper); }
.on-paper { background: var(--paper); color: var(--ink); }
.on-paper h2 { color: var(--purple); }
.on-paper .lede { color: var(--muted); }
.on-rose { background: var(--rose); color: var(--dark); }
.on-dark { background: var(--dark); color: var(--paper); }
.on-paper :focus-visible, .on-rose :focus-visible { outline-color: var(--purple); }


.status { margin: 0; font-size: 1.1rem; max-width: 62ch; }
.status + .status { margin-top: 16px; }
.status a { font-weight: 600; }
.center { text-align: center; }
.center .status { margin-inline: auto; }

/* Games: Steam capsule-shaped tiles */
.capsules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.capsule {
  aspect-ratio: 460 / 215; padding: 20px; border-radius: var(--r-inner);
  display: flex; flex-direction: column; justify-content: end;
  background: var(--dark); color: var(--paper); text-decoration: none;
}
.capsule h3 { font-size: 1.6rem; }
.capsule span { font-size: .9rem; opacity: .85; }

/* 3D models: three square photos */
.models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 2vw, 20px); margin-bottom: 24px; }
.ph { aspect-ratio: 1; border-radius: var(--r-inner); background: var(--line); }
.model { margin: 0; }
.model img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: var(--r-inner); }
.model figcaption { padding-top: 12px; font-weight: 600; }

/* Launch news signup (MailerLite) */
.signup { margin-top: 36px; max-width: 540px; }
.signup h3 { font-size: 1.5rem; margin-bottom: 12px; font-style: normal; }
.signup-row { display: flex; gap: 12px; flex-wrap: wrap; }
.signup input[type="email"] {
  flex: 1 1 220px; min-height: 50px; padding: 0 18px; border-radius: var(--r-inner);
  transition: border-color .15s ease-out;
  border: 2px solid currentColor; background: transparent; color: inherit; font: inherit;
}
.signup input[type="email"]::placeholder { color: inherit; opacity: .72; }
/* 20 useful feedback: flag a bad address only after the visitor has interacted */
.signup input[type="email"]:user-invalid { border-color: var(--rose); }
.signup .done { margin: 12px 0 0; font-weight: 600; }
.signup .fine { font-size: .9rem; margin: 12px 0 0; opacity: .9; }

.email, .contact .email { margin-top: 24px; font-size: .95rem; }
.email a { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Inner pages ---------- */
.masthead { background: var(--dark); color: var(--paper); padding-bottom: 56px; }
.page-head { padding-top: 24px; }
.page-head h1 { font-size: clamp(2.8rem, 7vw, 5rem); }
.page-head p { font-size: 1.2rem; max-width: 46ch; margin: 20px 0 0; color: var(--muted-dark); }
.block { padding-block: 72px; }
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.contact h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.contact p { margin: 0 0 16px; max-width: 52ch; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.ledger li:first-child { padding-top: 0; }
.ledger li:last-child { border-bottom: 0; }
.ledger h2, .ledger h3 { font-size: 1.6rem; color: var(--purple); }
.ledger p { margin: 0; color: var(--muted); max-width: 60ch; }
.ledger p + p { margin-top: 8px; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.shots figure { margin: 0; }
.shots img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: var(--r-inner); }
.shots figcaption { margin-top: 8px; font-size: .9rem; color: var(--muted); }
/* Previous work: one article per project, on dark */
.on-dark .section-h { color: var(--paper); }
.project h3 { font-size: 1.6rem; color: var(--gold); }
.project .meta { margin: 6px 0 16px; font-size: .9rem; letter-spacing: .04em; color: var(--muted-dark); }
.project p { max-width: 60ch; }
.on-dark .shots figcaption { color: var(--muted-dark); }
.prose { max-width: 68ch; }
.prose h2 { font-size: 1.6rem; color: var(--purple); margin: 40px 0 12px; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; }

/* ---------- Footer ---------- */
footer { background: var(--dark); color: var(--muted-dark); padding-block: 64px; font-size: .95rem; border-top: 1px solid rgba(251, 241, 238, .1); }
.foot { display: flex; justify-content: space-between; gap: 40px 48px; flex-wrap: wrap; align-items: start; }
footer .signup { margin-top: 0; flex: 1 1 340px; color: var(--paper); }
.foot-side { display: grid; gap: 12px; justify-items: start; }
.foot-side .legal { margin-top: 20px; }
.foot .brand { color: var(--paper); }
.social { display: flex; gap: 8px 20px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.social a { text-decoration: none; display: inline-block; padding-block: 6px; }
.social a:hover { color: var(--gold); }
.legal { font-size: .85rem; }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 12px; }
  .top nav { width: 100%; gap: 8px 20px; flex-wrap: wrap; }
  .top nav a { padding-block: 8px; }
  .chest { width: 78vw; margin-top: -14vh; }
  .intro { bottom: 5vh; padding-inline: 16px; }
  .card .lede { font-size: 1rem; }
  .reveal[data-mode="loot"] .card { max-height: calc(100svh - 110px); }
  .contact { grid-template-columns: 1fr; }
  .ledger li { grid-template-columns: 1fr; gap: 8px; }
}

/* Reduced motion: the script keeps the scene "static"; the chest is shown open. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { --p: 1; }
  .intro { opacity: 1; }
}
.reveal[data-mode="static"] .chest { margin-top: 0; }

/* Links from a card or list to a fuller page: one style everywhere */
.more { font-weight: 600; white-space: nowrap; }
/* Links in body text: the brand rose. Paper needs a deeper rose to stay readable (4.5:1),
   and rose sections fall back to dark ink, since rose on rose disappears. */
main :is(p, li) a:not(.btn) { color: var(--rose); }
.on-paper :is(p, li) a:not(.btn) { color: #A8503A; }
.on-rose :is(p, li) a:not(.btn) { color: var(--dark); }

/* Subpages */
.section-h { font-size: clamp(2rem, 4.5vw, 3rem); color: var(--purple); margin: -24px 0 48px; }
.ink-purple { color: var(--purple); }
.block.tight-top { padding-top: 0; }
.models-detail figcaption span { display: block; margin-top: 6px; font-weight: 400; color: var(--muted); max-width: 32ch; }
@media (max-width: 760px) { .models-detail { grid-template-columns: 1fr; } }
