/* ═══════════════════════════════════════════════════
   Concordance Engine — shared dark-theme stylesheet
   Used by: how-it-works, theory, verifiers, agents,
            install, benchmark, reach, use-cases
═══════════════════════════════════════════════════ */

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

/* ── TOKENS ─────────────────────────────────────────── */
:root {
  --bg:          #0f0d11;
  --surface:     #171419;
  --surface-2:   #1e1b22;
  --border:      #2a2630;
  --border-hi:   #3d3848;
  --text:        #ede7db;
  --muted:       #6e6878;
  --muted-2:     #4e4858;
  --accent:      #c9a87c;
  --accent-dim:  #7a5f3a;
  --pass:        #6fc47c;
  --fail:        #c96c6c;
  --hold:        #c4a030;
  --r:           10px;
  --r-sm:        6px;
}

/* ── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.78; }

h1, h2, h3, h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.15; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; line-height: 1.25; margin-top: 2.8rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; line-height: 1.3; margin-top: 1.6rem; margin-bottom: 0.4rem; }

p { margin-bottom: 0.9rem; max-width: 66ch; color: var(--muted); }
p strong { color: var(--text); }
ul, ol { padding-left: 1.4rem; color: var(--muted); }
li { margin-bottom: 0.4rem; }
li strong { color: var(--text); }

code, kbd {
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--accent);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  margin: 1.2rem 0;
}
pre code {
  background: none; border: none; padding: 0;
  font-size: 0.84em; color: #c8c0b0; line-height: 1.7;
}

table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
table.tools th, table.tools td {
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
table.tools th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
table.tools td:first-child {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: 12px;
}
table.tools tr:hover td { background: var(--surface); }

/* ── TOP BAR ────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,13,17,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: 52px;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  display: inline-block;
  width: 14px; height: 14px;
  background-color: var(--accent);
  -webkit-mask-image: url('/chi-rho.svg');
  mask-image: url('/chi-rho.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  border-radius: 0;
  filter: drop-shadow(0 0 4px rgba(201, 168, 124, 0.4));
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: nowrap;
}
.topnav a {
  font-size: 12px;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); opacity: 1; }
.topnav a.active { color: var(--text); }
.topnav .cta {
  background: var(--accent);
  color: #0f0d11;
  font-weight: 600;
  font-size: 11px;
  padding: 5px 14px;
  border-radius: var(--r-sm);
  margin-left: 6px;
  letter-spacing: 0.04em;
}
.topnav .cta:hover { opacity: 0.88; background: var(--accent); color: #0f0d11; }

/* ── PAGE HEADER ────────────────────────────────────── */
.page-header {
  padding: 52px 24px 36px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}
.page-header .container {
  max-width: 760px;
  margin: 0 auto;
}
.page-header h1 { margin-bottom: 0.6rem; }
.page-header p { font-size: 16px; color: var(--muted); margin-bottom: 0; max-width: 56ch; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 12px;
}

/* ── LAYOUT ─────────────────────────────────────────── */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}
section:last-of-type { border-bottom: none; }

/* ── CARDS ──────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 1.2rem;
}
@media (min-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px;
}
.card h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text); margin-top: 0; margin-bottom: 8px;
}
.card p { font-size: 13px; color: var(--muted); margin-bottom: 0; max-width: 100%; }

/* ── GATES (how-it-works) ───────────────────────────── */
.gates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 1.5rem 0;
}
@media (min-width: 700px) {
  .gates { grid-template-columns: repeat(4, 1fr); }
}

.gate {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 16px;
}
.gate .name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.gate .kind {
  font-size: 11px;
  color: var(--muted-2);
  margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.gate .what { font-size: 13px; color: var(--muted); line-height: 1.55; }

.gate.red   { border-left: 3px solid #c96c6c; }
.gate.floor { border-left: 3px solid #c4a030; }
.gate.bro   { border-left: 3px solid #6fc47c; }
.gate.god   { border-left: 3px solid #7fa8c0; }

/* ── VERDICT / STATUS CHIPS ─────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid;
}
.chip.pass       { color: var(--pass);  border-color: rgba(111,196,124,.3); background: rgba(111,196,124,.07); }
.chip.reject     { color: var(--fail);  border-color: rgba(201,108,108,.3); background: rgba(201,108,108,.07); }
.chip.quarantine { color: var(--hold);  border-color: rgba(196,160,48,.3);  background: rgba(196,160,48,.07); }

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em;
  padding: 9px 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: opacity .15s, border-color .15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #0f0d11;
  border-color: transparent;
}
.btn-primary:hover { opacity: 0.88; color: #0f0d11; }
.btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-hi); opacity: 1; }

/* ── BENCHMARK TABLE ────────────────────────────────── */
.bm-table { width: 100%; border-collapse: collapse; }
.bm-table th, .bm-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.bm-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted-2);
  text-align: left;
}
.bm-table td { color: var(--muted); }
.bm-table td:first-child { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text); }
.bm-table .score-high { color: var(--pass); font-weight: 600; }
.bm-table .score-mid  { color: var(--hold); }
.bm-table .score-low  { color: var(--fail); }
.bm-table tr:hover td { background: var(--surface); }

/* ── STAT BLOCK ─────────────────────────────────────── */
.stat-row {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin: 1.5rem 0;
}
.stat {
  display: flex; flex-direction: column; gap: 3px;
}
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem; font-weight: 600;
  color: var(--text); line-height: 1;
}
.stat-label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── INSTALL / SETUP CODE BLOCKS ────────────────────── */
.install-step {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px 0; border-bottom: 1px solid var(--border);
}
.install-step:last-child { border-bottom: none; }
.install-step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--accent-dim);
  min-width: 24px; padding-top: 2px; flex-shrink: 0;
}
.install-step-body {}
.install-step-title { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.install-step-desc { font-size: 13px; color: var(--muted); }

/* ── CALLOUT BOX ────────────────────────────────────── */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: var(--r);
  padding: 16px 20px;
  margin: 1.2rem 0;
}
.callout p { margin-bottom: 0; font-size: 13px; }

