/* ============================================================
   QUENCH — hand-forged blades & heritage tools
   Dark = forge; light = the polished shop. Tokens flip on
   :root[data-theme]. Damascus hero is raw WebGL (main.js).
   ============================================================ */

:root {
  --max: 1240px;
  --ease: cubic-bezier(.19, 1, .22, 1);      /* expo-out — a hammer's follow-through */
  --ease-snap: cubic-bezier(.16, 1, .3, 1);
  --brass: #b98a3f;
  --ember: #ff7a2f;
  --font-d: "Marcellus", Georgia, serif;
  --font-b: "Inter", system-ui, sans-serif;
  --font-m: "Space Mono", ui-monospace, monospace;
}

/* ---- dark: the forge ---- */
:root[data-theme="dark"] {
  --bg: #131211;
  --bg-2: #191715;
  --panel: #1c1a17;
  --ink: #efe9df;
  --dim: #b3aa9c;
  --faint: #6f675c;
  --line: rgba(239, 233, 223, .12);
  --line-2: rgba(239, 233, 223, .06);
  --accent: #ff7a2f;
  --steel: #7d8996;
  --edge: #cdd4da;
  --handle: #6a4a2f;
  --pat: #9aa4ad;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, .8);
}
/* ---- light: the polished shop ---- */
:root[data-theme="light"] {
  --bg: #e9e4db;
  --bg-2: #efeae1;
  --panel: #f4f0e8;
  --ink: #201c17;
  --dim: #5f574c;
  --faint: #8c8374;
  --line: rgba(32, 28, 23, .14);
  --line-2: rgba(32, 28, 23, .07);
  --accent: #d1571b;
  --steel: #5a6672;
  --edge: #2c333a;
  --handle: #7a5636;
  --pat: #4c5660;
  --shadow: 0 24px 60px -34px rgba(60, 44, 30, .45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-b);
  font-size: clamp(15px, 1vw + 13px, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}

.mono { font-family: var(--font-m); font-variant-ligatures: none; }
.wrap { width: min(100% - 2.4rem, var(--max)); margin-inline: auto; }
h1, h2, h3 { font-family: var(--font-d); font-weight: 400; line-height: 1.02; margin: 0; letter-spacing: -.01em; }
em { font-style: italic; color: var(--accent); }
a { color: inherit; }

.film {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 80% -10%, color-mix(in oklab, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(100% 100% at 10% 110%, var(--bg-2), transparent 70%);
  opacity: .9;
}
.film::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--line-2) 1px, transparent 0);
  background-size: 4px 4px; opacity: .6;
}

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: #17110b; padding: .5rem .9rem; border-radius: 8px; font-weight: 600;
}
.skip:focus { left: 12px; }

:where(a, button, input, textarea):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(100% - 2.4rem, var(--max)); margin: .7rem auto 0;
  padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; font-family: var(--font-d); font-size: 1.15rem; letter-spacing: .01em; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: .3rem; }
