/* RESONANCE — a nocturne programme.
   The ground is near-black and warm; the only colour on the page is the art (lamp light on water),
   and the live hero piece spills its light onto the page behind it. Mobile first. */

:root {
  --ground: #0B0A09;
  --well: #070606;
  --panel: #161311;
  --ink: #EFEAE4;
  --secondary: #B9B1A9;
  --tertiary: #8A827B;
  --hairline: #26211E;
  --line: #332D29;
  --border: #3A3430;
  --accent: #F3E7CB;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(18px, 5vw, 72px);
  --maxw: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--secondary);
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* film grain */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .06; mix-blend-mode: overlay;
  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");
}
::selection { background: var(--accent); color: var(--ground); }
a { color: var(--ink); text-decoration: none; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
img.pix, canvas { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ground); color: var(--ink); padding: 10px 16px; z-index: 60; }
.skip:focus { left: 12px; top: 12px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
main { display: block; overflow-x: clip; }

/* ---------- header (shared with /collection/) ---------- */
header.bar {
  position: sticky; top: 0; z-index: 40; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter); background: rgba(11,10,9,.78);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.wordmark { display: inline-flex; align-items: center; min-height: 40px; font-family: var(--serif); font-size: 22px; color: var(--ink); letter-spacing: .01em; line-height: 1; }
.wordmark i { color: var(--tertiary); font-size: 16px; margin-left: 4px; }
header.bar .meta { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
header.bar .meta a { display: inline-flex; align-items: center; min-height: 40px; color: var(--tertiary); padding: 0 8px; white-space: nowrap; }
header.bar .meta a:hover, header.bar .meta a[aria-current] { color: var(--ink); }
header.bar .meta a.mintlink { display: inline-flex; align-items: center; height: 40px; line-height: 1; color: var(--ink); border: 1px solid var(--border); padding: 0 calc(12px - .14em) 0 12px; margin-left: 4px; }

/* ---------- type ---------- */
.kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--tertiary); margin: 0 0 18px; }
.kicker b { color: var(--ink); font-weight: 500; }
h1, h2, .serif { font-family: var(--serif); font-weight: 400; color: var(--ink); letter-spacing: -.01em; }
h2 { font-size: clamp(28px, 5vw, 54px); line-height: 1.04; margin: 0 0 14px; }
h2 em, h1 em { font-style: italic; color: var(--secondary); }
.lede { font-size: 13.5px; line-height: 1.7; max-width: 62ch; margin: 0 0 14px; }
.small { font-size: 12px; color: var(--tertiary); }
code { font-family: var(--mono); color: var(--ink); }

section.s { padding-top: clamp(48px, 6vw, 88px); position: relative; }
section[id] { scroll-margin-top: 56px; }
.s-head { display: grid; gap: 6px; margin-bottom: clamp(12px, 2vw, 22px); }
.s-head .num { font-size: 11px; letter-spacing: .2em; color: var(--tertiary); }

