/* ── ⟴ circuits — enc theme v2 ────────────────────────────────────────── */
/*    palette: chart-svg palette1LCHA_ (viridis-family, 8-color LCH set)    */
/*    identity: ⟴ logo, board bubbles, Hermes brand                         */

:root {
  /* brand palette — chart-svg Data/Colour.hs palette1LCHA_ */
  --brand-blue:        #4B7FBD;  /* 1: LCH 72/12.3/207 — primary accent */
  --brand-indigo:      #3D3D7A;  /* 2: LCH 40/10/246   — deep */
  --brand-magenta:     #C44E8A;  /* 3: LCH 50/21/338   — links, highlight */
  --brand-rose:        #E07A9E;  /* 4: LCH 80/15/331   — soft */
  --brand-chartreuse:  #8FB83A;  /* 5: LCH 83/14/69    — bright */
  --brand-amber:       #D98A3A;  /* 6: LCH 57/15/50    — warm, CTA, focus */
  --brand-forest:      #1F7050;  /* 7: LCH 38/8.5/128  — code, live/green */
  --brand-teal:        #4B9680;  /* 8: LCH 60/8/104    — muted accent */

  /* lightness-bumped variants for dark mode readability */
  --brand-forest-hi:   #3fa47e;  /* forest L bumped for dark bg contrast */
  --brand-indigo-hi:   #5b5ba0;
  --brand-magenta-hi:  #e070a8;
  --brand-teal-hi:     #6bb898;

  /* semantic roles (first-class tier) */
  --live:      var(--brand-forest-hi);   /* 🟢 */
  --active:    var(--brand-magenta-hi);  /* 🟣 */
  --design:    var(--brand-blue);        /* 🔵 */
  --warn:      var(--brand-amber);

  /* dark theme (default) — warm-shifted, never pure black */
  --bg:         #1b1e23;
  --surface:    #21252d;
  --border:     #373c45;
  --text:       #c8ccd4;
  --muted:      #777d87;
  --heading:    #dfe2e8;
  --accent:     var(--brand-blue);
  --link:       var(--brand-magenta);
  --code-bg:    #252932;
  --code-fg:    var(--brand-forest-hi);
  --inline-code-bg: #282c34;
  --table-stripe: #252932;

  /* typography */
  --font-mono:  ui-monospace, 'SF Mono', 'Cascadia Code', 'Source Code Pro',
                Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  --font-body:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
                Arial, sans-serif;
  --font-heading: 'SF Pro Display', -apple-system, BlinkMacSystemFont,
                   'Segoe UI', Helvetica, Arial, sans-serif;

  --radius:     6px;
  --max-width:  720px;
  --breakout:   960px;
}

/* ── reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  padding: 2rem 1.5rem 4rem;
  margin: 0 auto;
}

/* article grid — prose column + breakout for code/figures */
article {
  display: grid;
  grid-template-columns:
    1fr minmax(0, var(--max-width)) 1fr;
}
article > * {
  grid-column: 2;
}
/* breakout for code blocks and wide elements */
article > pre,
article > .breakout,
article > figure,
article > .card-grid {
  grid-column: 2 / 4;
  max-width: var(--breakout);
}

/* ── typography ───────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--heading);
  line-height: 1.3;
  margin: 2rem 0 0.5rem;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; color: var(--accent); margin-top: 2.5rem; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--brand-magenta); }
h4 { font-size: 0.95rem; color: var(--brand-teal); font-weight: 600; }
h5 { font-size: 0.9rem; color: var(--text); font-weight: 600; }
h6 { font-size: 0.85rem; color: var(--muted); font-weight: 600; font-style: italic; }

/* heading depth markers — markdown-self-documenting */
h2::before { content: "## "; color: var(--muted); font-weight: 400; }
h3::before { content: "### "; color: var(--muted); font-weight: 400; }

p { margin: 0.75rem 0; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 100ms ease;
}
a:hover { text-decoration: underline; }

strong { color: var(--heading); }

/* focus ring */
:focus-visible {
  outline: 2px solid var(--warn);
  outline-offset: 2px;
}

/* ── code ─────────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--inline-code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
  color: var(--code-fg);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 1rem 0;
}
pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}

/* ⟴ prompt character in shell/session blocks */
pre.sh, pre.session, pre.shell, pre.bash, pre.zsh,
.language-sh, .language-bash, .language-zsh, .language-shell, .language-session,
.language-console {
  /* the prompt itself injected via JS or Hugo highlight classes */;
}
code.language-sh::before,
code.language-bash::before,
code.language-shell::before,
code.language-session::before {
  /* per-line prompt handled by chroma class if available */;
}

/* prompt block — use in markdown: ```prompt */
.prompt-line::before {
  content: "⟴ ";
  color: var(--accent);
  user-select: none;
}

/* ── syntax highlighting (Chroma overrides, palette1_-derived) ────────── */
.chroma { background: var(--code-bg) !important; }
.chroma .lntd:first-child { border-right: 1px solid var(--border); padding-right: 0.5rem; }

/* keywords */ .chroma .k, .chroma .kr, .chroma .kd, .chroma .kt { color: var(--brand-indigo); }
/* strings */  .chroma .s, .chroma .s1, .chroma .s2, .chroma .sc { color: var(--brand-forest); }
/* functions */.chroma .nf, .chroma .fm { color: var(--brand-magenta); }
/* literals */ .chroma .m, .chroma .mi, .chroma .mf, .chroma .mb { color: var(--brand-amber); }
/* comments */ .chroma .c, .chroma .c1, .chroma .cm, .chroma .ch { color: var(--muted); font-style: italic; }
/* operators */.chroma .o, .chroma .ow { color: var(--brand-teal); }
/* types */    .chroma .nc, .chroma .nn { color: var(--brand-blue); }
/* builtins */ .chroma .nb, .chroma .bp { color: var(--brand-chartreuse); }

