
/* ── Theme variables ───────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --para: #444444;
  --muted: #777777;
  --accent: #0B1F8C;
  --accent-alt: #04328C;
  --accent-hover: #FA6619;
  --surface: rgba(43, 62, 170, 0.06);
  --surface-2: rgba(43, 62, 170, 0.12);
  --surface-3: rgba(43, 62, 170, 0.2);
  --border: rgba(43, 62, 170, 0.45);
  --font-body: "freight-text-pro", serif;
  --font-heading: "freighttextcmp-pro", sans-serif;
  --font-mono: "JetBrains Mono", "Monaco", "Consolas", monospace;
  --glow-h1: none;
  --glow-h2: none;
  --glow-link: none;
  --glow-link-hover: none;
  --glow-home: none;
  --shadow-nav: 0 2px 8px rgba(43, 62, 170, 0.1);
  --shadow-card: 0 1px 4px rgba(43, 62, 170, 0.08);
  --shadow-content: 0 2px 10px rgba(43, 62, 170, 0.07);
  --shadow-btn-hover: 0 2px 6px rgba(232, 96, 28, 0.2);
  /* Chrome — solid backgrounds for nav + footer */
  --chrome-bg: #2B3EAA;
  --chrome-text: #ffffff;
  --chrome-text-muted: rgba(255, 255, 255, 0.6);
  --chrome-border: rgba(255, 255, 255, 0.18);
}

:root[data-theme="dark"] {
  --bg: #0f0f0f;
  --text: #e2e2e2;
  --para: #aaaaaa;
  --muted: #666666;
  --accent: #6675D4;
  --accent-alt: #7D8FE8;
  --accent-hover: #FA6619;
  --surface: rgba(102, 117, 212, 0.08);
  --surface-2: rgba(102, 117, 212, 0.15);
  --surface-3: rgba(102, 117, 212, 0.25);
  --border: rgba(102, 117, 212, 0.5);
  --font-body: "freight-text-pro", serif;
  --font-heading: "freight-text-pro", sans-serif;
  --font-mono: "JetBrains Mono", "Monaco", "Consolas", monospace;
  --glow-h1: none;
  --glow-h2: none;
  --glow-link: none;
  --glow-link-hover: none;
  --glow-home: none;
  --shadow-nav: 0 2px 12px rgba(102, 117, 212, 0.2);
  --shadow-card: 0 1px 6px rgba(102, 117, 212, 0.12);
  --shadow-content: 0 2px 15px rgba(102, 117, 212, 0.12);
  --shadow-btn-hover: 0 0 8px rgba(255, 140, 66, 0.35);
  /* Chrome */
  --chrome-bg: #1a2570;
  --chrome-text: #ffffff;
  --chrome-text-muted: rgba(255, 255, 255, 0.55);
  --chrome-border: rgba(255, 255, 255, 0.14);
}


/* ── Base ──────────────────────────────────────────────────── */
html {
  overflow-x: clip; /* Lets full-bleed breakouts (nav, footer, h1) extend
                       beyond the 900px body without causing horizontal scroll */
}

body {
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ── Type scale (augmented fourth: ×1.414) ────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  line-height: 0.8;
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  color: var(--accent);
}
h1 {
  font-size: clamp(2.5rem, 8vw, 7.993rem);
  font-weight: 600;
  text-shadow: var(--glow-h1);
  margin-bottom: 0.5em;
  text-transform: capitalize;
  /* font-family: "freighttextcmp-pro", sans-serif; */
}
h2 {
  font-size: clamp(2rem, 6vw, 5.653rem);
  font-weight: 500;
  padding-bottom: 10px;
  margin-top: 1.5em;
  color: var(--accent-alt);
  text-shadow: var(--glow-h2);
}
h3 {
  font-size: clamp(1.6rem, 4vw, 3.998rem);
  font-weight: 500;
  color: var(--accent-alt);
}
h4 {
  font-size: clamp(1.3rem, 3vw, 2.827rem);
  font-weight: 500;
}
h5 {
  font-size: clamp(1.1rem, 2vw, 1.999rem);
  font-weight: 500;
}
h6 {
  font-size: 1.414rem;
  font-weight: 500;
  color: var(--muted);
}


