/* revere.fi — a patent drawing of a protocol. Drafting vellum in light, blueprint in dark; ember for the forge. */
@import url("/fonts.css");

:root {
  --ground: #edf1f5; --grid: #dbe3ec; --grid-strong: #b9c8d8; --panel: #f8fafc; --ink: #10223a; --muted: #4d5f74;
  --line: #c3d0de; --wire: #1d4e89; --ember: #cf5418; --ember-ink: #ffffff; --ember-soft: #fbe7dc;
  --good: #2c7a53; --warn: #9a6100; --bad: #b3261e;
  --serif: "Libre Caslon Display", "Caslon", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --bar: 56px; --foot: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0a2341; --grid: #10305a; --grid-strong: #1d4675; --panel: #0d2a4c; --ink: #eaf2fa; --muted: #9fb5cb;
    --line: #23497a; --wire: #d3e4f5; --ember: #ff8a4c; --ember-ink: #1c0c03; --ember-soft: #3a2316;
    --good: #74d2a3; --warn: #f0b860; --bad: #ff8f86;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0a2341; --grid: #10305a; --grid-strong: #1d4675; --panel: #0d2a4c; --ink: #eaf2fa; --muted: #9fb5cb;
  --line: #23497a; --wire: #d3e4f5; --ember: #ff8a4c; --ember-ink: #1c0c03; --ember-soft: #3a2316;
  --good: #74d2a3; --warn: #f0b860; --bad: #ff8f86;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.6 var(--sans); background-color: var(--ground);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-strong) 1px, transparent 1px), linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  background-position: -1px -1px;
}
a { color: var(--ember); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fig { font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; display: flex; gap: 10px; align-items: center; }
.fig::after { content: ""; flex: 1; height: 1px; background: var(--line); max-width: 160px; }
h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: clamp(34px, 5.2vw, 60px); line-height: 1.04; }
h1 em, h2 em { font-style: normal; color: var(--ember); }
h2 { font-size: clamp(28px, 3.6vw, 42px); line-height: 1.1; }
h3 { font: 600 16px/1.35 var(--sans); margin: 0; }
p { margin: 0; }
.lede { color: var(--muted); font-size: 17px; max-width: 52ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── shell: bar, deck, footer ─────────────────────────────────────────────────────────────────────────────── */
/* minmax(0, 1fr): the one column may be narrower than its content. Without it the tab row's natural width (with
   icons, 481px) set the page's width on a 390px phone and every panel slid out of line. */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--bar) 1fr var(--foot); height: 100vh; height: 100dvh; }
.bar { display: flex; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--ground) 88%, transparent); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; flex: none; }
.brand svg { width: 26px; height: 26px; }
.brand b { font: 400 24px/1 var(--serif); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
/* Right-aligned with an auto margin, not justify-content:flex-end — that pushes an overflowing row's FIRST items
   out of reach on a narrow screen (the "Look up" tab was cut off on phones). */
.tabs a:first-child { margin-left: auto; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; color: var(--muted); text-decoration: none; font: 500 13px/1 var(--sans); padding: 9px 11px; border-radius: 4px; border: 1px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="true"] { color: var(--ink); border-color: var(--line); background: var(--panel); }
.tabs a .n { font: 500 10px var(--mono); color: var(--ember); margin-right: 6px; }

.deck { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.deck::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) { .deck { scroll-behavior: smooth; } }
.panel { min-width: 0; flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow-y: auto; overscroll-behavior-y: contain; display: grid; place-items: center; padding: 28px 16px; }
.sheet { width: 100%; max-width: 1080px; min-width: 0; }
/* Flex and grid children won't shrink below their content by default; one wide child widened the whole panel on
   phones and knocked every panel out of line. Everything in a sheet may shrink. */
.two > *, .stack > *, .card, .steps > *, .ident > * { min-width: 0; }

.foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--ground) 88%, transparent); }
.foot nav { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; }
.foot nav::-webkit-scrollbar { display: none; }
.foot a { color: var(--ink); text-decoration: none; white-space: nowrap; }
.foot a:hover { color: var(--ember); }
.foot .addr { display: flex; align-items: center; gap: 6px; font-family: var(--mono); white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager button { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 4px; cursor: pointer; font: 500 14px var(--mono); }
.pager button:disabled { opacity: .35; cursor: default; }
.dots { display: flex; gap: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--ember); }
@media (max-width: 720px) {
  :root { --bar: 52px; --foot: 48px; }
  .brand b { font-size: 21px; }
  .foot .addr, .foot .legal { display: none; }
}
@media (max-width: 420px) { .tabs a { padding: 8px 8px; } .tabs a .n { display: none; } }