.nav-links a { text-decoration: none; color: var(--dim); font-size: .86rem; padding: .45rem .7rem; border-radius: 9px; transition: color .25s, background .25s; }
.nav-links a:hover { color: var(--ink); background: var(--line-2); }
.nav-cta { color: var(--ink) !important; border: 1px solid var(--line); }
.nav-cta:hover { background: var(--accent) !important; color: #17110b !important; border-color: transparent; }
@media (max-width: 780px) { .nav-links a:not(.nav-cta) { display: none; } }

.theme-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; margin-left: .2rem;
  border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--dim); cursor: pointer;
  transition: color .25s, border-color .25s, transform .2s;
}
.theme-btn:hover { color: var(--ink); border-color: var(--accent); }
.theme-btn:active { transform: scale(.92); }
.theme-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
:root[data-theme="dark"] .ico-sun { display: block; }
:root[data-theme="dark"] .ico-moon { display: none; }
:root[data-theme="light"] .ico-sun { display: none; }
:root[data-theme="light"] .ico-moon { display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; text-decoration: none;
  padding: .72rem 1.15rem; border-radius: 11px; font-weight: 600; font-size: .92rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .2s var(--ease-snap), background .25s, border-color .25s, color .25s;
}
.btn-primary { background: var(--accent); color: #17110b; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -14px var(--accent); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- section scaffolding ---------- */
main { position: relative; z-index: 1; }
section { position: relative; }
.sec-head { max-width: 62ch; margin-bottom: 2.6rem; }
.kicker { color: var(--accent); font-size: .74rem; letter-spacing: .22em; text-transform: uppercase; margin: 0 0 1rem; }
.eyebrow { color: var(--faint); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; margin: 0 0 1.4rem; }
h2 { font-size: clamp(2rem, 4vw, 3.1rem); }
.lede { color: var(--dim); font-size: clamp(1rem, 1.4vw, 1.14rem); margin: 1rem 0 0; }
.wm {
  position: absolute; top: 6%; right: -2%; z-index: 0; pointer-events: none; user-select: none;
  font-family: var(--font-d); font-size: clamp(5rem, 18vw, 15rem); color: var(--ink); opacity: .035; letter-spacing: .04em;
}

/* ---------- hero ---------- */
.hero { padding: clamp(3rem, 7vw, 6rem) 0 clamp(3rem, 6vw, 5rem); width: min(100% - 2.4rem, var(--max)); margin-inline: auto; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-title { font-size: clamp(2.7rem, 7.5vw, 5.4rem); margin: .2rem 0 0; }
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: block; }
.js .hero-title .line > span { transform: translateY(110%); }
.js .hero.loaded .hero-title .line > span { animation: rise .95s var(--ease) forwards; }
.js .hero.loaded .hero-title .line:nth-child(2) > span { animation-delay: .1s; }
.js .hero.loaded .hero-title .line:nth-child(3) > span { animation-delay: .2s; }
@keyframes rise { to { transform: translateY(0); } }

.hero-sub { color: var(--dim); max-width: 46ch; margin: 1.5rem 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.8rem 0 0; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 1.8rem; margin: 2.4rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.hero-facts div { display: flex; flex-direction: column; gap: .2rem; }
.hero-facts dt { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.hero-facts dd { margin: 0; font-family: var(--font-d); font-size: 1.5rem; }

/* blade figure — canvas clipped to a blade */
.blade-fig { position: relative; margin: 0; }
.blade-clip {
  position: relative; aspect-ratio: 16 / 10; width: 100%;
  clip-path: polygon(2% 62%, 68% 30%, 88% 30%, 97% 38%, 97% 44%, 90% 47%, 30% 72%, 8% 78%, 3% 74%);
  background: #14110d; box-shadow: var(--shadow);
}
.damascus { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.blade-noise {
  position: absolute; inset: 0; mix-blend-mode: overlay; opacity: .5;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.14) 1px, transparent 0);
  background-size: 3px 3px;
}
.blade-edge {
  position: absolute; left: 2%; right: 3%; top: 62%; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--edge) 70%, transparent) 30%, var(--edge) 80%, transparent);
  transform: rotate(-11.5deg); transform-origin: left; opacity: .0;
}
.js .blade-fig.lit .blade-edge { animation: sheen 3.4s var(--ease) 1s; }
@keyframes sheen { 0% { opacity: 0; } 40% { opacity: .9; } 100% { opacity: .25; } }
.blade-cap { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; font-size: .72rem; color: var(--faint); flex-wrap: wrap; }
.hero-scroll { margin: clamp(2rem, 5vw, 3.4rem) 0 0; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }

/* ---------- forge steps ---------- */
.forge { padding: clamp(4rem, 9vw, 7rem) 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.step {
  display: grid; grid-template-columns: auto 1fr auto; gap: clamp(1rem, 3vw, 2.4rem); align-items: start;
  padding: 1.9rem 0; border-top: 1px solid var(--line); position: relative;
}
.step:last-child { border-bottom: 1px solid var(--line); }
.step-no { font-size: .8rem; color: var(--faint); padding-top: .35rem; }
.step-body h3 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); }
.step-body p { color: var(--dim); margin: .5rem 0 0; max-width: 54ch; }
.step-heat { display: inline-block; margin-top: .7rem; font-size: .72rem; color: var(--steel); }
.step::before {
  content: ""; position: absolute; left: -1.4rem; top: 1.9rem; width: 5px; height: 0;
  background: var(--heat, var(--accent)); border-radius: 3px; transition: height .8s var(--ease);
}
.step.is-in::before { height: calc(100% - 3.8rem); }
.step--quench .step-body h3 { color: var(--accent); }
.step--quench { background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 7%, transparent), transparent 60%); }
@media (max-width: 640px) {
  .step { grid-template-columns: auto 1fr; }
  .step-heat { grid-column: 2; }
}

