/* kerf.css — one stylesheet for every page.

   THE GROUND IS A PHOTOGRAPH and it never moves: a fixed, softened frame of
   sawn timber behind everything, with a dark scrim over it. Everything a reader
   has to READ sits on a surface of its own — a pane of tinted glass with a
   hairline edge — because type directly on a photograph is either illegible or
   forces the photograph down to a wash, and a wash is the flat grey that makes
   a page look unfinished.

   The bands between sections are thin and few. What separates one part of a
   page from the next is the SURFACE, not a full-width block of colour.

   Two accents, and they mean something:
     ember      what a sale costs you — the kerf
     verdigris  what a loan does instead — copper that has not been cut
   Nothing else is coloured, so a colour on this site is always a claim. */

:root {
  --ink: #f7ece1;
  --ink-2: #d9c6b6;
  --ink-3: #cdb6a6;
  --night: #150d0a;
  --night-2: #241710;

  --ember: #ef8f43;
  --ember-deep: #c96a26;
  --verdigris: #6fc2a4;
  --verdigris-deep: #3f8e75;

  --pane: rgba(24, 14, 10, 0.68);
  --pane-2: rgba(30, 18, 13, 0.84);
  --pane-3: rgba(18, 10, 7, 0.74);
  --edge: rgba(247, 236, 225, 0.14);
  --edge-2: rgba(247, 236, 225, 0.08);
  --glow: 0 18px 50px -22px rgba(0, 0, 0, 0.85);

  --serif: "Instrument Serif", Iowan Old Style, Palatino, Georgia, serif;
  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --w: 1160px;
  --r: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 400 16.5px/1.62 var(--sans);
  color: var(--ink);
  background: var(--night);
  letter-spacing: 0.004em;
  overflow-x: hidden;
}

/* ---- the ground ---------------------------------------------------- */

.ground {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url(../img/ground.jpg) center 45% / cover no-repeat var(--night);
  /* The tone is baked into the jpg; this only holds the frame steady across
     screens that render it warmer or cooler than it was made on. */
  filter: saturate(1.02) contrast(1.02);
}
.ground::after {
  content: "";
  position: absolute;
  inset: 0;
  /* A LIGHT scrim, and deliberately so. A heavy one buys legibility everywhere
     and costs the photograph: the page composites to something nearly black,
     which measures flat and reads unfinished however carefully the CSS is
     written. Type is made legible by the surface it sits on instead — a card,
     or the hero's own gradient — and this only keeps the frame from competing.
     Measured, not judged: tools/shots.mjs, beside the reference, in one run. */
  background:
    radial-gradient(130% 85% at 50% 0%, rgba(10, 6, 4, 0.52) 0%, rgba(10, 6, 4, 0.12) 48%, rgba(10, 6, 4, 0.4) 100%),
    linear-gradient(180deg, rgba(12, 7, 5, 0.34) 0%, rgba(12, 7, 5, 0.04) 26%, rgba(12, 7, 5, 0.46) 100%);
}

/* The hero's own scrim: dark where the words are, clear where the timber is.
   A band across the whole width would flatten the top of every page. */
.hero { position: relative; padding-top: 78px; padding-bottom: 74px; }
.hero::before {
  content: "";
  position: absolute; inset: -40px 0 -20px 0; z-index: -1;
  background: linear-gradient(96deg, rgba(11, 6, 4, 0.93) 0%, rgba(11, 6, 4, 0.86) 30%, rgba(11, 6, 4, 0.55) 58%, rgba(11, 6, 4, 0.04) 86%);
}
@media (max-width: 860px) {
  .hero::before { background: linear-gradient(180deg, rgba(11, 6, 4, 0.92) 0%, rgba(11, 6, 4, 0.88) 62%, rgba(11, 6, 4, 0.7) 100%); }
}

/* ---- rhythm --------------------------------------------------------- */

.wrap { width: min(var(--w), calc(100% - 40px)); margin: 0 auto; }
.narrow { width: min(760px, calc(100% - 40px)); margin: 0 auto; }
section { padding: 62px 0; }
section.tight { padding: 34px 0; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--edge), transparent); border: 0; margin: 0; }

