/* Shared styles for both pages. Colors and fonts are CSS variables: the
   values below are fallbacks; `nftgen site build` writes the real ones from
   site.config.json into each page's <head>. Edit freely — the build never
   touches this file. */

:root {
  --bg: #1c1810;
  --panel: #241912;
  --edge: #3d2b1f;
  --text: #fcf8ec;
  --dim: #b4a58f;
  --accent: #ccff00;
  --shadow: #000000;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pixel: "Silkscreen", "IBM Plex Mono", monospace;
  --pixel-sm: "Press Start 2P", "Silkscreen", monospace;
}

* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--text); }

/* The transition canvas: one flat color per coarse cell, scaled up with
   nearest neighbour. Sits above everything; never takes input. */
#wipe {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  image-rendering: pixelated; z-index: 50; display: none; pointer-events: none;
}

/* ---------------------------------------------------------------- home -- */
html:has(body.home), body.home { height: 100%; }
body.home { font: 400 15px/1.75 var(--mono); overflow: hidden; }

/* The living ground: a coarse pixel field that brightens around the cursor. */
#ground {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  image-rendering: pixelated; display: block;
}
/* The road (js/road.js, built from ../road): the scene the front page is.
   Its canvas is a whole number of scene pixels, so it may overhang the
   window by a few; the container hides that. */
#road { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
#road canvas { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; cursor: none; }
/* The torch's mark: a hard-edged cross, no glow. */
.road-cursor {
  position: absolute; z-index: 3; width: 4px; height: 4px; background: var(--text);
  transform: translate(-50%, -50%); pointer-events: none; visibility: hidden;
  box-shadow: -6px 0 0 var(--text), 6px 0 0 var(--text), 0 -6px 0 var(--text), 0 6px 0 var(--text);
}
.road-cursor.visible { visibility: visible; }
@media (pointer: coarse) { .road-cursor { display: none; } }

/* The title sits in the sky, above the road. */
.veil {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 20px;
  text-align: center; padding: clamp(20px, 7vh, 72px) 24px 24px; pointer-events: none;
}
.veil a, .veil h1, .veil p { pointer-events: auto; }
body.home h1 {
  font-family: var(--pixel); font-weight: 700;
  font-size: clamp(40px, 9vw, 84px); letter-spacing: 0.12em;
  text-transform: lowercase; color: var(--text);
  text-shadow: 3px 3px 0 var(--shadow); user-select: none;
  overflow-wrap: anywhere;
}
.collection-link {
  font-family: var(--pixel-sm); font-size: clamp(10px, 1.6vw, 13px);
  color: var(--accent); text-decoration: underline;
  text-underline-offset: 5px; text-decoration-thickness: 2px; letter-spacing: 0.08em;
}
.collection-link:hover { color: var(--text); }
.quiet-link {
  font-family: var(--pixel-sm); font-size: clamp(12px, 1.8vw, 15px);
  color: var(--dim); text-decoration: none; letter-spacing: 0.08em;
}
.quiet-link:hover { color: var(--accent); }
.links { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
/* Over the road the title is one line with a hard black edge, and the blurb
   is a tape along the bottom of the window. */
body.home h1 {
  font-size: clamp(24px, 5.4vw, 60px); white-space: nowrap;
  text-shadow: 3px 3px 0 #000, -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000;
}
body.home .collection-link, body.home .quiet-link {
  padding: 6px 9px 5px; background: var(--bg); box-shadow: 3px 3px 0 #000; text-decoration: none;
}
body.home .collection-link { color: var(--text); order: 2; }
body.home .collection-link:hover { color: #000; background: var(--text); }
/* Mint is the one loud button; the collection link sits under it. */
.mint-button {
  order: 1; padding: 11px 20px 10px; font: 700 clamp(15px, 2.2vw, 22px)/1 var(--pixel); letter-spacing: 0.12em;
  color: #000; background: var(--accent); box-shadow: 4px 4px 0 #000; text-decoration: none; text-transform: lowercase;
}
.mint-button[href]:hover { background: var(--text); }
.mint-button[aria-disabled="true"] { cursor: default; }
.blurb {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 30px;
  padding: 10px 16px 9px; background: var(--bg); border-top: 2px solid var(--edge);
  font: 10px/1.5 var(--pixel-sm); letter-spacing: 0.06em; color: var(--dim);
}
.blurb span:first-child { color: var(--text); }

/* ---------------------------------------------------------- collection -- */
body.collection {
  font: 400 14px/1.7 var(--mono); padding: 40px 20px 80px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}
body.collection h1 {
  font-family: var(--pixel); font-weight: 700; letter-spacing: 0.12em;
  font-size: clamp(26px, 5vw, 40px); text-transform: lowercase;
  text-shadow: 3px 3px 0 var(--shadow);
}
body.collection h1 a { color: inherit; text-decoration: none; }
.sub { font-family: var(--pixel-sm); font-size: 10px; color: var(--dim); letter-spacing: 0.1em; text-align: center; }
.sub a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.sub a.quiet-link { color: var(--dim); text-decoration: none; font-size: 13px; margin: 0 8px; }
.sub a.quiet-link:hover { color: var(--accent); }
.sub.note { margin-top: -16px; }
#grid {
  display: grid; grid-template-columns: repeat(auto-fit, 128px);
  gap: 14px; justify-content: center; width: 100%; max-width: 1200px;
}
.tok { cursor: pointer; position: relative; }
.tok img {
  width: 128px; height: 128px; image-rendering: pixelated; display: block;
  border: 1px solid var(--edge); background: var(--panel);
}
/* Hover: chunky stepped scaling, pixel-style. */
@keyframes tok-pulse {
  0% { transform: scale(1); } 50% { transform: scale(1.09); } 100% { transform: scale(1); }
}
.tok:hover { z-index: 3; }
.tok:hover img {
  border-color: var(--accent);
  animation: tok-pulse 0.7s steps(3, jump-none) infinite;
  box-shadow: 0 0 0 2px var(--accent), 6px 6px 0 rgba(0, 0, 0, 0.6);
}
.tok .num {
  position: absolute; left: 4px; bottom: 4px; font-size: 10px; padding: 0 4px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--dim);
}
#empty { color: var(--dim); font-size: 13px; max-width: 32em; text-align: center; }

