:root {
  --paper: #fcfcfb;
  --paper-2: #f2f2ef;
  --ink: #16130e;
  --ink-soft: #57503f;
  --line: #16130e;
  --hair: #d8d0c0;
  --accent: #a33212;
  --accent-ink: #a33212;
  --ok: #2e5e4e;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", sans-serif;
  --display: "Fraunces", "IBM Plex Sans", serif;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
/* ---------- masthead ---------- */
header.masthead { border-bottom: 2.5px solid var(--line); }
.mast-top {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 5vw 10px; border-bottom: 1.5px solid var(--line);
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft);
}
.mast-top .live { color: var(--accent-ink); font-weight: 600; }
.mast-top .live .dot { color: var(--accent); }
.mast-main {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; padding: 26px 5vw 20px;
}
h1.brand {
  font-family: var(--display); font-weight: 900; font-size: clamp(40px, 6vw, 68px);
  line-height: .95; letter-spacing: -0.02em;
}
h1.brand em { font-style: italic; color: var(--accent); }
.mast-tag { max-width: 300px; font-size: 14px; color: var(--ink-soft); text-align: right; line-height: 1.4; }
.mast-tag strong { color: var(--ink); }
/* ---------- sections ---------- */
main { padding: 0 5vw 80px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px;
  margin: 44px 0 18px; font-family: var(--mono);
  font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
}
.section-head::after { content: ""; flex: 1; border-top: 1.5px solid var(--line); }
.section-head .no { color: var(--accent-ink); font-weight: 700; }
/* ---------- tool cards ---------- */
.tools { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1.5px solid var(--line); }
a.tool {
  position: relative; display: block; padding: 26px 22px 60px;
  border-bottom: 1.5px solid var(--line); border-right: 1.5px solid var(--line);
  color: var(--ink); text-decoration: none; background: var(--paper);
  transition: background .15s ease;
}
a.tool:hover { background: var(--paper-2); }
a.tool:hover .t-go { transform: translateX(4px); color: var(--accent); }
.t-idx {
  font-family: var(--mono); font-size: 12px; color: var(--accent-ink);
  letter-spacing: .1em; margin-bottom: 34px;
}
.t-name { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.1; margin-bottom: 8px; }
.t-desc { font-size: 14px; color: var(--ink-soft); max-width: 34ch; }
.t-go {
  position: absolute; left: 22px; bottom: 18px; font-family: var(--mono);
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  transition: transform .15s ease, color .15s ease;
}
/* ---------- article strip ---------- */
.articles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1.5px solid var(--line); }
.article { padding: 20px; border-right: 1.5px solid var(--line); }
.article:last-child { border-right: none; }
.a-date { font-family: var(--mono); font-size: 11px; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .08em; }
.a-title { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 6px 0 6px; line-height: 1.2; }
.a-dek { font-size: 13.5px; color: var(--ink-soft); }
/* ---------- tool page workspace ---------- */
.work { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1.5px solid var(--line); background: var(--paper); }
.pane { display: flex; flex-direction: column; min-height: 300px; min-width: 0; }
.pane + .pane { border-left: 1.5px solid var(--line); }
.pane-label {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px 12px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1.5px solid var(--line);
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-soft); background: var(--paper-2);
}
.pane textarea, .pane .out {
  flex: 1; width: 100%; border: none; resize: vertical; padding: 16px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
  background: var(--paper); color: var(--ink); min-height: 260px; outline: none;
}
.pane .out { white-space: pre-wrap; overflow-wrap: anywhere; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
button.act {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  padding: 10px 18px; background: var(--ink); color: var(--paper); border: 1.5px solid var(--ink);
  cursor: pointer; transition: background .15s ease;
}
button.act:hover { background: var(--accent); border-color: var(--accent); }
button.ghost { background: transparent; color: var(--ink); }
button.ghost:hover { background: var(--paper-2); color: var(--ink); }
.stat {
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
  padding: 6px 12px; border: 1.5px solid var(--hair); background: var(--paper);
}
.stat b { color: var(--ink); font-weight: 600; }
select, input[type="text"] {
  font-family: var(--mono); font-size: 13px; padding: 9px 12px;
  border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink);
}
/* token meter */
.meter { height: 10px; border: 1.5px solid var(--ink); margin: 12px 0 4px; position: relative; background: var(--paper-2); }
.meter > i { position: absolute; inset: 0; width: 0%; background: var(--ink); }
.meter.warn > i { background: var(--accent); }
table.models { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; margin-top: 10px; }
table.models th, table.models td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--hair); }
table.models th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); border-bottom: 1.5px solid var(--line); }
table.models tr.over td { color: var(--accent-ink); }
.fit-ok { color: var(--ok); font-weight: 600; }
.fit-over { color: var(--accent-ink); font-weight: 600; }
table.models td.r, table.models th.r { text-align: right; }
footer {
  border-top: 2.5px solid var(--line); padding: 22px 5vw 60px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-family: var(--mono);
  font-size: 12px; padding: 10px 18px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
.estimate-settings label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; flex: 1 1 170px; }
.estimate-settings input { min-width: 0; width: 100%; font: inherit; padding: 10px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
.infer-label { font-size: 12px; display: flex; align-items: center; gap: 7px; }
.tool-note { font-size: 13px; line-height: 1.65; color: var(--ink-soft); max-width: 80ch; margin-top: 20px; }
.stat { max-width: 100%; overflow-wrap: anywhere; }
textarea:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
#preview { white-space: normal; }
#preview pre { white-space: pre-wrap; }
[data-page="estimator"] .out { white-space: normal; }
#t-headroom { font-size: 13px; line-height: 1.65; color: var(--ink-soft); }
.breadcrumbs { margin: 18px 0; font-family: var(--sans); font-size: 12px; color: var(--ink-soft); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.breadcrumbs li + li::before { content: '/'; margin-right: 8px; }
::selection { background: #e3b19a; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media (max-width: 900px) {
  .tools, .articles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .work { grid-template-columns: 1fr; }
  .pane + .pane { border-left: none; border-top: 1.5px solid var(--line); }
  .mast-main { flex-direction: column; align-items: flex-start; gap: 10px; }
  .mast-tag { text-align: left; }
  .mast-top { font-size: 11px; letter-spacing: .04em; }
  .tools, .articles { grid-template-columns: 1fr; }
  .tools a.tool { border-right: none; }
  .models th:nth-child(2), .models td:nth-child(2) { display: none; }
  .models th, .models td { padding: 6px; }
}
