/* Core stylesheet — tokens, resets, and shared components combined into one
   file so every page pays for one render-blocking request instead of three.
   These three concerns are still logically separate; the section dividers
   below preserve that. If you're editing this file, know which section
   you're in:
     TOKENS    — color/type/spacing/radius/motion variables + @font-face
     BASE      — element resets, body/h1-h3/code/a defaults, site header/footer/nav
     SHARED    — components used (or reasonably likely to be reused) on more
                 than one page
   A page's own <page-name>.css loads after this file and should only ever
   contain rules genuinely unique to that page. See STYLE_GUIDE.md. */

/* ============================== TOKENS ============================== */

/* Design tokens — site-wide. Colors are warm-neutral with a terracotta accent,
   adaptive to light/dark via prefers-color-scheme. Approved 2026-08-18. */

/* Self-hosted fonts (moved off Google Fonts @import 2026-08-26 — @import
   forced a 3-hop chain: base.css -> fonts.googleapis.com -> fonts.gstatic.com
   before any font byte arrived. Same-origin files skip that entirely.
   Only the weights actually used site-wide are included. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/fraunces-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-variable.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
}

:root {
  /* Color — light (default) — "Ink & Signal" */
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --text-primary: #14181F;
  --text-secondary: #5B6472;
  --border: #8A8C90;
  --accent: #2955D6;
  --on-accent: #FFFFFF;
  --code-bg: #E3E8ED;
  --shadow-card: 0 2px 8px rgba(20, 24, 31, 0.08);

  /* Diagram category colors — light */
  --cat-foundation: #2955D6;
  --cat-resume: #2E9E8F;
  --cat-coverletter: #6C5CE0;
  --cat-subcard: #C98A1F;

  /* Typography */
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --text-h1: clamp(1.75rem, 4vw, 2.5rem);
  --text-h2: clamp(1.375rem, 3vw, 1.75rem);
  --text-h3: 1.25rem;
  --text-body: 1.0625rem;
  --text-small: 0.8125rem;
  --text-code: 0.875rem;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Layout */
  --max-width: 1200px;
  --reading-width: 680px;
  --card-width: 440px;
  --breakpoint-tablet: 1024px;
  --breakpoint-mobile: 640px;

  /* Radius */
  --radius-sm: 6px;
  --radius-lg: 12px;

  /* Motion */
  --transition-fast: 150ms ease-out;
  --transition-base: 250ms ease;
}

@media (max-width: 640px) {
  :root {
    --card-width: 300px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    /* "Ink & Signal" — dark */
    --bg: #0D1117;
    --surface: #161B22;
    --text-primary: #E8EBEF;
    --text-secondary: #9098A6;
    --border: #66696F;
    --accent: #5B8AFF;
    --on-accent: #0D1117;
    --code-bg: #1C232C;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35);

    --cat-foundation: #5B8AFF;
    --cat-resume: #3FBBAA;
    --cat-coverletter: #8B7CF0;
    --cat-subcard: #D9A23E;
  }
}

/* =============================== BASE ================================ */

/* Base element styles + resets.
   Fonts are self-hosted via @font-face in the TOKENS section above. */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-4);
  line-height: 1.25;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }

p {
  margin: 0 0 var(--space-4);
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.75;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-code);
}

code {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

pre {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
}

img, svg {
  max-width: 100%;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-4);
  }
}

.prose {
  max-width: var(--reading-width);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Site header (sticky, applies across every page) */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-6);
}

.site-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.site-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--text-primary);
  text-decoration: none;
}

.site-name:hover {
  opacity: 0.75;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-resume);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--text-primary);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
}

.nav-dropdown-trigger:hover {
  opacity: 0.75;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-2);
  min-width: 220px;
  display: flex;
  flex-direction: column;
  z-index: 60;
}

.nav-dropdown-menu[hidden] {
  display: none;
}

