/* FencingAI API portal. Same ink-on-paper brand as fencingai.org (paper, ink, Cormorant Garamond,
   Archivo, JetBrains Mono). The only colours are the two scoring lights: green = live / valid,
   red (the brand signal) = stop / revoke. */
:root {
  --paper: #f4f3ee; --paper-deep: #eceae2; --card: #faf9f5;
  --ink: #191919; --ink-soft: #504f49; --ink-faint: #6f6d64; --line: #d4d1c6;
  --green: #1c6b45; --green-wash: #dfeadf; --red: #c22b1d; --red-wash: #f4dfdb;
  --display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --body: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--body); }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.012em; line-height: 1.02; margin: 0; text-wrap: balance; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- top bar (public pages) ---------- */
.topbar { display: flex; align-items: center; gap: 28px; padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line); background: rgba(244, 243, 238, .9); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5; }
.wordmark { font: 600 25px/1 var(--display); letter-spacing: -.02em; text-decoration: none; display: flex; align-items: baseline; gap: 8px; }
.wordmark .tag { font: 500 11px/1 var(--mono); letter-spacing: .12em; border: 1px solid var(--ink); padding: 3px 6px 2px; border-radius: 3px; }
.topbar nav { display: flex; gap: 22px; margin-left: auto; align-items: center; font-size: 15px; }
.topbar nav a { text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; transition: border-color .2s var(--ease); }
.topbar nav a:hover, .topbar nav a[aria-current] { border-bottom-color: var(--ink); }

/* ---------- buttons, inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 500 15px/1 var(--body); padding: 12px 18px;
  border: 1px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); cursor: pointer;
  text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s; box-shadow: 3px 3px 0 var(--line); }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--line); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 7px 11px; font-size: 13px; box-shadow: none; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: var(--paper); }
label { display: block; font: 500 13px/1 var(--body); margin: 18px 0 7px; }
label .hint { font-weight: 400; color: var(--ink-faint); }
input[type=text], input[type=email], input[type=password] { width: 100%; font: 400 16px/1.2 var(--body); padding: 12px 13px;
  border: 1px solid var(--ink-faint); border-radius: 4px; background: var(--card); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:hover { border-color: var(--ink); }
input:focus { outline: none; border-color: var(--ink); box-shadow: 3px 3px 0 var(--line); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.check input { margin-top: 3px; accent-color: var(--ink); }
.notice { border-left: 3px solid var(--ink); background: var(--paper-deep); padding: 12px 14px; font-size: 14px; margin: 18px 0; }
.notice.error { border-color: var(--red); background: var(--red-wash); }
.notice.good { border-color: var(--green); background: var(--green-wash); }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 5vw, 72px);
  padding: clamp(40px, 8vw, 104px) clamp(16px, 4vw, 48px) 56px; max-width: 1240px; margin: 0 auto; align-items: center; }
.hero h1 { font-size: clamp(52px, 8.4vw, 116px); margin: 18px 0 22px; }
.hero h1 em { font-style: italic; font-weight: 600; }
.hero p.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--ink-soft); max-width: 34em; margin: 0 0 30px; }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.figure { position: relative; }
.figure svg { width: 100%; height: auto; display: block; }
.bone { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.joint { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.joint.hot { fill: var(--green); stroke: var(--green); }
.floor { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 6; }
.coord { font: 500 10.5px var(--mono); fill: var(--ink-soft); }
.figure .joint { animation: settle 1.1s var(--ease) both; }
@keyframes settle { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .figure .joint { animation: none; } .btn { transition: none; } }
.terminal { background: var(--ink); color: #e9e4d6; border-radius: 6px; padding: 18px 20px; font: 400 13px/1.65 var(--mono);
  box-shadow: 10px 10px 0 var(--line); overflow-x: auto; margin-top: 14px; margin-left: 8%; position: relative; }
.terminal .dim { color: #8f8a7b; } .terminal .g { color: #8fd0a8; }
.band { border-top: 1px solid var(--line); padding: 56px clamp(16px, 4vw, 48px); }
.band > .inner { max-width: 1240px; margin: 0 auto; }
.models { display: grid; grid-template-columns: 1fr 1.5fr; gap: 0; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; background: var(--card); margin-top: 28px; }
.model { padding: 28px clamp(18px, 3vw, 34px); }
.model + .model { border-left: 1px solid var(--ink); background: var(--ink); color: var(--paper); }
.model h3 { font-size: 38px; margin: 10px 0 12px; }
.model ul { padding: 0; margin: 18px 0 0; list-style: none; font-size: 15px; }
.model li { padding: 9px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
.model + .model li { border-top-color: #3a382f; }
.model li span:last-child { font-family: var(--mono); font-size: 13px; text-align: right; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; margin-top: 30px; counter-reset: step; }
.steps div { counter-increment: step; border-top: 1px solid var(--ink); padding-top: 14px; }
.steps div::before { content: "0" counter(step); font: 500 12px var(--mono); color: var(--ink-faint); letter-spacing: .1em; }
.steps h3 { font-size: 30px; margin: 8px 0 8px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 15px; }
footer.site { border-top: 1px solid var(--line); padding: 26px clamp(16px, 4vw, 48px); font-size: 13px; color: var(--ink-faint); display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- auth pages ---------- */
.auth { max-width: 460px; margin: clamp(32px, 7vw, 84px) auto; padding: 0 16px; }
.auth h1 { font-size: 56px; margin: 12px 0 8px; }
.auth .sub { color: var(--ink-soft); margin: 0 0 8px; }
.auth form { background: var(--card); border: 1px solid var(--ink); border-radius: 6px; padding: 8px 26px 26px; box-shadow: 8px 8px 0 var(--line); margin-top: 22px; }
.auth form .btn { width: 100%; justify-content: center; margin-top: 22px; }
.auth .alt { font-size: 14px; color: var(--ink-soft); margin-top: 20px; }
.scope { margin-top: 20px; border: 1px dashed var(--ink-faint); border-radius: 6px; padding: 14px 16px; font-size: 14px; color: var(--ink-soft); }
.scope strong { color: var(--ink); }
.scope .row { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; transform: translateY(-1px); }
.dot.green { background: var(--green); } .dot.red { background: var(--red); } .dot.off { background: var(--ink-faint); }