.heat-rail { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .6rem 1rem; margin-top: 2.4rem; }
.heat-bar { grid-column: 1 / -1; height: 6px; border-radius: 4px; overflow: hidden; background: var(--line-2); border: 1px solid var(--line); }
.heat-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #3a3d42, #7a4a2a, #b5541c, #e07a22, #ff7a2f, #ffd27a); }
.heat-lbl { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.heat-lbl--hot { justify-self: end; color: var(--accent); }

/* ---------- tools ---------- */
.tools { padding: clamp(4rem, 9vw, 7rem) 0; background: var(--bg-2); border-block: 1px solid var(--line); overflow: hidden; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tool-grid { grid-template-columns: 1fr; } }
.tool { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; transition: transform .3s var(--ease), border-color .3s; }
.tool:hover { transform: translateY(-4px); border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.tool-art { aspect-ratio: 16 / 9; display: grid; place-items: center; background: linear-gradient(160deg, var(--bg), var(--bg-2)); border-bottom: 1px solid var(--line); }
.tool-art svg { width: 82%; height: auto; }
.tool-art .pat { fill: var(--pat); stroke: var(--edge); stroke-width: 1.2; }
.tool-info { padding: 1.1rem 1.2rem 1.3rem; }
.tool-top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.tool-top h3 { font-size: 1.3rem; }
.tool-price { font-size: .95rem; color: var(--ink); }
.tool-price .mono { color: var(--faint); font-size: .74rem; }
.tool-spec { margin: .5rem 0 .2rem; font-size: .72rem; color: var(--steel); }
.tool-note { color: var(--dim); font-size: .9rem; margin: .5rem 0 .9rem; }
.tool-tag { display: inline-block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); }
.tag--ok { color: #7fb98a; border-color: color-mix(in oklab, #7fb98a 40%, var(--line)); }
.tag--low { color: var(--ember); border-color: color-mix(in oklab, var(--ember) 40%, var(--line)); }
.tag--soon { color: var(--brass); border-color: color-mix(in oklab, var(--brass) 40%, var(--line)); }

/* ---------- smith ---------- */
.smith { padding: clamp(4rem, 9vw, 7rem) 0; }
.smith-grid { display: grid; grid-template-columns: 1.5fr .85fr; gap: clamp(1.6rem, 4vw, 3.4rem); align-items: start; }
@media (max-width: 860px) { .smith-grid { grid-template-columns: 1fr; } }
.smith-copy p { color: var(--dim); margin: 1.1rem 0 0; max-width: 60ch; }
.smith-sign { font-family: var(--font-d); font-style: italic; color: var(--ink); margin-top: 1.6rem !important; }
.smith-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: .4rem 1.2rem; position: sticky; top: 5rem; }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line-2); }
.sc-row:last-child { border-bottom: 0; }
.sc-row .mono { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.sc-row span:last-child { font-family: var(--font-d); font-size: 1.05rem; }

/* ---------- commission ---------- */
.commission { padding: clamp(4rem, 9vw, 7rem) 0; background: var(--bg-2); border-block: 1px solid var(--line); }
.comm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.6rem, 4vw, 3.4rem); align-items: center; }
@media (max-width: 860px) { .comm-grid { grid-template-columns: 1fr; } }
.kicker--fire { color: var(--ember); }
.comm-sub { color: var(--dim); margin: 1rem 0 1.4rem; max-width: 48ch; }
.comm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.comm-list li { position: relative; padding-left: 1.3rem; color: var(--dim); font-size: .82rem; }
.comm-list li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.comm-form { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); padding: 1.4rem; box-shadow: var(--shadow); }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: .4rem; }
.field input, .field textarea {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: .92rem; resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.comm-fine { margin: .8rem 0 0; font-size: .7rem; color: var(--faint); text-align: center; }
.comm-done { text-align: center; padding: 1.5rem .5rem; }
.comm-done strong { font-family: var(--font-d); font-weight: 400; font-size: 1.5rem; display: block; }
.comm-done .mono { display: block; margin-top: .5rem; font-size: .72rem; color: var(--faint); }

/* ---------- footer ---------- */
.footer { padding: 3rem 0 2.4rem; border-top: 1px solid var(--line); }
.foot-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 1.4rem; }
.foot-brand { font-family: var(--font-d); font-size: 1.4rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: .3rem; }
.foot-links a { text-decoration: none; color: var(--dim); font-size: .84rem; padding: .35rem .6rem; border-radius: 8px; }
.foot-links a:hover { color: var(--ink); background: var(--line-2); }
.foot-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .72rem; color: var(--faint); }
.foot-bottom a { color: var(--accent); text-decoration: none; }
.foot-bottom a:hover { text-decoration: underline; }

/* ---------- reveals (gated behind .js so content is never hidden without JS) ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  .hero-title .line > span { transform: none !important; animation: none !important; }
  .step::before { transition: none; }
  .blade-edge { animation: none !important; }
  * { scroll-behavior: auto !important; }
}