p {
  font-family: "freight-text-pro", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-size: 1rem;
  color: var(--para);
}
small {
  font-size: 0.707rem;
  color: var(--muted);
}

a {
  color: var(--accent);
}
a:hover {
  color: var(--accent-hover);
}

/* ── Code & pre ────────────────────────────────────────────── */
pre,
code,
kbd {
  font-family: var(--font-mono);
  font-optical-sizing: auto;
}
pre {
  font-size: 0.875rem;
  font-weight: 400;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25em 1.5em;
  overflow-x: auto;
  line-height: 1.6;
}
code {
  font-size: 0.875em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ── Utility: keyboard shortcut chip ──────────────────────── */
/* Usage: <span class="kbd">⌘K</span> or <span class="kbd">Copy</span> */
.kbd {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

/* ── Utility: article tag pill ────────────────────────────── */
/* Usage: <a class="tag" href="/tags/foo">foo</a> */
.tag {
  display: inline-flex;
  align-items: center;
  position: relative;
  font-family: "freight-text-pro", serif;
  /* font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--accent);
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s; */


  height: 32px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  line-height: 32px;
  padding: 0 12px;
  /* border-radius: 16px; */
  /* background-color: rgba(16, 152, 205, .1); */
  color: var(--blue);
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}

.tag:hover {
  background: var(--surface-3);
  color: var(--accent-hover);
}

.tag:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 14px;
  background: var(--border);
}

/* ── Utility: published date ───────────────────────────────── */
/* Usage: <time class="date">2026-03-15</time> */
.date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ── Nav ───────────────────────────────────────────────────── */
nav {
  /* Full-bleed breakout from the 900px body */
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  margin-top: -20px;          /* flush against top of viewport */
  margin-bottom: 3rem;

  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0;

  background: var(--chrome-bg);
  padding: 1.1rem clamp(1.5rem, 6vw, 4rem);
  box-shadow: 0 3px 24px rgba(0, 0, 0, 0.22);
}

nav a {
  text-decoration: none;
  color: var(--chrome-text);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  padding: 0.2em 0;
  margin-right: 1.75rem;
  border-bottom: 2px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
  text-shadow: none;
}

nav a:hover {
  color: var(--chrome-text);
  opacity: 0.72;
  border-bottom-color: var(--chrome-text);
  text-shadow: none;
}

.home-link {
  font-family: var(--font-heading);
  font-size: 1.25rem !important;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-right: 2.5rem;
  padding: 0 !important;
  border-bottom: none !important;
  color: var(--chrome-text) !important;
  text-shadow: none !important;
  white-space: nowrap;
}

.home-link:hover {
  opacity: 0.85;
  border-bottom: none !important;
}

/* Responsive nav: on narrow screens the site title fills the first
   row and the theme switcher drops to a new full-width row        */
@media (max-width: 540px) {
  nav {
    padding: 0.9rem 1.25rem;
    gap: 0.5rem 0;
  }
  .home-link {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.25rem;
  }
  .theme-switcher {
    width: 100%;
    margin-left: 0;
  }
}

/* ── Theme switcher ────────────────────────────────────────── */
.theme-switcher {
  display: flex;
  margin-left: auto;
  border: 1px solid var(--chrome-border);
  border-radius: 6px;
  overflow: hidden;
}

.theme-btn {
  background: transparent;
  border: none;
  border-left: 1px solid var(--chrome-border);
  color: var(--chrome-text);
  padding: 5px 14px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
  transition: background 0.15s, opacity 0.15s;
}

.theme-btn:first-child {
  border-left: none;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--chrome-text);
  opacity: 1;
  text-shadow: none;
}

/* Active theme button — lit up with a translucent fill */
:root[data-theme="light"] .theme-btn[data-theme="light"],
:root[data-theme="dark"] .theme-btn[data-theme="dark"] {
  background: rgba(255, 255, 255, 0.18);
  color: var(--chrome-text);
  opacity: 1;
  text-shadow: none;
}