.nav-dropdown-menu a,
.dropdown-item-disabled {
  font-family: var(--font-sans);
  font-size: 13px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

/* Collapse Work/Resume/Contact into a hamburger-triggered panel below the
   header on narrow screens -- three top-level items (Resume added
   2026-09-17) read as squished at phone width with them inline, and a
   stopgap tighter padding/gap still felt cramped. Placed after the
   .nav-dropdown-menu base rule above so its position:static override
   actually wins the cascade at matching widths, instead of losing to a
   same-specificity rule that happens to appear later in the file. */
@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }
  .site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: var(--space-4);
    left: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 200px;
    padding: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
  }
  .site-nav.nav-open {
    display: flex;
  }
  /* Top-level links get the same card-row treatment as an item inside the
     "Work" submenu, so the whole panel reads as one consistent menu instead
     of plain text sitting inside a box. */
  .site-nav > a {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
  }
  .site-nav > a:hover {
    background: var(--code-bg);
    opacity: 1;
  }
  .nav-dropdown {
    width: 100%;
  }
  .nav-dropdown-trigger {
    width: 100%;
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
  }
  .nav-dropdown-trigger:hover {
    background: var(--code-bg);
    opacity: 1;
  }
  .nav-dropdown-menu {
    position: static;
    transform: none;
    margin-top: 2px;
    box-shadow: none;
    border: none;
    background: var(--code-bg);
    width: 100%;
    min-width: 0;
  }
}

.dropdown-item-disabled .soon-tag {
  margin-top: 2px;
}

.nav-dropdown-menu a:hover {
  background: var(--code-bg);
  opacity: 1;
}

.dropdown-item-disabled {
  color: var(--text-secondary);
  cursor: default;
}

/* Site footer (applies across every page) */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-9);
}

