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

:root {
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --navy: #131c31;
  --navy-light: #1b2b4a;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --green-50: #f0fdf4;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --amber-500: #f59e0b;
  --teal-50: #f0fdfa;
  --teal-600: #0d9488;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --max-width: 1120px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --shadow-glow: 0 6px 24px rgba(79,70,229,.3);
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--gray-800);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── NAV (dark, like Maya) ─── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .nav {
    background: rgba(19,28,49,.97);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-logo span { color: var(--primary-500); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: color .2s;
  padding: 8px 0;
}
.nav-links a:hover { color: var(--white); }
.nav-links a.active { color: var(--white); }
.nav-cta {
  background: var(--primary-600);
  color: var(--white) !important;
  padding: 8px 20px !important;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}
.nav-cta:hover {
  background: var(--primary-500);
  box-shadow: 0 4px 16px rgba(79,70,229,.4);
  transform: translateY(-1px);
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--white);
}
.nav-toggle svg { display: block; stroke: var(--white); }

/* ─── SHARED ─── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ─── BREADCRUMB (on dark header) ─── */
.breadcrumb { padding: 24px 0 16px; font-size: 13px; color: rgba(255,255,255,.5); }
.breadcrumb a { color: rgba(255,255,255,.5); text-decoration: none; transition: color .2s; }
.breadcrumb a:hover { color: rgba(255,255,255,.85); }
.breadcrumb span { margin: 0 8px; color: rgba(255,255,255,.25); }

/* ─── ARTICLE HEADER (dark hero, Maya-inspired) ─── */
.article-header {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 50%, #1a2744 100%);
  margin: -24px -24px 0 -24px;
  padding: 48px 24px 56px;
  border-bottom: none;
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
}
.article-header::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.12) 0%, transparent 70%);
  pointer-events: none;
}
.article-header::after {
  content: '';
  position: absolute;
  bottom: -30%; left: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,.08) 0%, transparent 70%);
  pointer-events: none;
}
.article-category {
  display: inline-block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--primary-500); margin-bottom: 16px;
  background: rgba(99,102,241,.12);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid rgba(99,102,241,.2);
}
.article-header h1 {
  font-family: var(--font-heading);
  font-size: 40px; font-weight: 700; line-height: 1.15;
  color: var(--white); letter-spacing: -0.03em;
  margin-bottom: 24px; max-width: 720px;
  position: relative;
}
.article-meta {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; font-size: 14px; color: rgba(255,255,255,.5);
  position: relative;
}
.article-meta-item { display: flex; align-items: center; gap: 6px; }
.article-meta-item svg { stroke: rgba(255,255,255,.4); }

/* Full-bleed header trick */
main.container > .breadcrumb,
main.container > .article-header {
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  padding-left: calc(50vw - 50%);
  padding-right: calc(50vw - 50%);
}
main.container > .breadcrumb {
  background: var(--navy);
  margin-bottom: 0;
  padding-bottom: 0;
  padding-top: 16px;
}
main.container > .article-header {
  margin-top: 0;
}

/* ─── ARTICLE LAYOUT ─── */
.article-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px;
  gap: 64px; padding-bottom: 64px;
}

/* ─── ARTICLE CONTENT ─── */
.article-content h2 {
  font-family: var(--font-heading);
  font-size: 26px; font-weight: 700; color: var(--gray-900);
  letter-spacing: -0.02em; margin: 56px 0 18px; padding-top: 8px;
  position: relative;
}
.article-content h2::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 40px; height: 3px;
  background: linear-gradient(90deg, var(--primary-600), var(--primary-500));
  border-radius: 2px;
}
.article-content h2:first-child { margin-top: 0; }
.article-content h3 {
  font-family: var(--font-heading);
  font-size: 18px; font-weight: 600; color: var(--gray-900);
  margin: 36px 0 12px;
}
.article-content p {
  font-size: 16px; color: var(--gray-700);
  line-height: 1.8; margin-bottom: 20px;
}
.article-content ul, .article-content ol {
  margin: 0 0 24px 20px; font-size: 16px;
  color: var(--gray-700); line-height: 1.8;
}
.article-content li { margin-bottom: 10px; }
.article-content strong { color: var(--gray-900); font-weight: 600; }
.article-content a {
  color: var(--primary-600); text-decoration: underline;
  text-decoration-color: rgba(79,70,229,.3);
  text-underline-offset: 3px; transition: all .2s;
}
.article-content a:hover {
  text-decoration-color: var(--primary-600);
  color: var(--primary-700);
}

