/* Monero Cat: the DOM story over the 3D world. Tokens come from tokens.css.
   Motion lives in main.js (GSAP); this file sets the resting states and the no-JS fallback. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body { margin: 0; color: var(--moon); font: 400 var(--step-0)/1.55 var(--body); background: var(--night); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--fur); outline-offset: 4px; border-radius: 999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--moon); color: var(--night); padding: 10px 16px; border-radius: 999px; }
.skip:focus { top: 12px; }

/* ---------- the world behind everything ---------- */
/* Sized to the large viewport rather than inset: 0, so a phone's URL bar sliding away never resizes
   the world's canvas (main.js sizes the renderer from this box). */
.stage { position: fixed; inset: 0 0 auto; height: 100vh; height: 100lvh; z-index: 0; overflow: hidden; }
.poster, #world { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster { object-fit: cover; object-position: 50% 50%; transition: opacity var(--d-4) ease; }
#world { opacity: 0; transition: opacity 1.2s ease; }
.world-ready #world { opacity: 1; }
.world-ready .poster { opacity: 0; }
.grain { position: absolute; inset: -50%; opacity: .08; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- fixed bar ---------- */
.bar { position: fixed; z-index: 20; inset: 0 0 auto 0; display: flex; align-items: center; gap: var(--s-3);
  padding: max(16px, env(safe-area-inset-top)) clamp(16px, 3vw, 40px) 14px; }
.bar::before { /* copy scrolling up under the bar fades out instead of colliding with it */
  content: ""; position: absolute; z-index: -1; inset: 0 0 -28px 0; pointer-events: none;
  background: linear-gradient(rgba(5, 12, 26, .72), rgba(5, 12, 26, .38) 60%, rgba(5, 12, 26, 0)); }
.mark { font: italic 900 1.7rem/1 var(--disp); text-transform: uppercase; text-decoration: none; letter-spacing: .01em; white-space: nowrap; }
.rail { position: relative; display: flex; gap: clamp(12px, 1.6vw, 26px); margin: 0 auto; font: 500 var(--step--1)/1 var(--body); letter-spacing: .08em; text-transform: uppercase; }
.rail a { position: relative; text-decoration: none; color: var(--mist); padding: 8px 0; transition: color var(--d-2); white-space: nowrap; }
.rail a span { color: rgba(169, 180, 200, .5); margin-right: 4px; font-variant-numeric: tabular-nums; }
.rail a:hover, .rail a[aria-current="true"] { color: var(--moon); }
.rail a[aria-current="true"] span { color: var(--fur); }
.rail-ind { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; border-radius: 2px; background: var(--fur); box-shadow: 0 0 12px rgba(234, 119, 25, .7); }
.artist { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none;
  font: 600 var(--step--1)/1 var(--body); letter-spacing: .06em; text-transform: uppercase;
  padding: 11px 14px 11px 16px; border-radius: 999px; background: var(--glass); border: 1px solid rgba(242, 235, 221, .22); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color var(--d-2), background var(--d-2); }
.artist:hover { border-color: rgba(242, 235, 221, .6); background: rgba(242, 235, 221, .1); }
.artist .ic { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.rail + .artist { margin-left: 0; }

/* ---------- chapters ---------- */
/* The copy scrims reach past their column on purpose; clip them so phones do not zoom out to fit. */
main { position: relative; z-index: 10; overflow-x: clip; }
.ch { position: relative; min-height: calc(var(--w, 1) * 100svh); display: grid; align-items: center; padding: 104px clamp(16px, 4vw, 64px); }
.copy { position: relative; max-width: 36rem; display: grid; gap: 1.1rem; }
.side-r .copy { justify-self: end; }
.copy::before { /* a local scrim, so copy stays readable whatever the world does behind it */
  content: ""; position: absolute; z-index: -1; inset: -18% -22%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(5, 12, 26, .74), rgba(5, 12, 26, .45) 55%, rgba(5, 12, 26, 0)); }
.copy p, .copy ul, .copy ol, .copy dl { margin: 0; }
.js .copy { visibility: hidden; }   /* main.js reveals each chapter with its own timeline */
.eyebrow { font: 600 var(--step--1)/1.2 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--fur); }
.eyebrow.watched { color: var(--searchlight); }
h2 { margin: 0; font: italic 900 var(--step-3)/.88 var(--disp); text-transform: uppercase; letter-spacing: .005em; text-wrap: balance; }
.title { margin: 0; font: italic 900 min(var(--step-5), 21svh)/.8 var(--disp); text-transform: uppercase; letter-spacing: .005em; }
.title.small { font-size: var(--step-3); }
.lede { font-size: var(--step-1); max-width: 24ch; line-height: 1.3; font-weight: 500; }
/* the rewards line; the XMR coin beside it spins in on arrival (motion.js tweens --coin) */
.perk { position: relative; padding-left: 2.15em; font-weight: 500; }
.perk::before { content: ""; position: absolute; left: 0; top: calc(50% - .78em); width: 1.56em; height: 1.56em;
  background: url(../assets/xmr-coin.svg) center / contain no-repeat; filter: drop-shadow(0 0 10px rgba(242, 104, 34, .45));
  opacity: var(--coin, 1); transform: perspective(9em) rotateY(calc((1 - var(--coin, 1)) * -540deg)); }
