/* Old Flames — warm cinematic dark, sibling to Double Bill.
   Warm near-black canvas, bone ink, hairline rules, one ember accent.
   Album art carries the color; everything else stays quiet.
   No purple, no glass, no gradient hero. */

:root {
  color-scheme: dark;
  --canvas: #0E0C0A;
  --surface: #171310;
  --surface-2: #1D1814;
  --ink: #CFC8BD;
  --ink-strong: #F2EEE6;
  --ink-muted: #8C8478;
  --rule: rgba(255, 248, 240, 0.08);
  --rule-strong: rgba(255, 248, 240, 0.15);
  --ember: #E08B4A;
  --ember-deep: #B05F2E;
  --ember-dim: #6E4528;
  --ember-bg: rgba(224, 139, 74, 0.11);
  --display: 'Big Shoulders', 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --sans: 'SF Pro Display', -apple-system, 'Helvetica Neue', sans-serif;
  --mono: 'SF Mono', ui-monospace, 'Menlo', monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  background-image:
    radial-gradient(ellipse 1100px 540px at 78% -12%, rgba(224, 139, 74, 0.07), transparent 65%),
    radial-gradient(ellipse 900px 640px at -12% 36%, rgba(255, 244, 230, 0.025), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* film grain, fixed so it never repaints on scroll */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.035;
  background-image:
    repeating-radial-gradient(circle at 17% 32%, #fff 0 0.4px, transparent 0.4px 7px),
    repeating-radial-gradient(circle at 73% 64%, #fff 0 0.3px, transparent 0.3px 5px);
}

.mono { font-family: var(--mono); font-size: 0.92em; }
a { color: inherit; text-underline-offset: 3px; }

/* ── top bar ──────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px 24px 20px;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-strong);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.mark { width: 16px; height: 16px; }
.mark .m1 { fill: var(--ember); }
.mark .m2 { fill: var(--ink-strong); }
.topbar-links { display: flex; gap: 22px; }
.topbar-links a {
  font-size: 13.5px;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 280ms var(--ease);
}
.topbar-links a:hover { color: var(--ink-strong); }

/* ── protocol note ────────────────────────────────────── */

.protocol-note {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 12px 18px;
  border: 1px solid var(--rule-strong);
  border-left: 2px solid var(--ember);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink);
}

/* ── masthead ─────────────────────────────────────────── */

.masthead {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}
.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  margin: 0 auto;
  padding: 88px 24px 104px;
}
.kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
  margin: 0 0 20px;
}
h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(64px, 10vw, 132px);
  line-height: 0.88;
  letter-spacing: 0.012em;
  text-transform: uppercase;
  color: var(--ink-strong);
  margin: 0 0 26px;
}
h1 .hl { color: var(--ember); }
.lede {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 52ch;
  margin: 0 0 30px;
}

/* lookup form */
.lookup { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
#username {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink-strong);
  background: rgba(23, 19, 16, 0.82);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 13px 22px;
  min-width: 240px;
  outline: none;
  backdrop-filter: blur(6px);
  transition: border-color 280ms var(--ease), box-shadow 280ms var(--ease);
}
#username::placeholder { color: var(--ink-muted); }
#username:focus {
  border-color: var(--ember-deep);
  box-shadow: 0 0 0 3px var(--ember-bg);
}
.btn-primary {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  color: #1A120B;
  background: var(--ember);
  border: none;
  border-radius: 999px;
  padding: 14px 26px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 380ms var(--ease), background 380ms var(--ease);
}
.btn-primary:hover { background: #EFA063; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary[disabled] { opacity: 0.45; cursor: default; transform: none; }
.btn-quiet {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-muted);
  background: none;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
  transition: color 280ms var(--ease);
}
.btn-quiet:hover { color: var(--ink-strong); }

/* ── the sleeve wall ──────────────────────────────────── */

.wall {
  position: absolute;
  inset: -70px -8% -50px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  transform: rotate(-4deg);
  pointer-events: none;
}
.wrow { overflow: visible; }
.wtrack {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: drift 110s linear infinite;
}
.wrow.rev .wtrack { animation-direction: reverse; }
@keyframes drift { to { transform: translateX(-50%); } }
.wtile {
  flex: none;
  width: 124px;
  height: 124px;
  border-radius: 7px;
  overflow: hidden;
  opacity: 0.5;
  filter: saturate(0.85) brightness(0.78);
}
.wtile img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* readability scrim between the wall and the hero copy */
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--canvas) 26%, rgba(14, 12, 10, 0.72) 56%, rgba(14, 12, 10, 0.3)),
    linear-gradient(180deg, var(--canvas), transparent 26%, transparent 62%, var(--canvas) 97%);
}

/* ── definition strip ─────────────────────────────────── */

