/* =========================================================================
   envellum Design System — Tokens  (Direction A · Proof)
   Precision over theme. The metaphor lives in the words; the visuals
   embody the product's quality — mathematically precise, nothing extra.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---------- Color: Surfaces ---------- */
  --paper:        #FAFAFA;   /* primary background — clean, neutral, open */
  --paper-raw:    #FFFFFF;   /* elevated surface / card emphasis */
  --paper-deep:   #F3F4F6;   /* alt section background, sidebars, code blocks */
  --paper-edge:   #E5E7EB;   /* fold / inner separator */
  --white:        #FFFFFF;

  /* ---------- Color: Ink (text, structure) ---------- */
  --ink:          #0F0F0F;   /* primary text — near-black, not pure */
  --ink-pressed:  #000000;
  --ink-soft:     #1F2937;
  --ink-faint:    #6B7280;   /* supporting text, captions, secondary UI */
  --ink-mute:     #9CA3AF;

  /* ---------- Color: Indigo (primary accent) ----------
     LaTeX theorem-environment indigo. Intellectual authority without coldness.
     Distinct from "corporate blue" (trust) and "aggressive red" (threat). */
  --indigo:        #4338CA;
  --indigo-deep:   #3730A3;
  --indigo-soft:   #6D28D9;   /* muted violet — hover states, secondary emphasis */
  --indigo-wash:   #EEF2FF;   /* tint for theorem backgrounds, highlights */
  --indigo-edge:   #C7D2FE;

  /* ---------- Color: Semantic (functional, not brand) ---------- */
  --ok:           #059669;   /* emerald — proven, 0 errors */
  --ok-wash:      #ECFDF5;
  --deny:         #DC2626;   /* red — denial, violation */
  --deny-wash:    #FEF2F2;
  --warn:         #D97706;
  --info:         var(--indigo);

  /* ---------- Legacy semantic aliases (retained for unswept components) ---------- */
  --seal:         var(--deny);
  --seal-dark:    #991B1B;

  /* ---------- Rules / borders ---------- */
  --rule:         #E5E7EB;            /* hairline on paper */
  --rule-strong:  var(--ink);
  --rule-faint:   #F3F4F6;

  /* ---------- Radii ---------- */
  --r-0: 0px;
  --r-1: 3px;    /* buttons, chips, inputs */
  --r-2: 4px;    /* cards */
  --r-3: 8px;    /* modals */

  /* ---------- Shadows ---------- */
  --shadow-paper: 0 1px 2px rgba(15,15,15,0.04), 0 1px 3px rgba(15,15,15,0.04);
  --shadow-lift:  0 8px 24px rgba(15,15,15,0.06), 0 2px 6px rgba(15,15,15,0.04);
  --shadow-focus: 0 0 0 3px rgba(67,56,202,0.18);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.6);

  /* ---------- Spacing (8-pt + 4-pt half-step) ---------- */
  --s-1:   4px;
  --s-2:   8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  24px;
  --s-6:  32px;
  --s-7:  48px;
  --s-8:  64px;
  --s-9:  96px;
  --s-10:128px;

  /* ---------- Motion ---------- */
  --ease:         cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-hover:      120ms;
  --t-press:       80ms;
  --t-enter:      320ms;
  --t-reveal:     480ms;

  /* ---------- Type families ----------
     Sans: Inter. Geometric, clean, reads as infrastructure.
     Mono: JetBrains Mono. For code, theorem names, proof output, CLI.
     No display serif. The italic "e" in the wordmark carries the only
     curved gesture in the system — a reference to Euler's constant (e).
     Legacy --ff-display kept as an alias to --ff-body for unswept code. */
  --ff-body:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --ff-mono:      'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;
  --ff-display:   var(--ff-body);

  /* Legacy wordmark "e" — used where the Euler "e" glyph is rendered inline
     (not the logo SVG). Georgia italic is the closest system-font match. */
  --ff-wordmark-e: Georgia, 'Times New Roman', serif;

  /* ---------- Type scale ---------- */
  --fs-hero:    clamp(56px, 7vw, 88px);
  --fs-h1:      clamp(40px, 4.4vw, 64px);
  --fs-h2:      clamp(28px, 3vw, 40px);
  --fs-h3:      22px;
  --fs-h4:      18px;
  --fs-body-l:  18px;
  --fs-body:    16px;
  --fs-sm:      14px;
  --fs-xs:      12px;
  --fs-eyebrow: 11px;

  --lh-tight:   1.02;
  --lh-display: 1.05;
  --lh-snug:    1.3;
  --lh-body:    1.6;

  /* ---------- Layout ---------- */
  --col-wide:   1280px;
  --col-page:   1120px;
  --col-read:    680px;
  --nav-h:        64px;
}

/* =========================================================================
   Base element defaults
   ========================================================================= */

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { margin: 0; background: var(--paper); color: var(--ink); }

