/* Shared global stylesheet for VB2026 lessons */
:root {
    --navy: #0d1b2a;
    --royal: #1a3a6b;
    --blue: #1e5fa8;
    --accent: #4fc3f7;
    --gold: #f0b429;
    --white: #f5f7fa;
    --muted: #8aa0bb;
    --surface: #132236;
    --surface2: #1a2f47;
    --border: rgba(79,195,247,0.18);
    --glow: 0 0 32px rgba(79,195,247,0.15);
    --text: #d6e4f0;
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }

  body {
    font-family: 'Outfit', sans-serif;
    background: var(--navy);
    color: var(--white);
    line-height: 1.75;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(ellipse 70% 50% at 80% 10%, rgba(30,95,168,0.2) 0%, transparent 60%),
      radial-gradient(ellipse 50% 40% at 10% 80%, rgba(79,195,247,0.10) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
  }

  /* ── Nav ── */
  nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13,27,42,0.93);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
  }

  .nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 56px;
    flex-wrap: wrap;
  }

  .nav-brand {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
  }

  nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
  }
  nav a:hover, nav a.active { color: var(--accent); }

  /* ── Page Layout ── */
  .page-layout {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  /* ── Sidebar ── */
  .sidebar {
    width: 224px;
    flex-shrink: 0;
    padding: 2rem 0 4rem 2rem;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    border-right: 1px solid var(--border);
  }

  .sidebar::-webkit-scrollbar { width: 4px; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

  .sidebar h5 {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.6rem;
    margin-top: 1.4rem;
    padding-left: 0.5rem;
  }

  .sidebar a {
    display: block;
    padding: 0.32rem 0.5rem;
    font-size: 0.82rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar a:hover { background: rgba(79,195,247,0.08); color: var(--accent); }
  .sidebar a.active {
    background: rgba(79,195,247,0.12);
    color: var(--accent);
    font-weight: 600;
    border-left: 2px solid var(--accent);
  }

  /* ── Main Content ── */
  .main-content {
    flex: 1;
    min-width: 0;
    padding: 3rem 2.5rem 5rem;
  }

  /* ── Lesson Header ── */
  .lesson-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(79,195,247,0.12);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 0.3rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1rem;
  }

  h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1.15;
    margin-bottom: 0.8rem;
  }

  h1 span { color: var(--accent); }

  .lesson-tagline {
    color: var(--muted);
    font-size: 1rem;
    margin-bottom: 2rem;
    max-width: 620px;
  }

  /* ── Lesson Nav Buttons ── */
  .lesson-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.3rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
  }

  .btn-outline {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
  }
  .btn-outline:hover { color: var(--accent); border-color: var(--accent); }

  .btn-primary {
    background: var(--accent);
    color: var(--navy);
  }
  .btn-primary:hover { background: #81d4fa; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,195,247,0.3); }

  /* ── Key Takeaway Box ── */
  .takeaway {
    background: rgba(79,195,247,0.07);
    border: 1px solid rgba(79,195,247,0.25);
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    padding: 1.1rem 1.4rem;
    margin-bottom: 2.5rem;
    font-size: 0.93rem;
    color: var(--text);
  }

  .takeaway strong { color: var(--accent); }

  /* ── Section Headings ── */
  h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.6rem;
    margin: 2.8rem 0 0.9rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    color: var(--white);
  }

  h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.8rem 0 0.6rem;
    color: var(--white);
  }

  h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 1.4rem 0 0.4rem;
    color: var(--accent);
  }

  p {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 0.95rem;
  }

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

  ul, ol {
    color: var(--text);
    font-size: 0.93rem;
    padding-left: 1.4rem;
    margin-bottom: 1rem;
  }

  li { margin-bottom: 0.4rem; }
  li strong { color: var(--white); }

  /* ── Figures / Images ── */
  .figure {
    margin: 1.6rem 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
    line-height: 0; /* eliminates inline baseline gap under image */
  }

  .figure img {
    width: 100%;
    max-width: 100%;
    display: block;
    height: auto;
    object-fit: contain;
    vertical-align: bottom; /* belt-and-suspenders fix for baseline gap */
    border-radius: 0; /* let the parent handle rounding */
  }

  .figure figcaption {
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    line-height: 1.5; /* restore normal line-height inside caption */
    color: var(--muted);
    border-top: 1px solid var(--border);
    font-style: italic;
    text-align: center;
    background: var(--surface);
  }

  .figure figcaption {
    padding: 0.7rem 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    font-style: italic;
    text-align: center;
  }

  /* ── Callout boxes ── */
  .callout {
    border-radius: 10px;
    padding: 1.1rem 1.4rem;
    margin: 1.5rem 0;
    font-size: 0.9rem;
  }

  .callout-tip {
    background: rgba(40,200,64,0.07);
    border: 1px solid rgba(40,200,64,0.25);
    border-left: 3px solid #28c840;
  }

  .callout-info {
    background: rgba(79,195,247,0.07);
    border: 1px solid rgba(79,195,247,0.22);
    border-left: 3px solid var(--accent);
  }

  .callout-warning {
    background: rgba(240,180,41,0.07);
    border: 1px solid rgba(240,180,41,0.25);
    border-left: 3px solid var(--gold);
  }

  .callout-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 0.35rem;
  }

  .callout-tip .callout-label { color: #28c840; }
  .callout-info .callout-label { color: var(--accent); }
  .callout-warning .callout-label { color: var(--gold); }

  .callout p { margin: 0; color: var(--text); }

  /* ── Code Blocks ── */
  .code-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: var(--glow);
  }

  .code-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.1rem;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
  }

  .dot { width: 10px; height: 10px; border-radius: 50%; }
  .dot-r { background: #ff5f57; }
  .dot-y { background: #febc2e; }
  .dot-g { background: #28c840; }

  .code-lang {
    font-family: 'DM Mono', monospace;
    font-size: 0.73rem;
    color: var(--muted);
    margin-left: auto;
    background: rgba(79,195,247,0.1);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.55rem;
  }

  pre {
    padding: 1.4rem 1.6rem;
    overflow-x: auto;
    font-family: 'DM Mono', monospace;
    font-size: 0.84rem;
    line-height: 1.75;
    color: #cdd6f4;
  }

  code {
    font-family: 'DM Mono', monospace;
    font-size: 0.83em;
    background: rgba(79,195,247,0.1);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    color: var(--accent);
  }

  /* syntax colors */
  .kw { color: #89b4fa; }
  .fn { color: #94e2d5; }
  .st { color: #a6e3a1; }
  .cm { color: #585b70; font-style: italic; }
  .ty { color: #f9e2af; }
  .nm { color: #cba6f7; }
  .nu { color: #fab387; }

  /* ── IDE Component Table ── */
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 1.2rem 0;
  }

  th {
    background: var(--surface2);
    color: var(--accent);
    text-align: left;
    padding: 0.7rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
  }

  td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
    vertical-align: top;
  }

  tr:hover td { background: rgba(79,195,247,0.03); }

  td:first-child { font-family: 'DM Mono', monospace; font-size: 0.82rem; color: var(--white); white-space: nowrap; }

  /* ── Step Cards ── */
  .steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .step {
    display: flex;
    gap: 1.2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    align-items: flex-start;
  }

  .step-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(79,195,247,0.15);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 0.1rem;
  }

  .step-body h4 { margin: 0 0 0.3rem; color: var(--white); font-size: 0.93rem; }
  .step-body p { margin: 0; font-size: 0.87rem; color: var(--muted); }

  /* ── AI Feature Grid ── */
  .ai-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.2rem 0;
  }

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

  .ai-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
  }

  .ai-item h4 { margin: 0 0 0.3rem; color: var(--white); font-size: 0.88rem; }
  .ai-item p { margin: 0; font-size: 0.82rem; color: var(--muted); }

  /* ── Summary Box ── */
  .summary-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    margin: 3rem 0 2rem;
  }

  .summary-box h3 {
    margin-top: 0;
    font-family: 'DM Serif Display', serif;
    font-size: 1.3rem;
    margin-bottom: 1rem;
  }

  .summary-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .summary-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-size: 0.9rem;
    color: var(--text);
    margin: 0;
  }

  .summary-list li::before {
    content: '✓';
    color: #28c840;
    font-weight: 700;
    font-size: 0.85rem;
    margin-top: 0.05rem;
    flex-shrink: 0;
  }

  /* ── Next Lesson CTA ── */
  .next-cta {
    background: linear-gradient(135deg, var(--royal) 0%, var(--blue) 100%);
    border: 1px solid rgba(79,195,247,0.28);
    border-radius: 16px;
    padding: 2rem 2.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
  }

  .next-cta h3 { font-family: 'DM Serif Display', serif; font-size: 1.3rem; margin: 0 0 0.3rem; }
  .next-cta p { color: rgba(255,255,255,0.72); margin: 0; font-size: 0.88rem; }

  /* ── Related Resources ── */
  .resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .resource-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    text-decoration: none;
    transition: all 0.2s;
  }

  .resource-card:hover { border-color: var(--accent); transform: translateY(-2px); }
  .resource-card h4 { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--white); }
  .resource-card p { font-size: 0.78rem; color: var(--muted); margin: 0; }

  /* ── Books ── */
  .books-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
  }

  .book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.4rem;
    display: flex;
    gap: 1.2rem;
    flex: 1;
    min-width: 260px;
  }

  .book-card img {
    width: 80px;
    height: 112px;
    border-radius: 5px;
    flex-shrink: 0;
    object-fit: cover;
    object-position: center top;
    align-self: flex-start;
  }
  .book-info h4 { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.2rem; color: var(--white); }
  .book-info .author { font-size: 0.76rem; color: var(--muted); margin-bottom: 0.5rem; }
  .book-info a { font-size: 0.8rem; font-weight: 600; color: var(--accent); text-decoration: none; }

  /* ── Divider ── */
  hr.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem 0;
  }

  /* ── Footer ── */
  footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
  }
  footer a { color: var(--accent); text-decoration: none; }

  /* ── Hamburger button ── */
  .sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(79,195,247,0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
    transition: background 0.2s;
  }
  .sidebar-toggle:hover { background: rgba(79,195,247,0.2); }
  .sidebar-toggle svg { display: block; }

  /* ── Overlay ── */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
  }
  .sidebar-overlay.active { display: block; }

  /* ── Sidebar close button ── */
  .sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(79,195,247,0.1);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    margin-left: auto;
    margin-bottom: 1rem;
    transition: background 0.2s;
  }
  .sidebar-close:hover { background: rgba(79,195,247,0.22); }
  .sidebar-close svg { display: block; }

  @media (max-width: 768px) {
    .main-content { padding: 2rem 1.2rem 4rem; }
    .next-cta { flex-direction: column; }

    .sidebar-toggle { display: flex; }
    .sidebar-close   { display: flex; }

    /* Reset stacking context so sidebar isn't trapped behind overlay */
    .page-layout { position: static; z-index: auto; }

    .sidebar {
      position: fixed !important;
      top: 0 !important;
      left: 0 !important;
      width: 280px !important;
      height: 100dvh !important;
      padding: 1rem 0.75rem 2rem 1rem !important;
      background: #0d1b2a !important;
      border-right: 1px solid rgba(79,195,247,0.18) !important;
      z-index: 200 !important;
      overflow-y: auto !important;
      transform: translateX(-100%);
      transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
      will-change: transform;
    }

    .sidebar.open {
      transform: translateX(0);
      box-shadow: 4px 0 32px rgba(0,0,0,0.5);
    }

    /* Larger, readable, tappable links */
    .sidebar a {
      white-space: normal !important;
      overflow: visible !important;
      text-overflow: unset !important;
      font-size: 0.92rem !important;
      padding: 0.6rem 0.5rem !important;
      color: #8aa0bb !important;
      line-height: 1.4 !important;
    }
    .sidebar a:hover, .sidebar a:active {
      background: rgba(79,195,247,0.12) !important;
      color: #4fc3f7 !important;
    }
    .sidebar h5 {
      font-size: 0.72rem !important;
      margin-top: 1rem !important;
    }
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .main-content { animation: fadeUp 0.5s ease both; }

/* ===== Shared promo + cross-links ===== */
.book-promo {
  display:flex;
  gap:16px;
  align-items:center;
  background: linear-gradient(135deg, rgba(26,58,107,.95), rgba(13,27,42,.98));
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
  margin: 1.25rem 0 1.75rem;
  box-shadow: var(--glow);
}
.book-promo img { width: 92px; border-radius: 10px; flex:0 0 auto; }
.book-promo h3 { margin:0 0 .35rem; font-size:1.05rem; }
.book-promo p { margin:0 0 .55rem; color:var(--text); }
.book-promo .promo-badge {
  display:inline-block;
  font-size:.74rem;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:#08111b;
  background:linear-gradient(90deg,#ffd166,#f0b429);
  padding:.28rem .55rem;
  border-radius:999px;
  font-weight:700;
  margin-bottom:.55rem;
}
.book-promo .promo-actions { display:flex; gap:.75rem; flex-wrap:wrap; }
.book-promo .promo-btn,
.lesson-crosslinks a,
.sticky-book-cta {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.35rem;
  border-radius:999px;
  padding:.72rem 1rem;
  font-weight:700;
  text-decoration:none;
}
.book-promo .promo-btn.primary,
.sticky-book-cta {
  background:linear-gradient(90deg,#f0b429,#ffd166);
  color:#08111b;
}
.book-promo .promo-btn.secondary,
.lesson-crosslinks a {
  border:1px solid var(--border);
  color:var(--white);
  background:rgba(255,255,255,.04);
}
.lesson-crosslinks {
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
  margin: 2rem 0 0;
}
.lesson-crosslinks a span { display:block; }
.lesson-crosslinks .label { font-size:.72rem; opacity:.8; text-transform:uppercase; letter-spacing:.05em; }
.lesson-crosslinks .title { font-size:.95rem; margin-top:.2rem; }
.lesson-crosslinks .disabled { opacity:.45; pointer-events:none; }
.sticky-book-cta {
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:120;
  box-shadow: 0 14px 38px rgba(0,0,0,.32);
}
@media (max-width: 768px) {
  .book-promo { flex-direction:column; text-align:center; }
  .book-promo .promo-actions { justify-content:center; }
  .lesson-crosslinks { grid-template-columns:1fr; }
  .sticky-book-cta {
    left:12px; right:12px; bottom:12px; width:auto;
    padding:.85rem 1rem;
  }
}
