/* ═══════════════════════════════════════════════════════════════════════════
   JS Form Validation — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  /* Brand colours */
  --c-indigo:       #4f46e5;
  --c-indigo-dark:  #3730a3;
  --c-indigo-light: #e0e7ff;
  --c-violet:       #7c3aed;
  --c-violet-light: #ede9fe;
  --c-cyan:         #06b6d4;
  --c-cyan-light:   #cffafe;
  --c-green:        #10b981;
  --c-green-light:  #d1fae5;
  --c-red:          #ef4444;
  --c-red-light:    #fee2e2;
  --c-orange:       #f59e0b;
  --c-orange-light: #fef3c7;
  --c-teal:         #14b8a6;
  --c-teal-light:   #ccfbf1;
  --c-purple:       #8b5cf6;
  --c-blue:         #3b82f6;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  /* Backgrounds */
  --bg-page:        #f8fafc;
  --bg-surface:     #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-code:        #0f1117;

  /* Borders */
  --border:         #e2e8f0;
  --border-dark:    #cbd5e1;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.05);
  --shadow-md:  0 4px 12px rgba(15,23,42,.10), 0 2px 4px rgba(15,23,42,.06);
  --shadow-lg:  0 10px 30px rgba(15,23,42,.14), 0 4px 8px rgba(15,23,42,.08);
  --shadow-xl:  0 20px 50px rgba(15,23,42,.18);

  /* Layout */
  --header-h:       68px;
  --sidebar-w:      260px;
  --content-max:    1440px;
  --prose-max:      860px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Transitions */
  --t: 180ms ease;
  --t-slow: 320ms ease;

  /* Typography */
  --font:      system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--c-indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.5rem; }

/* Skip-to-content link (keyboard / screen reader accessibility) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: .5rem 1rem;
  background: var(--c-indigo);
  color: #fff;
  font-weight: 700;
  border-radius: 0 0 var(--r-md) var(--r-md);
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; }

/* Scroll offset handled by JS initHashScroll() for reliable sticky-header clearance */

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-svg { flex-shrink: 0; border-radius: 10px; }
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-text-main {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.3px;
}
.logo-text-sub {
  font-size: .72rem;
  font-weight: 600;
  color: var(--c-indigo);
  letter-spacing: .3px;
  text-transform: uppercase;
}

/* Nav */
.site-nav { margin-left: auto; }
.nav-list {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  padding: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .8rem;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}
.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-link:hover { background: var(--bg-surface-alt); color: var(--text-primary); text-decoration: none; }

.nav-link--active { color: var(--c-indigo) !important; background: var(--c-indigo-light) !important; }
.nav-link--indigo.nav-link--active { color: var(--c-indigo) !important; background: var(--c-indigo-light) !important; }
.nav-link--violet.nav-link--active { color: var(--c-violet) !important; background: var(--c-violet-light) !important; }
.nav-link--cyan.nav-link--active   { color: var(--c-cyan)   !important; background: var(--c-cyan-light)   !important; }

.nav-link--indigo:hover { color: var(--c-indigo); }
.nav-link--violet:hover { color: var(--c-violet); }
.nav-link--cyan:hover   { color: var(--c-cyan); }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.menu-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem 1.5rem;
  box-shadow: var(--shadow-md);
}
.mobile-menu[hidden] { display: none; }
.mobile-nav-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.mobile-nav-list a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem .9rem;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--t), color var(--t);
}
.mobile-nav-list a svg { width: 16px; height: 16px; flex-shrink: 0; }
.mobile-nav-list a:hover { background: var(--bg-surface-alt); color: var(--text-primary); }
.mobile-nav-list a[aria-current] { background: var(--c-indigo-light); color: var(--c-indigo); }
.mobile-nav-link--violet[aria-current] { background: var(--c-violet-light); color: var(--c-violet); }
.mobile-nav-link--cyan[aria-current]   { background: var(--c-cyan-light); color: var(--c-cyan); }