/* ---------- art tiles ---------- */
.tile { position: relative; display: block; color: inherit; }
.tile .frame { position: relative; aspect-ratio: 1 / 1; background: var(--well); overflow: hidden; }
.tile .frame img, .tile .frame canvas, .tile .frame .spr { position: absolute; inset: 0; width: 100%; height: 100%; }
.spr { background-size: 1000% 1000%; background-repeat: no-repeat; image-rendering: pixelated; image-rendering: crisp-edges; }
.tile .frame canvas { opacity: 0; transition: opacity .35s ease; }
.tile .frame.live canvas { opacity: 1; }
.tile .cap { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; font-size: 11.5px; line-height: 1.5; color: var(--tertiary); }
.tile .cap b { color: var(--ink); font-weight: 500; }
a.tile:hover .cap b { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- hero ---------- */
.hero { position: relative; display: grid; align-content: start; padding: 22px var(--gutter) 8px; isolation: isolate; }
/* the art is 128 px native: the hero shows it at an exact multiple (2x, 3x, 4x) so every pixel is the same size */
.hero .stage { position: relative; width: 256px; margin: 0 auto; }
.hero .stage .frame { aspect-ratio: 1 / 1; position: relative; background: var(--well); }
.hero .stage canvas.main, .hero .stage .spr { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .stage canvas.main { opacity: 0; transition: opacity .35s ease; }
.hero .stage.live canvas.main { opacity: 1; }
.hero .stage canvas.halo { position: absolute; inset: -6%; width: 112%; height: 112%; z-index: -1; filter: blur(60px) saturate(1.6); opacity: 0; image-rendering: auto; transition: opacity 1s ease; }
.hero .stage.live canvas.halo { opacity: .6; }
.hero .hold { position: absolute; inset: 0; background: none; border: 0; cursor: pointer; z-index: 2; }
.readout { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 14px auto 0; width: 256px; max-width: 100%; font-size: 11.5px; color: var(--tertiary); letter-spacing: .04em; }
.readout b { color: var(--ink); font-weight: 500; }
.readout .hz { font-variant-numeric: tabular-nums; }
/* phones: title, then the art, then the words */
.hero-copy { display: contents; }
/* phones: title, art, buttons, then the paragraph */
.hero-copy .kicker, .hero h1, .hero .tag { order: -1; }
.hero .actions { margin: 16px auto 20px; width: 256px; max-width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hero .actions .btn { justify-content: center; padding: 0 6px; font-size: 11.5px; letter-spacing: 0; white-space: nowrap; }
.hero .lede { order: 1; }
.readout > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hero h1 { font-size: clamp(52px, 14vw, 132px); line-height: .9; margin: 0 0 14px; letter-spacing: -.025em; }
.hero .tag { font-family: var(--serif); font-size: clamp(20px, 4vw, 30px); line-height: 1.25; color: var(--ink); margin: 0 0 14px; max-width: 26ch; }
.hero .tag em { color: var(--secondary); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--border); background: none; color: var(--ink); font: inherit; font-size: 12.5px; letter-spacing: .04em; cursor: pointer; }
.btn:hover { border-color: var(--tertiary); }
.btn.solid { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn.solid:hover { background: var(--accent); }
.btn[aria-pressed="true"], .btn.solid[aria-pressed="true"] { background: none; border-color: var(--accent); color: var(--accent); }
.status { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px; border: 1px solid var(--border); color: var(--secondary); font-size: 12.5px; letter-spacing: .04em; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .status i { animation: none; } }

/* ---------- strips (swipe on phones, grid on desktop) ---------- */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 44%; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); padding: 0 var(--gutter) 10px; margin: 0 calc(-1 * var(--gutter)); scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip > * { scroll-snap-align: start; }
.swipe-hint { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--secondary); margin: 8px 0 0; letter-spacing: .06em; }
.swipe-hint::after { content: "→"; color: var(--accent); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@media (max-width: 759px) {
  /* the right edge fades, so a clipped card reads as "more this way" */
  .strip { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .swipe-hint::after { animation: none; } }
/* wall: the first 64 pieces as a looping video */
.wall { position: relative; display: block; color: inherit; }
.wall video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 1; background: var(--well); image-rendering: pixelated; }
.wall-cap { position: absolute; right: var(--gutter); bottom: 12px; font-size: 11px; letter-spacing: .08em; color: var(--ink); background: rgba(11,10,9,.72); padding: 6px 10px; }
.wall:hover .wall-cap { color: var(--accent); }

/* how it works: the principles */
.principles { list-style: none; counter-reset: pr; display: grid; gap: 10px 28px; padding: 0; margin: clamp(14px, 2.4vw, 24px) 0 0; }
.principles li { counter-increment: pr; position: relative; padding: 0 0 0 30px; font-size: 13px; line-height: 1.65; color: var(--secondary); }
.principles li::before { content: counter(pr); position: absolute; left: 0; top: 0; font-size: 11px; color: var(--accent); letter-spacing: .08em; }
.principles b { color: var(--ink); font-weight: 500; }

/* in 30 seconds */
.tldr { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--hairline); }
.tldr > div { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.tldr dt { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.tldr dd { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--ink); max-width: 72ch; }

/* bitcoin */
.steps { list-style: none; counter-reset: step; display: grid; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); margin: clamp(20px, 3vw, 32px) 0 0; padding: 0; }
.steps li { counter-increment: step; background: var(--ground); padding: 20px 18px 22px; }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; font-size: 11px; letter-spacing: .2em; color: var(--accent); margin-bottom: 10px; }
.steps b { display: block; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.15; color: var(--ink); margin-bottom: 8px; }
.steps p { margin: 0; font-size: 13.5px; line-height: 1.7; }
.codeblock { font-size: clamp(12px, 3.2vw, 17px); line-height: 1.6; color: var(--ink); background: var(--panel); border: 1px solid var(--hairline); padding: 18px; white-space: pre-wrap; word-break: break-word; }
.codeblock .c { color: var(--tertiary); }
.codeblock .k { color: var(--accent); }

