/* Design Tokens */
:root,
[data-theme="dark"] {
  /* Canvas & Surfaces (Obsidian Slate / Titanium Dark) */
  --canvas: #0b0c0e;
  --surface-soft: #14171f;
  --surface-card: #161922;
  --surface-elevated: #1e2330;
  --surface-hover: #252b3b;

  /* Aliases for app components */
  --bg-primary: var(--canvas);
  --bg-secondary: var(--surface-soft);
  --bg-tertiary: var(--surface-card);
  --surface: var(--surface-card);
  --surface-hover: var(--surface-hover);

  /* Hairlines & Borders */
  --hairline: #242936;
  --hairline-strong: #383f52;
  --border: var(--hairline);
  --border-color: var(--hairline);
  --border-strong: var(--hairline-strong);

  /* Typography Colors (High Contrast WCAG AAA) */
  --primary: #ffffff;
  --ink: #ffffff;
  --on-dark: #ffffff;
  --text-primary: #ffffff;
  --text-body: #f4f4f5;
  --text-secondary: #e4e4e7;
  --text-body-strong: #ffffff;
  --text-muted: #a1a1aa;
  --text-muted-soft: #71717a;

  /* Semantics & Accent */
  --link: #c3d9f3;
  --accent-ice: #c3d9f3;
  --warning: #f59e0b;
  --success: #10b981;

  /* Interactive Elements */
  --btn-bg: transparent;
  --btn-border: #383f52;
  --btn-text: #ffffff;
  --btn-hover-bg: #ffffff;
  --btn-hover-text: #000000;
  --active-sidebar-bg: #1e2330;
  --active-sidebar-bar: #ffffff;
  --active-text: #ffffff;

  /* Typography */
  --font-display: "Saira Condensed", "Instrument Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Newsreader", "Cormorant Garamond", Georgia, serif;
  --font-sans: "Instrument Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --font-body: var(--font-serif);

  /* Letter Spacing Tokens (Engineered Precision) */
  --tracking-wordmark: 6px;
  --tracking-display: 3px;
  --tracking-headline: 2px;
  --tracking-mono: 2px;
  --tracking-btn: 2.5px;
  --tracking-body: 0px;

  /* Radius System */
  --radius-none: 0px;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-pill: 9999px;
  --radius-full: 9999px;

  /* Spacing Scale (4px base) */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-xxl: 64px;
  --space-section: 120px;

  /* Layout Tokens */
  --sidebar-width: 290px;

  /* Motion Curves */
  --ease-editorial: cubic-bezier(0.16, 1, 0.3, 1);
  --speed-fast: 0.15s;
  --speed-normal: 0.25s;
}

/* Light Theme */
[data-theme="light"] {
  /* Canvas & Surfaces (Editorial White Paper) */
  --canvas: #ffffff;
  --surface-soft: #f8f8f8;
  --surface-card: #ffffff;
  --surface-elevated: #f0f0f0;
  --surface-hover: #f3f3f3;

  /* Aliases for app components */
  --bg-primary: var(--canvas);
  --bg-secondary: var(--surface-soft);
  --bg-tertiary: var(--surface-card);
  --surface: var(--surface-card);
  --surface-hover: var(--surface-hover);

  /* Hairlines & Borders */
  --hairline: #e4e4e7;
  --hairline-strong: #71717a;
  --border: var(--hairline);
  --border-color: var(--hairline);
  --border-strong: var(--hairline-strong);

  /* Typography Colors (Deep Obsidian Ink - WCAG AAA High Contrast) */
  --primary: #09090b;
  --ink: #09090b;
  --on-dark: #09090b;
  --text-primary: #09090b;
  --text-body: #27272a;
  --text-secondary: #3f3f46;
  --text-body-strong: #09090b;
  --text-muted: #52525b;
  --text-muted-soft: #71717a;

  /* Semantics & Accent */
  --link: #1d4ed8;
  --accent-ice: #2563eb;
  --warning: #d97706;
  --success: #16a34a;

  /* Interactive Elements */
  --btn-bg: transparent;
  --btn-border: #18181b;
  --btn-text: #09090b;
  --btn-hover-bg: #09090b;
  --btn-hover-text: #ffffff;
  --active-sidebar-bg: #f0f0f0;
  --active-sidebar-bar: #09090b;
  --active-text: #09090b;
}

