/* TALLOW — candlelight on Joseph Wright of Derby's "An Experiment on a Bird in the Air Pump" (1768).
 *
 * SURFACE DIVISION (checked by tools/contrast.mjs on painted pixels, never by reading this file):
 *   .veil   — the thinnest glass: display type only (eyebrows, h1/h2 on the hero), ink --ink at ≥ 3:1 over the
 *             BRIGHTEST pixel the painting can put behind it.
 *   .card   — body glass: prose, labels, forms, at ≥ 4.5:1.
 *   .slab   — dense glass for figures, tables and the candle: ≥ 4.5:1 for 12 px type.
 *   chips, buttons and the nav each carry their own surface. No word stands on the bare painting.
 * Colour lives in these tokens only; achromatic literals elsewhere are alpha stops and shadows.
 */
:root {
  --night: #120b07;
  --umber: #1d130c;
  --veil: rgba(16, 10, 6, .52);
  --card: rgba(16, 10, 6, .72);
  --slab: rgba(13, 8, 5, .86);
  --line: rgba(240, 190, 110, .2);
  --line-2: rgba(240, 190, 110, .34);
  --ink: #f6eedc;
  --ink-2: #e2d3b4;
  --ink-3: #c7b48f;
  --gold: #f2b54c;
  --gold-2: #ffd27c;
  --gold-ink: #1c1106;
  --ember: #e0714a;
  --ok: #9fe0ae;
  --bad: #f39a7c;
  --wax: #f4ead2;
  --r: 18px;
  --r-sm: 12px;
  --maxw: 1160px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .8);
  --display: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--night); color: var(--ink);
  font: 400 16px/1.55 var(--ui); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* The ground: the painting, fixed, with a vignette that keeps its corners as dark as Wright painted them. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: var(--night) url("../img/ground-2400.jpg") 50% 42% / cover no-repeat;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .55) 100%);
}
@media (max-width: 1500px) { body::before { background-image: url("../img/ground-1440.jpg"); } }
@media (max-width: 760px) { body::before { background-image: url("../img/ground-900.jpg"); background-position: 50% 30%; } }