/* ---- type ------------------------------------------------------------ */

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.012em; margin: 0 0 0.4em; }
h1 { font-size: clamp(44px, 6.4vw, 78px); line-height: 1.02; }
h2 { font-size: clamp(29px, 3.4vw, 40px); line-height: 1.08; }
h3 { font-size: 22px; line-height: 1.2; }
p { margin: 0 0 1.05em; }
.lede { font-size: clamp(17px, 1.9vw, 20px); line-height: 1.55; color: var(--ink-2); }
.small { font-size: 14px; line-height: 1.58; color: var(--ink-2); }
.small.dim, .dim { color: var(--ink-3); }
.eyebrow {
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--ember);
  margin: 0 0 18px; display: block;
}
.eyebrow.cool { color: var(--verdigris); }
a { color: var(--ink); text-decoration-color: rgba(239, 143, 67, 0.5); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ember); }
b, strong { font-weight: 600; }
em { font-style: italic; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ember { color: var(--ember); }
.verdigris { color: var(--verdigris); }
.dim { color: var(--ink-3); }

/* ---- nav ------------------------------------------------------------- */

.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: linear-gradient(180deg, rgba(15, 9, 6, 0.86), rgba(15, 9, 6, 0.5));
  border-bottom: 1px solid var(--edge-2);
}
.nav .wrap { display: flex; align-items: center; gap: 10px; height: 62px; }
.lockup { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.lockup b { font: 400 26px/1 var(--serif); letter-spacing: 0.004em; color: var(--ink); }
.nav nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav nav a {
  font: 500 14px/1 var(--sans); color: var(--ink-2); text-decoration: none;
  padding: 9px 12px; border-radius: 9px;
}
.nav nav a:hover { color: var(--ink); background: rgba(247, 236, 225, 0.07); }
.nav nav a.on { color: var(--ink); background: rgba(247, 236, 225, 0.1); }
.nav .nav-x { display: inline-flex; padding: 9px 10px; }
.nav .nav-x svg { width: 15px; height: 15px; fill: var(--ink-2); }
.nav .nav-x:hover svg { fill: var(--ink); }
.burger { display: none; }

/* ---- buttons --------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px/1 var(--sans); letter-spacing: 0.01em;
  padding: 13px 20px; border-radius: 11px; border: 1px solid transparent;
  background: var(--ember); color: #1c0f06; text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: #ffa159; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.ghost { background: rgba(247, 236, 225, 0.06); color: var(--ink); border-color: var(--edge); }
.btn.ghost:hover { background: rgba(247, 236, 225, 0.12); }
.btn.cool { background: var(--verdigris); color: #07201a; }
.btn.cool:hover { background: #86d9ba; }
.btn.sm { font-size: 13.5px; padding: 9px 13px; border-radius: 9px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---- surfaces -------------------------------------------------------- */

.card {
  background: var(--pane);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  box-shadow: var(--glow);
  padding: 22px 24px;
}
.card.flat { box-shadow: none; background: var(--pane-3); }

/* PROSE NEVER SITS ON THE PHOTOGRAPH. A paragraph on a bright frame is either
   illegible or forces the frame down to a wash; a panel is the third option —
   tinted glass with no border, so a block of text reads like a block of text
   rather than like a card of data, and the timber is still visible through it.
   Every run of the contrast tool has found the same thing: what fails is never
   the type inside a surface, it is the sentence someone left outside one. */
.panel {
  background: rgba(15, 8, 6, 0.68);
  backdrop-filter: blur(13px) saturate(1.1);
  -webkit-backdrop-filter: blur(13px) saturate(1.1);
  border-radius: var(--r);
  padding: 26px 28px;
}
.panel.slim { padding: 18px 22px; }
.panel > :last-child { margin-bottom: 0; }
.card.solid { background: var(--pane-2); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* A figure and its label, the unit this site is mostly made of. */
.stat { display: flex; flex-direction: column; gap: 5px; }
.stat .k { font: 500 12px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.stat .v { font: 500 27px/1.06 var(--mono); letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .v.sm { font-size: 20px; }
.stat .v.lg { font-size: 38px; }
.stat .note { font: 400 13px/1.45 var(--sans); color: var(--ink-3); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 11.5px/1 var(--sans); letter-spacing: 0.07em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 7px;
  background: rgba(247, 236, 225, 0.08); color: var(--ink-2); border: 1px solid var(--edge-2);
}
.tag.ember { background: rgba(239, 143, 67, 0.16); color: #ffb478; border-color: rgba(239, 143, 67, 0.3); }
.tag.cool { background: rgba(111, 194, 164, 0.15); color: #8fd8bd; border-color: rgba(111, 194, 164, 0.3); }
.tag.warn { background: rgba(226, 96, 78, 0.16); color: #ff9a8c; border-color: rgba(226, 96, 78, 0.32); }

/* ---- tables ---------------------------------------------------------- */

.tablewrap { overflow-x: auto; border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: right; padding: 11px 14px; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  font: 500 11.5px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--edge); padding-bottom: 9px;
}
tbody tr { border-bottom: 1px solid var(--edge-2); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: rgba(247, 236, 225, 0.04); }
td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---- form controls --------------------------------------------------- */

label.field { display: block; }
label.field .k {
  display: block; font: 500 12px/1 var(--sans); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
input[type="text"], input[type="number"], select {
  width: 100%; font: 500 18px/1 var(--mono); color: var(--ink);
  background: rgba(12, 7, 5, 0.55); border: 1px solid var(--edge);
  border-radius: 11px; padding: 13px 14px; letter-spacing: -0.01em;
}
select { font-family: var(--sans); font-size: 15.5px; letter-spacing: 0; }
input:focus, select:focus { outline: 2px solid rgba(239, 143, 67, 0.55); outline-offset: 1px; border-color: transparent; }
input::placeholder { color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 13px/1 var(--mono); color: var(--ink-2); cursor: pointer;
  background: rgba(247, 236, 225, 0.06); border: 1px solid var(--edge-2);
  border-radius: 9px; padding: 9px 12px;
}
.chip:hover { background: rgba(247, 236, 225, 0.12); color: var(--ink); }
.chip.on { background: rgba(97, 47, 14, 0.82); border-color: rgba(239, 143, 67, 0.45); color: #ffc08c; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
/* A tab sits directly over the photograph, so its own background has to carry
   it — 5% white over a bright frame is not a surface, it is a tint, and the
   label on it measured 3.4:1 over the pale end of the timber. */
.tabs button {
  font: 500 14px/1 var(--sans); color: var(--ink-2); cursor: pointer;
  background: rgba(18, 10, 7, 0.72); border: 1px solid var(--edge-2);
  border-radius: 10px; padding: 10px 15px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabs button:hover { color: var(--ink); background: rgba(28, 17, 12, 0.82); }
.tabs button.on { color: var(--ink); background: rgba(46, 28, 20, 0.9); border-color: var(--edge); }

/* ---- the two routes, side by side ----------------------------------- */

.routes { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route { position: relative; overflow: hidden; }
.route::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
}
.route.sell::before { background: linear-gradient(180deg, var(--ember), rgba(239, 143, 67, 0)); }
.route.borrow::before { background: linear-gradient(180deg, var(--verdigris), rgba(111, 194, 164, 0)); }
.route.best { border-color: rgba(239, 143, 67, 0.42); }
.route.borrow.best { border-color: rgba(111, 194, 164, 0.42); }
.route h3 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.route .lines { display: grid; gap: 9px; margin-top: 4px; }
.line { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 14.5px; }
.line .k { color: var(--ink-3); }
.line .v { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---- charts ---------------------------------------------------------- */

figure { margin: 0; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }
svg.chart .axis { stroke: var(--edge); stroke-width: 1; }
svg.chart .grid-line { stroke: var(--edge-2); stroke-width: 1; }

/* ---- misc ------------------------------------------------------------ */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 90; max-width: min(560px, calc(100% - 32px));
  background: var(--pane-2); border: 1px solid var(--edge); border-radius: 12px;
  box-shadow: var(--glow); padding: 13px 16px; font-size: 14.5px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.toast.bad { border-color: rgba(226, 96, 78, 0.45); }
.toast.good { border-color: rgba(111, 194, 164, 0.45); }
.hidden { display: none !important; }

.steps { display: grid; gap: 10px; counter-reset: step; }
.step {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 13px 15px; border-radius: 12px; border: 1px solid var(--edge-2);
  background: rgba(12, 7, 5, 0.4);
}
.step .i {
  flex: none; width: 23px; height: 23px; border-radius: 7px; margin-top: 1px;
  display: grid; place-items: center; font: 600 12px/1 var(--mono);
  background: rgba(247, 236, 225, 0.1); color: var(--ink-2);
}
.step.done .i { background: rgba(111, 194, 164, 0.22); color: #8fd8bd; }
.step.now { border-color: rgba(239, 143, 67, 0.4); background: rgba(239, 143, 67, 0.07); }
.step .t { font-size: 14.5px; }
.step .d { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

footer.foot { padding: 46px 0 60px; border-top: 1px solid var(--edge-2); margin-top: 30px; }
footer.foot .wrap { display: flex; flex-wrap: wrap; gap: 22px 34px; align-items: flex-start; }
footer.foot .links { display: flex; flex-wrap: wrap; gap: 18px; margin-left: auto; }
footer.foot a { color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
footer.foot a:hover { color: var(--ink); }

/* Sections reveal as they arrive; js/site.js removes .rise when it is on. */
.rise { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.rise.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rise { opacity: 1; transform: none; transition: none; } }

/* ---- phones ---------------------------------------------------------- */

@media (max-width: 860px) {
  .g3, .g4, .routes { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
  section { padding: 46px 0; }
  .nav nav { display: none; }
  .nav nav.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; top: 62px; right: 12px; left: 12px; padding: 10px;
    background: rgba(17, 10, 7, 0.96); border: 1px solid var(--edge);
    border-radius: 14px; box-shadow: var(--glow);
  }
  .burger {
    display: inline-flex; margin-left: auto; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
    background: rgba(247, 236, 225, 0.07); border: 1px solid var(--edge-2);
  }
  .burger span { display: block; width: 16px; height: 1.5px; background: var(--ink); box-shadow: 0 5px var(--ink), 0 -5px var(--ink); }
  .card { padding: 18px; }
}
