/* Build Logs / shared styles for blog pages
   Editorial reading layout: strong type scale, 50-70ch measure, generous whitespace,
   flat surfaces, hairline borders, one accent. No glassmorphism, no gradients, no glow. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #09090b;
  --bg-surface: #0f0f13;
  --bg-card: #131318;
  --bg-code: #0b0b0f;
  --bg-code-head: #101014;

  --text: #f4f4f5;
  --text-body: #cfcfd6;
  --text-muted: #9e9ea8;
  --text-dim: #5c5c6b;

  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.14);

  --green: #10b981;
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --red: #f87171;

  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint film grain, keeps large dark surfaces from looking flat */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--text); color: var(--bg); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }

/* reading progress */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 200; background: transparent;
}
.progress-bar span {
  display: block; height: 100%; width: 0;
  background: var(--green);
  transition: width 0.08s linear;
}

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem clamp(1.25rem, 4vw, 3rem);
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand-mark {
      font-family: var(--mono); font-weight: 600; font-size: 0.8rem;
      color: var(--green); letter-spacing: -0.06em;
    }
    .brand {
      display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--mono); font-size: 0.82rem; font-weight: 600;
  color: var(--text); letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand svg { width: 15px; height: 15px; stroke: var(--green); }
.topbar-links { display: flex; gap: 1.6rem; }
.topbar-links a {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  transition: color 0.2s var(--ease);
  white-space: nowrap;
}
.topbar-links a:hover, .topbar-links a.active { color: var(--text); }

.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; color: var(--green);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ── hub hero ── */
.hub-hero { padding: clamp(2rem, 4.5vw, 3.25rem) 0 clamp(1.75rem, 4vw, 2.75rem); border-bottom: 1px solid var(--border); }
.hub-hero-inner { max-width: none; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }
.blur-title {
  font-size: clamp(1.85rem, 3.3vw, 2.6rem);
  line-height: 1.12; letter-spacing: -0.025em; font-weight: 700;
  color: var(--text); max-width: 30ch;
  margin-bottom: 1.1rem;
  text-wrap: balance;
}
.blur-title .w {
  display: inline-block;
  opacity: 0; filter: blur(9px); transform: translateY(0.45em);
  transition: opacity 0.55s var(--ease), filter 0.55s var(--ease), transform 0.55s var(--ease);
}
.blur-title.loaded .w { opacity: 1; filter: blur(0); transform: none; }
.dek {
  font-size: 0.97rem;
  color: var(--text-muted); max-width: 46ch; margin-bottom: 1.5rem;
  line-height: 1.65;
}
.hub-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 3rem; align-items: end;
}
.hub-head .dek { margin-bottom: 0; }
.hub-meta {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.hub-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }

/* ── hub: editorial post list ── */
.hub-main { max-width: none; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem) 3rem; }
.list-label {
  font-family: var(--mono); font-size: 0.66rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
  padding-bottom: 1.1rem;
}
.post-list { list-style: none; }
.post-row { border-top: 1px solid var(--border); }
.post-list li:last-child .post-row { border-bottom: 1px solid var(--border); }
.post-row {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 1.5rem; align-items: baseline;
  padding: 2rem 0.75rem 2.1rem 0.25rem;
  transition: background 0.25s var(--ease);
}
.post-row:hover { background: rgba(255, 255, 255, 0.02); }
.row-num {
  font-family: var(--mono); font-size: 0.95rem; color: var(--text-dim);
  font-weight: 500; letter-spacing: 0.04em;
  transition: color 0.25s var(--ease);
}
.post-row:hover .row-num { color: var(--green); }
.row-body h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  line-height: 1.22; letter-spacing: -0.015em; font-weight: 600;
  color: var(--text); margin-bottom: 0.7rem;
  transition: color 0.25s var(--ease);
}
.post-row:hover .row-body h2 { color: var(--green); }
.row-dek {
  font-size: 0.98rem; color: var(--text-muted); max-width: 62ch;
  line-height: 1.6;
}
.row-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.55rem;
  font-family: var(--mono); font-size: 0.66rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.row-tag {
  border: 1px solid var(--border); border-radius: 99px;
  padding: 0.24rem 0.65rem; font-size: 0.6rem;
}
.row-arrow { color: var(--text-dim); transition: color 0.25s var(--ease), transform 0.25s var(--ease); }
.post-row:hover .row-arrow { color: var(--green); transform: translateX(3px); }