a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(242, 181, 76, .4); color: var(--ink); }
img { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
@media (max-width: 760px) { .wrap { padding: 0 16px; } }

/* ------------------------------------------------------------------ surfaces */
.veil, .card, .slab { border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.veil { background: var(--veil); backdrop-filter: blur(10px) saturate(1.15); -webkit-backdrop-filter: blur(10px) saturate(1.15); }
.card { background: var(--card); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); }
.slab { background: var(--slab); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.pad { padding: 26px 28px; }
@media (max-width: 760px) { .pad { padding: 20px 18px; } }

/* ------------------------------------------------------------------ type */
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .005em; margin: 0; color: var(--ink); }
h1 { font-size: clamp(44px, 6.4vw, 84px); line-height: .98; }
h2 { font-size: clamp(32px, 4vw, 48px); line-height: 1.04; }
h3 { font-size: 26px; line-height: 1.12; }
h1 em, h2 em { color: var(--gold-2); font-style: italic; }
p { margin: 0 0 12px; }
.lede { font-size: 18.5px; line-height: 1.55; color: var(--ink-2); max-width: 58ch; }
.eyebrow { font: 600 11.5px/1.2 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .gold { color: var(--gold-2); }

/* ------------------------------------------------------------------ nav */
.top { position: sticky; top: 0; z-index: 30; padding: 14px 0; }
.bar { display: flex; align-items: center; gap: 18px; padding: 8px 10px 8px 14px; border-radius: 999px; background: var(--slab); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 400 25px/1 var(--display); letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand svg, .brand img { width: 34px; height: 34px; flex: none; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a { color: var(--ink-2); font: 500 14.5px/1 var(--ui); padding: 10px 12px; border-radius: 999px; }
.nav-links a:hover, .nav-links a.on { color: var(--ink); background: rgba(240, 190, 110, .1); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ca-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); font: 600 12.5px/1 var(--ui); background: rgba(242, 181, 76, .08); white-space: nowrap; }
.ca-chip b { color: var(--gold-2); font-weight: 700; }
.ca-chip code { color: var(--ink-2); font-size: 11.5px; }
.menu-btn { display: none; background: none; border: 1px solid var(--line-2); color: var(--ink); width: 40px; height: 40px; border-radius: 999px; cursor: pointer; }
.only-sm { display: none !important; }
@media (max-width: 980px) {
  .nav-links { display: none; position: absolute; left: 16px; right: 16px; top: 70px; flex-direction: column; background: var(--slab); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 12px; font-size: 16px; }
  .menu-btn { display: grid; place-items: center; }
  .only-sm { display: block !important; }
  .hide-sm { display: none !important; }
  .brand { font-size: 22px; }
}

/* ------------------------------------------------------------------ buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; cursor: pointer; font: 600 15px/1 var(--ui); padding: 14px 20px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); transition: transform .12s, background .12s, box-shadow .12s; box-shadow: 0 10px 30px -12px rgba(242, 181, 76, .7); white-space: nowrap; }
.btn:hover { background: var(--gold-2); text-decoration: none; transform: translateY(-1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: rgba(240, 190, 110, .08); color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: rgba(240, 190, 110, .16); }
.btn.sm { padding: 10px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.big { padding: 18px 24px; font-size: 17px; }
label { display: block; font: 600 13px/1.3 var(--ui); color: var(--ink-2); margin: 0 0 7px; }
.field { margin-bottom: 16px; }
input, textarea, select { width: 100%; font: 500 16px/1.3 var(--ui); color: var(--ink); background: rgba(8, 5, 3, .72); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 13px 14px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 181, 76, .2); }
textarea { min-height: 88px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(8, 5, 3, .7); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--ink-2); font: 600 13.5px/1 var(--ui); padding: 10px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--gold); color: var(--gold-ink); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap-sm { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ sections */
section { margin: 0 0 26px; }
.sec-head { padding: 22px 26px; margin-bottom: 16px; max-width: 760px; }
.sec-head h2 { margin: 8px 0 8px; }
.sec-head p { color: var(--ink-2); margin: 0; }

/* hero: the painting is the first screen; the type sits in the dark upper left */
.hero { min-height: calc(100vh - 90px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 26px; align-items: end; padding: 12px 0 34px; }
.hero-copy { padding: 34px 34px 30px; align-self: start; margin-top: 4vh; }
.hero-copy h1 { margin: 14px 0 18px; }
.hero-copy .row { margin-top: 22px; flex-wrap: wrap; }
.hero-side { align-self: end; }
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 4px; } .hero-copy { margin-top: 0; padding: 26px 22px; } }

/* steps */
.step { padding: 24px 24px 22px; }
.step .k { font: 400 46px/1 var(--display); color: var(--gold-2); }
.step h3 { margin: 10px 0 8px; }
.step p { color: var(--ink-2); margin: 0; }

/* ------------------------------------------------------------------ the candle */
.candle { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 22px; align-items: center; }
.candle-art { position: relative; height: 230px; display: flex; align-items: flex-end; justify-content: center; }
.candle-art .glow { position: absolute; left: 50%; width: 180px; height: 180px; margin-left: -90px; border-radius: 50%; background: radial-gradient(closest-side, rgba(242, 181, 76, .45), rgba(242, 181, 76, 0)); pointer-events: none; transition: bottom .6s linear; }
.candle-art .stick { position: relative; width: 44px; border-radius: 8px 8px 3px 3px; background: linear-gradient(90deg, #d4c095, var(--wax) 45%, #b9a277); transition: height .6s linear; box-shadow: inset 0 -12px 18px rgba(0, 0, 0, .18); }
.candle-art .stick::after { content: ""; position: absolute; right: 6px; top: 0; width: 8px; height: 26px; border-radius: 0 0 6px 6px; background: #fbf5e4; }
.candle-art .wick { position: absolute; left: 50%; bottom: 100%; width: 3px; height: 12px; margin-left: -1.5px; background: #2b1c10; border-radius: 2px; }
.candle-art .flame { position: absolute; left: 50%; bottom: calc(100% + 8px); width: 30px; height: 48px; margin-left: -15px; border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%; background: radial-gradient(circle at 50% 72%, #fff3cc 0 22%, #ffd27c 38%, #f0a93a 62%, rgba(224, 113, 74, .0) 76%); transform-origin: 50% 90%; animation: flick 1.6s ease-in-out infinite; filter: drop-shadow(0 0 14px rgba(242, 181, 76, .8)); }
.candle-art .base { position: absolute; bottom: -6px; left: 50%; width: 78px; height: 10px; margin-left: -39px; border-radius: 5px; background: #8c5a2b; }
.candle-art.out .flame { display: none; }
.candle-art.out .smoke { display: block; }
.candle-art .smoke { display: none; position: absolute; left: 50%; bottom: calc(100% + 6px); width: 10px; height: 60px; margin-left: -5px; background: linear-gradient(to top, rgba(220, 210, 190, .5), rgba(220, 210, 190, 0)); filter: blur(4px); border-radius: 50%; animation: smoke 3s ease-in infinite; }
.candle-art.unlit .flame { display: none; }
@keyframes flick { 0%, 100% { transform: scale(1, 1) rotate(-1deg); } 30% { transform: scale(.94, 1.06) rotate(1.5deg); } 60% { transform: scale(1.04, .96) rotate(-1.5deg); } }
@keyframes smoke { from { opacity: .8; transform: translateY(0) scaleX(1); } to { opacity: 0; transform: translateY(-30px) scaleX(2); } }
@media (prefers-reduced-motion: reduce) { .candle-art .flame, .candle-art .smoke { animation: none; } }
.clock { font: 600 clamp(40px, 6vw, 64px)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--ink); }
.clock.low { color: var(--ember); }
.stat-label { font: 600 11px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.stat-big { font: 600 26px/1.15 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 22px; margin-top: 18px; }
@media (max-width: 560px) { .candle { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; } .candle-art { height: 180px; } }

/* ------------------------------------------------------------------ lists and tables */
.coins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.coin-card { display: block; padding: 18px; color: var(--ink); transition: transform .12s, border-color .12s; }
.coin-card:hover { transform: translateY(-2px); border-color: var(--line-2); text-decoration: none; }
.coin-card .head { display: flex; gap: 12px; align-items: center; }
.coin-card .pic, .coin-pic { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--umber); border: 1px solid var(--line); flex: none; }
.coin-card .name { font: 600 16px/1.2 var(--ui); }
.coin-card .sym { font: 500 13px/1.2 var(--mono); color: var(--ink-3); }
.coin-card .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font: 600 11.5px/1 var(--ui); border: 1px solid var(--line-2); background: rgba(8, 5, 3, .6); color: var(--ink-2); white-space: nowrap; }
.badge.lit { color: var(--gold-2); border-color: rgba(242, 181, 76, .55); }
.badge.lit::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.badge.out { color: var(--bad); border-color: rgba(243, 154, 124, .5); }
.badge.paid { color: var(--ok); border-color: rgba(159, 224, 174, .5); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 11px/1.2 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--line-2); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
tbody tr:nth-child(even) td { background: rgba(240, 190, 110, .035); }
td.num, th.num { text-align: right; }
.scroll-x { overflow-x: auto; }
.compare td:first-child { color: var(--ink-2); }
.compare td:last-child { color: var(--gold-2); }

/* ------------------------------------------------------------------ app layout */
.app { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .app { grid-template-columns: 1fr; } }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 1px solid var(--line-2); background: rgba(8, 5, 3, .6); color: var(--ink-2); font: 600 15px/1 var(--ui); padding: 13px; border-radius: var(--r-sm); cursor: pointer; }
.tabs button.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.quote { margin: 12px 0 16px; padding: 14px; border-radius: var(--r-sm); background: rgba(8, 5, 3, .66); border: 1px dashed var(--line-2); font-size: 14px; }
.quote .line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.quote .line b { font-family: var(--mono); font-weight: 600; }
.flame-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: rgba(242, 181, 76, .1); border: 1px solid rgba(242, 181, 76, .4); color: var(--ink); font-size: 14px; margin-bottom: 14px; }
.flame-note.no { background: rgba(8, 5, 3, .6); border-color: var(--line-2); color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.feed { max-height: 420px; overflow: auto; }
.feed .t { display: grid; grid-template-columns: 60px 1fr auto; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: center; }
.feed .t:nth-child(even) { background: rgba(240, 190, 110, .035); }
.feed .buy { color: var(--ok); } .feed .sell { color: var(--bad); }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 320px; overflow: auto; padding: 2px; }
.picker button { text-align: left; border: 1px solid var(--line-2); background: rgba(8, 5, 3, .66); color: var(--ink); border-radius: var(--r-sm); padding: 10px 11px; cursor: pointer; font: 600 14px/1.2 var(--ui); }
.picker button small { display: block; font: 500 11.5px/1.3 var(--ui); color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker button.on { border-color: var(--gold); background: rgba(242, 181, 76, .16); box-shadow: 0 0 0 2px rgba(242, 181, 76, .3) inset; }
.drop { display: flex; gap: 14px; align-items: center; border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 12px; background: rgba(8, 5, 3, .6); cursor: pointer; }
.drop img, .drop .ph { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: var(--umber); flex: none; display: grid; place-items: center; color: var(--ink-3); font-size: 26px; }
.steps-out { list-style: none; padding: 0; margin: 14px 0 0; font-size: 14px; }
.steps-out li { padding: 8px 0 8px 28px; position: relative; color: var(--ink-3); }
.steps-out li::before { content: "○"; position: absolute; left: 4px; color: var(--ink-3); }
.steps-out li.doing { color: var(--ink); } .steps-out li.doing::before { content: "◔"; color: var(--gold-2); }
.steps-out li.done { color: var(--ink-2); } .steps-out li.done::before { content: "●"; color: var(--ok); }
.steps-out li.fail { color: var(--bad); } .steps-out li.fail::before { content: "×"; color: var(--bad); }

/* ------------------------------------------------------------------ faq, docs, footer */
details { border-bottom: 1px solid var(--line); padding: 4px 0; }
details summary { cursor: pointer; list-style: none; padding: 14px 4px; font: 600 16.5px/1.35 var(--ui); color: var(--ink); display: flex; justify-content: space-between; gap: 16px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--gold-2); font-size: 20px; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { color: var(--ink-2); padding: 0 4px 12px; margin: 0; }
.doc { max-width: 860px; }
.doc h2 { margin: 6px 0 12px; font-size: 36px; }
.doc h3 { margin: 22px 0 8px; font-size: 24px; }
.doc p, .doc li { color: var(--ink-2); }
.doc li { margin-bottom: 6px; }
.doc code { color: var(--ink); background: rgba(240, 190, 110, .08); padding: 1px 5px; border-radius: 5px; }
.foot { margin: 40px 0 26px; padding: 26px 28px; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 22px; }
.foot h4 { margin: 0 0 10px; font: 600 11px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.foot a { display: block; color: var(--ink-2); padding: 3px 0; font-size: 14.5px; }
.foot .fine { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 860px) { .foot { grid-template-columns: 1fr 1fr; } .foot > div:first-child { grid-column: 1 / -1; } }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 14px 16px; border-radius: var(--r-sm); background: var(--slab); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; box-shadow: var(--shadow); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.toast.err { border-color: rgba(243, 154, 124, .6); }
.toast.ok { border-color: rgba(159, 224, 174, .6); }
.skeleton { color: var(--ink-3); }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }
.hide { display: none !important; }
.sp { height: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stock-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 999px; background: rgba(8, 5, 3, .66); border: 1px solid var(--line); font: 600 13px/1 var(--ui); color: var(--ink); }
.stock-chip small { color: var(--ink-3); font: 500 12px/1 var(--mono); }