/* Headings — geometric sans, tight tracking, high confidence */
h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
  font-family: var(--ff-body);
  color: var(--ink);
  letter-spacing: -0.022em;
  line-height: var(--lh-display);
  margin: 0 0 var(--s-4);
}
h1, .h1 { font-size: var(--fs-h1); font-weight: 600; }
h2, .h2 { font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.02em; }
h3, .h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.015em; }
h4, .h4 { font-size: var(--fs-h4); font-weight: 600; letter-spacing: -0.01em; line-height: var(--lh-snug); }

.hero, .display-hero {
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: var(--fs-hero);
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* Body */
p, .p, .body {
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-soft);
  margin: 0 0 var(--s-4);
}
.body-l {
  font-size: var(--fs-body-l);
  line-height: 1.55;
  color: var(--ink-soft);
}
.small    { font-size: var(--fs-sm); line-height: 1.55; color: var(--ink-soft); }
.caption  { font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-faint); letter-spacing: 0.01em; font-weight: 500; }

.eyebrow {
  font-family: var(--ff-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

/* Code + theorem IDs */
code, kbd, pre, .mono {
  font-family: var(--ff-mono);
  font-size: 13px;
}

.theorem-id {
  font-family: var(--ff-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--indigo);
  background: var(--indigo-wash);
  border: 1px solid var(--indigo-edge);
  padding: 2px 7px;
  border-radius: var(--r-1);
  display: inline-block;
  line-height: 1.5;
}

/* Links — underline thickens on hover, no color change */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-mute);
  transition: text-decoration-thickness var(--t-hover) var(--ease),
              text-decoration-color var(--t-hover) var(--ease);
}
a:hover { text-decoration-thickness: 2px; text-decoration-color: var(--ink); }

/* Pull quote */
.pullquote {
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.4;
  color: var(--ink);
  border-left: 2px solid var(--indigo);
  padding-left: var(--s-5);
  margin: var(--s-6) 0;
  letter-spacing: -0.01em;
}

/* Geometric divider (no manuscript styling) */
.divider {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: var(--s-7) 0;
}

/* QED tombstone — micro-brand element, end of proof */
.qed::after { content: " ∎"; color: var(--indigo); font-family: var(--ff-body); font-weight: 500; }
.qed-mark  { color: var(--indigo); font-family: var(--ff-body); font-weight: 500; }

/* =========================================================================
   Components
   ========================================================================= */

/* Buttons */
.btn {
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: var(--fs-sm);
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--r-1);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-raw);
  cursor: pointer;
  transition: background var(--t-hover) var(--ease), transform var(--t-press) var(--ease), border-color var(--t-hover) var(--ease);
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
  letter-spacing: -0.005em;
}
.btn:hover { background: var(--ink-pressed); border-color: var(--ink-pressed); }
.btn:active { transform: translateY(1px); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn--secondary:hover { border-color: var(--ink); background: transparent; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
}
.btn--ghost:hover { background: var(--paper-deep); }

.btn--primary {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #FFFFFF;
}
.btn--primary:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); }

/* Legacy alias */
.btn--seal { background: var(--indigo); border-color: var(--indigo); color: #FFFFFF; }
.btn--seal:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); }

.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--lg { padding: 14px 22px; font-size: var(--fs-body); }

/* Input */
.input {
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-1);
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--t-hover) var(--ease), box-shadow var(--t-hover) var(--ease);
}
.input:focus { outline: none; border-color: var(--indigo); box-shadow: var(--shadow-focus); }
.input::placeholder { color: var(--ink-mute); }

/* Card */
.card {
  background: var(--paper-raw);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  padding: var(--s-5);
}
.card--strong { border-color: var(--ink); }
.card--lift   { box-shadow: var(--shadow-paper); }

/* Chip / tag */
.chip {
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--paper-raw);
  border: 1px solid var(--rule);
  border-radius: var(--r-1);
  padding: 3px 8px;
  letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 6px;
  line-height: 1.5;
}
.chip--ink    { background: var(--ink); color: var(--paper-raw); border-color: var(--ink); }
.chip--indigo { background: var(--indigo-wash); color: var(--indigo-deep); border-color: var(--indigo-edge); }
.chip--ok     { background: var(--ok-wash); color: var(--ok); border-color: transparent; }
.chip--deny   { background: var(--deny-wash); color: var(--deny); border-color: transparent; }

/* Legacy aliases */
.chip--seal  { background: var(--deny-wash); color: var(--deny); border-color: transparent; }
.chip--slate { background: var(--paper-deep); color: var(--ink-faint); border-color: transparent; }

/* Status dot */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--ok   { background: var(--ok); }
.dot--deny { background: var(--deny); }
.dot--warn { background: var(--warn); }
.dot--info { background: var(--indigo); }

/* Verification badge — QED-shaped, replaces wax seal on proof artifacts */
.verify-badge {
  width: 64px; height: 64px;
  background: var(--indigo);
  color: #FFFFFF;
  border-radius: var(--r-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-paper);
}
/* Legacy alias */
.seal-badge {
  width: 64px; height: 64px;
  background: var(--indigo);
  color: #FFFFFF;
  border-radius: var(--r-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 26px;
  line-height: 1;
}