/* ═══════════════════════════════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--c-indigo);
  background: var(--c-indigo-light);
  padding: .3rem .8rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.5px;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}
.hero-title-accent {
  background: linear-gradient(135deg, var(--c-indigo), var(--c-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 540px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1.25rem;
  border-radius: var(--r-md);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--t), box-shadow var(--t), opacity var(--t);
  white-space: nowrap;
}
.hero-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.hero-btn:hover { transform: translateY(-2px); text-decoration: none; }

.hero-btn--indigo {
  background: linear-gradient(135deg, var(--c-indigo), var(--c-violet));
  color: #fff;
  box-shadow: 0 4px 14px rgba(79,70,229,.35);
}
.hero-btn--indigo:hover { box-shadow: 0 6px 20px rgba(79,70,229,.45); }

.hero-btn--violet {
  background: linear-gradient(135deg, var(--c-violet), #a855f7);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.hero-btn--violet:hover { box-shadow: 0 6px 20px rgba(124,58,237,.45); }

.hero-btn--cyan {
  background: linear-gradient(135deg, var(--c-cyan), #0891b2);
  color: #fff;
  box-shadow: 0 4px 14px rgba(6,182,212,.35);
}
.hero-btn--cyan:hover { box-shadow: 0 6px 20px rgba(6,182,212,.45); }

/* Hero code card */
.hero-visual { display: flex; justify-content: center; align-items: center; }
.hero-code-card {
  background: var(--bg-code);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 460px;
  border: 1px solid rgba(255,255,255,.06);
}
.hero-code-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.hero-code-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.hero-code-dot--red    { background: #ff5f57; }
.hero-code-dot--yellow { background: #febc2e; }
.hero-code-dot--green  { background: #28c840; }
.hero-code-filename {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: rgba(255,255,255,.35);
}
.hero-code-body {
  margin: 0;
  padding: 1.5rem;
  background: transparent;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.75;
  color: #a9b1d6;
  white-space: pre;
  overflow-x: auto;
}
.hc-k  { color: #bb9af7; }
.hc-t  { color: #2ac3de; }
.hc-s  { color: #9ece6a; }
.hc-f  { color: #7aa2f7; }
.hc-c  { color: #565f89; }

/* ── Intro ──────────────────────────────────────────────────────────────── */
.intro-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.intro-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.intro-inner p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.75;
}
.intro-inner code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--bg-surface-alt);
  padding: .15em .4em;
  border-radius: var(--r-sm);
  color: var(--c-indigo);
}

/* ── Sections grid ──────────────────────────────────────────────────────── */
.sections-grid-section {
  padding: 4rem 2rem;
  max-width: var(--content-max);
  margin: 0 auto;
}
.sections-grid-heading {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-align: center;
}
.sections-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.section-card {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--t), transform var(--t);
}
.section-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.section-card-icon-wrap {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}
.section-card-icon-wrap svg { width: 24px; height: 24px; }
.section-card--indigo .section-card-icon-wrap { background: var(--c-indigo-light); color: var(--c-indigo); }
.section-card--violet .section-card-icon-wrap { background: var(--c-violet-light); color: var(--c-violet); }
.section-card--cyan   .section-card-icon-wrap { background: var(--c-cyan-light);   color: var(--c-cyan); }

.section-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: .6rem;
}
.section-card-desc {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}
.section-card-desc code {
  font-family: var(--font-mono);
  font-size: .82em;
  background: var(--bg-surface-alt);
  padding: .1em .35em;
  border-radius: 4px;
  color: var(--c-indigo);
}
.section-card-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
}
.section-card-list li::before {
  content: '→ ';
  color: var(--text-muted);
}
.section-card-list a {
  font-size: .875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--t);
}
.section-card-list a:hover { color: var(--c-indigo); text-decoration: underline; }
.section-card--violet .section-card-list a:hover { color: var(--c-violet); }
.section-card--cyan   .section-card-list a:hover { color: var(--c-cyan); }

.section-card-cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  font-weight: 700;
  padding: .6rem 1.1rem;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background var(--t), color var(--t);
}
.section-card-cta svg { width: 16px; height: 16px; }
.section-card--indigo .section-card-cta { background: var(--c-indigo-light); color: var(--c-indigo); }
.section-card--violet .section-card-cta { background: var(--c-violet-light); color: var(--c-violet); }
.section-card--cyan   .section-card-cta { background: var(--c-cyan-light);   color: var(--c-cyan); }
.section-card-cta:hover { filter: brightness(.92); text-decoration: none; }

