/* FaxOnce — Receipt Mode design system
   Anti-subscription. Editorial. Document-grade.
   Used by index.html, app.html, receipt.html, admin.html,
   privacy.html, terms.html, refund.html, support.html. */

:root {
  color-scheme: light dark;

  /* Paper + ink */
  --paper:    #FAF7F0;
  --paper-2:  #F2EEE2;
  --paper-3:  #E8E3D2;
  --ink:      #0F0F0E;
  --ink-2:    #2A2A28;
  --ink-3:    #6B6962;
  --rule:     #1A1A19;
  --rule-2:   #DCD7C7;

  /* Stamps */
  --stamp:    #C73E1D;        /* notary red */
  --stamp-2:  #8E2A12;
  --paid:     #0E5C3A;        /* delivered green */
  --paid-2:   #094127;
  --amber:    #B45309;

  /* Type */
  --f-display: "Feature Display", "Times New Roman", serif;
  --f-body:    "Whitney", ui-sans-serif, sans-serif;
  --f-mono:    "DIN Pro", ui-monospace, "SF Mono", Menlo, monospace;

  /* Scale */
  --t-display-xl: clamp(3.25rem, 9vw, 7rem);
  --t-display-l:  clamp(1.375rem, 2.8vw, 1.625rem); /* h2 22-26px (Marketing preset) */
  --t-display-m:  clamp(1.75rem, 3.4vw, 2.5rem);
  --t-body-l:     1.125rem;
  --t-body:       1rem;
  --t-mono-s:     0.8125rem;
  --t-micro:      0.8125rem; /* 13px label floor (Marketing preset) */

  --line-tight:   1.02;
  --line-snug:    1.15;
  --line-body:    1.5;

  /* Rules */
  --r-hair:   1px solid var(--rule-2);
  --r-line:   1.5px solid var(--rule);
  --r-bold:   3px solid var(--ink);

  /* Spacing rhythm */
  --gap-1: 6px;
  --gap-2: 12px;
  --gap-3: 18px;
  --gap-4: 28px;
  --gap-5: 44px;
  --gap-6: 72px;
}

/* ─── Dark theme ───────────────────────────────────────────────
   Receipt Mode after dark: warm near-black "carbon paper" with the
   same notary-red / delivered-green stamps. Activated by the system
   preference OR an explicit [data-theme="dark"] on <html>. The light
   identity above remains the default and brand-primary surface. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:    #14130F;
  --paper-2:  #1C1B16;
  --paper-3:  #25241D;
  --ink:      #F4F0E6;
  --ink-2:    #D8D3C4;
  --ink-3:    #9A958A;
  --rule:     #EDE8DA;
  --rule-2:   #3A382F;
  --stamp:    #F0653F;        /* notary red, lifted for dark contrast */
  --stamp-2:  #C7421F;
  --paid:     #46C08A;        /* delivered green, lifted for dark contrast */
  --paid-2:   #2E9468;
  --amber:    #E1922F;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:    #14130F;
    --paper-2:  #1C1B16;
    --paper-3:  #25241D;
    --ink:      #F4F0E6;
    --ink-2:    #D8D3C4;
    --ink-3:    #9A958A;
    --rule:     #EDE8DA;
    --rule-2:   #3A382F;
    --stamp:    #F0653F;
    --stamp-2:  #C7421F;
    --paid:     #46C08A;
    --paid-2:   #2E9468;
    --amber:    #E1922F;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: var(--line-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

body { font-variant-numeric: tabular-nums; }

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

/* Visible keyboard focus on every interactive element, on every page
   (the marketing pages had page-local rings; the web legal pages were
   falling back to the UA default ring). */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 2.5px solid var(--stamp);
  outline-offset: 3px;
}

/* ─── Typography ───────────────────────────────────────────── */

.t-display, .t-display-l, .t-display-m, .t-display-xl, .t-eyebrow, .t-lede {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.t-display-xl {
  font-size: var(--t-display-xl);
  line-height: var(--line-tight);
  letter-spacing: -0.025em;
}

.t-display-l {
  font-size: var(--t-display-l);
  line-height: var(--line-snug);
  letter-spacing: -0.02em;
}

.t-display-m {
  font-size: var(--t-display-m);
  line-height: var(--line-snug);
}

.t-lede {
  font-size: clamp(1.125rem, 1.6vw, 1.5rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--ink-2);
  text-wrap: pretty;
}

.t-eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-mono-s);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.t-mono     { font-family: var(--f-mono); font-feature-settings: "tnum","zero"; }
.t-mono-s   { font-family: var(--f-mono); font-size: var(--t-mono-s); }
.t-micro    { font-family: var(--f-mono); font-size: var(--t-micro); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

.t-strike   { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-3); }
.t-stamp    { color: var(--stamp); }
.t-paid     { color: var(--paid); }
.t-ital     { font-style: italic; }

/* ─── Page chrome ──────────────────────────────────────────── */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

.page--narrow { max-width: 820px; }

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-3);
  padding: 22px 28px 18px;
  border-bottom: var(--r-line);
  max-width: 1200px;
  margin: 0 auto;
  font-family: var(--f-mono);
  font-size: var(--t-mono-s);
}