/* ── Content areas ─────────────────────────────────────────── */
.content {
}
.post-meta {
  color: var(--muted);
  font-size: 0.9em;
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}
.post-list {
  list-style: none;
  padding: 0;
}
.post-list li {
}
.post-list a {
  text-decoration: none;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.1em;
  text-shadow: var(--glow-link);
}
.post-list a:hover {
  color: var(--accent-hover);
  text-shadow: var(--glow-link-hover);
}

/* ── Tutorial navigation ───────────────────────────────────── */
.tutorial-nav {
  margin-top: 3em;
  padding: 2em;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
}
.nav-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
}
.prev-link,
.next-link,
.index-link {
  padding: 10px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--accent);
  font-weight: bold;
  text-shadow: var(--glow-link);
  transition: all 0.3s ease;
}
.prev-link:hover,
.next-link:hover,
.index-link:hover {
  background: var(--surface-3);
  color: var(--accent-hover);
  text-shadow: var(--glow-link-hover);
  box-shadow: var(--shadow-btn-hover);
}
.tutorial-series {
  background: var(--surface-2);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  margin-left: 1em;
  border: 1px solid var(--border);
}

/* ── Footer ────────────────────────────────────────────────── */
.tech-footer {
  /* Full-bleed breakout */
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  margin-top: 5rem;
  margin-bottom: -20px;       /* flush against bottom of viewport */

  background: var(--chrome-bg);
  color: var(--chrome-text);
  border-top: 3px solid var(--chrome-border);

  padding: 2.5rem clamp(1.5rem, 6vw, 4rem);

  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 2rem;

  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.tech-footer-brand {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--chrome-text);
}

.tech-footer-desc {
  color: var(--chrome-text-muted);
  font-size: 0.78rem;
}

.tech-footer-credit {
  margin-left: auto;
  color: var(--chrome-text-muted);
  font-size: 0.78rem;
  font-style: italic;
}

.tech-footer a {
  color: var(--chrome-text);
  text-decoration: none;
  opacity: 0.72;
  transition: opacity 0.15s;
}

.tech-footer a:hover {
  opacity: 1;
  color: var(--chrome-text);
}

@media (max-width: 540px) {
  .tech-footer {
    flex-direction: column;
    gap: 0.35rem;
    padding: 2rem 1.25rem;
  }
}

/* ══════════════════════════════════════════════════════════════
   TYPOGRAPHIC ENHANCEMENTS
   ══════════════════════════════════════════════════════════════ */

/* ── 1. Full-bleed breakout headings ──────────────────────── */
/* H1: full viewport width band behind the title */
.post-content h1 {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  padding-left: clamp(1.5rem, 8vw, 6rem);
  padding-right: clamp(1.5rem, 8vw, 6rem);
  padding-top: 0.4em;
  padding-bottom: 0.3em;
}

/* H2: steps out to 115% for a graduated hierarchy */
.post-content h2 {
  width: min(115%, 100vw);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  padding-left: clamp(1rem, 5vw, 4rem);
  padding-right: clamp(1rem, 5vw, 4rem);
}

/* ── 2. Drop caps (span injected by typography.js) ─────────── */
.dropcap {
  float: left;
  font-family: var(--font-heading);
  font-size: 5.2rem;
  font-weight: 600;
  line-height: 0.78;
  color: var(--accent);
  padding-right: 0.08em;
  padding-top: 0.06em;
  text-shadow: var(--glow-h1);
}

/* ── 3. Pull quotes ─────────────────────────────────────────── */
.post-content blockquote {
  width: min(110%, 100vw);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  padding: 1.2em clamp(1.5rem, 6vw, 4rem);
  margin: 2em 0;
  border-left: none;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  font-size: 1.414rem;        /* one step up the type scale */
  font-style: italic;
  color: var(--accent-alt);
  text-align: center;
  line-height: 1.4;
}

.post-content blockquote::before {
  content: '\201C';           /* opening smart quote as ornament */
  display: block;
  font-size: 4rem;
  line-height: 0.6;
  color: var(--border);
  font-style: normal;
  margin-bottom: 0.3em;
}

/* ── 4. Small caps for NLP acronyms ─────────────────────────── */
abbr.sc {
  font-variant: small-caps;
  font-variant-caps: small-caps;
  letter-spacing: 0.06em;
  font-size: 0.95em;
  text-decoration: none;
}

