/* =====================================================================
   IRONWORKS B2B — Ironworks theme (riveted steel, rust, forged copper, ember).
   Used by the front page AND the sign-in / buy / account pages.
   Body text: Atkinson Hyperlegible (easy to read). Headings: Oswald. Name: Alfa Slab One.
   ===================================================================== */
@font-face { font-family: "Hyperlegible"; src: url("/fonts/hyperlegible-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hyperlegible"; src: url("/fonts/hyperlegible-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("/fonts/oswald-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Alfa Slab One"; src: url("/fonts/alfa-slab-one.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #111214; --surface: #1b1c1f; --surface-2: #26282c; --border: #3b3d42;
  --text: #ede8de; --muted: #aaa398;
  --primary: #d2722c; --primary-h: #e8873d; --primary-d: #8f4718; --primary-rgb: 210, 114, 44;
  --rust-rgb: 123, 59, 29; --ok: #4fbf7f; --bad: #ef6b5b; --focus: #ffb37a;
  --font: "Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Oswald", "Arial Narrow", Arial, sans-serif;
  --slab: "Alfa Slab One", Rockwell, "Courier New", serif;
  --grain: 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --r: radial-gradient(circle, #9a9ea5 0 2.2px, #5d6168 2.6px 3.1px, #2b2d31 3.4px 4.2px, transparent 4.6px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); font: 17px/1.6 var(--font); letter-spacing: .01em;
  background:
    var(--grain),
    radial-gradient(1100px 520px at 88% -8%, rgba(var(--rust-rgb), .22), transparent 60%),
    radial-gradient(900px 520px at -8% 110%, rgba(var(--primary-rgb), .10), transparent 60%),
    linear-gradient(165deg, #141518 0%, #0f1012 100%) fixed;
  min-height: 100vh;
}
a { color: var(--primary-h); text-decoration-color: rgba(var(--primary-rgb), .55); text-underline-offset: 3px; }
a:hover { color: #ffb37a; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .03em; line-height: 1.15; margin: 0 0 .5rem; color: #f2ede3; }
p { margin: .6rem 0; }
.muted { color: var(--muted); } .small { font-size: .9rem; }
.wrap { width: min(1160px, 100% - 32px); margin: 0 auto; }
.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(--primary); color: #160c05; padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- Header: riveted steel plate ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--grain), repeating-linear-gradient(90deg, rgba(255,255,255,.022) 0 1px, transparent 1px 4px), linear-gradient(180deg, #2b2d31 0%, #1d1e21 55%, #17181a 100%);
  box-shadow: 0 3px 0 0 var(--primary-d), 0 4px 0 0 #000, 0 8px 18px rgba(0,0,0,.5);
}
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 8px; pointer-events: none; opacity: .8;
  background: radial-gradient(circle at 4px 4px, #8a8e94 0 1.6px, #303236 2.2px 3px, transparent 3.4px) 10px 0 / 46px 8px repeat-x; }
.top .wrap { display: flex; align-items: center; gap: 1rem; min-height: 68px; padding: 8px 0 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--text); margin-right: auto; }
.brand img { width: 44px; height: 44px; border-radius: 6px; border: 2px solid #4b4d52; box-shadow: 0 0 0 1px #000, 0 0 14px rgba(var(--primary-rgb), .25); }
.brand-name { font: 22px/1 var(--slab); letter-spacing: .04em;
  background: linear-gradient(180deg, #f6f1e7 0%, #d9d2c4 46%, #9b9387 54%, #e2dbcd 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.8)); }
.brand-tag { display: block; font: 600 11px/1.2 var(--display); letter-spacing: .26em; text-transform: uppercase; color: var(--primary); margin-top: 4px; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { color: #cfc8bc; text-decoration: none; font-weight: 700; padding: .5rem .8rem; border-bottom: 3px solid transparent; }
.nav a:hover { color: #fff; border-bottom-color: var(--primary); }
.who { font-size: .9rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: 0 1.2rem;
  font: 700 16px var(--font); color: var(--text); text-decoration: none; cursor: pointer; border-radius: 2px;
  background: linear-gradient(180deg, #303237 0%, #25272b 100%); border: 1px solid #46484e; border-bottom-color: #18191b;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.5); margin: 6px 8px 6px 0;
}
.btn:hover { border-color: var(--primary); color: #fff; }
.btn.main, .btn-primary {
  background: linear-gradient(180deg, #ea8a43 0%, #cf6a24 52%, #a9521a 100%); border: 1px solid #6e3410; color: #160c05;
  text-shadow: 0 1px 0 rgba(255,214,170,.35); box-shadow: inset 0 1px 0 rgba(255,220,185,.45), 0 2px 4px rgba(0,0,0,.5);
}
.btn.main:hover, .btn-primary:hover { background: linear-gradient(180deg, #f39a55 0%, #dc7630 52%, #b45a1d 100%); color: #160c05; box-shadow: inset 0 1px 0 rgba(255,220,185,.5), 0 0 14px rgba(var(--primary-rgb), .45); }
.btn.link { background: none; border: 0; box-shadow: none; padding: 0 .3rem; min-height: 44px; text-decoration: underline; font-weight: 400; color: var(--primary-h); }
.btn.sm { min-height: 40px; font-size: 15px; padding: 0 .9rem; }
.btn[disabled] { opacity: .55; cursor: wait; }

/* ---------- Steel plate (cards, panels) ---------- */
.plate {
  position: relative; border: 1px solid #36383d; border-top-color: #4a4c52; border-bottom-color: #0c0c0d;
  background:
    var(--r) left 7px top 7px / 12px 12px no-repeat, var(--r) right 7px top 7px / 12px 12px no-repeat,
    var(--r) left 7px bottom 7px / 12px 12px no-repeat, var(--r) right 7px bottom 7px / 12px 12px no-repeat,
    var(--grain), linear-gradient(180deg, #24262a 0%, #1b1c1f 120px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 8px 22px rgba(0,0,0,.45);
  padding: 1.5rem 1.6rem;
}
.kicker { font: 600 13px var(--display); letter-spacing: .26em; text-transform: uppercase; color: var(--primary); margin: 0 0 .4rem; }
.bar::before { content: ""; display: inline-block; width: 6px; height: .9em; margin-right: .55rem; vertical-align: -.06em;
  background: linear-gradient(180deg, var(--primary-h), var(--primary-d)); box-shadow: 0 0 8px rgba(var(--primary-rgb), .4); }

/* ---------- Front page ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2.5rem; align-items: center; padding: 3.5rem 0 2.5rem; }
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); letter-spacing: .02em; }
.hero h1 em { font-style: normal; color: var(--primary-h); text-shadow: 0 0 22px rgba(var(--primary-rgb), .35); }
.hero .lead { font-size: 1.15rem; color: #d9d2c6; max-width: 36rem; }
.hero-plate { width: 100%; max-width: 440px; justify-self: center; border-radius: 22px; box-shadow: 0 30px 70px rgba(0,0,0,.65), 0 0 60px rgba(var(--primary-rgb), .12); }
.section { padding: 2.2rem 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.product { display: grid; grid-template-columns: 120px 1fr; gap: 1.5rem; align-items: start; }
.product > img { width: 120px; height: 120px; border-radius: 12px; border: 2px solid #4b4d52; object-fit: cover; box-shadow: 0 0 0 1px #000, 0 6px 18px rgba(0,0,0,.55); }
.product h2 { font-family: var(--slab); font-weight: 400; font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: .03em; }
.price-tag { display: inline-flex; align-items: baseline; gap: .4rem; padding: .25rem .8rem; border: 1px solid var(--primary-d); background: rgba(var(--primary-rgb), .12); font-weight: 700; margin: .2rem 0 .6rem; }
.price-tag small { font-weight: 400; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.4rem 0 1rem; }
.feature { padding: 1.2rem 1.25rem; }
.feature h3 { font-size: 1.2rem; }
.feature p { margin: .3rem 0 0; color: #d0c9bd; font-size: .98rem; }
.ticks { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .35rem; }
.ticks li { padding-left: 1.6rem; position: relative; }
.ticks li::before { content: ""; position: absolute; left: .2rem; top: .62em; width: .7rem; height: .7rem; background: radial-gradient(circle at 40% 35%, #ffb070, var(--primary) 55%, var(--primary-d)); border-radius: 50%; box-shadow: 0 0 8px rgba(var(--primary-rgb), .5); }
.note { border-left: 4px solid var(--primary); padding: .6rem .9rem; background: rgba(var(--primary-rgb), .08); margin: 1rem 0; }
.note.ok { border-left-color: var(--ok); background: rgba(79,191,127,.08); }
.note.bad { border-left-color: var(--bad); background: rgba(239,107,91,.08); }
.owned { color: var(--ok); font-weight: 700; }

/* ---------- Forms ---------- */
form { margin: .8rem 0; }
label { display: block; font-weight: 700; margin: .9rem 0 .35rem; }
input[type=email], input[type=text], input[type=tel], select, textarea {
  width: 100%; min-height: 48px; padding: .65rem .8rem; font: inherit; color: var(--text);
  background: #0d0e10; border: 1px solid #3a3c41; border-radius: 2px; box-shadow: inset 0 1px 3px rgba(0,0,0,.6);
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input.code { font-size: 1.6rem; letter-spacing: .35em; text-align: center; max-width: 14rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.status { min-height: 1.6em; font-weight: 700; margin-top: .6rem; }
.status.ok { color: var(--ok); } .status.bad { color: var(--bad); }

/* ---------- Account / sign-in pages (api/_lib/page.php) ---------- */
.page-main { width: min(42rem, 100% - 32px); margin: 2.2rem auto; }
.page-main h1 { font-size: 2rem; }
.page-main h2 { font-size: 1.35rem; margin-top: 1.4rem; }
.app { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.app .ic { flex: none; width: 72px; height: 72px; border: 2px solid #4b4d52; border-radius: 10px; overflow: hidden; display: grid; place-items: center; color: var(--primary); }
.app .ic img { width: 100%; height: 100%; object-fit: cover; }
.app .ic svg { width: 36px; height: 36px; }
.price { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 12px; border: 1px solid var(--primary-d); background: rgba(var(--primary-rgb), .12); font-weight: 700; margin: 6px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid #2a2c30; vertical-align: top; }
th { font: 600 13px var(--display); letter-spacing: .1em; text-transform: uppercase; color: #b0a99d; border-bottom: 2px solid #34363b; }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid #000; box-shadow: inset 0 1px 0 #2c2e32; margin-top: 2.5rem; padding: 1.4rem 0 2rem; color: var(--muted); font-size: .92rem; }
.foot .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 2rem; }
  .hero-plate { max-width: 320px; order: -1; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .features, .grid2 { grid-template-columns: 1fr; }
  .product { grid-template-columns: 1fr; }
  .product > img { width: 96px; height: 96px; }
  .nav { width: 100%; }
  .btn { width: 100%; margin-right: 0; }
  .btn.link { width: auto; }
  .plate { padding: 1.2rem 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Salvage Master side page */
.crumbs { margin: 1.4rem auto 0; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 700; }
.crumbs a:hover, .crumbs a:focus-visible { color: var(--primary); }
.side-tool { padding-top: 1rem; }

/* About + price */
.about { display: grid; grid-template-columns: 1.35fr .9fr; gap: 2rem; align-items: start; }
.about h2 { font-family: var(--slab); font-weight: 400; font-size: clamp(1.7rem, 3.2vw, 2.4rem); letter-spacing: .03em; margin-bottom: .6rem; }
.about h3 { font-size: 1.25rem; margin: 1.6rem 0 .3rem; }
.about-lead { font-size: 1.15rem; color: #e6dfd3; }
.price-plate { padding: 1.5rem 1.4rem; border-top: 4px solid var(--primary); position: sticky; top: 96px; }
.big-price { font-family: var(--slab); font-size: clamp(2.6rem, 5vw, 3.4rem); line-height: 1; margin: .2rem 0 .3rem; color: var(--primary-h); text-shadow: 0 0 24px rgba(var(--primary-rgb), .35); }
.price-sub { font-weight: 700; margin: 0 0 .6rem; }
.copper { color: var(--primary-h); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } .price-plate { position: static; } }
section[id] { scroll-margin-top: 90px; }
@media (max-width: 620px) { .top { position: static; } section[id] { scroll-margin-top: 0; } }