.site-footer-inner {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.footer-links {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
  opacity: 1;
}

.footer-link-disabled {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.soon-tag {
  font-size: 10px;
  font-weight: 500;
  background: var(--code-bg);
  border-radius: 10px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.footer-meta p {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* ============================== SHARED ================================ */

/* Shared component library. See STYLE_GUIDE.md for the "when to use which"
   reference. A page-specific stylesheet should only ever contain rules that
   are genuinely unique to that page — if a second page needs the same rule,
   it belongs here instead. */

/* Section rhythm */

.section {
  padding: var(--space-9) 0;
}

.section-tint {
  background: var(--surface);
}

.section-heading {
  text-align: center;
  margin-bottom: var(--space-6);
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.hero {
  text-align: center;
  padding: var(--space-9) 0;
}

.status-line {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

/* Buttons */

.btn-row {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.btn-pill {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 20px;
  text-decoration: none;
  display: inline-block;
}

.btn-pill-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid transparent;
}

.btn-pill-secondary {
  background: var(--code-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* At-a-glance strip (executive-snapshot fact cards) */

.at-a-glance-label {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: var(--space-7) 0 var(--space-3);
}

.glance-row {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.glance-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  flex: 1;
  min-width: 220px;
  max-width: 280px;
  text-align: left;
}

.glance-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Long-form prose */

.prose-block {
  max-width: var(--reading-width);
  margin: 0 auto;
}

.prose-block p {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Two-column decision/condition cards (e.g. "key decisions", "method selection") */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  max-width: 800px;
  margin: 0 auto;
}

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

.decision-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.decision-card p {
  margin: 0;
}

/* Three-column boundary/ownership split (uses the resume/coverletter/subcard
   category triad purely for visual differentiation, not shared semantics) */

.triad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

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

.triad-col {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border-top: 3px solid var(--triad-color, var(--border));
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.triad-col.c1 { --triad-color: var(--cat-resume); }
.triad-col.c2 { --triad-color: var(--cat-coverletter); }
.triad-col.c3 { --triad-color: var(--cat-subcard); }

.triad-col h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 16px;
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
}

.triad-col ul {
  margin: 0 0 var(--space-3);
  padding-left: 18px;
}

.triad-col li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.triad-col .why {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  margin-top: auto;
}

/* Small classification/concept tags */

.term-list {
  max-width: 640px;
  margin: 0 auto var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.term-pill {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 12px;
}

/* Only pills that are real buttons (job-pipeline's expandable-term pills) get
   interactive affordances — a static classification label should never look
   clickable. */
button.term-pill {
  cursor: pointer;
}

button.term-pill:hover {
  opacity: 0.8;
}

/* Wrapping row of pill-shaped steps connected by arrows (a linear process:
   homepage's "how the work connects", the research page's operating model) */

.pill-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  max-width: 900px;
  margin: 0 auto;
}

.pill-flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 16px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.pill-flow-arrow {
  color: var(--accent);
  font-size: 15px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .pill-flow-arrow { display: none; }
  .pill-flow { flex-direction: column; align-items: stretch; }
  .pill-flow-step { text-align: center; }
}

/* Evidence-state badge (e.g. Demonstrated / Self-use / External validation) */

.state-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 12px;
  margin-bottom: var(--space-2);
}

/* Sequential fault/round record (debug timelines, convergence excerpts) */

.bug-story {
  max-width: 620px;
  margin: 0 auto var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.bug-story h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.bug-story .bs-note {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0 0 var(--space-5);
}

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-step {
  position: relative;
  margin-bottom: var(--space-4);
}

.timeline-step:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline-step.is-fail .timeline-dot,
.timeline-step.is-final .timeline-dot {
  background: var(--accent);
}

.timeline-step.is-fail .timeline-step-label {
  color: var(--text-primary);
}

.timeline-step-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.timeline-step-detail {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.timeline-step-detail strong {
  color: var(--text-primary);
}

/* Limitations / deeper-inspection footer */

.limits-block {
  max-width: var(--reading-width);
  margin: 0 auto;
}

.limits-block p {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.6;
}

.inspect-links {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-align: center;
  margin-top: var(--space-5);
}

.inspect-links a {
  color: var(--accent);
}

/* Card carousel + expand overlay (job-pipeline.html's diagram carousel and
   the research page's study cards both use this exact markup pattern —
   see STYLE_GUIDE.md). A page includes this only if it has a carousel, and
   loads js/carousel.js for the interaction behavior. */

.view-all-row {
  text-align: center;
  margin-bottom: var(--space-4);
}

.view-all-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  background: var(--code-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 16px;
  cursor: pointer;
}

.carousel-wrap {
  position: relative;
  margin-bottom: var(--space-6);
}

.carousel {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: var(--space-2) 4px var(--space-2);
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.view-all-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 21, 0.55);
  z-index: 150;
  padding: var(--space-6) var(--space-4);
  overflow-y: auto;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.view-all-overlay.open {
  display: block;
}

.view-all-overlay.visible {
  opacity: 1;
}

.view-all-inner {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-6) var(--space-6);
  position: relative;
  transform: scale(0.97);
  transition: transform var(--transition-base);
}

.view-all-overlay.visible .view-all-inner {
  transform: scale(1);
}

.view-all-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: var(--space-6) 0 var(--space-3);
  z-index: 5;
}

.view-all-header h3 {
  margin: 0;
}

.view-all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

.view-all-grid .diagram-card {
  flex: none;
  width: 100%;
}

.carousel-fade {
  position: absolute;
  top: 0;
  bottom: var(--space-2);
  width: 64px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.carousel-fade.visible {
  opacity: 1;
}

.carousel-fade.left {
  left: 0;
  background: linear-gradient(to right, var(--bg), transparent);
}

.carousel-fade.right {
  right: 0;
  background: linear-gradient(to left, var(--bg), transparent);
}

.section-tint .carousel-fade.left {
  background: linear-gradient(to right, var(--surface), transparent);
}

.section-tint .carousel-fade.right {
  background: linear-gradient(to left, var(--surface), transparent);
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast);
}

.carousel-arrow.prev { left: -14px; }
.carousel-arrow.next { right: -14px; }

.carousel-arrow[disabled] {
  opacity: 0;
  pointer-events: none;
}

.carousel-arrow svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-primary);
}

@media (max-width: 640px) {
  .carousel-arrow { display: none; }
}

.diagram-card {
  flex: 0 0 var(--card-width);
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
}

.diagram-card h3 {
  font-size: 17px;
  margin: 0 0 6px;
  min-height: 42px;
}

.diagram-card .card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.5em * 3);
}

.expand-btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-top: auto;
  text-align: left;
}

.overlay-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 21, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.overlay-backdrop.open {
  display: flex;
}

.overlay-backdrop.visible {
  opacity: 1;
}

.overlay-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.97);
  transition: transform var(--transition-base);
}

.overlay-card.wide {
  max-width: 640px;
}

.overlay-backdrop.visible .overlay-card {
  transform: scale(1);
}

.overlay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--code-bg);
  color: var(--text-primary);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
}

.overlay-card p {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
}
