/* ═══════════════════════════════════════════════════════════════════════════
   VERITAS — BIRR BANKNOTE ENGRAVING  ·  design tokens
   Paper + engraved ink. Security-line world. No glass, no gradients-as-chrome.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* materials */
  --paper:          #F3EEDF;   /* note cream — page ground */
  --paper-deep:     #EAE2CA;   /* panel ground */
  --paper-dark:     #E0D6B8;   /* pressed panel */
  --paper-ink:      #F8F4E8;   /* reversed-on-ink text */

  --ink:            #1D261D;   /* engraved near-black (green-cast) */
  --ink-muted:      #56513C;   /* secondary ink on paper */
  --rule:           rgba(29, 38, 29, 0.26);  /* engraving hairlines */
  --rule-soft:      rgba(29, 38, 29, 0.12);

  --green:          #1C5A3C;   /* banknote viridian */
  --green-ink:      #143B2C;   /* deep engraved green */
  --green-soft:     #2C7A52;
  --copper:         #A8551B;   /* the 200-birr copper, darkened one step to clear 4.5:1 as a button ground */
  --copper-deep:    #7E3A0F;
  --copper-light:   #B25A1F;   /* the unshifted note copper — large print and rules only, never text on paper */
  --red:            #A12D24;   /* authentication red — rejections, destructive */
  --watermark:      #C6D1C2;   /* latent-image light */

  /* type — the legibility floor is 12px for content and 11px for functional labels.
     Serials are functional text, so they sit on the same floor as body copy. */
  --font-display: 'Bodoni Moda', 'Times New Roman', serif;
  --font-ui:      'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'Fragment Mono', 'Courier New', monospace;

  /* measure */
  --measure: 66ch;
  --radius: 2px;               /* engraved paper does not bend much */

  /* shadows — offset + blur, physical. Hue is neutral ink, never a colour halo. */
  --shadow-pressed: 0 1px 0 rgba(255,255,255,.5) inset, 0 2px 3px rgba(29,38,29,.16);
  --shadow-press: 0 2px 0 rgba(29,38,29,.85), 0 4px 10px rgba(29,38,29,.22);
  --shadow-ink-green: 0 2px 0 rgba(10,32,23,.9), 0 4px 10px rgba(10,32,23,.24);
  --shadow-ink-copper: 0 2px 0 rgba(58,26,7,.9), 0 4px 10px rgba(58,26,7,.24);

  /* motion — one authored moment: the press */
  --ease-out: cubic-bezier(.16,1,.3,1);
  /* The seal lands with weight and stops. Deliberately not a back-out/overshoot
     curve: a bouncing stamp reads playful, and this is a reference desk. */
  --ease-press: cubic-bezier(.12,.9,.24,1);
  --dur-fast: 160ms;
  --dur-med:  340ms;
  --dur-slow: 620ms;
  --dur-press: 900ms;

  /* sizes */
  --topbar-h: 3.75rem;
  --sidebar-w: 15.5rem;
}

/* the one reveal: ink settling into paper */
@keyframes ink-in {
  from { opacity: 0; filter: blur(2px); transform: translateY(4px); }
  to   { opacity: 1; filter: blur(0); transform: none; }
}

/* ── Browser surfaces belong to the design ──────────────────────────────── */

::selection { background: var(--green); color: var(--paper-ink); }

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: 1px;
}

html { color-scheme: light; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--green) var(--paper-deep); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--paper-deep); }
*::-webkit-scrollbar-thumb { background: var(--green); border: 2px solid var(--paper-deep); }

input, select, textarea { caret-color: var(--green); }

/* tabular numerals for data, per craft floor */
table, .serial, .numeric { font-variant-numeric: tabular-nums; }

a { color: var(--green-ink); text-underline-offset: 3px; }
a:hover { color: var(--green); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; text-wrap: balance; margin: 0; }

/* ── Shared primitives ─────────────────────────────────────────────────── */

/* Emphasis in this world is weight and ink, never a gradient through the glyph.
   `.struck` is the one mark that may sit under a word: an engraved rule. */
.struck {
  color: var(--green-ink);
  font-weight: 700;
  box-shadow: inset 0 -0.09em 0 var(--copper-light);
  padding-bottom: 0.03em;
}

.serial {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kickers-none { display: none; } /* no eyebrow labels anywhere */

.btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.82rem;
  padding: 0.72rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  box-shadow: 0 1px 0 rgba(255,255,255,.45) inset;
  position: relative;
}
.btn:hover { background: rgba(29,38,29,.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--green-ink);
  color: var(--paper-ink);
  box-shadow: var(--shadow-ink-green);
}
.btn-primary:hover { background: var(--green); }
.btn-print {
  background: var(--copper);
  border-color: var(--copper-deep);
  color: var(--paper-ink);
  box-shadow: var(--shadow-ink-copper);
}
.btn-print:hover { background: var(--copper-deep); }
.btn-ghost { border-color: var(--rule); color: var(--ink-muted); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-danger {
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover { background: rgba(161,45,36,.08); }

.field {
  display: grid;
  gap: 0.35rem;
}
.field label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-left: 2px;
}
.field .ctrl {
  border: 1px solid var(--ink);
  background: var(--paper-ink);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.66rem 0.78rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.field .ctrl:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(28,90,60,.18); outline: none; }
.field .ctrl::placeholder { color: rgba(86,81,60,.55); }
.field .hint { font-size: 0.8rem; color: var(--ink-muted); padding-left: 2px; }

/* engraved instrument panel */
.instrument {
  background:
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(29,38,29,.018) 11px 12px);
  background-color: var(--paper-ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pressed);
  position: relative;
}
.instrument::before,
.instrument::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--rule);
}
.instrument::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.instrument::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.instrument .inst-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 1.1rem;
  gap: 1rem;
}
.instrument .inst-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.instrument .inst-body { padding: 1.25rem 1.1rem 1.35rem; }