/* ─── CODE BLOCKS ─── */
.code-block {
  background: var(--navy); border-radius: 12px; margin: 28px 0;
  overflow: hidden; box-shadow: var(--shadow-md);
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.code-block-lang {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,.5);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.code-block pre {
  padding: 16px 20px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px;
  line-height: 1.7; color: rgba(255,255,255,.85);
}
.code-block .kw { color: #c084fc; }
.code-block .fn { color: #67e8f9; }
.code-block .str { color: #86efac; }
.code-block .cm { color: rgba(255,255,255,.35); }
.code-block .num { color: #fbbf24; }

/* ─── CALLOUT ─── */
.callout {
  padding: 20px 24px; border-radius: 12px; margin: 28px 0;
  font-size: 15px; line-height: 1.65; box-shadow: var(--shadow-sm);
}
.callout-title { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.callout-info { background: var(--primary-50); border: 1px solid rgba(99,102,241,.15); color: var(--gray-700); }
.callout-info .callout-title { color: var(--primary-600); }
.callout-tip { background: var(--green-50); border: 1px solid rgba(34,197,94,.15); color: var(--gray-700); }
.callout-tip .callout-title { color: var(--green-600); }
.callout-warning { background: #fffbeb; border: 1px solid rgba(245,158,11,.15); color: var(--gray-700); }
.callout-warning .callout-title { color: #d97706; }

/* ─── TABLE (polished) ─── */
.article-table, .article-content table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  margin: 28px 0; font-size: 14px;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.article-table th, .article-content table th {
  text-align: left; padding: 14px 18px;
  background: var(--navy);
  font-weight: 600; color: var(--white);
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: none;
}
.article-table td, .article-content table td {
  padding: 14px 18px; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700); line-height: 1.5;
}
.article-table tr:last-child td, .article-content table tr:last-child td { border-bottom: none; }
.article-table tbody tr:hover td, .article-content table tbody tr:hover td {
  background: var(--primary-50);
}

/* ─── SIDEBAR (glass effect) ─── */
.sidebar { position: sticky; top: 88px; }
.toc {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 16px; padding: 24px;
  box-shadow: var(--shadow-sm);
}
.toc-title {
  font-family: var(--font-heading);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 16px;
}
.toc-list { list-style: none; }
.toc-list a {
  display: block; padding: 7px 0; font-size: 13px; font-weight: 500;
  color: var(--gray-500); text-decoration: none; transition: all .2s;
  border-left: 2px solid transparent; padding-left: 14px; margin-left: -1px;
}
.toc-list a:hover {
  color: var(--primary-600); border-left-color: var(--primary-500);
  padding-left: 18px;
}
.toc-list a.active {
  color: var(--primary-600); border-left-color: var(--primary-600);
  font-weight: 600;
}
.sidebar-cta {
  margin-top: 24px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: 16px; padding: 28px; text-align: center;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.sidebar-cta::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(99,102,241,.15) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar-cta h3 {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 700; color: var(--white);
  margin-bottom: 8px; position: relative;
}
.sidebar-cta p {
  font-size: 13px; color: rgba(255,255,255,.55);
  line-height: 1.5; margin-bottom: 16px; position: relative;
}
.sidebar-cta .btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  border: none; border-radius: 8px; cursor: pointer; text-decoration: none;
  background: var(--primary-600); color: var(--white);
  padding: 12px 24px; transition: all .2s;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
  position: relative;
}
.sidebar-cta .btn-primary:hover {
  background: var(--primary-500);
  box-shadow: 0 6px 20px rgba(79,70,229,.45);
  transform: translateY(-1px);
}

/* ─── FAQ ─── */
.faq-section { margin: 48px 0; }
.faq-section h2 { margin-bottom: 24px; }
.faq-item { border-bottom: 1px solid var(--gray-200); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 500; color: var(--gray-800);
  transition: color .2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--primary-600); }
.faq-chevron { transition: transform .2s; color: var(--gray-400); flex-shrink: 0; margin-left: 16px; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); color: var(--primary-600); }
.faq-answer { padding-bottom: 18px; font-size: 15px; color: var(--gray-500); line-height: 1.65; }

/* ─── CTA BANNER (glowing, Maya-style) ─── */
.cta-banner {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 50%, #1a2744 100%);
  border-radius: 20px; padding: 56px 48px; text-align: center;
  margin: 56px 0 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.06);
}
.cta-banner::before {
  content: '';
  position: absolute;
  top: -40%; right: -20%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,.15) 0%, transparent 60%);
  pointer-events: none;
}
.cta-banner::after {
  content: '';
  position: absolute;
  bottom: -30%; left: -15%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,.1) 0%, transparent 60%);
  pointer-events: none;
}
.cta-banner h2 {
  font-family: var(--font-heading);
  font-size: 30px; font-weight: 700; color: var(--white);
  margin-bottom: 14px; letter-spacing: -0.02em;
  position: relative;
}
.cta-banner p {
  font-size: 16px; color: rgba(255,255,255,.55); margin-bottom: 28px;
  max-width: 480px; margin-left: auto; margin-right: auto;
  line-height: 1.6; position: relative;
}
.cta-banner .btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 600; font-size: 16px;
  border: none; border-radius: 10px; cursor: pointer; text-decoration: none;
  background: var(--primary-600); color: var(--white);
  padding: 16px 36px; transition: all .25s;
  box-shadow: 0 6px 24px rgba(79,70,229,.35);
  position: relative;
}
.cta-banner .btn-primary:hover {
  background: var(--primary-500);
  box-shadow: 0 8px 32px rgba(79,70,229,.5);
  transform: translateY(-2px);
}