/* ── tables ───────────────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.9rem;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  text-align: left;
}
th { color: var(--accent); font-weight: 600; }
tr:nth-child(even) td { background: var(--table-stripe); }

/* ── images ───────────────────────────────────────────────────────────── */
img, svg {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* ── blockquote ───────────────────────────────────────────────────────── */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 1rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--muted);
}

/* ── lists ────────────────────────────────────────────────────────────── */
ul, ol { margin: 0.5rem 0 0.5rem 1.5rem; }
li { margin: 0.2rem 0; }

/* ── horizontal rule ──────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── header / nav ─────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--heading);
  text-decoration: none;
  transition: color 100ms ease;
}
.site-title:hover { color: var(--accent); text-decoration: none; }

.site-nav { display: flex; gap: 1.2rem; align-items: baseline; }
.site-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 100ms ease;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.active { color: var(--accent); }

/* ── buttons / controls ──────────────────────────────────────────────── */
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1;
  transition: color 100ms ease, border-color 100ms ease;
}
.btn-icon:hover { color: var(--text); border-color: var(--accent); }

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  width: 140px;
  transition: border-color 100ms ease;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

/* ── home page — board-style ──────────────────────────────────────────── */
.home-lede {
  font-size: 1rem;
  color: var(--heading);
  font-family: var(--font-mono);
  margin-bottom: 2rem;
}
.home-lede::before { content: "⟴ "; color: var(--accent); }

/* ── posts list ───────────────────────────────────────────────────────── */
.post-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }

.post-item h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}
.post-item h2 a { color: var(--heading); transition: color 100ms ease; }
.post-item h2 a:hover { color: var(--accent); text-decoration: none; }

/* bubble dot — status indicator */
.post-item .bubble {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.bubble-live    { background: var(--live); }
.bubble-active  { background: var(--active); }
.bubble-design  { background: var(--design); }

.post-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.post-summary {
  font-size: 0.9rem;
  color: var(--text);
}

/* ── single post ──────────────────────────────────────────────────────── */
.post-header { margin-bottom: 2rem; }
.post-header h1 { margin-bottom: 0.3rem; }

/* mono post header: ⟴ post --date X --status live */
.post-command {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.post-command .prompt { color: var(--accent); user-select: none; }

.post-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.post-tags a {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 100ms ease, border-color 100ms ease;
}
.post-tags a:hover { color: var(--accent); border-color: var(--accent); }

/* ── footer ───────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); transition: color 100ms ease; }
.site-footer a:hover { color: var(--text); }

/* agent roster strip */
.agent-roster {
  margin-top: 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.3rem;
  user-select: none;
}
.agent-roster span { cursor: default; }
.agent-roster span:hover { opacity: 0.7; }

/* ── pagination ───────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 1rem; margin-top: 2rem; font-size: 0.9rem; }
.pagination a { color: var(--accent); }

/* ── card grid (fingerprint posts, project cards) ─────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card img, .card svg { width: 100%; display: block; border-radius: 0; }
.card-body { padding: 0.8rem 1rem; }
.card-body h3 { font-size: 0.9rem; margin: 0 0 0.2rem; }
.card-body .meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.4rem; }
.card-body p { font-size: 0.82rem; margin: 0; }
.card-wide { grid-column: 1 / -1; }

/* ── callout boxes ────────────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
}
.callout-warn { border-color: var(--warn); }

/* ── lead paragraph ───────────────────────────────────────────────────── */
.lead { font-size: 1.1rem; color: var(--heading); margin: 1.5rem 0; }

/* ── profile ──────────────────────────────────────────────────────────── */
.profile { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; }
.profile-avatar { width: 48px; height: 48px; border-radius: 50%; }
.profile-name { font-weight: 600; color: var(--heading); }
.profile-headline { color: var(--muted); font-size: 0.85rem; }

/* ── search results ───────────────────────────────────────────────────── */
#search-results { margin-top: 1rem; }
.search-result-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.search-result-item a { color: var(--heading); }
.search-result-item .context { font-size: 0.8rem; color: var(--muted); }

/* ── sabela iframe ────────────────────────────────────────────────────── */
.sabela-frame {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1rem 0;
}

/* ── 404 page ─────────────────────────────────────────────────────────── */
.not-found {
  text-align: center;
  margin-top: 4rem;
}
.not-found h1 {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--muted);
}
.not-found h1 .prompt { color: var(--accent); }
.not-found .cursor {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* ── print ────────────────────────────────────────────────────────────── */
@media print {
  body { color: #000; background: #fff; max-width: 100%; }
  .site-nav, .btn-icon, .search-input, .site-footer { display: none; }
}

/* ── light theme — warm off-white, never pure #fff ────────────────────── */
html.light {
  --brand-forest-hi:   var(--brand-forest);   /* canonical in light mode */
  --brand-indigo-hi:   var(--brand-indigo);
  --brand-magenta-hi:  var(--brand-magenta);
  --brand-teal-hi:     var(--brand-teal);

  --live:      var(--brand-forest);
  --active:    var(--brand-magenta);
  --design:    var(--brand-blue);

  --bg:         #f7f5f3;
  --surface:    #fefefc;
  --border:     #e2dfda;
  --text:       #3a3a3a;
  --muted:      #8c8a86;
  --heading:    #222222;
  --accent:     var(--brand-blue);
  --link:       var(--brand-magenta);
  --code-bg:    #f0ede9;
  --code-fg:    var(--brand-forest);
  --inline-code-bg: #eeebe6;
  --table-stripe: #f5f2ef;
  --warn:       var(--brand-amber);
}