/* ── 5. First-paragraph lead-in small caps ──────────────────── */
/* Class added by typography.js after dropcap injection */
.has-dropcap::first-line {
  font-variant: small-caps;
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
  font-size: 0.95em;
}

/* ── 6. Ornamental HR section dividers ──────────────────────── */
hr {
  border: none;
  text-align: center;
  margin: 2.5em 0;
  overflow: visible;
}

hr::after {
  content: '✦  ✦  ✦';
  font-size: 0.9rem;
  letter-spacing: 0.5em;
  color: var(--border);
  display: inline-block;
}

/* ── 7. Sidenotes / marginalia ──────────────────────────────── */
/* On wide screens these float into the right margin */
.sidenote {
  float: right;
  clear: right;
  width: 200px;
  margin-right: -240px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding-left: 0.8em;
  font-style: normal;
}

/* Collapse to inline on narrow viewports */
@media (max-width: 1200px) {
  .sidenote {
    float: none;
    width: auto;
    margin-right: 0;
    border-left: none;
    padding: 1.5em 0;
    margin: 1em 0;
    font-size: 0.85rem;
    display: inline-block;
  }
}

/* ── Stats grid shortcode ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-hover);
  margin-top: 0.5em;
}

@media (max-width: 540px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 8. Balanced headlines and widow/orphan control ─────────── */
h1, h2, h3, h4 {
  text-wrap: balance;
}

.post-content p {
  widows: 2;
  orphans: 2;
}

/* ── 9. Pilcrow § on heading hover ──────────────────────────── */
.post-content h2:hover::after,
.post-content h3:hover::after {
  content: ' ¶';
  font-size: 0.7em;
  color: var(--border);
  font-weight: 400;
  vertical-align: middle;
  cursor: pointer;
}

/* ── 11. OpenType ligatures and numeric figures ─────────────── */
body {
  font-variant-ligatures: common-ligatures discretionary-ligatures;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-kerning: normal;
}

h1, h2, h3, h4, h5, h6, .stat, table {
  font-variant-numeric: lining-nums tabular-nums;
}

/* ── Featured concepts shortcode ───────────────────────────── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (max-width: 720px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .featured-grid {
    grid-template-columns: 1fr;
  }
}

.featured-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.featured-card:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: var(--shadow-content);
  color: inherit;
}

.featured-topic {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.featured-title {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  margin: 0;
}

.featured-card:hover .featured-title {
  color: var(--accent);
}

.featured-summary {
  font-size: 0.875rem;
  color: var(--para);
  line-height: 1.5;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.featured-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.6rem;
}

.featured-badge::before {
  content: '↳ ';
}

/* ── Topics grid shortcode ──────────────────────────────────── */
.topics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0;
  justify-content: center;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 1em;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-hover);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.topic-pill:hover {
  background: var(--surface-2);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.topic-count {
  font-size: 0.75em;
  color: var(--bg);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.1em 0.5em;
  min-width: 1.5em;
  text-align: center;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════
   VISUALISATION COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* ── Shared figure shell ────────────────────────────────────── */
.visualisation {
  margin: 2.5em 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.viz-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 2.5rem 2rem;
  background: var(--surface);
}

.viz-caption {
  padding: 0.6rem 1.25rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: center;
}

.viz-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.viz-controls .btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}

.viz-controls .btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--accent-hover);
}

.viz-controls .btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.viz-step-counter {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  min-width: 3ch;
  text-align: right;
}

/* ── viz-tokenise — token split animation ───────────────────── */
/*
 * Four steps driven by .step-N on .viz-stage:
 *   0  — unsplit string (default)
 *   1  — split marker visible between groups
 *   2  — groups slide apart, marker fades
 *   3  — chip styling fades in on each group
 */

.tok-strip {
  display: flex;
  align-items: center;
  gap: 0px;
  /* gap is transitionable in Chrome 99+, FF 95+, Safari 16.4+ */
  transition: gap 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Each token group */
.tok-group {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: transparent;
  transition:
    border-color 0.35s ease,
    background   0.35s ease,
    padding      0.35s ease;
}

/* Individual characters inside a group */
.tok-char {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--text);
  transition: color 0.35s ease;
  display: inline-block;
  /* prevent collapse */
  min-width: 0.6em;
  text-align: center;
}

