/* Scrap Metal Intel site. Tokens follow the app's src/theme.ts palette. */
:root {
  --bg: #F3F0EA;
  --surface: #FFFFFF;
  --surface-2: #EFEBE3;
  --border: #E1DBD0;
  --text: #181510;
  --muted: #585349;
  --accent: #D9A97A;
  --accent-deep: #A8763F;
  --accent-text: #8C6236;
  --on-accent: #1A1206;
  --up: #07704C;
  --down: #B01734;
  --warn-bg: #FFF1CC;
  --warn-text: #5A3E00;
  --focus: #1F5FBF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 21, 16, .06), 0 4px 16px rgba(24, 21, 16, .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090C11;
    --surface: #141A23;
    --surface-2: #1B222D;
    --border: #2A3542;
    --text: #F5F2EC;
    --muted: #B4BECB;
    --accent-text: #D0975C;
    --up: #3DD69C;
    --down: #FF8FA3;
    --warn-bg: #3A2A05;
    --warn-text: #FFE3A3;
    --focus: #8AB4FF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.6rem); margin: .4em 0 .3em; }
h2 { font-size: 1.3rem; margin: 0 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .3em; }
p { margin: 0 0 .8em; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.fine { font-size: .86rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* preview watermark */
.preview-banner {
  background: repeating-linear-gradient(-45deg, var(--warn-bg), var(--warn-bg) 12px, transparent 12px, transparent 24px), var(--warn-bg);
  color: var(--warn-text); text-align: center; padding: 8px 16px; font-size: .92rem;
  border-bottom: 2px solid #E0961B;
}
.sample-badge {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .04em;
  background: var(--warn-bg); color: var(--warn-text); border: 1px solid #E0961B;
  border-radius: 999px; padding: 2px 10px; margin-bottom: 8px;
}

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand img { border-radius: 7px; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
@media (max-width: 480px) {
  .brand { font-size: .95rem; gap: 6px; }
  .nav a { padding: 8px 6px; font-size: .88rem; }
}
.nav a[aria-current="page"], .nav a:hover { background: var(--surface-2); }
@media (max-width: 350px) { .brand span { display: none; } }

main { padding-bottom: 32px; }
.intro { font-size: 1.08rem; color: var(--muted); max-width: 46em; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 0; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin: 18px 0;
}
section { margin: 22px 0; }
.prose { max-width: 46em; }
.prose li { margin-bottom: .35em; }
.eyebrow { font-size: .88rem; font-weight: 600; color: var(--accent-text); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.big { font-size: clamp(2.4rem, 1.8rem + 3vw, 3.2rem); font-weight: 800; margin: 0; letter-spacing: -.02em; }
.big .unit { font-size: 1.1rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.alt { margin: 2px 0 6px; }
.alt .unit { color: var(--muted); }
.asof { font-size: .88rem; color: var(--muted); }
/* site.js: shown when a dated price is older than STALE_WARN_HOURS */
.stale-warn {
  display: block; margin-top: 4px; padding: 4px 8px; border-radius: 8px;
  background: var(--warn-bg); color: var(--warn-text); font-weight: 600;
}
.price-line { margin: 0 0 18px; }
.changes { display: flex; gap: 16px; list-style: none; padding: 0; margin: 6px 0; font-weight: 600; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.spark { display: block; width: 100%; height: 64px; color: var(--accent-text); margin: 6px 0 10px; }
.note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .94rem; margin: 10px 0 0; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .96rem; }
caption { caption-side: top; text-align: left; color: var(--muted); font-size: .86rem; padding-bottom: 8px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* A price never breaks inside itself; its unit ("/troy oz") may wrap, so a
   table never forces the page wider than a 320 px phone. */
data.px { white-space: nowrap; }
td.up, td.down, td.flat { white-space: nowrap; }
.prices th a { font-weight: 600; }
.prices th .series { display: block; font-weight: 400; font-size: .78rem; }
@media (max-width: 380px) {
  th, td { padding: 8px 6px; }
  .prices th, .prices td { padding: 8px 4px; }
  thead th { letter-spacing: 0; }
  table { font-size: .92rem; }
  .card { padding: 14px; }
}
/* Stacked rows on phones for tables with long text (grades, brass). */
@media (max-width: 639px) {
  table.stack, table.stack tbody, table.stack tr, table.stack th, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.stack th, table.stack td { border: 0; padding: 2px 0; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); }
}
details.history summary { cursor: pointer; list-style: none; }
details.history summary h2 { display: inline; }
details.history summary::after { content: " ▸"; color: var(--muted); }
details.history[open] summary::after { content: " ▾"; }
details.history summary::-webkit-details-marker { display: none; }

/* forms + calculators */
.calc .lede { color: var(--muted); }
.calc-form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
label, legend { font-weight: 600; font-size: .95rem; }
input, select, button { font: inherit; color: inherit; }
input[type="number"], input[type="email"], select {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
}
input::placeholder { color: var(--muted); opacity: 1; }
.hint { display: block; font-size: .86rem; }
.with-unit { display: flex; gap: 8px; align-items: center; }
.with-unit select { width: auto; }
.suffix { font-weight: 600; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.mode { display: flex; flex-wrap: wrap; gap: 0 18px; }
fieldset.mode legend { width: 100%; margin-bottom: 2px; }
fieldset.mode label, .choices label { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 44px; }
input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent-deep); }
.grid2, .grid3 { display: grid; gap: 12px; }
.grid2.keep { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid2 > *, .grid3 > * { min-width: 0; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.sub { margin-top: 6px; }
.calc-out {
  display: block; margin-top: 14px; padding: 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px dashed var(--border);
}
.calc-out .formula { display: block; font-size: .98rem; }
.calc-out .total { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -.01em; }
.calc-out .row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.calc-out .row:last-child { border-bottom: 0; }
.calc-out .row strong { white-space: nowrap; }
.example { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.steps { padding-left: 1.3em; margin: 0 0 4px; }
.steps li { margin-bottom: .55em; }

/* buttons + CTA */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 20px;
  background: linear-gradient(180deg, #F3CE9F, #D9A97A 55%, #C08D55); color: var(--on-accent);
  border: 1px solid #A8763F; border-radius: 12px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.04); }
.store-badge img { display: block; height: 48px; width: auto; }
.cta { display: grid; gap: 16px; align-items: center; }
@media (min-width: 720px) { .cta { grid-template-columns: 1fr auto; } }
.qr { margin: 0; text-align: center; font-size: .82rem; color: var(--muted); max-width: 170px; }
.qr img { background: #fff; padding: 8px; border-radius: 10px; display: block; margin: 0 auto 6px; }
.cta-hero { text-align: center; }

/* waitlist */
.waitlist form { display: grid; gap: 12px; max-width: 32em; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wl-status:empty { display: none; }
.wl-status { font-weight: 600; }
.wl-status.err { color: var(--down); }
.preview-note { border-left: 3px solid #E0961B; padding-left: 8px; }

/* device targeting: <html data-device> is set by a tiny inline script.
   Without JS every block shows. */
html[data-device="android"] .show-ios,
html[data-device="android"] .show-desktop,
html[data-device="ios"] .show-desktop,
html[data-device="ios"] .show-nonios { display: none !important; }

/* guides + features */
.guides, .feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .guides, .feats { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .guides { grid-template-columns: repeat(3, 1fr); } }
.guide {
  display: grid; gap: 4px; height: 100%; padding: 16px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow);
}
.guide strong { color: var(--accent-text); }
.guide span { color: var(--muted); font-size: .94rem; }
.guide:hover { border-color: var(--accent); }
.guides.compact { grid-template-columns: 1fr; max-width: 28em; }
.feat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.feat p { margin: 0; color: var(--muted); }
.spot-list { padding-left: 1.1em; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--border); padding: 4px 0; }
.faq summary { cursor: pointer; padding: 10px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq summary h3 { margin: 0; font-size: 1.02rem; }
.faq .answer { padding: 0 0 10px; max-width: 46em; }

/* desktop: price card (or table) and calculator side by side */
/* minmax(0, 1fr): a wide table scrolls inside its own .table-wrap instead of
   stretching the track (and the page) past the viewport. */
.duo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 18px 0; }
.duo > * { min-width: 0; }
.duo > .card { margin: 0; }
@media (min-width: 960px) { .duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

footer.foot { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0 32px; margin-top: 24px; }
.foot-cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 12px; }
.foot h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .top, .foot, .cta, .waitlist, .calc { display: none; } }
