/* ═══════════════════════════════════════════════════════════════════════════
   Protocols Dark — protocols.foundation theme
   Same token family as openearth.css but with blue (Profits) primary accent.
   Minimal, spec-site feel. No animated logo.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds — space & earth */
  --oe-bg-space:       #0A1628;
  --oe-bg-surface:     #111820;
  --oe-bg-card:        #1C1916;
  --oe-bg-card-hover:  #252018;

  /* Ocean & earth */
  --oe-ocean:          #3A85B5;
  --oe-ocean-dark:     #10405E;
  --oe-earth:          #3D2E1E;
  --oe-sand:           #C4A882;

  /* 5 Transparency Pledge colours */
  --oe-ecological:     #00e000;
  --oe-income:         #e0a000;
  --oe-produce:        #e040c0;
  --oe-process:        #00c0a0;
  --oe-profits:        #0080e0;

  /* Text */
  --oe-text:           #c8c8c8;
  --oe-text-muted:     #888888;
  --oe-text-bright:    #e8e8e8;

  /* Primary accent (blue for protocols.foundation) */
  --oe-primary:        var(--oe-profits);
  --oe-accent:         var(--oe-income);
  --oe-link:           #0080e0;
  --oe-link-hover:     #3A85B5;
  --oe-border:         #2a2a2a;
  --oe-code-bg:        #1a1a1a;

  /* Typography */
  --oe-font-body:      'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --oe-font-mono:      'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --oe-max-width:      1000px;
  --oe-radius:         8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--oe-font-body);
  color: var(--oe-text);
  background: var(--oe-bg-space);
  line-height: 1.6;
}

a { color: var(--oe-link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--oe-link-hover); }
img { max-width: 100%; height: auto; }

.container { max-width: var(--oe-max-width); margin: 0 auto; padding: 0 2rem; }

/* ── 5-Colour Accent Bar ────────────────────────────────────────────────── */
.accent-bar {
  height: 3px;
  background: linear-gradient(90deg,
    var(--oe-ecological) 0%, var(--oe-ecological) 20%,
    var(--oe-income) 20%, var(--oe-income) 40%,
    var(--oe-produce) 40%, var(--oe-produce) 60%,
    var(--oe-process) 60%, var(--oe-process) 80%,
    var(--oe-profits) 80%, var(--oe-profits) 100%
  );
}

/* ── Nav ────────────────────────────────────────────────────────────────── */
nav {
  background: var(--oe-bg-surface);
  border-bottom: 1px solid var(--oe-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
nav .container { display: flex; align-items: center; justify-content: space-between; }
nav .logo { font-size: 1rem; font-weight: 600; color: var(--oe-text-bright); font-family: var(--oe-font-mono); }
nav .logo span { color: var(--oe-primary); }
nav .nav-links { display: flex; gap: 1.5rem; list-style: none; }
nav .nav-links a { color: var(--oe-text-muted); font-size: 0.9rem; }
nav .nav-links a:hover { color: var(--oe-primary); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 2rem 4rem;
  border-bottom: 1px solid var(--oe-border);
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--oe-text-bright);
  margin-bottom: 0.75rem;
  font-family: var(--oe-font-mono);
}
.hero h1 span { color: var(--oe-primary); }

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--oe-text-muted);
  max-width: 650px;
  margin: 0 auto 1.5rem;
}

.hero .stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.hero .stat {
  text-align: center;
}
.hero .stat .number { font-size: 2rem; font-weight: 700; color: var(--oe-primary); }
.hero .stat .label  { font-size: 0.8rem; color: var(--oe-text-muted); }

/* ── Section ────────────────────────────────────────────────────────────── */
section { padding: 3.5rem 0; }
section h2 { font-size: 1.6rem; color: var(--oe-primary); margin-bottom: 0.5rem; }
section h2 + p { color: var(--oe-text-muted); font-size: 1rem; margin-bottom: 2rem; }

/* ── Event Family Cards ─────────────────────────────────────────────────── */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.event-card {
  background: var(--oe-bg-card);
  border: 1px solid var(--oe-border);
  border-radius: var(--oe-radius);
  padding: 1.25rem;
  border-left: 4px solid var(--oe-border);
  transition: border-color 0.2s;
}
.event-card:hover { border-left-color: var(--oe-primary); }