/* scope note */
.hub-note {
  margin-top: 3rem; border: 1px solid var(--border); border-radius: 10px;
  border-left: 2px solid var(--amber);
  background: var(--bg-surface); padding: 1.3rem 1.5rem;
}
.hub-note .note-label {
  font-family: var(--mono); font-size: 0.68rem; color: var(--amber);
  text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 0.5rem;
}
.hub-note p { font-size: 0.9rem; color: var(--text-muted); }

/* ── article layout: content + right rail TOC ── */
.article-layout {
  display: grid; grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: clamp(2rem, 3vw, 3rem);
  max-width: none;
  padding: 0 clamp(1.25rem, 3vw, 2.75rem);
}
.article { width: 100%; padding-top: clamp(2rem, 4.5vw, 3.25rem); }

.article-head { margin-bottom: 2.4rem; }
.article-head h1 {
  font-size: clamp(1.6rem, 3.1vw, 2.3rem);
  line-height: 1.18; letter-spacing: -0.02em; font-weight: 700;
  color: var(--text); margin-bottom: 1.2rem;
}
.article-head h1 .w {
  display: inline-block;
  opacity: 0; filter: blur(9px); transform: translateY(0.45em);
  transition: opacity 0.55s var(--ease), filter 0.55s var(--ease), transform 0.55s var(--ease);
}
.article-head h1.loaded .w { opacity: 1; filter: blur(0); transform: none; }
.article-dek {
  font-size: 1.16rem; color: var(--text-muted); max-width: 54ch;
  margin-bottom: 1.6rem; line-height: 1.6;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  font-family: var(--mono); font-size: 0.7rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.07em;
  border-top: 1px solid var(--border); padding-top: 1.15rem;
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }

/* prose: 50-70ch measure, roomy leading */
.article > p {
  margin-bottom: 1.5rem;
  font-size: 1.08rem;
  line-height: 1.82;
}
.article h2 {
  font-size: 1.6rem; letter-spacing: -0.02em; color: var(--text);
  margin: 3.8rem 0 1.3rem; line-height: 1.22;
  scroll-margin-top: 5.5rem;
}
.article h2 .sec-num {
  font-family: var(--mono); font-size: 0.72rem; color: var(--green);
  vertical-align: super; margin-right: 0.55rem; font-weight: 500;
}
.article h3 {
  font-size: 1.08rem; color: var(--text); margin: 2.2rem 0 0.8rem;
}
.article ul, .article ol { margin: 0 0 1.5rem 1.2rem; }
.article li { margin-bottom: 0.6rem; font-size: 1.03rem; line-height: 1.7; }
.article li::marker { color: var(--text-dim); }
.article strong { color: var(--text); font-weight: 600; }
.article code.inline {
  font-family: var(--mono); font-size: 0.82em;
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.12em 0.42em; color: #a5d6ff;
}

.article a.txt-link {
  color: var(--green); border-bottom: 1px solid rgba(16, 185, 129, 0.35);
  transition: border-color 0.2s var(--ease);
}
.article a.txt-link:hover { border-bottom-color: var(--green); }

/* pull quote: the one line to remember from each section */
.pull {
  border-left: 2px solid var(--green);
  margin: 2.8rem 0; padding: 0.4rem 0 0.4rem 1.6rem;
  font-size: 1.32rem; line-height: 1.45;
  color: var(--text); font-weight: 500; letter-spacing: -0.01em;
  max-width: 30ch;
}

/* callouts */
.callout {
  border: 1px solid var(--border); border-left: 2px solid var(--green);
  background: var(--bg-surface); border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.4rem; margin: 2.4rem 0;
}
.callout.amber { border-left-color: var(--amber); }
.callout.red { border-left-color: var(--red); }
.callout .co-label {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 0.65rem;
  color: var(--green);
}
.callout.amber .co-label { color: var(--amber); }
.callout.red .co-label { color: var(--red); }
.callout p { font-size: 0.96rem; color: var(--text-muted); margin-bottom: 0.7rem; line-height: 1.7; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 0 0 0 1.15rem; }
.callout li { font-size: 0.96rem; margin-bottom: 0.55rem; line-height: 1.65; }

/* code blocks: old terminal window, title bar carries the filename */
.code-window {
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin: 1.8rem 0;
  background: var(--bg-code);
}
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-code-head);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
}
.code-file {
  font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 0.5rem;
}
.code-file::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); display: inline-block;
}
.code-lang {
  font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-dim);
}
.code-window pre {
  padding: 1rem 1.1rem; overflow-x: auto;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.65;
  color: #d4d4dc;
  tab-size: 4;
}
.copy-btn {
  font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.18rem 0.5rem; background: transparent;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-bright); }