/* Detail overlay */
#overlay {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 90%, transparent);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
#overlay.open { display: flex; }
#detail {
  background: var(--panel); border: 1px solid var(--edge);
  padding: 20px; display: flex; gap: 20px; flex-wrap: wrap;
  max-width: 680px; width: 100%; overflow-y: auto;
  /* Fixed height: late-arriving metadata can never resize the card, so the
     artwork holds its position at every viewport shape. */
  height: min(620px, 86vh); align-content: flex-start;
}
.art-box {
  width: min(256px, 100%); aspect-ratio: 1; flex: 0 0 auto;
  align-self: flex-start; background: var(--bg); border: 1px solid var(--edge);
}
.art-box img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#detail .side { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#d-name { font-family: var(--pixel); font-size: 18px; letter-spacing: 0.06em; }
#d-title { color: var(--accent); }
#d-desc { color: var(--dim); font-size: 12px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; border-bottom: 1px solid var(--edge); padding: 3px 0; }
.kv span { color: var(--dim); }
.kv b { text-align: right; }

/* -------------------------------------------------- whispers (optional) -- */
#whispers { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.whisper {
  position: absolute; white-space: nowrap; font-size: 13px;
  color: var(--dim); text-shadow: 1px 1px 0 var(--bg); will-change: transform;
}
.whisper .w-main { pointer-events: auto; cursor: pointer; }
.whisper .w-main:hover { color: var(--accent); }
.w-replies { margin-left: 14px; }
.w-replies div { font-size: 11px; opacity: 0.85; }
.w-replies div::before { content: "\2514 "; color: var(--dim); }
#reply-chip {
  display: none; align-items: center; gap: 8px;
  position: fixed; left: 50%; bottom: 58px; transform: translateX(-50%);
  max-width: min(420px, 86vw); z-index: 5; font: 400 11px var(--mono);
  color: var(--accent); background: color-mix(in srgb, var(--panel) 85%, transparent);
  border: 1px solid var(--edge); padding: 4px 10px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#reply-chip b { cursor: pointer; color: var(--dim); font-weight: 400; }
#chatbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(420px, 86vw); z-index: 5; display: flex; gap: 8px;
}
#chatbar input {
  flex: 1; background: color-mix(in srgb, var(--panel) 85%, transparent); color: var(--text);
  border: 1px solid var(--edge); padding: 9px 12px; font: 400 13px var(--mono);
}
#chatbar input:focus { outline: none; border-color: var(--accent); }
#chatbar input::placeholder { color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
  .tok:hover img { animation: none; }
}