.event-card[data-accent="process"]    { border-left-color: var(--oe-process); }
.event-card[data-accent="ecological"] { border-left-color: var(--oe-ecological); }
.event-card[data-accent="profits"]    { border-left-color: var(--oe-profits); }
.event-card[data-accent="income"]     { border-left-color: var(--oe-income); }
.event-card[data-accent="produce"]    { border-left-color: var(--oe-produce); }

.event-card .namespace {
  font-family: var(--oe-font-mono);
  font-size: 0.85rem;
  color: var(--oe-primary);
  margin-bottom: 0.25rem;
}
.event-card h3 { font-size: 1rem; color: var(--oe-text-bright); margin-bottom: 0.25rem; }
.event-card .count { font-size: 0.8rem; color: var(--oe-accent); margin-bottom: 0.5rem; }
.event-card p { font-size: 0.85rem; color: var(--oe-text-muted); line-height: 1.5; }

/* ── Principles List ────────────────────────────────────────────────────── */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

.principle {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.principle .icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--oe-bg-card);
  border: 1px solid var(--oe-border);
}

.principle h4 { font-size: 0.95rem; color: var(--oe-text-bright); margin-bottom: 0.2rem; }
.principle p  { font-size: 0.85rem; color: var(--oe-text-muted); }

/* ── Code / JSON examples ───────────────────────────────────────────────── */
code {
  font-family: var(--oe-font-mono);
  background: var(--oe-code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--oe-accent);
}

pre {
  background: var(--oe-code-bg);
  border-left: 3px solid var(--oe-primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--oe-radius) var(--oe-radius) 0;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 1rem 0;
}
pre code { background: none; padding: 0; color: var(--oe-text); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: var(--oe-radius);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
}
.btn-primary { background: var(--oe-primary); color: #0A1628; }
.btn-primary:hover { background: var(--oe-ocean); color: #fff; }
.btn-secondary { background: transparent; color: var(--oe-primary); border: 1.5px solid var(--oe-primary); }
.btn-secondary:hover { background: var(--oe-primary); color: #0A1628; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  background: var(--oe-bg-surface);
  padding: 2rem 0;
  border-top: 1px solid var(--oe-border);
  text-align: center;
}
footer p { font-size: 0.85rem; color: var(--oe-text-muted); margin-bottom: 0.3rem; }
footer a { color: var(--oe-text-muted); }
footer a:hover { color: var(--oe-primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   Spec Page Styles — individual event family pages
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Spec Hero ─────────────────────────────────────────────────────────── */
.spec-hero {
  padding: 3rem 2rem 2.5rem;
  border-bottom: 1px solid var(--oe-border);
}
.spec-hero .back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--oe-text-muted);
  margin-bottom: 1rem;
}
.spec-hero .back-link:hover { color: var(--oe-primary); }
.spec-hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--oe-text-bright);
  font-family: var(--oe-font-mono);
  margin-bottom: 0.5rem;
}
.spec-hero h1 span { color: var(--oe-primary); }
.spec-hero .subtitle {
  font-size: 1rem;
  color: var(--oe-text-muted);
  max-width: 700px;
  margin-bottom: 1.5rem;
}
.spec-hero .stats {
  display: flex; gap: 2rem; flex-wrap: wrap;
}
.spec-hero .stat .number { font-size: 1.6rem; font-weight: 700; color: var(--oe-primary); }
.spec-hero .stat .label  { font-size: 0.75rem; color: var(--oe-text-muted); }

/* Accent-coloured hero borders */
.spec-hero[data-accent="ecological"] { border-left: 4px solid var(--oe-ecological); }
.spec-hero[data-accent="process"]    { border-left: 4px solid var(--oe-process); }
.spec-hero[data-accent="profits"]    { border-left: 4px solid var(--oe-profits); }
.spec-hero[data-accent="income"]     { border-left: 4px solid var(--oe-income); }
.spec-hero[data-accent="produce"]    { border-left: 4px solid var(--oe-produce); }