/* Smooth Theme Transitions */
html, body, #blog-app, .blog-sidebar, .blog-main, .global-course-card, .editorial-article, table, pre, code, .tag-card, .devtools-mockup {
  transition: background-color 0.25s var(--ease-editorial), color 0.25s var(--ease-editorial), border-color 0.25s var(--ease-editorial);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Custom Sleek Luxury Ultra-Thin Scrollbar System */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--canvas);
}

::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: var(--radius-pill);
  transition: background var(--speed-fast) ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted-soft);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}

/* SVG Icon Helper Styles */
.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform var(--speed-fast) ease;
}

/* App Main Layout Grid */
#blog-app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--canvas);
}

/* Left Sidebar Navigation Tree (Used ONLY in Course Reader View) */
.blog-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--canvas);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  transition: margin-left var(--speed-normal) var(--ease-editorial);
}

.blog-sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

/* Sidebar Header: clean editorial strip */
.sidebar-header {
  padding: 1rem 1rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
  gap: 0.5rem;
}

/* Sleek Brand Link in Sidebar Header */
.sidebar-brand-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25rem 0;
  transition: opacity var(--speed-fast) ease;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-btn:hover {
  opacity: 0.7;
}

.sidebar-title-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 1px;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Icon-only floating theme toggle: fixed top-right of viewport */
.theme-toggle-icon-btn {
  position: fixed;
  top: 0.85rem;
  right: 1rem;
  z-index: 9999;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--hairline-strong);
  background: var(--surface-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--speed-fast) ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22);
  pointer-events: all;
}

.theme-toggle-icon-btn:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  transform: scale(1.1);
}

.theme-toggle-icon-btn .svg-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}


.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--speed-fast) ease;
}

.icon-btn:hover {
  background: var(--surface-card);
  border-color: var(--hairline);
  color: var(--text-primary);
}

/* Index Category Navigation */
.index-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem;
}

.sidebar-course-meta {
  padding: 0.25rem 0.35rem 0.25rem;
}

.course-meta-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  color: var(--text-muted);
  font-weight: 400;
}

.course-meta-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-top: 0.25rem;
  line-height: 1.25;
}

.sidebar-divider {
  height: 1px;
  background: var(--hairline);
  margin: 0.75rem 0.25rem;
}

.cat-group {
  margin-bottom: 0.5rem;
}

/* Clean Accordion Header */
.cat-header-btn {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 0.65rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: all var(--speed-fast) ease;
}

.cat-header-btn:hover {
  background: var(--surface-soft);
}

.cat-header-info {
  display: flex;
  flex-direction: column;
}

.cat-module-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  line-height: 1.35;
}

.cat-header-btn .arrow-icon {
  color: var(--text-muted);
  transition: transform var(--speed-fast) ease;
}

.cat-group.open .cat-header-btn .arrow-icon .svg-icon {
  transform: rotate(180deg);
}

.article-list {
  display: none;
  padding: 0.35rem 0 0.35rem 0.25rem;
}

.cat-group.open .article-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-section-group {
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
}

.sidebar-section-heading {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  padding: 0.35rem 0.5rem 0.2rem;
  border-bottom: 1px dashed var(--hairline);
  margin-bottom: 0.25rem;
}

.article-list-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.article-nav-btn {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-body);
  cursor: pointer;
  text-align: left;
  transition: all var(--speed-fast) ease;
  line-height: 1.4;
}

.article-nav-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.article-nav-btn.active {
  background: var(--active-sidebar-bg);
  color: var(--active-text);
  border-left: 2px solid var(--active-sidebar-bar);
  padding-left: calc(0.75rem - 2px);
  font-weight: 500;
}

/* Main Content Column */
.blog-main {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  overflow: hidden;
  position: relative;
}

/* Reader Top Navigation Bar (Header Strip Above Article, 0% Content Overlap) */
.reader-top-navbar {
  position: relative;
  height: 48px;
  min-height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1.25rem;
  background: var(--canvas);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  flex-shrink: 0;
  box-sizing: border-box;
}

#blog-app:not(.in-course) .reader-top-navbar {
  display: none !important;
}