.definition {
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px 24px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: center;
}
.def-line {
  font-family: var(--display);
  font-weight: 550;
  letter-spacing: 0.025em;
  font-size: clamp(22px, 2.8vw, 30px);
  color: var(--ink-strong);
  margin: 0;
  line-height: 1.7;
}
.def-line select {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--mono);
  font-size: 0.78em;
  color: var(--ember);
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--ember-dim);
  border-radius: 0;
  padding: 0 18px 2px 4px;
  margin: 0 2px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23B05F2E' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 10px 6px;
  transition: border-color 280ms var(--ease);
}
.def-line select:hover { border-bottom-color: var(--ember); }
.def-line select:focus { outline: none; border-bottom-style: solid; }
.def-sub {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin: 10px 0 0;
}

/* ── how it works ─────────────────────────────────────── */

.how {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
  padding: 56px 24px;
}
.step-n {
  font-family: var(--display);
  font-weight: 750;
  font-size: 34px;
  color: var(--ember);
  margin: 0 0 6px;
}
.step h3 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-strong);
  margin: 0 0 8px;
}
.step p { font-size: 14.5px; color: var(--ink-muted); margin: 0; line-height: 1.65; }

/* ── progress ─────────────────────────────────────────── */

.progress { max-width: 760px; margin: 0 auto; padding: 48px 24px; }
.progress-rule {
  height: 2px;
  background: var(--rule-strong);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ember);
  border-radius: 2px;
  transition: width 600ms var(--ease);
}
.progress-text { font-size: 13px; color: var(--ink-muted); margin: 14px 0 0; }

/* ── results ──────────────────────────────────────────── */

#results { max-width: 1040px; margin: 0 auto; padding: 26px 24px 30px; }

.cache-note { font-size: 12px; color: var(--ink-muted); margin: 0 0 18px; }
.cache-note button {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ember);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.statsrow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: rgba(255, 248, 240, 0.02);
  margin-bottom: 46px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 18px 20px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 248, 240, 0.04);
}
.stat b {
  display: block;
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 750;
  line-height: 1.1;
  color: var(--ink-strong);
}
.stat.accent b { color: var(--ember); }
.stat small {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* era sections */
.era { margin-bottom: 54px; }
.era-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 10px;
  margin-bottom: 22px;
}
.era-year {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(52px, 6vw, 76px);
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--ink-strong);
  margin: 0;
}
.era-meta { font-family: var(--mono); font-size: 12.5px; color: var(--ember); }

.flamegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 18px;
}
.flame {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 9px;
  transition: transform 500ms var(--ease), border-color 500ms var(--ease),
              background 500ms var(--ease);
}
.flame:hover {
  transform: translateY(-3px);
  border-color: var(--rule-strong);
  background: var(--surface-2);
}
.flame-art {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.flame-art img {
  position: relative; /* paints above the blank tile underneath */
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 700ms var(--ease);
}
.flame:hover .flame-art img { transform: scale(1.035); }
.tile-blank {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 46px;
  color: rgba(255, 250, 242, 0.85);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.flame-meta { padding: 12px 8px 8px; }
.flame-track {
  font-family: var(--display);
  font-weight: 650;
  font-size: 21px;
  letter-spacing: 0.015em;
  line-height: 1.08;
  color: var(--ink-strong);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.flame-artist {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 3px 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flame-stats {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-muted);
  border-top: 1px solid var(--rule);
  padding-top: 9px;
}
.flame-stats b { color: var(--ember); font-weight: 600; }
.flame-last { display: block; }

/* empty / error / rerun */
.emptybox, .errorbox {
  max-width: 640px;
  margin: 30px auto;
  padding: 26px 30px;
  border: 1px solid var(--rule-strong);
  border-radius: 16px;
  background: var(--surface);
  font-size: 15px;
}
.errorbox { border-left: 2px solid var(--ember); }
.empty-head { font-family: var(--display); font-weight: 650; font-size: 24px; color: var(--ink-strong); margin: 0 0 8px; }
.rerun { text-align: center; padding: 18px 0 6px; }

/* ── footer ───────────────────────────────────────────── */

footer {
  max-width: 1040px;
  margin: 40px auto 0;
  padding: 44px 24px 56px;
  border-top: 1px solid var(--rule);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  margin-bottom: 30px;
}
.foot-head {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-strong);
  margin: 0 0 8px;
}
.foot-grid p { font-size: 14px; color: var(--ink-muted); margin: 0; line-height: 1.7; }
.foot-line { font-size: 13px; color: var(--ink-muted); margin: 0; }

/* ── reveals ──────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  transition-delay: calc(var(--i, 0) * 45ms);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .wtrack { animation: none; }
  .flame, .flame-art img, .btn-primary { transition: none; }
}

/* ── small screens ────────────────────────────────────── */

@media (max-width: 900px) {
  .hero-copy { padding: 60px 20px 72px; }
  .wtile { width: 96px; height: 96px; }
  .how { grid-template-columns: 1fr; gap: 26px; padding: 40px 20px; }
  .statsrow { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 480px) {
  #username { min-width: 0; width: 100%; }
  .lookup .btn-primary { width: 100%; text-align: center; }
  .flamegrid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .flame-track { font-size: 16px; }
  .spec-stat span { display: none; }
  .def-line { line-height: 2; }
}