/* ── Patterns grid ──────────────────────────────────────────────────────── */
.patterns-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4rem 2rem;
}
.patterns-inner { max-width: var(--content-max); margin: 0 auto; }
.patterns-heading {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 2.5rem;
}
.patterns-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.pattern-item {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  transition: box-shadow var(--t), transform var(--t);
}
.pattern-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pattern-item h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: .75rem 0 .5rem;
}
.pattern-item p {
  font-size: .875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.pattern-item code {
  font-family: var(--font-mono);
  font-size: .8em;
  background: var(--bg-surface);
  padding: .1em .35em;
  border-radius: 4px;
  color: var(--c-indigo);
}
.pattern-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pattern-icon svg { width: 22px; height: 22px; }
.pattern-icon--green  { background: var(--c-green-light);  color: var(--c-green); }
.pattern-icon--purple { background: #f3e8ff;               color: var(--c-purple); }
.pattern-icon--blue   { background: #dbeafe;               color: var(--c-blue); }
.pattern-icon--orange { background: var(--c-orange-light); color: var(--c-orange); }
.pattern-icon--teal   { background: var(--c-teal-light);   color: var(--c-teal); }
.pattern-icon--red    { background: var(--c-red-light);    color: var(--c-red); }

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT PAGES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Breadcrumbs ────────────────────────────────────────────────────────── */
.breadcrumbs {
  padding: 1rem 2rem;
  max-width: var(--content-max);
  margin: 0 auto;
}
.breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .15rem;
  list-style: none;
  padding: 0;
  font-size: .8rem;
  color: var(--text-muted);
}
.breadcrumbs-item { display: flex; align-items: center; gap: .15rem; }
.breadcrumbs-item--current { color: var(--text-secondary); font-weight: 600; }
.breadcrumbs-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t);
}
.breadcrumbs-link:hover { color: var(--c-indigo); }
.breadcrumbs-sep svg { width: 14px; height: 14px; color: var(--border-dark); }

/* ── Content layout grid ────────────────────────────────────────────────── */
.content-layout {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0;
}

.content-body {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 3rem;
  padding: 1.5rem 2rem 4rem;
  align-items: start;
}

/* ── Article prose ──────────────────────────────────────────────────────── */
.article-content {
  min-width: 0;
}

.article-content h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.4px;
  background: linear-gradient(135deg, var(--c-indigo) 0%, var(--c-violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--c-indigo-light);
  display: flex;
  align-items: baseline;
  gap: .5rem;
}
.article-content h2 .header-anchor { font-size: .75em; color: var(--text-muted); text-decoration: none; opacity: 0; transition: opacity var(--t); }
.article-content h2:hover .header-anchor { opacity: 1; }

.article-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2rem 0 .75rem;
}
.article-content h3 .header-anchor { font-size: .75em; color: var(--text-muted); text-decoration: none; opacity: 0; transition: opacity var(--t); }
.article-content h3:hover .header-anchor { opacity: 1; }

.article-content h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 1.5rem 0 .5rem;
}

.article-content p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.1rem;
}

.article-content strong { color: var(--text-primary); font-weight: 700; }

.article-content a {
  color: var(--c-indigo);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--t);
}
.article-content a:hover { color: var(--c-indigo-dark); }

