:root { --accent: #2563eb; --text: #0f172a; --muted: #475569; --bg: #f5f7fa; --card: #ffffff; }
* { box-sizing: border-box; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
.learn-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: rgba(245,247,250,0.97); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(0,0,0,0.07); }
.learn-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; color: var(--text); text-decoration: none; }
.learn-logo { display: block; border-radius: 7px; }
.learn-nav { display: inline-flex; align-items: center; gap: 18px; }
.learn-nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.learn-nav .learn-cta { color: #fff; background: var(--accent); padding: 8px 16px; border-radius: 8px; font-weight: 600; }
/* "☰ Guides" opens the mobile drawer; hidden on desktop (sidebar is always visible there). */
.learn-nav-open { display: none; cursor: pointer; font-weight: 600; color: var(--accent); }
.learn-nav-close { display: none; }
.learn-nav-backdrop { display: none; }

/* Shell: guides sidebar + article + (on breakdowns) a right-rail table of contents. */
.learn-shell { display: flex; align-items: flex-start; gap: 32px; max-width: 1340px; margin: 0 auto; }
.learn-sidebar { flex-shrink: 0; width: clamp(265px, 21vw, 300px); padding: 28px 8px 28px 20px; position: sticky; top: 57px; align-self: flex-start; max-height: calc(100vh - 57px); overflow-y: auto; scrollbar-gutter: stable; }
.learn-sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.learn-sidebar-title { margin: 0 0 4px; }
.learn-sidebar-title a { font-weight: 700; color: var(--text); text-decoration: none; }
.learn-nav-group { margin-top: 18px; }
.learn-nav-tier { margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--accent); font-family: ui-monospace, monospace; }
.learn-sidebar ul { list-style: none; margin: 0; padding: 0; }
.learn-sidebar li a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 0.85rem; line-height: 1.35; }
.learn-sidebar li a:hover { background: #eef2f7; color: var(--text); }
/* Active item: emphasize with background + accent color, and a text-shadow
   "faux bold" instead of font-weight so the (wider) bold text can't push a
   borderline title onto a second line — that reflow is what made the sidebar
   overflow (and show a scrollbar) only on long-title pages. */
.learn-sidebar li a.is-active { background: #eff6ff; color: var(--accent); text-shadow: 0.35px 0 0 currentColor; }
.learn-main { flex: 1; min-width: 0; max-width: 800px; padding: 32px 20px 64px; }

/* Right-rail "On this page" table of contents (breakdown pages). */
.learn-toc { flex-shrink: 0; width: 240px; position: sticky; top: 57px; align-self: flex-start; max-height: calc(100vh - 57px); overflow-y: auto; scrollbar-gutter: stable; padding: 32px 4px; }
.learn-toc-title { margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; color: var(--muted); font-family: ui-monospace, monospace; }
.learn-toc ul { list-style: none; margin: 0; padding: 0; }
.learn-toc li a { display: block; padding: 4px 10px; border-left: 2px solid #e2e8f0; color: var(--muted); text-decoration: none; font-size: 0.82rem; line-height: 1.35; }
.learn-toc li a:hover { color: var(--text); }
.learn-toc li a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
/* Nested ### subsections: text is indented, but the border-left rail stays at
   the same x as the parent items so the vertical line reads as one continuous
   bar (indenting the <ul> instead would jog the rail sideways at each level). */
.learn-toc ul.learn-toc-sub { padding-left: 0; }
.learn-toc-sub li a { padding: 3px 10px 3px 24px; font-size: 0.76rem; }
@media (max-width: 1100px) { .learn-toc { display: none; } }

/* Mobile: sidebar becomes a slide-out drawer toggled by #learn-nav-toggle. */
@media (max-width: 860px) {
  .learn-main { max-width: none; margin: 0 auto; }
  .learn-nav-open { display: inline-flex; align-items: center; }
  .learn-nav-pricing { display: none; }
  /* Fixed panel carries the slide transform and is a flex column so the head stays
     pinned while .learn-sidebar-scroll scrolls. Keeping transform and overflow on
     separate elements is what makes the drawer reliably touch-scroll (a transformed
     overflow container won't scroll on iOS Safari). Desktop keeps the <aside>
     itself as the sticky scroller — deliberately not the wrapper — so do NOT add a
     desktop rule to .learn-sidebar-scroll. */
  .learn-sidebar {
    position: fixed; top: 0; left: 0; width: 280px; max-width: 82vw;
    height: 100vh; height: 100dvh; margin: 0; padding: 0; max-height: none; background: var(--bg);
    box-shadow: 2px 0 16px rgba(0,0,0,0.18); z-index: 60;
    transform: translateX(-100%); transition: transform 0.25s ease; overflow: hidden;
    display: flex; flex-direction: column;
  }
  .learn-sidebar-head { flex: 0 0 auto; padding: 20px 18px 10px; }
  .learn-sidebar-scroll { flex: 1; min-height: 0; padding: 0 18px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .learn-nav-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; cursor: pointer; color: var(--muted); font-size: 1.1rem; border-radius: 8px; }
  .learn-nav-close:hover { background: #eef2f7; }
  #learn-nav-toggle:checked ~ .learn-shell .learn-sidebar { transform: translateX(0); }
  #learn-nav-toggle:checked ~ .learn-nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 50; }
}
/* Lock background scroll while the drawer is open (modern browsers). */
body:has(#learn-nav-toggle:checked) { overflow: hidden; }
.learn-article h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin-bottom: 4px; }
.learn-subtitle { margin: 0 0 4px; color: var(--muted); font-size: 1.05rem; font-weight: 500; }
.learn-article h2 { margin-top: 2em; scroll-margin-top: 72px; }
.learn-article h3 { scroll-margin-top: 72px; }
.learn-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.learn-eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75rem; color: var(--accent); font-family: ui-monospace, monospace; }
.learn-updated { margin-left: auto; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
@media (max-width: 520px) { .learn-updated { margin-left: 0; } }
.learn-article table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.learn-article th, .learn-article td { border: 1px solid #e2e8f0; padding: 8px 12px; text-align: left; }
.learn-article details { border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 16px; margin: 1em 0; background: var(--card); }
.learn-article summary { cursor: pointer; font-weight: 600; }
/* Colored solution accordions: <details class="good"> / <details class="bad"> / <details class="warn">. */
.learn-article details.good { border-color: #bbf7d0; background: #f0fdf4; }
.learn-article details.good > summary { color: #047857; }
.learn-article details.bad { border-color: #fecaca; background: #fef2f2; }
.learn-article details.bad > summary { color: #b91c1c; }
.learn-article details.warn { border-color: #fde68a; background: #fffbeb; }
.learn-article details.warn > summary { color: #b45309; }

/* Code blocks (``` fences) and inline `code`. Mermaid <pre> keeps its own style. */
.learn-article pre:not(.mermaid) { background: #f6f8fa; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; margin: 1em 0; overflow-x: auto; line-height: 1.5; }
.learn-article pre:not(.mermaid) code { background: none; padding: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; color: #1f2937; }
.learn-article :not(pre) > code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; color: #be185d; }

/* Inline glossary terms. Authors use:
   <span class="learn-term" tabindex="0" data-tip="Short explanation">Term</span>
   Hover shows the tip; keyboard focus shows it for accessibility. */
.learn-term { position: relative; display: inline-block; border-bottom: 1px dotted var(--accent); color: #1d4ed8; cursor: help; outline: none; }
.learn-term::before,
.learn-term::after { position: absolute; left: 50%; opacity: 0; pointer-events: none; transform: translate(-50%, 6px); transition: opacity 0.14s ease, transform 0.14s ease; }
.learn-term::before { content: ""; bottom: calc(100% + 4px); border: 6px solid transparent; border-top-color: #111827; z-index: 21; }
.learn-term::after {
  content: attr(data-tip);
  bottom: calc(100% + 16px);
  z-index: 20;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 8px 10px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 10px 24px rgba(15,23,42,0.22);
}
.learn-term:hover::before,
.learn-term:hover::after,
.learn-term:focus::before,
.learn-term:focus::after,
.learn-term:focus-visible::before,
.learn-term:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.learn-term:focus-visible { box-shadow: 0 0 0 3px rgba(37,99,235,0.18); border-radius: 3px; }

/* GitHub-style callouts (> [!NOTE] / [!TIP] / [!WARNING] / [!CAUTION] / [!IMPORTANT]). */
.markdown-alert { border-left: 4px solid #cbd5e1; background: #f8fafc; border-radius: 8px; padding: 12px 18px; margin: 1.25em 0; }
.markdown-alert p { margin: 0.4em 0; }
.markdown-alert p:first-child { margin-top: 0; }
.markdown-alert p:last-child { margin-bottom: 0; }
.markdown-alert-title { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.markdown-alert-title svg { fill: currentColor; }
.markdown-alert-note { border-left-color: #3b82f6; background: #eff6ff; }
.markdown-alert-note .markdown-alert-title { color: #1d4ed8; }
.markdown-alert-tip { border-left-color: #10b981; background: #ecfdf5; }
.markdown-alert-tip .markdown-alert-title { color: #047857; }
.markdown-alert-important { border-left-color: #8b5cf6; background: #f5f3ff; }
.markdown-alert-important .markdown-alert-title { color: #6d28d9; }
.markdown-alert-warning { border-left-color: #f97316; background: #fff7ed; }
.markdown-alert-warning .markdown-alert-title { color: #c2410c; }
.markdown-alert-caution { border-left-color: #ef4444; background: #fef2f2; }
.markdown-alert-caution .markdown-alert-title { color: #b91c1c; }
.learn-article pre.mermaid { background: var(--card); border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; text-align: center; cursor: zoom-in; }

/* Click-to-zoom lightbox for diagrams. */
.learn-lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15,23,42,0.8); cursor: zoom-out; }
.learn-lightbox-inner { background: #fff; border-radius: 12px; padding: 24px; width: min(1200px, 94vw); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.learn-lightbox-inner svg { max-width: none !important; width: 100%; height: auto; }
.learn-cta-block { margin-top: 3em; padding: 24px; border-radius: 12px; background: var(--card); border: 1px solid #e2e8f0; text-align: center; }
.learn-cta-button { display: inline-block; margin-top: 8px; padding: 12px 20px; background: var(--accent); color: #fff; border-radius: 10px; text-decoration: none; font-weight: 600; }
/* Hub: compact list of worked-example guides (below the intro). */
.learn-guide-list { list-style: none; padding: 0; margin: 1.25em 0 0; }
.learn-guide-list li { border-top: 1px solid #e2e8f0; }
.learn-guide-list li:last-child { border-bottom: 1px solid #e2e8f0; }
.learn-guide-list a { display: flex; align-items: center; gap: 12px; padding: 13px 6px; text-decoration: none; color: var(--text); }
.learn-guide-list a:hover { color: var(--accent); }
.learn-guide-list .learn-guide-title { font-weight: 600; }
.learn-card-diff { display: inline-block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; }
/* Difficulty colors, matching the Mock Interview badges. */
.learn-card-diff.diff-easy { color: #047857; background: #d1fae5; }
.learn-card-diff.diff-medium { color: #b45309; background: #fef3c7; }
.learn-card-diff.diff-hard { color: #dc2626; background: #fee2e2; }
.learn-nav-tier.diff-easy { color: #047857; }
.learn-nav-tier.diff-medium { color: #b45309; }
.learn-nav-tier.diff-hard { color: #dc2626; }
.learn-footer { max-width: 820px; margin: 0 auto; padding: 24px 20px; color: var(--muted); font-size: 0.85rem; }
.learn-footer a { color: var(--muted); }