.fine { font-size: var(--step--1); color: var(--mist); }
.hint { color: var(--searchlight); font-weight: 500; }
.tlink { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: background-size var(--d-2) var(--ease-out), color var(--d-2); }
.tlink:hover { background-size: 0 1px; background-position: 100% 100%; color: var(--fur); }

/* ---------- buttons: pills with an icon bubble; labels roll on hover (main.js) ---------- */
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.btn { position: relative; display: inline-flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 6px 6px 22px; border-radius: 999px; cursor: pointer;
  font: 600 var(--step-0)/1 var(--body); letter-spacing: .01em; text-decoration: none; border: 0; color: var(--night-deep); background: var(--fur);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 14px 34px -14px rgba(234, 119, 25, .9); will-change: transform; }
.btn .lbl { display: inline-block; overflow: hidden; line-height: 1.25; padding: 0 1px; }
.btn .lbl .ch-roll { display: inline-block; text-shadow: 0 1.25em 0 currentColor; }
.btn .ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--night-deep); color: var(--fur); flex: none; overflow: hidden; }
.btn .ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: var(--fur-hi); }
.btn.ghost { color: var(--moon); background: var(--glass); box-shadow: inset 0 0 0 1px rgba(242, 235, 221, .24); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn.ghost:hover { background: rgba(242, 235, 221, .12); box-shadow: inset 0 0 0 1px rgba(242, 235, 221, .5); }
.btn.ghost .ico { background: var(--moon); color: var(--night-deep); }
.btn.signal { color: var(--sun); background: rgba(242, 173, 57, .08); box-shadow: inset 0 0 0 1px rgba(242, 173, 57, .5), 0 0 0 rgba(242, 173, 57, 0); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn.signal .ico { background: var(--sun); color: var(--night-deep); }
.btn.signal[aria-pressed="true"] { color: var(--night-deep); background: var(--sun); box-shadow: 0 0 40px -6px rgba(242, 173, 57, .9); }
.btn.signal[aria-pressed="true"] .ico { background: var(--night-deep); color: var(--sun); }

/* ---------- the contract address ---------- */
.ca { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; padding: 6px 6px 6px 18px; border-radius: 999px;
  background: rgba(5, 12, 26, .5); box-shadow: inset 0 0 0 1px var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ca-k { font: 700 var(--step--1)/1 var(--body); letter-spacing: .14em; color: var(--fur); }
.ca-v { font: 500 var(--step--1)/1.35 var(--mono); color: var(--moon); word-break: break-all; min-width: 0; flex: 1 1 auto; }
.ca-copy { position: relative; display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; background: var(--moon); color: var(--night-deep); }
.ca-copy svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
.ca-copy .i-ok { opacity: 0; }
.ca-copy[data-done] { background: var(--fur); }
.ca-copy[data-done] .i-copy { opacity: 0; } .ca-copy[data-done] .i-ok { opacity: 1; }

/* ---------- chapter details ---------- */
/* below 900px of height the top space shrinks twice as fast, so short laptop windows still show the buy button */
.ch-hero { align-items: start; padding-top: max(96px, min(24svh, 48svh - 216px)); }
.facts { list-style: none; padding: 0; display: grid; gap: 14px; margin-top: 6px !important; }
.facts li { display: grid; gap: 2px; }
.f-k { font: 600 var(--step--1)/1.2 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--searchlight); opacity: .8; }
.f-v { position: relative; width: fit-content; font: italic 900 var(--step-2)/.95 var(--disp); text-transform: uppercase; }
.f-v .bar { position: absolute; inset: 6% -3%; background: var(--moon); transform-origin: 100% 50%; transform: scaleX(0); }
.steps { list-style: none; padding: 0; display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: 3.2rem 1fr; align-items: baseline; gap: 6px; }
.steps .n { font: italic 900 var(--step-2)/1 var(--disp); color: var(--fur); }
.token { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.token dt { font: 600 var(--step--1)/1.2 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.token dd { margin: 2px 0 0; font: italic 800 var(--step-1)/1 var(--disp); text-transform: uppercase; }
.gen-preview { display: flex; gap: 0; max-width: 26rem; padding-left: 8px; }
.gen-preview img { width: 33%; border-radius: 18px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(242, 235, 221, .14); margin-left: -8px; }
.gen-preview img:nth-child(1) { transform: rotate(-6deg); } .gen-preview img:nth-child(3) { transform: rotate(6deg); }
.links { display: flex; flex-wrap: wrap; gap: 8px 22px; font-weight: 500; }

/* suit up: the generator on a glass panel; Luke stands to its right in the world */
.ch-suit .copy { max-width: min(1040px, 70vw); }
.ch-suit .copy > p { max-width: 50rem; }   /* breaks the intro at its sentence, not before its last words */
.gen-mount { margin-top: 6px; padding: clamp(14px, 2vw, 24px); border-radius: 28px; min-height: 320px;
  background: rgba(5, 12, 26, .74); box-shadow: inset 0 0 0 1px var(--line), 0 40px 80px -40px rgba(0, 0, 0, .9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.gen-mount .lg-stage { top: 96px; }   /* clear the fixed bar when the preview sticks */
.gen-wait { margin: 0; }

/* the signal: a timeline from the first issue to the revival, and the artist's own signature */
.ch-signal .copy { max-width: 34rem; }
.years { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 16px; max-width: 32rem; margin: 2px 0; }
.yr { margin: 0; display: grid; gap: 4px; }
.yr:nth-child(3) { text-align: center; }
.yr:last-child { text-align: right; }
.y { font: italic 900 clamp(2.4rem, 1.6rem + 2.4vw, 3.8rem)/.85 var(--disp); color: var(--fur); font-variant-numeric: tabular-nums; }
.yr:nth-child(3) .y { color: var(--moon); }
.yr:last-child .y { color: var(--sun); text-shadow: 0 0 28px rgba(242, 173, 57, .45); }

/* the original 2014 post, pinned in front of the signal like a print someone kept */
.orig { position: absolute; left: calc(100% + 5vw); bottom: 2%; width: clamp(220px, 19vw, 290px); margin: 0; padding: 12px 12px 14px;
  background: #f4ecdb; color: #1b1511; border-radius: 6px; transform: rotate(-5deg);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .25); }   /* no CSS transition: GSAP owns this transform, hover included (motion.js) */
.orig-pic { display: block; border-radius: 3px; overflow: hidden; background: #fffaf0; }
.orig-pic img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.orig figcaption { display: grid; gap: 4px; padding: 10px 2px 0; }
.orig-k { font: 700 .68rem/1.2 var(--body); letter-spacing: .14em; text-transform: uppercase; color: #a24a0b; }
.orig q { font: italic 900 1.5rem/1 var(--disp); text-transform: uppercase; quotes: "“" "”"; }
.orig-by { font: 500 .8rem/1.3 var(--body); color: #4a4038; }
.orig .tlink { color: #1b1511; }
.orig .tlink:hover { color: #a24a0b; }
.yl { font: 600 var(--step--1)/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--mist); }
.yline { position: relative; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--fur), var(--sun)); opacity: .9; transform-origin: 0 50%; margin-bottom: 1.1rem; }
/* A spark runs each line from one year to the next like a fuse, then rests there: a line-wide track
   slid by its own width in CSS, so the compositor runs the loop and the main thread does nothing. */
.yline i { position: absolute; inset: 0; pointer-events: none; animation: fuse 3.2s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes fuse { 0% { transform: translateX(0); } 81.25%, 100% { transform: translateX(100%); } }
.yline i::before { content: ""; position: absolute; top: 50%; left: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff6df;
  box-shadow: 0 0 10px 3px rgba(242, 173, 57, .9), 0 0 26px 8px rgba(234, 119, 25, .5); }
.credit { display: flex; align-items: center; gap: 16px; padding-top: 4px; }
.sig { flex: none; width: 104px; height: 74px; background: var(--moon);
  -webkit-mask: url("../assets/signature.png") center / contain no-repeat; mask: url("../assets/signature.png") center / contain no-repeat; }
.who { display: grid; gap: 3px; font-size: var(--step--1); color: var(--mist); }
.who b { font: 600 var(--step-0)/1.1 var(--body); color: var(--moon); }
.ch-end { align-items: end; padding-bottom: 8svh; }

/* "I'm Luke." from whichever cat you point at */
.say { position: fixed; z-index: 30; left: 0; top: 0; pointer-events: none; opacity: 0; transform: translate(-50%, -100%) scale(.9);
  font: 700 var(--step--1)/1 var(--body); letter-spacing: .02em; color: var(--night-deep); background: var(--moon); padding: 9px 12px; border-radius: 999px; white-space: nowrap;
  transition: opacity var(--d-1), transform var(--d-2) var(--ease-out); }
.say::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; border-radius: 2px; transform: translateX(-50%) rotate(45deg); }
.say.on { opacity: 1; transform: translate(-50%, -100%) scale(1); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .rail { display: none; }
  .artist { padding: 10px 12px 10px 14px; }
  .side-r .copy { justify-self: start; }
  .copy { max-width: none; }
  /* Phones: the scene owns the top of the screen, the copy rides along the bottom as a caption. */
  .ch, .ch-hero, .ch-end { align-items: end; padding: 84px 16px max(18px, env(safe-area-inset-bottom)); }
  /* lvh minus svh is the browser chrome that may cover the layout viewport's bottom edge */
  .copy { position: sticky; bottom: calc(14px + 100lvh - 100svh); }
  /* a vertical fade that reaches zero at its top edge, so there is no seam across the scene */
  .copy::before { inset: -28% -16px -24px; background: linear-gradient(0deg, rgba(5, 12, 26, .9) 0%, rgba(5, 12, 26, .74) 58%, rgba(5, 12, 26, 0) 100%); }
  .title { font-size: clamp(4rem, 21vw, 6.4rem); }
  .btn { min-height: 48px; }
  .copy { gap: .85rem; }
  .years { gap: 10px; }
  .y { font-size: 2.1rem; }
  .yline { margin-bottom: .9rem; }
  .sig { width: 76px; height: 54px; }
  .f-v { font-size: 1.55rem; }
  /* the 2014 print sits in the caption as a small row on phones */
  .orig { position: relative; left: auto; bottom: auto; width: auto; display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; padding: 8px; transform: none; }
  .orig figcaption { padding: 0; }
  .orig q { font-size: 1.15rem; }
  .ch-signal .credit { display: none; }   /* the paragraph and the credits chapter both name Luis */
  /* the generator is too tall to ride as a caption: it scrolls in place */
  .ch-suit { align-items: start; }
  .ch-suit .copy { position: relative; bottom: auto; max-width: none; }
  .gen-mount { padding: 12px; border-radius: 22px; }
}
/* short phones (iPhone SE): a tighter caption keeps the hero's first line clear of Luke's feet */
@media (max-width: 900px) and (max-height: 700px) {
  .copy { gap: .65rem; }
}

/* ---------- touch screens ---------- */
/* No backdrop blur and no blended grain on touch screens: both are redone every frame over the
   moving world. On a software GPU standing in for a budget phone, the generator panel's blur alone
   halved the suit-up chapter's frame rate. The glass turns to a deeper storm tint to keep contrast. */
@media (pointer: coarse) {
  .grain { display: none; }
  .artist, .btn.ghost, .btn.signal, .ca, .gen-mount { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .artist, .btn.ghost { background: rgba(16, 27, 50, .78); }
  .btn.signal { background: rgba(30, 24, 14, .78); }
  .ca { background: rgba(5, 12, 26, .72); }
  .gen-mount { background: rgba(5, 12, 26, .86); }
}

/* the ?fps readout (main.js), for checking frame rate on a real phone */
.hud { position: fixed; z-index: 60; left: 8px; top: calc(max(16px, env(safe-area-inset-top)) + 54px); max-width: calc(100vw - 16px); margin: 0; padding: 6px 8px; border-radius: 6px;
  font: 500 11px/1.45 var(--mono); color: #fff; background: rgba(0, 0, 0, .78); white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.hud.bad { background: rgba(160, 20, 20, .85); }

/* ---------- motion and fallbacks ---------- */
@media (prefers-reduced-motion: reduce) {
  .poster, #world, .say { transition: none; }
  .yline i { animation: none; }
}
.no-webgl .poster { opacity: 1 !important; }
.no-webgl #world { display: none; }