/* ─── INSTRUCTOR CARD (enhanced) ─── */
.article-content .instructor-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 28px;
  align-items: center;
  padding: 32px;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  margin: 56px 0;
  box-shadow: var(--shadow-md);
  transition: box-shadow .3s;
}
.article-content .instructor-card:hover {
  box-shadow: var(--shadow-lg);
}
.article-content .instructor-card .instructor-photo-wrap {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  position: relative;
}
.article-content .instructor-card .instructor-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--gray-200);
  border: 3px solid var(--white);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.article-content .instructor-card .instructor-fallback {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-600);
  border: 3px solid var(--white);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.article-content .instructor-card .instructor-photo-wrap.fallback .instructor-photo { display: none; }
.article-content .instructor-card .instructor-photo-wrap.fallback .instructor-fallback { display: flex; }
.article-content .instructor-card .instructor-info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-600);
  margin-bottom: 4px;
}
.article-content .instructor-card h3.instructor-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px 0;
  line-height: 1.3;
}
.article-content .instructor-card p.instructor-title {
  font-size: 14px;
  color: var(--gray-600);
  font-weight: 500;
  margin-bottom: 10px;
  line-height: 1.4;
}
.article-content .instructor-card p.instructor-bio {
  font-size: 14px;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 14px;
}
.article-content .instructor-card .instructor-creds {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.article-content .instructor-card .cred {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--white);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: all .2s;
}
.article-content .instructor-card .cred:hover {
  border-color: var(--primary-500);
  box-shadow: 0 2px 8px rgba(79,70,229,.12);
}
.article-content .instructor-card .cred-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-500);
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .article-content .instructor-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    padding: 24px;
  }
  .article-content .instructor-card .instructor-creds { justify-content: center; }
}

/* ─── FOOTER (dark, Maya-style) ─── */
.footer {
  background: var(--navy);
  padding: 40px 0;
  border-top: none;
  margin-top: 0;
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-copy { font-size: 13px; color: rgba(255,255,255,.45); }
.footer-links { display: flex; gap: 24px; list-style: none; }
.footer-links a {
  font-size: 13px; color: rgba(255,255,255,.45); text-decoration: none;
  transition: color .2s; padding: 8px 0;
}
.footer-links a:hover { color: var(--white); }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; position: absolute;
    top: 64px; left: 0; right: 0; background: var(--navy);
    border-bottom: 1px solid rgba(255,255,255,.08); padding: 16px 24px;
    gap: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  }
  .nav-links.open a { display: flex; align-items: center; padding: 12px 8px; min-height: 44px; color: rgba(255,255,255,.7); }
  .nav-toggle { display: flex; }
  .article-header h1 { font-size: 28px; }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .article-table, .article-content table { display: block; overflow-x: auto; }
  .sidebar { position: static; order: -1; }
  .toc { display: none; }
  .sidebar-cta { margin-top: 0; }
  .cta-banner { padding: 36px 24px; border-radius: 16px; }
  .cta-banner h2 { font-size: 22px; }
  .code-block pre { font-size: 12px; }
  main.container > .breadcrumb,
  main.container > .article-header {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}