.topbar a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
/* Buttons keep their own color: .topbar a (0,1,1) otherwise beats
   .btn--stamp (0,1,0) and paints ink text on the stamp-red mini CTA
   (3.78:1 on mobile, where that CTA is the primary top-bar action). */
.topbar a.btn { color: var(--paper); }
.topbar a.btn--ghost { color: var(--ink); }
.topbar a:hover { border-bottom-color: var(--ink); }

.brand {
  font-family: var(--f-display);
  font-size: 1.625rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand .dot { color: var(--stamp); font-style: italic; }

.topbar .nav { display: flex; gap: 22px; align-items: baseline; }

.footrule {
  margin: var(--gap-6) 0 0;
  border-top: var(--r-bold);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 0 36px;
  font-family: var(--f-mono);
  font-size: var(--t-mono-s);
  color: var(--ink-3);
  max-width: 1200px;
  margin: 0 auto;
}
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--stamp); }

/* ─── Buttons ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  font-family: var(--f-body);
  font-size: 0.9375rem;
  font-weight: 500; /* Medium - the only control weight */
  letter-spacing: 0.01em;
  background: var(--ink);
  color: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
}
.btn:hover { background: var(--stamp); border-color: var(--stamp); }
.btn:active { transform: translateY(1px); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); }

.btn--stamp {
  background: var(--stamp);
  border-color: var(--stamp);
  color: var(--paper);
}
.btn--stamp:hover { background: var(--stamp-2); border-color: var(--stamp-2); }

.btn--danger {
  background: var(--stamp);
  border-color: var(--stamp);
  color: var(--paper);
}
.btn--danger:hover { background: var(--stamp-2); border-color: var(--stamp-2); }

.btn--small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8125rem;
}

/* ─── Form controls ────────────────────────────────────────── */

label, .label {
  display: block;
  font-family: var(--f-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 18px 0 6px;
}

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  background: #FFFEF8;
  box-shadow: inset 0 -3px 0 var(--stamp);
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }

/* ─── Sheet / receipt panel ────────────────────────────────── */

.sheet {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 24px 24px 28px;
}

.sheet + .sheet { margin-top: 18px; }

.sheet--paid { border-color: var(--paid); }
.sheet--stamp { border-color: var(--stamp); }

.sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: var(--r-hair);
}

.sheet__head h2,
.sheet__head h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.625rem;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.1;
}

/* ─── Leader-dot line item (the receipt motif) ─────────────── */

.line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  font-family: var(--f-mono);
  font-size: 0.9375rem;
}
.line__leader {
  border-bottom: 1.5px dotted var(--ink-3);
  position: relative;
  top: -5px;
}
.line__label { color: var(--ink-2); }
.line__val { color: var(--ink); font-weight: 500; }

/* ─── Stamp seal (anti-subscription badge) ─────────────────── */

.stamp-seal {
  display: inline-grid;
  place-items: center;
  width: 168px;
  height: 168px;
  border: 2.5px solid var(--stamp);
  border-radius: 999px;
  color: var(--stamp);
  text-align: center;
  font-family: var(--f-display);
  line-height: 0.95;
  position: relative;
  transform: rotate(-7deg);
  font-style: italic;
}
.stamp-seal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed var(--stamp);
  border-radius: 999px;
}
.stamp-seal__big {
  font-size: 2.4rem;
  letter-spacing: -0.02em;
  font-style: italic;
}
.stamp-seal__sub {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 4px;
  font-style: normal;
}

/* ─── Status dot + pill ────────────────────────────────────── */

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--stamp);
  border-radius: 0;
  vertical-align: 1px;
}
.dot.ok { background: var(--paid); }
.dot.warn { background: var(--amber); }
.dot.idle { background: var(--ink-3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--ink);
  border-radius: 0;
}
.pill--paid { background: transparent; border-color: var(--paid); color: var(--paid); }
.pill--stamp { background: transparent; border-color: var(--stamp); color: var(--stamp); }

/* ─── Tables (history / ledger) ────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--f-mono);
  font-size: 0.875rem;
}
.table th, .table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--rule-2);
  vertical-align: top;
}
.table th {
  font-family: var(--f-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1.5px solid var(--ink);
  font-weight: 500;
}
.table tr:last-child td { border-bottom: 1.5px solid var(--ink); }

/* ─── Misc ─────────────────────────────────────────────────── */

hr.rule {
  border: 0;
  border-top: var(--r-line);
  margin: var(--gap-5) 0;
}

hr.rule--bold { border-top: var(--r-bold); }

.kbd {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  border: 1px solid var(--ink);
  padding: 1px 6px;
  background: var(--paper-2);
}

.cluster { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.doc__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0 0;
  font-family: var(--f-mono);
  font-size: var(--t-mono-s);
}
.doc__links a { color: var(--ink); }
.doc__links a:hover { color: var(--stamp); }
.stack { display: grid; gap: var(--gap-2); }
.stack-3 { display: grid; gap: var(--gap-3); }

/* ─── Code/output block (kept dark for contrast) ───────────── */

pre.terminal {
  margin: 0;
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--ink);
  color: var(--paper);
  border-radius: 0;
  padding: 16px;
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* ─── Print/receipt mode ───────────────────────────────────── */
@media print {
  body { background: white; }
  .topbar, .foot, .btn { display: none; }
}