/* chips — engraved, not pills. A world whose declared radius is 2px does not
   round its labels; the rule is the ornament. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.2rem 0.5rem;
  color: var(--ink-muted);
  background: var(--paper);
}
.chip[data-state="active"] { color: var(--green-ink); border-color: rgba(28,90,60,.4); }
.chip[data-state="off"] { color: var(--red); border-color: rgba(161,45,36,.4); }

/* tables */
.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.ledger th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0.55rem 0.8rem;
  border-bottom: 2px solid var(--ink);
}
.ledger td {
  padding: 0.62rem 0.8rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
.ledger tbody tr:hover { background: rgba(29,38,29,.035); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE PRESS — the one authored moment.
   A request that takes seconds is the product's proof, not its delay. The press
   ledger prints the real request lifecycle as it happens, the elapsed readout
   counts real milliseconds, and the seal lands with weight when the record
   arrives. Every value shown is measured, never scripted.

   Built so the un-enhanced state is already good: without JS the ledger reads
   as a plain printed list and the bench still verifies.
   ═══════════════════════════════════════════════════════════════════════════ */

/* the ledger: a printed record of what the request is actually doing */
.press {
  display: grid;
  gap: 0;
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
}
.press-list { list-style: none; margin: 0; padding: 0; }

.press-row {
  display: grid;
  grid-template-columns: 1.35rem 1fr auto;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.32rem 0;
  border-bottom: 1px dotted var(--rule-soft);
  color: var(--ink-muted);
}
.press-row:last-child { border-bottom: 0; }

/* the state mark is a drawn glyph, not a unicode character */
.press-row .press-mark {
  width: 1.35rem;
  height: 1.35rem;
  align-self: center;
  display: block;
  color: var(--rule);
}
.press-row .press-ms {
  font-variant-numeric: tabular-nums;
  color: var(--rule);
  font-size: 0.75rem;
}

/* a row that has happened is inked in */
.press-row[data-state="done"] { color: var(--ink); }
.press-row[data-state="done"] .press-mark { color: var(--green); }
.press-row[data-state="done"] .press-ms { color: var(--ink-muted); }

/* the row in motion — the only travelling light in the interface */
.press-row[data-state="active"] { color: var(--ink); }
.press-row[data-state="active"] .press-mark { color: var(--copper); }
.press-row[data-state="active"] .press-label { font-weight: 700; }
.press-row[data-state="active"] .press-ms { color: var(--copper-deep); }
.press-row[data-state="fault"] { color: var(--red); }
.press-row[data-state="fault"] .press-mark { color: var(--red); }

/* the in-flight row breathes, and the rule beneath it advances as real bytes land */
.press-row[data-state="active"] .press-mark { animation: press-turn 1.4s linear infinite; }
@keyframes press-turn { to { transform: rotate(360deg); } }

.press-bar {
  height: 3px;
  margin-top: 0.75rem;
  background: repeating-linear-gradient(90deg, var(--paper-dark) 0 5px, transparent 5px 9px);
  position: relative;
  overflow: hidden;
}
.press-bar .press-bar-fill {
  position: absolute;
  inset: 0;
  /* Scaled rather than resized: the bar grows on the compositor instead of
     recalculating layout on every frame of the run. */
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--copper);
  transition: transform 240ms linear;
}
.press[data-sealed="true"] .press-bar .press-bar-fill { background: var(--green); }
.press[data-idle="true"] .press-bar { display: none; }

/* the elapsed readout — tabular, so the digits never dance */
.press-clock {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  padding-bottom: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.press-clock .clock-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* the seal lands: struck down, settles, then rings once */
.seal-land { transform-origin: 50% 50%; }
.press-sealed .seal-land { animation: seal-land var(--dur-press) var(--ease-press); }
@keyframes seal-land {
  0%   { transform: scale(1.34) rotate(-7deg); opacity: 0; }
  38%  { opacity: 1; }
  100% { transform: scale(1) rotate(-2deg); opacity: 1; }
}
/* the ring that runs out from the seal once the record is in */
.press-sealed .seal-ring { animation: seal-ring var(--dur-press) var(--ease-out); transform-origin: 50% 50%; }
@keyframes seal-ring {
  0%   { transform: scale(0.55); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}
/* the verdict line inks in behind the seal */
.press-sealed .result-verdict span { animation: ink-in var(--dur-slow) var(--ease-out) 90ms both; }

@media (prefers-reduced-motion: reduce) {
  .press-row[data-state="active"] .press-mark { animation: none; }
}