/* ============================================================
   Lingual — Color tokens
   "Rubric on paper": a warm liturgical palette taken from the
   illuminated manuscript — ink on aged paper, with the scribe's
   rubric red reserved for the sacred and the live.
   Light is the canonical brand surface. Dark is the attendee
   reading mode (and operator OS-preference dark).
   ============================================================ */
:root {
  /* — Base palette (light) — */
  --paper:      #FAF6EE;   /* aged-paper background */
  --ink:        #1A1612;   /* deep warm ink — primary text */
  --ink-muted:  #6B5D52;   /* secondary text, metadata */
  --ink-dim:    #66635D;   /* phone prior lines — 66% ink on paper */
  --rubric:     #8B1A1A;   /* the scribe's red — sacred & live accent */
  --rubric-deep:#6D1313;   /* rubric hover / pressed */
  --rule:       #C9BDA8;   /* hairline rules, borders */
  --highlight:  #F2E9D5;   /* tinted fill — cards, active chips */

  /* — Status palette (operator + caption states) — */
  --status-idle:       var(--ink-muted);
  --status-connecting: #7C6404;   /* amber — connecting / stopping */
  --status-live:       var(--rubric);
  --status-error:      #5A0F0F;   /* deep oxblood — error */
  --status-ok:         #2E7D32;   /* readiness pass */

  /* — Semantic aliases — */
  --bg-page:        var(--paper);
  --bg-surface:     var(--paper);
  --bg-raised:      var(--highlight);
  --text-strong:    var(--ink);
  --text-body:      var(--ink);
  --text-muted:     var(--ink-muted);
  --text-accent:    var(--rubric);
  --border-hairline:var(--rule);
  --accent:         var(--rubric);
  --accent-hover:   var(--rubric-deep);

  /* — Shadow tints (warm, never neutral-gray) — */
  --shadow-card:    0 1px 2px rgba(26,22,18,0.04);
  --shadow-raised:  0 16px 44px rgba(26,22,18,0.13);
  --shadow-rubric:  0 2px 6px rgba(139,26,26,0.18);

  /* @lingual-liturgy-tokens begin */
  /* Phase 0 (#962): additive liturgical text-type aliases (leaf/rail/seal/chip).
     Every value is a var() of an existing base token — no literal color, no new
     hue; rubric stays the only accent. Aliasing base tokens means dark mode
     follows automatically. A literal here fails
     scripts/check_design_principles.py (invariant 4). */
  --rail-color:       var(--rubric);
  --rail-color-muted: var(--rule);
  --leaf-border:      var(--rule);
  --leaf-bg:          var(--highlight);
  --leaf-accent:      var(--rubric);
  --seal-fg:          var(--ink-muted);
  --seal-border:      var(--rule);
  --chip-fg:          var(--ink-muted);
  --chip-border:      var(--rule);
  /* @lingual-liturgy-tokens end */
}

/* Operator OS-dark path: operator.html uses prefers-color-scheme directly
   and does not add html.dark. Keep the connecting state readable there too. */
@media (prefers-color-scheme: dark) {
  :root {
    --status-connecting: #C8951E;
  }
}

/* Dark = the attendee night-reading mode. Triggered by html.dark
   (app sets this from a saved pref) and mirrored for OS preference. */
html.dark,
:root.dark {
  --paper:      #14110D;
  --ink:        #ECE6D8;
  --ink-muted:  #8A8273;
  --ink-dim:    #A39E93;   /* phone prior lines — 66% ink on dark paper */
  --rubric:     #D9886A;   /* rubric warms to terracotta on dark paper */
  --rubric-deep:#C2725A;
  --rule:       #2F2A23;
  --highlight:  #211D18;
  --seal-fg:    #8F8778;   /* #1017 leaf-metadata contrast ≥4.5:1 on #211D18 — was 4.40 via ink-muted */
  --chip-fg:    #8F8778;   /* same — narrow fix, not global ink-muted bump */

  --status-connecting: #C8951E;
  --status-error: #B25656;
  --status-ok:    #6FBF73;

  --shadow-card:   0 1px 2px rgba(0,0,0,0.40);
  --shadow-raised: 0 16px 44px rgba(0,0,0,0.45);
  --shadow-rubric: 0 2px 6px rgba(0,0,0,0.45);
}