/* The split-point hairline between groups */
.tok-divider {
  flex-shrink: 0;
  width: 0;
  height: 2.4rem;
  border-radius: 2px;
  background: var(--accent-hover);
  opacity: 0;
  transition:
    width   0.25s ease,
    opacity 0.25s ease;
}

/* ── Step 1: split marker appears ────── */
.step-1 .tok-divider {
  width: 2px;
  opacity: 1;
}

/* ── Step 2: tokens slide apart ─────── */
.step-2 .tok-strip { gap: 1.5rem; }
.step-2 .tok-divider { opacity: 0; width: 0; }

/* ── Step 3: chip styling fades in ──── */
.step-3 .tok-strip { gap: 1.5rem; }
.step-3 .tok-divider { display: none; }

.step-3 .tok-group {
  background: var(--surface-2);
  border-color: var(--border);
  padding: 0.15em 0.55em;
}

.step-3 .tok-char {
  color: var(--accent);
}

/* ── Reduced motion ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tok-strip,
  .tok-group,
  .tok-char,
  .tok-divider {
    transition: none;
  }
}

/* ══════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════ */

.table-wrapper {
  overflow-x: auto;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-card);
}

.table-default {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: var(--font-mono);
}

.table-default thead tr {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}

.table-default th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-default td {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  color: var(--para);
  line-height: 1.5;
}

.table-default tbody tr:last-child td {
  border-bottom: none;
}

.table-default tbody tr:hover {
  background: var(--surface);
}

/* ── Fallback: style raw <table> elements if render hook doesn't fire ── */
.post-content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  /* border: 0.5px solid var(--border); */
  /* border-radius: 6px; */
  margin: 1.5rem 0;
  /* box-shadow: var(--shadow-card); */
}

.post-content table thead tr {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}

.post-content table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-content table td {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  color: var(--para);
  line-height: 1.5;
}

.post-content table tbody tr:last-child td {
  border-bottom: none;
}

.post-content table tbody tr:hover {
  background: var(--surface);
}

/* ── Ninja-Keys command palette ────────────────────────────── */

/* Theme the palette to match the site's colour scheme */
ninja-keys {
  --ninja-width: 620px;
  --ninja-top: 18%;
  --ninja-border-radius: 0.45rem;
  --ninja-font-family: var(--font-body);
  --ninja-font-size: 15px;

  /* Colours – inherit from the active CSS theme */
  --ninja-accent-color:              var(--accent);
  --ninja-text-color:                var(--text);
  --ninja-secondary-text-color:      var(--muted);
  --ninja-placeholder-color:         var(--muted);
  --ninja-icon-color:                var(--muted);
  --ninja-modal-background:          var(--bg);
  --ninja-selected-background:       var(--surface-2);
  --ninja-secondary-background-color: var(--surface);
  --ninja-separator-border:          1px solid var(--border);
  --ninja-overflow-background:       rgba(0, 0, 0, 0.45);
  --ninja-backdrop-filter:           blur(4px);
  --ninja-modal-shadow:              0 24px 64px rgba(0, 0, 0, 0.25), 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ── Nav search button ─────────────────────────────────────── */
#ninja-open-btn {
  display:         inline-flex;
  align-items:     center;
  gap:             0.4em;
  padding:         0.3em 0.75em;
  background:      var(--chrome-bg);
  color:           var(--chrome-text);
  border:          1px solid var(--chrome-border);
  border-radius:   0.35rem;
  font-family:     var(--font-body);
  font-size:       0.82rem;
  cursor:          pointer;
  opacity:         0.85;
  transition:      opacity 0.15s, box-shadow 0.15s;
  white-space:     nowrap;
}

#ninja-open-btn:hover {
  opacity:    1;
  box-shadow: var(--shadow-btn-hover);
}

#ninja-open-btn kbd {
  font-family:      var(--font-mono);
  font-size:        0.72em;
  padding:          0.15em 0.35em;
  border-radius:    0.25rem;
  background:       rgba(255, 255, 255, 0.15);
  border:           1px solid rgba(255, 255, 255, 0.25);
  color:            inherit;
  letter-spacing:   0;
}