/* mint */
.mint { text-align: left; }
.mint .big { font-family: var(--serif); color: var(--ink); font-size: clamp(40px, 7vw, 88px); line-height: .95; margin: 0 0 18px; letter-spacing: -.02em; }

/* faq */
.faq details { border-top: 1px solid var(--hairline); }
.faq-groups { display: grid; gap: clamp(18px, 3vw, 28px); }
.faq-group h3 { margin: 0 0 4px; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.faq-group details:last-child { border-bottom: 1px solid var(--hairline); }
.faq summary { list-style: none; cursor: pointer; padding: 14px 28px 14px 0; color: var(--ink); font-family: var(--serif); font-size: 19px; line-height: 1.25; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 14px; font-family: var(--mono); color: var(--tertiary); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; max-width: 64ch; font-size: 13px; }

footer { padding: clamp(48px, 6vw, 88px) 0 36px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--tertiary); border-top: 1px solid var(--hairline); padding-top: 22px; }
footer a { display: inline-flex; align-items: center; min-height: 40px; color: var(--secondary); }

/* ---------- the scene: a side-view diagram of the table ---------- */
.rig { margin: clamp(18px, 3vw, 32px) 0 clamp(20px, 3vw, 36px); display: grid; gap: 14px; }
.rig svg { width: 100%; height: auto; max-width: 760px; display: block; }
.rig-line { fill: none; stroke: var(--tertiary); stroke-width: 1.5; stroke-linejoin: round; }
.rig-water { fill: none; stroke: var(--ink); stroke-width: 2; }
.rig-card { fill: #000; stroke: var(--tertiary); stroke-width: 1.5; stroke-linejoin: round; }
.rig-ray { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.rig-dark { fill: none; stroke: #8A827B; stroke-width: 1.3; stroke-dasharray: 6 4; }
.rig-flat { fill: none; stroke: var(--tertiary); stroke-width: 1.2; stroke-dasharray: 1.5 4; stroke-linecap: round; }
.rig-norm path { stroke: var(--tertiary); stroke-width: 1; }
.rig-hit { fill: var(--accent); }
.rig-hit.dark { fill: #000; stroke: var(--ink); stroke-width: 1.2; }
.rig-sound path { fill: none; stroke: var(--tertiary); stroke-width: 1.2; }
.rig-num text { font-family: var(--mono); font-size: 15px; fill: var(--accent); }
.rig-legend { margin: 12px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--secondary); }
.rig-legend span { display: inline-block; width: 22px; height: 0; vertical-align: middle; margin: 0 4px 0 2px; border-top: 2px solid var(--accent); }
.rig-legend span:first-child { margin-left: 0; }
.rig-legend .k-card { border-top: 2px dashed #8A827B; }
.rig-legend .k-flat { border-top: 2px dotted var(--tertiary); }
.rig-key { margin: 0; padding: 0 0 0 22px; display: grid; gap: 4px; font-size: 12.5px; line-height: 1.6; }
.rig-key li::marker { color: var(--accent); font-size: 11px; }
.rig-key b { color: var(--ink); font-weight: 500; }

/* ---------- traits: one row per setting, each value on a live piece ---------- */
.trait-rows { display: grid; gap: clamp(26px, 4vw, 44px); margin-top: clamp(18px, 3vw, 30px); }
.trait { display: grid; gap: 12px; border-top: 1px solid var(--hairline); padding-top: 16px; }
.trait-head h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 3vw, 30px); line-height: 1.1; color: var(--ink); margin: 0 0 6px; }
.trait-head p { margin: 0; font-size: 12.5px; line-height: 1.65; max-width: 46ch; }
.strip.ex { grid-auto-columns: 38%; gap: 10px; }
.strip.ex .tile .cap { padding-top: 6px; font-size: 11px; flex-wrap: wrap; gap: 0 6px; line-height: 1.35; }
.aside { font-size: 12.5px; color: var(--tertiary); max-width: 64ch; margin: clamp(22px, 3vw, 32px) 0 0; padding-top: 14px; border-top: 1px solid var(--hairline); }
.aside a { text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 760px) {
  .rig { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; gap: 36px; }
  .trait { grid-template-columns: minmax(200px, 1fr) minmax(0, 3fr); gap: 28px; align-items: start; }
  .strip.ex { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; overflow: visible; padding: 0; margin: 0; gap: 12px; -webkit-mask-image: none; mask-image: none; max-width: calc(var(--n, 6) * 172px); }
}

/* ---------- larger screens ---------- */
@media (min-width: 760px) {
  /* hero: copy left, art right, from tablet width up; the art never outgrows the copy */
  .hero { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(28px, 4vw, 56px); padding: clamp(28px, 4vw, 56px) var(--gutter) 8px; }
  .hero .stage, .readout { width: 384px; margin-left: auto; margin-right: 0; }
  .hero-copy { display: block; order: -1; margin: 0; min-width: 0; }
  .hero .actions { margin: 22px 0 0; width: auto; display: flex; }
  .hero .actions .btn { padding: 0 18px; font-size: 12.5px; letter-spacing: .04em; }
  .hero .tag + .lede { margin-top: 0; }
  .hero h1 { font-size: clamp(56px, 7vw, 120px); }
  .hero .tag { font-size: clamp(20px, 2.6vw, 34px); }
  body { font-size: 14px; }
  .swipe-hint { display: none; }
  .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  .two.center { align-items: center; }
  .tldr > div { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: baseline; }
  .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .hero .stage, .readout { width: 512px; }
  .faq-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 36px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  body::after, header.bar, .hold, .btn { display: none !important; }
}

/* phones: the title block is centred over the centred art (after the hero rules so it wins) */
@media (max-width: 759px) {
  .hero-copy .kicker, .hero h1, .hero .tag { text-align: center; }
  .hero .tag { max-width: none; }
}

/* ---------- drift: a slow ribbon of pieces under the summary ---------- */
.drift { overflow: hidden; padding: calc(clamp(48px, 6vw, 88px) + 14px) 0 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.drift-track { display: flex; width: max-content; animation: ribbon 90s linear infinite; }
.drift .tile { flex: none; width: 104px; margin-right: 10px; }
.drift:hover .drift-track, .drift:focus-within .drift-track { animation-play-state: paused; }
@keyframes ribbon { to { transform: translateX(-50%); } }
@media (min-width: 760px) { .drift .tile { width: 152px; margin-right: 14px; } }
@media (min-width: 1000px) { .drift .tile { width: 176px; margin-right: 16px; } }

/* ---------- motion: hero entrance, reveal on scroll, tile lift ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hero .kicker, .hero h1, .hero .tag, .hero .stage, .hero .actions, .hero .lede { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero h1 { animation-delay: .08s; }
.hero .tag { animation-delay: .18s; }
.hero .stage { animation-delay: .28s; animation-duration: 1.2s; }
.hero .actions { animation-delay: .42s; }
.hero .lede { animation-delay: .5s; }
.js .rv { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 70ms); }
.js .rv.in { opacity: 1; transform: none; }
a.tile .frame { transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease; }
a.tile:hover .frame, a.tile:focus-visible .frame { transform: translateY(-3px); box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .8), 0 0 0 1px rgba(243, 231, 203, .08); }
@media (prefers-reduced-motion: reduce) {
  .drift { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .drift-track { animation: none; }
  .drift-track > [aria-hidden="true"] { display: none; }
  .hero .kicker, .hero h1, .hero .tag, .hero .stage, .hero .actions, .hero .lede { animation: none; }
  .js .rv { opacity: 1; transform: none; transition: none; }
  a.tile .frame { transition: none; }
}


/* nav on phones: collection, faq, mint (the hero's button covers how it works) */
@media (max-width: 559px) {
  header.bar .meta { gap: 0; letter-spacing: .1em; }
  header.bar .meta a { padding: 0 7px; }
  header.bar .meta a.nav-how { display: none; }
}