.reader-navbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.reader-nav-toggle-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-soft, #0d0d0d);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--speed-fast) ease;
  flex-shrink: 0 !important;
  white-space: nowrap;
}

.reader-nav-toggle-btn:hover {
  border-color: var(--text-primary);
  background: var(--hairline);
}

/* On responsive viewports (<= 860px): Collapse Mục lục text to icon only */
@media (max-width: 860px) {
  .reader-nav-toggle-btn .nav-toggle-label {
    display: none !important;
  }

  .reader-nav-toggle-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: var(--radius-pill) !important;
  }
}

/* On desktop (> 768px): Hide open button ONLY when sidebar is already visibly open */
@media (min-width: 769px) {
  #blog-app:not(.sidebar-collapsed) #sidebar-open-btn {
    display: none !important;
  }

  #blog-app.sidebar-collapsed #sidebar-open-btn {
    display: inline-flex !important;
  }
}

/* On tablet & mobile (<= 768px): Menu button MUST ALWAYS be visible and reachable */
@media (max-width: 768px) {
  #sidebar-open-btn {
    display: inline-flex !important;
    flex-shrink: 0 !important;
  }
}

.reader-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-body);
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-course-btn {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  padding: 0.25rem 0.55rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  flex-shrink: 1;
  max-width: 220px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: border-color var(--speed-fast, 0.2s) ease, background-color var(--speed-fast, 0.2s) ease, color var(--speed-fast, 0.2s) ease;
  border-radius: var(--radius-sm, 2px);
}

.breadcrumb-course-btn .svg-icon {
  color: var(--text-muted);
  transition: transform var(--speed-fast, 0.2s) ease, color var(--speed-fast, 0.2s) ease;
  flex-shrink: 0;
}

.breadcrumb-course-btn:hover {
  color: var(--link);
  background: var(--surface-hover);
  border-color: var(--hairline-strong);
}

.breadcrumb-course-btn:hover .svg-icon {
  color: var(--link);
  transform: translateX(-2px);
}

.breadcrumb-course-btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}

#breadcrumb-course-title {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.breadcrumb-sep {
  color: var(--hairline-strong);
  font-size: 0.8rem;
  font-weight: 400;
  flex-shrink: 0;
  opacity: 0.6;
}

.breadcrumb-topic {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.reader-navbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.reader-portfolio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #c5a880;
  background: rgba(197, 168, 128, 0.1);
  border: 1px solid rgba(197, 168, 128, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all var(--speed-fast) ease;
}

.reader-portfolio-btn:hover {
  background: rgba(197, 168, 128, 0.2);
  border-color: #c5a880;
  transform: translateY(-1px);
}

/* Scrollable View Area */
.blog-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 4rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--canvas);
}

/* ==========================================================================
   RESPONSIVE SYSTEM
   Breakpoints (ui-ux-pro-max standard):
     375px  — Mobile S/M  (iPhone SE → standard)
     768px  — Tablet Portrait (iPad mini/Air portrait)
     1024px — Tablet Landscape / Small Desktop
     1440px — Wide Desktop (already handled by clamp above)
   ========================================================================== */

/* ── 1024px and below: Tablet Landscape ─────────────────── */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }

  .blog-content-scroll {
    padding: 3.5rem clamp(1rem, 3vw, 2.5rem) 4rem;
  }
}

/* ── 768px and below: Tablet Portrait (iPad) ────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: min(320px, 85vw);
  }

  /* Sidebar becomes a slide-over overlay on tablet/mobile */
  .blog-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 85vw;
    height: 100%;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    /* Start collapsed off-screen */
    transform: translateX(-100%);
    margin-left: 0 !important;
    transition: transform var(--speed-normal) var(--ease-editorial);
  }

  /* When JS adds .mobile-open class, slide it in */
  .blog-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Dim overlay behind sidebar on mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 190;
    backdrop-filter: blur(4px);
    transition: opacity var(--speed-normal) ease;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  /* Reader Top Navbar on tablet & mobile */
  .reader-top-navbar {
    padding: 0 0.75rem;
    height: 46px;
    min-height: 46px;
    gap: 0.5rem;
  }

  /* Rút gọn breadcrumb: ẩn tên khóa học và dấu phân cách, chỉ hiển thị nút back chevron và tên bài học */
  #breadcrumb-course-title {
    display: none !important;
  }

  .breadcrumb-course-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: var(--radius-pill) !important;
    flex-shrink: 0 !important;
  }

  .breadcrumb-sep {
    display: none !important;
  }

  .breadcrumb-topic {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Clean padding on mobile — navbar handles top spacing */
  .blog-content-scroll {
    padding: 2rem 1.25rem 4rem;
  }

  /* Courses hub: single column on tablet */
  .global-courses-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .global-courses-hub {
    padding: 1rem 0.75rem;
    box-sizing: border-box;
  }

  .global-hub-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hub-brand {
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    gap: 0.5rem;
  }

  .hub-logo-title {
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hub-header-actions {
    flex-shrink: 0;
  }

  /* Course hub hub container padding */
  #article-content-body.hub-mode {
    padding: 1.5rem;
  }
}