/* ── content ───────────────────────────────────────────────────────────────────────────────────────────────── */
.two { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
@media (max-width: 880px) { .two { grid-template-columns: 1fr; gap: 26px; } }
.stack { display: grid; gap: 18px; align-content: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 15px/1 var(--sans); padding: 12px 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.primary { background: var(--ember); border-color: var(--ember); color: var(--ember-ink); }
.btn:disabled { opacity: .6; cursor: progress; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* the label motif: a grading slab's label, drawn */
.label { border: 1.5px solid var(--ink); border-radius: 4px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: var(--ground); }
.label .g { font: 600 12px/1 var(--sans); letter-spacing: .14em; }
.label .c { font: 500 19px/1.2 var(--mono); letter-spacing: .04em; }
.label .k { grid-row: span 2; align-self: center; font: 500 10px/1 var(--mono); letter-spacing: .12em; border: 1px solid var(--ink); border-radius: 3px; padding: 5px 6px; }
.keyline { font: 400 12px/1.4 var(--mono); color: var(--muted); word-break: break-all; }
.keyline b { color: var(--wire); font-weight: 500; }

form.look { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
@media (max-width: 480px) { form.look { grid-template-columns: 1fr auto; } form.look .scan { grid-column: 1 / -1; } }
input[type="text"], input:not([type]) { font: 500 16px var(--mono); color: var(--ink); background: var(--ground); border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; width: 100%; min-width: 0; min-height: 44px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { font: 500 12px var(--mono); padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--ground); color: var(--ink); cursor: pointer; }
.chip.clear { color: var(--muted); font-family: var(--sans); }

.result { display: grid; gap: 12px; min-height: 120px; }
dl.kv { margin: 0; display: grid; grid-template-columns: 104px 1fr; gap: 6px 12px; font-size: 14px; }
dl.kv dt { color: var(--muted); font: 500 11px/1.9 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
dl.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.offers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.offers li { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-top: 1px dashed var(--line); padding-top: 7px; font: 400 14px var(--mono); }
.pill { font: 600 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.pill.live, .pill.accepted { color: var(--good); } .pill.expired { color: var(--warn); } .pill.cancelled, .pill.refunded, .pill.none { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }
.err { font-size: 14px; color: var(--bad); }

/* loading skeletons — the shape of the answer, before it arrives */
.skel { display: grid; gap: 10px; }
.skel i { display: block; height: 12px; border-radius: 3px; background: var(--line); opacity: .55; }
.skel i:nth-child(1) { width: 62%; } .skel i:nth-child(2) { width: 84%; } .skel i:nth-child(3) { width: 48%; } .skel i:nth-child(4) { width: 92%; height: 30px; }
@media (prefers-reduced-motion: no-preference) {
  .skel i { background: linear-gradient(90deg, var(--line) 0%, var(--grid-strong) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* how it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
@media (max-width: 880px) { .steps { grid-template-columns: 1fr; gap: 12px; } }
.step { display: grid; gap: 8px; align-content: start; }
.step .no { font: 400 34px/1 var(--serif); color: var(--ember); }
.step p { color: var(--muted); font-size: 15px; }
code.k { font: 400 12.5px var(--mono); background: var(--ember-soft); color: var(--ink); padding: 1px 5px; border-radius: 3px; word-break: break-all; }

/* build on it */
pre.code { margin: 0; font: 400 13px/1.65 var(--mono); background: #0a1b31; color: #e3edf7; border-radius: 8px; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); }
pre.code .c { color: #8aa3bb; } pre.code .k { color: #ffab7a; } pre.code .s { color: #9ed9c4; }
ul.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
ul.facts li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 15px; }
ul.facts li::before { content: ""; width: 8px; height: 8px; margin-top: 8px; border: 1.5px solid var(--ember); transform: rotate(45deg); }

/* status */
.tablewrap { overflow-x: auto; margin-top: 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
td .mono { font-size: 13px; }
.callout { margin-top: 18px; border-left: 3px solid var(--ember); padding: 4px 0 4px 14px; max-width: 70ch; font-size: 15px; }

/* the forge */
.forge { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 62vh; }
.forge canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.forge-copy { display: grid; gap: 12px; }
.forge-copy blockquote { margin: 0; font: 400 clamp(22px, 2.6vw, 30px)/1.25 var(--serif); }
/* The forge panel: on a wide screen the drawing takes the whole panel and the words sit on it. */
.forge-panel { position: relative; place-items: stretch; padding: 0; }
/* width:auto — the base rule's width:100% would otherwise beat the right inset and run the drawing under the card. */
.forge-panel .forge { position: absolute; inset: 0 calc(min(420px, 38vw) + clamp(24px, 5vw, 72px)) 0 0; width: auto; max-height: none; aspect-ratio: auto; }
.forge-panel .forge-copy { position: absolute; right: clamp(16px, 4vw, 56px); top: 50%; transform: translateY(-50%); width: min(420px, 38vw);
  background: color-mix(in srgb, var(--panel) 90%, transparent); backdrop-filter: blur(3px); }
@media (max-width: 880px) {
  .forge-panel { display: grid; grid-template-rows: minmax(260px, 50vh) auto; place-items: stretch; padding: 0 0 20px; }
  .forge-panel .forge { position: relative; inset: auto; width: 100%; }
  .forge-panel .forge-copy { position: relative; right: auto; top: auto; transform: none; width: auto; margin: 0 16px; }
}

/* camera */
dialog.scan { border: 1px solid var(--line); border-radius: 10px; padding: 0; background: var(--panel); color: var(--ink); width: min(520px, calc(100vw - 32px)); }
dialog.scan::backdrop { background: rgba(5, 15, 30, .6); }
dialog.scan video { width: 100%; display: block; aspect-ratio: 4 / 3; background: #000; object-fit: cover; }
dialog.scan .in { padding: 14px; display: grid; gap: 10px; }

/* single pages: legal and 404 */
.page { min-height: calc(100dvh - var(--bar) - var(--foot)); padding: 36px 16px 56px; }
.page .sheet { max-width: 720px; margin: 0 auto; display: grid; gap: 14px; }
.page h1 { font-size: clamp(32px, 5vw, 46px); }
.page h2 { font: 600 18px/1.3 var(--sans); margin-top: 18px; }
.page p, .page li { max-width: 66ch; }
.page li { margin: 6px 0; }
.page .meta { font: 400 12.5px var(--mono); color: var(--muted); }
.shell.single { height: auto; min-height: 100dvh; }
.shell.single .bar { position: sticky; top: 0; z-index: 10; }

/* toasts (polish/qol), in this palette */
:root { --qol-font: var(--sans); --qol-bg: var(--panel); --qol-ink: var(--ink); --qol-muted: var(--muted); --qol-line: var(--line); --qol-accent: var(--ember); --qol-accent-2: var(--ember); --qol-alert: var(--bad); }
.qol-toasts { bottom: calc(var(--foot) + 10px); }

/* ── icons, illustrations, tooltips ────────────────────────────────────────────────────────────────────────── */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.16em; }
.ic.flip { transform: scaleX(-1); }
.btn .ic { width: 18px; height: 18px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
.tabs .tabic { width: 15px; height: 15px; color: var(--muted); }
.tabs a[aria-current="true"] .tabic { color: var(--ember); }
@media (max-width: 720px) { .tabs a .n { display: none; } }
.foot nav a { display: inline-flex; align-items: center; gap: 5px; }
.foot nav .ic { width: 14px; height: 14px; color: var(--muted); }
.foot .addr .ic { width: 14px; height: 14px; }
.foot .addr .chip { display: inline-grid; place-items: center; padding: 5px 7px; }
.pager .ic { width: 16px; height: 16px; }
.live-ic { color: var(--good); width: 14px; height: 14px; }
@media (prefers-reduced-motion: no-preference) { .live-ic { animation: pulse 2.4s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: .35; } }

/* the slab: a drawing of the object the cert is printed on */
.ident { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; }
.slab { margin: 0; border: 1.5px solid var(--ink); border-radius: 7px; padding: 6px; display: grid; gap: 5px; background: var(--ground); box-shadow: 3px 3px 0 var(--line); }
.slab-label { border: 1px solid var(--ink); border-radius: 3px; padding: 4px 5px; display: grid; grid-template-columns: 1fr auto; gap: 0 4px; align-items: center; }
.slab-label .g { font: 600 8.5px/1 var(--sans); letter-spacing: .14em; }
.slab-label .c { font: 500 9px/1.3 var(--mono); letter-spacing: .02em; grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; }
.slab-label .qrmark .ic { width: 12px; height: 12px; stroke-width: 1.5; }
.slab-window { border: 1px solid var(--line); border-radius: 3px; padding: 5px; display: grid; place-items: center; background: color-mix(in srgb, var(--ground) 70%, var(--panel)); }
.card-art { width: 100%; height: auto; fill: none; stroke: var(--wire); stroke-width: 1.3; stroke-linecap: round; }
.card-art .hatch { stroke: var(--ember); stroke-width: .8; opacity: .55; }
.ident-text { display: grid; gap: 6px; min-width: 0; }
.ident-cert { font: 500 clamp(18px, 2.2vw, 22px)/1.15 var(--mono); letter-spacing: .03em; word-break: break-all; }
.ident-cert .g2 { font: 600 .7em/1 var(--sans); letter-spacing: .14em; color: var(--muted); }
@media (max-width: 480px) { .ident { grid-template-columns: 88px 1fr; gap: 12px; } }

/* the three steps: a diagram each */
.dg { width: 100%; height: auto; max-height: 92px; fill: none; stroke: var(--wire); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.dg .em { stroke: var(--ember); }
.dg text { stroke: none; fill: var(--ink); font-family: var(--mono); }
.dg .t-b { font: 600 12px var(--sans); letter-spacing: .12em; }
.dg .t-m { font-size: 11px; }
.dg .t-s { font-size: 9.5px; fill: var(--muted); letter-spacing: .06em; }
.dg .em-t { fill: var(--ember); }

ul.facts li { grid-template-columns: 22px 1fr; }
ul.facts li::before { content: none; }
.fact-ic { width: 20px; height: 20px; color: var(--ember); margin-top: 2px; }
.cell-ic { display: inline-flex; align-items: center; gap: 8px; }
.cell-ic .ic { color: var(--wire); width: 17px; height: 17px; }
.pill { display: inline-flex; align-items: center; gap: 4px; }
.pill .ic { width: 11px; height: 11px; stroke-width: 2.2; }
.ic.dotic { fill: currentColor; stroke: none; }
.callout-ic { color: var(--ember); width: 18px; height: 18px; vertical-align: -3px; }
a .ic { width: .9em; height: .9em; }

/* result rows */
dl.kv dt { display: flex; align-items: center; gap: 6px; }
dl.kv dt .ic { width: 14px; height: 14px; color: var(--wire); }
.offers li .ic { width: 13px; height: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* terms that explain themselves */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.term:hover { color: var(--ember); }

/* the tooltip: one element, placed by script beside whatever is hovered, focused or tapped */
.tip { position: fixed; z-index: 2147482000; max-width: min(300px, calc(100vw - 24px)); padding: 9px 11px; border-radius: 6px; background: var(--ink); color: var(--ground);
  font: 400 13px/1.45 var(--sans); box-shadow: 0 10px 30px -12px #000; pointer-events: none; opacity: 0; transform: translateY(3px); }
.tip.on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: no-preference) { .tip { transition: opacity .12s, transform .12s; } }