/* ── SCRIPTURE PULL-QUOTE ───────────────────────────── */
.scripture {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--accent);
  border-left: 2px solid var(--accent-dim);
  padding-left: 16px;
  margin: 1.5rem 0;
  line-height: 1.55;
}
.scripture cite {
  display: block;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  color: var(--muted);
  margin-top: 6px;
}

/* ── INLINE STATUS / BADGE ──────────────────────────── */
.badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
}
.badge-pass       { background: rgba(111,196,124,.12); color: var(--pass); }
.badge-reject     { background: rgba(201,108,108,.12); color: var(--fail); }
.badge-quarantine { background: rgba(196,160,48,.12);  color: var(--hold); }
.badge-info       { background: rgba(201,168,124,.12); color: var(--accent); }

/* ── AXIS PILLS (scaffold / grid) ───────────────────── */
.axis-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 500; line-height: 1.6;
}
.axis-enc { background: #1e3550; color: #5b9bd5; border: 1px solid #2a4870; }
.axis-met { background: #1a3325; color: #6ec98a; border: 1px solid #264e38; }
.axis-rsn { background: #32300f; color: #d4c46a; border: 1px solid #4a4718; }
.axis-phy { background: #3a2515; color: #d9945c; border: 1px solid #5a3a20; }
.axis-aut { background: #2a1e40; color: #a87cd6; border: 1px solid #40306a; }
.axis-tim { background: #1a2a35; color: #7fa8c0; border: 1px solid #284555; }
.axis-csv { background: #0f3230; color: #5ec4b4; border: 1px solid #1a4e4c; }

/* ── AGENTS PAGE ────────────────────────────────────── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.tool-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600;
  color: var(--accent); margin-bottom: 5px;
}
.tool-desc { font-size: 13px; color: var(--muted); margin-bottom: 0; }

/* ── REACH / DOMAIN LIST ────────────────────────────── */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 1rem 0;
}
.domain-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ── FOOTER ─────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--text); opacity: 1; }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 640px) {
  .topnav a:not(.cta) { display: none; }
  .page-header { padding: 36px 16px 24px; }
  .container { padding: 0 16px; }
  section { padding: 28px 0; }
  h2 { font-size: 1.2rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}


/* ─────────────────────────────────────────────────────
   Narrator — shared Listen button across the project.
   Used by site/narrator.js. One voice (M.R. Harris) for
   the whole engine; this is just the trigger UI.
───────────────────────────────────────────────────── */
.listen-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  vertical-align: middle;
}
.listen-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.listen-btn.loading {
  color: var(--accent);
  border-color: var(--accent-dim);
  cursor: wait;
}
.listen-btn.playing {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(201, 168, 124, 0.06);
}
.listen-btn.error {
  color: var(--fail);
  border-color: rgba(201, 108, 108, 0.4);
}
.listen-btn .listen-glyph {
  font-size: 9px;
  line-height: 1;
  opacity: 0.85;
}
.listen-btn .listen-label {
  font-weight: 500;
}

/* Home icon in nav — hover lifts the amber background */
.nav-home:hover {
  background: var(--accent) !important;
  color: #1a1208 !important;
  border-color: var(--accent) !important;
}

/* ── Almanac trio tabs — Kept / Promoted / Flagged ───────────────
   Shared by almanac.html, receipts.html, misalignments.html so the
   three feel like one lens with three views. */
.almanac-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 6px 0 22px;
}
.alm-tab {
  display: inline-flex; flex-direction: column;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid var(--border-hi);
  background: var(--surface);
  color: var(--text-dim);
  text-decoration: none;
  font-family: inherit;
  transition: all 0.15s;
  min-width: 150px;
}
.alm-tab .alm-tab-label {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.alm-tab .alm-tab-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.alm-tab:hover {
  color: var(--text);
  border-color: var(--accent);
}
.alm-tab.active {
  background: rgba(217,168,114,0.12);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: inset 0 -2px 0 0 var(--accent);
}
.alm-tab.active .alm-tab-meta { color: var(--accent); }

/* ── "A tool the Shepherd uses" strip ─────────────────────────────
   Sits at the top of every lens page to reinforce the OS-and-tools
   metaphor: the Shepherd is the OS; this lens is one of the tools
   he reaches into when you ask him a question. */
.tool-strip {
  max-width: 1080px; margin: 12px auto 0;
  padding: 9px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.tool-strip-label {
  color: var(--muted);
}
.tool-strip-label b {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.14em;
}
.tool-strip-link {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 1px;
  letter-spacing: 0.12em;
}
.tool-strip-link:hover { color: var(--accent-hi); }