.article-content ul,
.article-content ol {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}
.article-content li { margin-bottom: .4rem; line-height: 1.75; }
.article-content li > p { margin-bottom: .4rem; }

.article-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 2.5rem 0;
}

/* Inline code */
.article-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--c-indigo-light);
  color: var(--c-indigo-dark);
  padding: .15em .45em;
  border-radius: 5px;
  font-weight: 500;
}

/* ── Code blocks ────────────────────────────────────────────────────────── */

/* Wrapper injected by JS — carries the border, radius, shadow and margin */
.code-block {
  margin: 1.75rem 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Header bar: language label + copy button */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .75rem .45rem 1rem;
  background: #e2e8f0;
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Copy button — sits inline in the header, no absolute positioning needed */
.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .6rem;
  background: #fff;
  border: 1px solid var(--border-dark);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  box-shadow: var(--shadow-sm);
}
.code-copy-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
.code-copy-btn:hover { background: var(--c-indigo-light); color: var(--c-indigo); border-color: var(--c-indigo); }
.code-copy-btn.copied { background: var(--c-green-light); border-color: var(--c-green); color: #15803d; }

/* The <pre> itself: wrapper handles chrome, pre just holds the code */
.article-content pre,
pre[class*="language-"] {
  background: #f8fafc !important;
  border-radius: 0 !important;
  padding: 1.25rem 1.5rem !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .84rem;
  line-height: 1.8;
  position: static !important;
}

pre[class*="language-"] code {
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: inherit !important;
  color: inherit !important;
}

/* Suppress the old ::before language label — header bar replaces it */
pre[class*="language-"]::before { display: none; }
code[class*="language-"],
pre[class*="language-"]                   { color: #334155; }

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata                              { color: #94a3b8; font-style: italic; }
.token.punctuation                        { color: #64748b; }
.token.namespace                          { color: #64748b; }
.token.property,
.token.tag,
.token.deleted                            { color: #dc2626; }
.token.boolean,
.token.number,
.token.constant,
.token.symbol                             { color: #ea580c; }
.token.selector,
.token.attr-name,
.token.char,
.token.inserted                           { color: #16a34a; }
.token.string                             { color: #16a34a; }
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string                      { color: #0891b2; }
.token.atrule,
.token.attr-value,
.token.keyword                            { color: #7c3aed; font-weight: 600; }
.token.function                           { color: #4f46e5; }
.token.class-name                         { color: #0891b2; }
.token.regex,
.token.important,
.token.variable                           { color: #ea580c; }
.token.builtin                            { color: #16a34a; }

/* Language label is now rendered by JS in .code-header — ::before suppressed above */

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.75rem 0;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.article-content table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--bg-surface);
}
.article-content thead {
  background: linear-gradient(135deg, var(--c-indigo) 0%, var(--c-violet) 100%);
}
.article-content th {
  color: #fff;
  font-weight: 700;
  padding: .85rem 1.1rem;
  text-align: left;
  white-space: nowrap;
  font-size: .85rem;
  letter-spacing: .3px;
}
.article-content td {
  padding: .75rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.article-content tbody tr:last-child td { border-bottom: none; }
.article-content tbody tr:nth-child(even) { background: var(--bg-surface-alt); }
.article-content tbody tr:hover { background: var(--c-indigo-light); }
.article-content td code {
  font-size: .8em;
  background: var(--bg-surface-alt);
  color: var(--c-indigo);
}

/* ── Blockquotes ────────────────────────────────────────────────────────── */
.article-content blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem 1rem 1.5rem;
  border-left: 4px solid var(--c-indigo);
  background: var(--c-indigo-light);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-secondary);
}
.article-content blockquote p { margin-bottom: 0; }

/* ── Task lists (checkboxes) ────────────────────────────────────────────── */
.article-content .task-list-item {
  list-style: none;
  margin-left: -1.5rem;
  display: flex;
  align-items: baseline;
  gap: .6rem;
}
.article-content .task-list-item-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  accent-color: var(--c-indigo);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: .25rem;
}

/* ── Child page cards ───────────────────────────────────────────────────── */
.child-pages {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}
.child-pages-heading {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
.child-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.child-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.child-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--c-indigo);
  text-decoration: none;
}
.child-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-primary);
}
.child-card-arrow { color: var(--c-indigo); flex-shrink: 0; }
.child-card-arrow svg { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOC SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.toc-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 4rem);
  overflow-y: auto;
}
.toc-inner {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
}
.toc-heading {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
#toc-nav a {
  display: block;
  padding: .3rem .6rem;
  border-radius: var(--r-sm);
  font-size: .8rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--t), color var(--t);
  border-left: 2px solid transparent;
  line-height: 1.4;
}
#toc-nav a:hover { background: var(--bg-surface-alt); color: var(--text-primary); text-decoration: none; }
#toc-nav a.toc-active { color: var(--c-indigo); border-left-color: var(--c-indigo); background: var(--c-indigo-light); font-weight: 600; }
#toc-nav .toc-h3 { padding-left: 1.4rem; font-size: .76rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   FAQ ACCORDIONS (injected by JS)
   ═══════════════════════════════════════════════════════════════════════════ */
.faq-section { margin: 2rem 0; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: .6rem;
  overflow: hidden;
  background: var(--bg-surface);
  transition: box-shadow var(--t);
}
.faq-item:hover { box-shadow: var(--shadow-sm); }
.faq-item[open] { box-shadow: var(--shadow-md); border-color: var(--c-indigo); }
.faq-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text-primary);
  list-style: none;
  user-select: none;
  transition: background var(--t);
}
.faq-summary::-webkit-details-marker { display: none; }
.faq-summary:hover { background: var(--bg-surface-alt); }
.faq-item[open] .faq-summary { color: var(--c-indigo); background: var(--c-indigo-light); }
.faq-chevron { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); transition: transform var(--t-slow); }
.faq-item[open] .faq-chevron { transform: rotate(180deg); color: var(--c-indigo); }
.faq-body {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.75;
}
.faq-body p:last-child { margin-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.site-footer {
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: auto;
}
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3rem 2rem 2rem;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  margin-bottom: 2rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}
.footer-section { }
.footer-section-heading {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md);
  color: rgba(255,255,255,.65);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t), color var(--t);
}
.footer-section-heading svg { width: 16px; height: 16px; }
.footer-section-heading:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); text-decoration: none; }
.footer-copy {
  font-size: .8rem;
  color: rgba(255,255,255,.3);
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .sections-grid { grid-template-columns: repeat(2, 1fr); }
  .patterns-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .content-body {
    grid-template-columns: 1fr;
    padding: 1rem 1.5rem 3rem;
  }
  .toc-sidebar { display: none; }

  .hero {
    grid-template-columns: 1fr;
    padding: 3rem 1.5rem 2.5rem;
    text-align: center;
  }
  .hero-visual { display: none; }
  .hero-description { max-width: 100%; }
  .hero-actions { justify-content: center; }
}

@media (max-width: 768px) {
  .site-nav { display: none; }
  .menu-toggle { display: flex; }

  .header-inner { padding: 0 1rem; }
  .logo-text { display: none; }

  .sections-grid { grid-template-columns: 1fr; }
  .patterns-grid { grid-template-columns: 1fr; }

  .breadcrumbs { padding: .75rem 1rem; }
  .content-body { padding: 1rem 1rem 3rem; }

  .intro-inner { padding: 2rem 1rem; }
  .sections-grid-section { padding: 2.5rem 1rem; }
  .patterns-section { padding: 2.5rem 1rem; }

  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-btn { justify-content: center; }
}

@media (max-width: 480px) {
  .site-header { height: 56px; }
  :root { --header-h: 56px; }
  .child-pages-grid { grid-template-columns: 1fr; }
}