/* ── 480px and below: Mobile ─────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --sidebar-width: min(310px, 88vw);
  }

  .blog-sidebar {
    width: var(--sidebar-width);
    max-width: 88vw;
  }

  .global-courses-hub {
    padding: 0.75rem 0.5rem;
  }

  .global-hub-header {
    gap: 0.35rem;
    padding-bottom: 0.85rem;
    margin-bottom: 1.25rem;
  }

  .hub-brand {
    gap: 0.35rem;
  }

  .hub-logo-badge {
    font-size: 0.62rem;
    padding: 0.15rem 0.4rem;
    letter-spacing: 1px;
  }

  .hub-logo-title {
    font-size: 0.92rem;
    letter-spacing: 0.5px;
  }

  .reader-top-navbar {
    padding: 0 0.5rem;
    height: 44px;
    min-height: 44px;
    gap: 0.4rem;
    overflow: hidden;
  }

  .reader-navbar-left {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .reader-breadcrumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .breadcrumb-course-btn {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .breadcrumb-topic {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .reader-navbar-right {
    flex-shrink: 0;
  }

  .blog-content-scroll {
    padding: 1.5rem 0.85rem 3.5rem;
  }

  /* Article title slightly smaller on small screens */
  .article-title {
    font-size: 1.65rem;
    line-height: 1.2;
  }

  /* Hub header title */
  .directory-title {
    font-size: 1.45rem;
  }

  .hub-logo-title {
    font-size: 1rem;
  }

  /* Course cards: reduce padding */
  .global-course-card {
    padding: 1.25rem;
  }

  /* Ensure touch targets for nav buttons */
  .article-nav-btn {
    min-height: 44px;
  }

  .cat-header-btn {
    min-height: 44px;
  }
}

/* Accessibility (A11y) Skip Link & Focus States */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.5rem 1rem;
  z-index: 9999;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: top var(--speed-fast) ease;
}

.skip-link:focus {
  top: 1rem;
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* High Contrast Focus States for Keyboard Navigation */
:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Article Bottom Navigation (Prev / Next Article)
   ========================================================================== */
.article-bottom-nav {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline, #262626);
}

.article-nav-step-spacer {
  flex: 1;
}

.article-nav-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-none, 0px);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--speed-fast, 0.2s) ease, background-color var(--speed-fast, 0.2s) ease, transform var(--speed-fast, 0.2s) ease;
  color: inherit;
}

.article-nav-step.next-step {
  text-align: right;
}

.article-nav-step:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.nav-step-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  transition: color var(--speed-fast, 0.2s) ease;
}

.article-nav-step:hover .nav-step-label {
  color: var(--link);
}

.article-nav-step.next-step .nav-step-label {
  justify-content: flex-end;
}

.nav-step-title {
  font-family: var(--font-sans, "Instrument Sans", sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

[data-theme="light"] .article-nav-step {
  background: #ffffff;
  border-color: #e4e4e7;
}

[data-theme="light"] .article-nav-step:hover {
  background: #f4f4f5;
  border-color: #71717a;
}

@media (max-width: 640px) {
  .article-bottom-nav {
    flex-direction: column;
    gap: 0.85rem;
  }
  .article-nav-step.next-step {
    text-align: left;
  }
  .article-nav-step.next-step .nav-step-label {
    justify-content: flex-start;
  }
}