/* ---------- console ---------- */
.console { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail { border-right: 1px solid var(--line); padding: 22px 18px; display: flex; flex-direction: column; gap: 4px; background: var(--paper-deep); position: sticky; top: 0; height: 100vh; }
.rail .wordmark { margin: 2px 6px 26px; }
.rail a.item { text-decoration: none; padding: 9px 10px; border-radius: 4px; font-size: 15px; display: flex; justify-content: space-between; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.rail a.item:hover { border-color: var(--line); background: var(--paper); }
.rail a.item[aria-current] { background: var(--ink); color: var(--paper); }
.rail .who { margin-top: auto; font-size: 13px; color: var(--ink-soft); border-top: 1px solid var(--line); padding: 14px 6px 0; overflow-wrap: anywhere; }
.rail .who form { margin-top: 10px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.main { padding: clamp(24px, 4vw, 52px) clamp(16px, 4vw, 56px) 80px; max-width: 1040px; }
.main h1 { font-size: clamp(44px, 5vw, 64px); margin: 10px 0 10px; }
.main > p.sub { color: var(--ink-soft); max-width: 46em; margin: 0 0 26px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 22px 24px; margin: 22px 0; }
.panel.reveal { border: 1px solid var(--ink); box-shadow: 8px 8px 0 var(--green-wash); }
.panel h2 { font-size: 30px; margin-bottom: 6px; }
.keyline { display: flex; gap: 10px; align-items: stretch; margin: 14px 0 12px; }
.keyline code { flex: 1; background: var(--ink); color: #e9e4d6; padding: 13px 14px; border-radius: 4px; font-size: 14px; overflow-x: auto; white-space: nowrap; user-select: all; }
.createrow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.createrow .grow { flex: 1; min-width: 220px; }
.createrow label { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); padding: 0 12px 10px 0; border-bottom: 1px solid var(--ink); }
td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.revoked td { color: var(--ink-faint); } tr.revoked .keyhint { text-decoration: line-through; }
tbody tr { transition: background .15s; } tbody tr:hover { background: var(--paper-deep); }
.keyhint { font-family: var(--mono); font-size: 13px; }
.empty { padding: 34px 0 20px; color: var(--ink-soft); }
.meter { height: 14px; border: 1px solid var(--ink); border-radius: 7px; overflow: hidden; background: var(--paper); margin: 16px 0 10px; }
.meter i { display: block; height: 100%; background: var(--ink); transition: width .6s var(--ease); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; background: var(--card); }
.stats div { padding: 18px 20px; } .stats div + div { border-left: 1px solid var(--line); }
.stats b { display: block; font: 600 50px/1 var(--display); letter-spacing: -.02em; margin-top: 8px; }

/* ---------- docs ---------- */
.docs { max-width: 860px; margin: 0 auto; padding: clamp(32px, 6vw, 72px) 16px 90px; }
.docs h1 { font-size: clamp(48px, 7vw, 84px); margin: 12px 0 14px; }
.docs h2 { font-size: 38px; margin: 54px 0 12px; padding-top: 18px; border-top: 1px solid var(--ink); }
.docs h3 { font-size: 26px; margin: 28px 0 8px; }
.docs p, .docs li { color: var(--ink-soft); } .docs strong { color: var(--ink); }
pre { background: var(--ink); color: #e9e4d6; padding: 16px 18px; border-radius: 6px; overflow-x: auto; line-height: 1.6; font-size: 13px; }
:not(pre) > code { background: var(--paper-deep); padding: 1px 5px; border-radius: 3px; }
.docs table { margin: 14px 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; } .terminal { margin-left: 0; }
  .models, .steps, .stats { grid-template-columns: 1fr; }
  .model + .model { border-left: 0; border-top: 1px solid var(--ink); } .stats div + div { border-left: 0; border-top: 1px solid var(--line); }
  .console { grid-template-columns: 1fr; } .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .rail .wordmark { margin: 0 12px 0 0; } .rail .who { margin: 0 0 0 auto; border: 0; padding: 0; }
  .topbar nav { gap: 14px; font-size: 14px; }
}