/* highlight.js theme override, matched to palette */
.hljs-comment, .hljs-quote { color: #5c5c6b; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-meta-keyword { color: #10b981; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #7dd3fc; }
.hljs-number, .hljs-literal { color: #f59e0b; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #e2e8f0; font-weight: 600; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #c4b5fd; }
.hljs-type, .hljs-built_in, .hljs-builtin-name, .hljs-class .hljs-title { color: #67e8f9; }
.hljs-meta { color: #9e9ea8; }
.hljs-deletion { color: #f87171; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* PoC video frames: cinematic width, breaks out of the text column */
.video-frame {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--bg-code);
  margin: 2.4rem auto 2.6rem;
  width: 100%;
}
.video-frame video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video-caption {
  font-family: var(--mono); font-size: 0.68rem; color: var(--text-dim);
  padding: 0.6rem 0.9rem; border-top: 1px solid var(--border);
  letter-spacing: 0.03em;
}

/* meme figures */
.meme {
  margin: 2.8rem auto; max-width: 560px;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--bg-card);
}
.meme img { display: block; width: 100%; height: auto; }
.meme figcaption {
  font-family: var(--mono); font-size: 0.68rem; color: var(--text-dim);
  padding: 0.6rem 0.9rem; border-top: 1px solid var(--border);
  letter-spacing: 0.03em;
}

/* flow diagram: methodology at a glance, no code needed */
.flow {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-surface);
  padding: 1rem 1.2rem; margin: 1.8rem 0;
  font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted);
  line-height: 2;
  overflow-x: auto; white-space: nowrap;
}
.flow b { color: var(--green); font-weight: 600; }
.flow .fl-label {
  display: block; font-size: 0.62rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.35rem;
}

/* TOC rail */
.toc {
  position: sticky; top: 5.5rem; align-self: start;
  grid-column: 1; grid-row: 1;
  padding-top: clamp(2rem, 4.5vw, 3.25rem);
  font-family: var(--mono);
}
.article { grid-column: 2; grid-row: 1; }
.toc-label {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin-bottom: 0.9rem;
}
.toc a {
  display: block; font-size: 0.72rem; color: var(--text-dim);
  padding: 0.32rem 0 0.32rem 0.85rem;
  border-left: 1px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
  line-height: 1.45;
}
.toc a:hover { color: var(--text-muted); }
.toc a.active { color: var(--green); border-left-color: var(--green); }

/* series nav at bottom */
.series-nav {
  max-width: 1200px; margin: 0 auto;
  padding: 2.5rem clamp(1.25rem, 4vw, 3rem) 4rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.series-nav a {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1.1rem 1.3rem; background: var(--bg-card);
  transition: border-color 0.25s var(--ease);
}
.series-nav a:hover { border-color: var(--border-bright); }
.series-nav .sn-label {
  font-family: var(--mono); font-size: 0.62rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 0.4rem;
}
.series-nav .sn-title { font-size: 0.95rem; color: var(--text); font-weight: 500; }
.series-nav a.next { text-align: right; }
.back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-top: 3rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }

/* footer */
.blog-footer { border-top: 1px solid var(--border); margin-top: 2rem; }
.blog-footer-inner {
  max-width: none; margin: 0 auto;
  padding: 1.6rem clamp(1.25rem, 4vw, 3rem);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  font-family: var(--mono); font-size: 0.68rem; color: var(--text-dim);
}
.blog-footer-links { display: flex; gap: 1.4rem; }
.blog-footer-links a { color: var(--text-muted); transition: color 0.2s; }
.blog-footer-links a:hover { color: var(--text); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* responsive */
@media (max-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .article { grid-column: 1; grid-row: auto; }
}
@media (max-width: 760px) {
  .post-row { grid-template-columns: 1fr; gap: 0.7rem; padding: 1.7rem 0.25rem 1.8rem 0; }
  .row-num { font-size: 0.8rem; }
  .row-side { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 0.9rem; }
}
@media (max-width: 640px) {
  .topbar { padding: 0.75rem 0.9rem; }
  .brand { font-size: 0.7rem; gap: 0.45rem; }
  .brand svg { width: 13px; height: 13px; }
  .topbar-links { gap: 0.85rem; }
  .topbar-links a { font-size: 0.6rem; letter-spacing: 0.05em; }
  .article { padding-top: 2.5rem; }
  .article > p { font-size: 1rem; }
  .pull { font-size: 1.15rem; padding-left: 1.1rem; }
  .series-nav { grid-template-columns: 1fr; }
  .series-nav a.next { text-align: left; }
  .code-window pre { font-size: 0.74rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blur-title .w, .article-head h1 .w { transition: none; opacity: 1; filter: none; transform: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
  .post-row, .row-arrow { transition: none; }
}