/* ── Table of Contents ─────────────────────────────────────────────────── */
.toc {
  background: var(--oe-bg-surface);
  padding: 2rem 0;
  border-bottom: 1px solid var(--oe-border);
}
.toc h2 { font-size: 1.1rem; color: var(--oe-text-bright); margin-bottom: 1rem; }
.toc-list {
  list-style: none;
  columns: 2;
  column-gap: 2rem;
}
.toc-list li { margin-bottom: 0.4rem; }
.toc-list a {
  font-size: 0.88rem;
  color: var(--oe-text-muted);
  font-family: var(--oe-font-mono);
}
.toc-list a:hover { color: var(--oe-primary); }
.toc-list .toc-count {
  font-family: var(--oe-font-body);
  font-size: 0.78rem;
  color: var(--oe-text-muted);
  opacity: 0.7;
}

/* ── Event Badge (timeline / state) ────────────────────────────────────── */
.event-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}
.event-badge.timeline { background: var(--oe-primary); color: #0A1628; }
.event-badge.state    { background: var(--oe-accent);  color: #0A1628; }

/* ── Event Section ─────────────────────────────────────────────────────── */
.event-section {
  padding: 2.5rem 0;
  border-top: 1px solid var(--oe-border);
}
.event-section:first-of-type { border-top: none; }

.event-section .event-name {
  font-family: var(--oe-font-mono);
  font-size: 1.05rem;
  color: var(--oe-text-bright);
  margin-bottom: 0.25rem;
}
.event-section .event-desc {
  font-size: 0.9rem;
  color: var(--oe-text-muted);
  margin-bottom: 1.25rem;
  max-width: 700px;
}

/* ── Category Header (groups of events) ────────────────────────────────── */
.category-header {
  padding: 2rem 0 0.5rem;
  border-top: 2px solid var(--oe-border);
  margin-top: 1rem;
}
.category-header:first-child { border-top: none; margin-top: 0; }
.category-header h2 {
  font-size: 1.2rem;
  color: var(--oe-primary);
  margin-bottom: 0.25rem;
}
.category-header p {
  font-size: 0.88rem;
  color: var(--oe-text-muted);
}

/* ── Fields Table ──────────────────────────────────────────────────────── */
.fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1rem 0;
}
.fields-table th {
  text-align: left;
  color: var(--oe-text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--oe-border);
  padding: 0.5rem 0.75rem;
}
.fields-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--oe-border);
  color: var(--oe-text);
  vertical-align: top;
}
.fields-table td:first-child {
  font-family: var(--oe-font-mono);
  color: var(--oe-accent);
  white-space: nowrap;
}
.fields-table td:nth-child(2) {
  font-family: var(--oe-font-mono);
  font-size: 0.8rem;
  color: var(--oe-text-muted);
  white-space: nowrap;
}

/* ── Allowed Values ────────────────────────────────────────────────────── */
.allowed-values {
  font-size: 0.82rem;
  color: var(--oe-text-muted);
  margin-top: 0.25rem;
}
.allowed-values code { font-size: 0.78rem; }

/* ── Flow Diagram (text-based) ─────────────────────────────────────────── */
.flow-diagram {
  background: var(--oe-bg-surface);
  border: 1px solid var(--oe-border);
  border-radius: var(--oe-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  font-family: var(--oe-font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--oe-text);
  white-space: pre-wrap;
}
.flow-diagram .flow-arrow { color: var(--oe-primary); }
.flow-diagram .flow-event { color: var(--oe-accent); }
.flow-diagram .flow-comment { color: var(--oe-text-muted); }

/* ── Info Box ──────────────────────────────────────────────────────────── */
.info-box {
  background: var(--oe-bg-card);
  border-left: 3px solid var(--oe-primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--oe-radius) var(--oe-radius) 0;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}
.info-box strong { color: var(--oe-text-bright); }

/* ── State Key Cards ───────────────────────────────────────────────────── */
.state-keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.state-key-card {
  background: var(--oe-bg-card);
  border: 1px solid var(--oe-border);
  border-radius: var(--oe-radius);
  padding: 1rem;
}
.state-key-card code {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.state-key-card p {
  font-size: 0.82rem;
  color: var(--oe-text-muted);
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.5rem; }
  .event-grid { grid-template-columns: 1fr; }
  nav .nav-links { gap: 1rem; font-size: 0.8rem; }
  .spec-hero h1 { font-size: 1.2rem; }
  .toc-list { columns: 1; }
  .fields-table { font-size: 0.8rem; }
  .state-keys { grid-template-columns: 1fr; }
}
