/* ============================================================
   qa-styles.css — Academic Study Repository (Parchment & Liquid Glass)
   B.Tech Computer Science & Engineering (MAKAUT Autonomous)
   Scholarly Editorial Styling · Bespoke Vector Accents · ZERO Emojis
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;0,6..72,700;1,6..72,400;1,6..72,600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Creamy Parchment & Liquid Glass Foundation */
  --bg-page: #FAF6EE;
  --bg-card: rgba(255, 255, 255, 0.74);
  --bg-card-hover: rgba(255, 255, 255, 0.92);
  --bg-glass-nav: rgba(250, 246, 238, 0.85);

  /* Academic Ink Hierarchy */
  --text-main: #1C1917;
  --text-body: #374151;
  --text-muted: #6B7280;
  --text-subtle: #9CA3AF;

  /* Group Badges & Heritage Colors */
  --oxford-blue: #1E3A8A;
  --oxford-light: rgba(30, 58, 138, 0.08);
  --oxford-border: rgba(30, 58, 138, 0.25);

  --cambridge-amber: #9A3412;
  --cambridge-light: rgba(154, 52, 18, 0.08);
  --cambridge-border: rgba(154, 52, 18, 0.28);

  --royal-purple: #6D28D9;
  --royal-light: rgba(109, 40, 217, 0.08);
  --royal-border: rgba(109, 40, 217, 0.28);

  /* Borders & Specular Glass Refractions */
  --border-glass: rgba(255, 255, 255, 0.95);
  --border-parchment: rgba(214, 203, 185, 0.75);
  --border-light: rgba(226, 217, 202, 0.65);

  /* Elevation Shadows */
  --shadow-glass: 0 16px 40px -8px rgba(44, 38, 28, 0.07), 0 4px 14px rgba(44, 38, 28, 0.03);
  --shadow-card: 0 4px 18px -2px rgba(44, 38, 28, 0.04), inset 0 1px 1px rgba(255, 255, 255, 0.95);
  --shadow-card-hover: 0 14px 34px -4px rgba(44, 38, 28, 0.09), inset 0 1px 1px #FFFFFF;
  --shadow-specular: inset 0 1.5px 2px rgba(255, 255, 255, 0.98);

  /* Typography */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Legacy compatibility aliases */
  --grp-a: var(--oxford-blue);
  --grp-b: var(--cambridge-amber);
  --grp-c: var(--royal-purple);
  --border: var(--border-light);
  --border-med: var(--border-parchment);
  --text-1: var(--text-main);
  --text-2: var(--text-body);
  --text-3: var(--text-muted);
  --text-4: var(--text-subtle);
  --accent: var(--cambridge-amber);
  --accent-glow: rgba(154, 52, 18, 0.2);
}

/* ============================================================
   1. GLOBAL RESET & PARCHMENT CANVAS
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  /* Tactile Vellum Parchment Atmosphere with SVG Fractal Grain */
  background-image:
    radial-gradient(1200px 700px at 15% 0%, rgba(238, 218, 188, 0.55), transparent 70%),
    radial-gradient(1100px 650px at 85% 12%, rgba(230, 200, 175, 0.42), transparent 65%),
    radial-gradient(1200px 850px at 50% 50%, rgba(236, 222, 200, 0.48), transparent 75%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paperGrain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.62' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.38  0 0 0 0 0.30  0 0 0 0 0.22  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paperGrain)'/%3E%3C/svg%3E");
  background-attachment: fixed;
  color: var(--text-body);
  margin: 0;
  padding: 0;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

::selection {
  background: rgba(154, 52, 18, 0.16);
  color: var(--text-main);
}

/* ============================================================
   2. FROSTED LIQUID GLASS TOP NAVIGATION
   ============================================================ */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.95rem clamp(1.2rem, 3.5vw, 2.5rem);
  background: var(--bg-glass-nav);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-parchment);
  box-shadow: 0 4px 20px -2px rgba(44, 38, 28, 0.04), inset 0 -1px 0 rgba(255, 255, 255, 0.85);
  gap: 1.25rem;
}

.nav-title {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.8vw, 1.32rem);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
  text-align: center;
  flex: 1;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 1.05rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-parchment);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(44, 38, 28, 0.04), inset 0 1px 0 #FFFFFF;
  white-space: nowrap;
}

.top-nav a:hover {
  background: #FFFFFF;
  transform: translateY(-1.5px);
  border-color: var(--cambridge-amber);
  color: var(--cambridge-amber);
  box-shadow: 0 4px 14px rgba(44, 38, 28, 0.08), inset 0 1px 0 #FFFFFF;
}

/* ============================================================
   3. SCHOLARLY GRID LAYOUT
   ============================================================ */
.layout,
.qa-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  max-width: 1440px;
  margin: 2.25rem auto 4.5rem;
  gap: 2.5rem;
  padding: 0 clamp(1rem, 2.5vw, 2.5rem);
  align-items: start;
}

/* ============================================================
   4. LIQUID GLASS STICKY SIDEBAR NAVIGATOR
   ============================================================ */
.sidebar,
.qa-sidebar {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 105px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 203, 185, 0.8) transparent;
}

.sidebar::-webkit-scrollbar,
.qa-sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb,
.qa-sidebar::-webkit-scrollbar-thumb {
  background: rgba(214, 203, 185, 0.85);
  border-radius: 4px;
}

.toc-box {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.62) 100%);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow-glass), var(--shadow-specular);
}

.toc-box h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1.5px solid var(--border-parchment);
  letter-spacing: -0.01em;
}

.toc-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.toc-box li {
  margin: 0;
}

.toc-box a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(44, 38, 28, 0.02);
}

.toc-box a b {
  font-weight: 600;
}

.toc-box a:hover {
  background: #FFFFFF;
  transform: translateX(4px);
  border-color: rgba(154, 52, 18, 0.35);
  box-shadow: 0 4px 14px rgba(44, 38, 28, 0.06), inset 0 1px 0 #FFFFFF;
  color: var(--cambridge-amber);
}

/* Distinct border cues for syllabus examination groups */
.toc-box a[href*="group-a"],
.sidebar-nav a[href*="group-a"] {
  border-left: 3.5px solid var(--oxford-blue);
}

.toc-box a[href*="group-b"],
.sidebar-nav a[href*="group-b"] {
  border-left: 3.5px solid var(--cambridge-amber);
}

.toc-box a[href*="group-c"],
.sidebar-nav a[href*="group-c"] {
  border-left: 3.5px solid var(--royal-purple);
}

/* Sidebar Sections & Nav Synonyms */
.sidebar-section {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.62) 100%);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: var(--shadow-glass), var(--shadow-specular);
  margin-bottom: 1.25rem;
}

.sidebar-section h3 {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1.5px solid var(--border-parchment);
  letter-spacing: -0.01em;
}

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

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.62rem 0.92rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(44, 38, 28, 0.02);
}

.sidebar-nav a:hover {
  background: #FFFFFF;
  color: var(--cambridge-amber);
  border-color: rgba(154, 52, 18, 0.35);
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(44, 38, 28, 0.06), inset 0 1px 0 #FFFFFF;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* ============================================================
   5. EXPANSIVE LIQUID GLASS MAIN CONTENT VAULT
   ============================================================ */
.content,
.qa-page {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.65) 100%);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: clamp(2rem, 4vw, 3.75rem);
  box-shadow: var(--shadow-glass), var(--shadow-specular);
  min-width: 0;
}

/* Content Header & Intro Lead */
.content-header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-parchment);
}

.content-header .section-title,
.content-header .group-title {
  margin-top: 0;
  margin-bottom: 0.65rem;
  border-bottom: none;
  padding-bottom: 0;
}

.lead {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0;
}

/* Section Titles & Group Titles (Group A, B, C) */
.section-title,
.group-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 2.7vw, 2.35rem);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 3.5rem 0 1.25rem;
  padding-bottom: 0.95rem;
  border-bottom: 2px solid var(--border-parchment);
  scroll-margin-top: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title:first-child,
.group-title:first-child {
  margin-top: 0;
}

.group-desc {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 2rem;
}

.qa-group {
  margin-bottom: 3rem;
}

.content-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-parchment);
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.88rem;
}

/* ============================================================
   6. REAL LIQUID GLASS QUESTION CARDS
   ============================================================ */
.qa-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 217, 202, 0.85);
  border-radius: 18px;
  padding: 1.65rem 1.95rem;
  margin-bottom: 1.85rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease,
              background 0.25s ease;
  scroll-margin-top: 96px;
  overflow: hidden;
}

.qa-card:hover {
  transform: translateY(-2.5px);
  background: var(--bg-card-hover);
  border-color: rgba(154, 52, 18, 0.38);
  box-shadow: var(--shadow-card-hover);
}

.qa-card:target {
  border-color: var(--cambridge-amber);
  box-shadow: 0 0 0 3.5px rgba(154, 52, 18, 0.2), var(--shadow-card-hover);
  background: #FFFFFF;
}

/* Question Header & Badges */
.q-text,
.qa-card__q,
.qa-question,
.qa-card h4.qa-question {
  font-family: var(--font-sans);
  font-size: 1.14rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
  margin: 0 0 1.15rem;
  letter-spacing: -0.012em;
}

.q-badge,
.qa-card__badge,
.mark-badge,
.highlight-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.24rem 0.65rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  /* Default: Group A (1 Mark SAQs) */
  background: var(--oxford-light);
  color: var(--oxford-blue);
  border: 1px solid var(--oxford-border);
}

/* Group B (5 Marks Descriptive) */
.q-badge.b5,
.qa-card[data-group="b"] .qa-card__badge {
  background: var(--cambridge-light);
  color: var(--cambridge-amber);
  border-color: var(--cambridge-border);
}

/* Group C (15 Marks Long/Numerical) */
.q-badge.c15,
.qa-card[data-group="c"] .qa-card__badge {
  background: var(--royal-light);
  color: var(--royal-purple);
  border-color: var(--royal-border);
}

/* ============================================================
   7. ELEGANT ANSWER TYPOGRAPHY & CODE
   ============================================================ */
.a-text,
.qa-answer,
.answer {
  font-family: var(--font-sans);
  font-size: 0.985rem;
  line-height: 1.78;
  color: var(--text-body);
  padding-left: 1.35rem;
  border-left: 3.5px solid rgba(154, 52, 18, 0.35);
  transition: border-left-color 0.22s ease;
}

.qa-card:hover .a-text,
.qa-card:hover .qa-answer,
.qa-card:hover .answer {
  border-left-color: var(--cambridge-amber);
}

.a-text p,
.qa-answer p,
.answer p {
  margin: 0 0 1.05rem;
}

.a-text p:last-child,
.qa-answer p:last-child,
.answer p:last-child {
  margin-bottom: 0;
}

.a-text b,
.a-text strong,
.qa-answer strong,
.qa-answer b,
.answer strong,
.answer b {
  color: var(--text-main);
  font-weight: 700;
}

.a-text ul,
.a-text ol,
.qa-answer ul,
.qa-answer ol,
.answer ul,
.answer ol {
  margin: 0.8rem 0 1.2rem;
  padding-left: 1.55rem;
  line-height: 1.74;
}

.a-text li,
.qa-answer li,
.answer li {
  margin-bottom: 0.5rem;
}

.a-text h3,
.a-text h4,
.qa-answer h3,
.qa-answer h4,
.answer h3,
.answer h4 {
  font-family: var(--font-serif);
  color: var(--text-main);
  margin: 1.5rem 0 0.75rem;
  letter-spacing: -0.015em;
}

.a-text h3,
.answer h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.a-text h4,
.answer h4 {
  font-size: 1.08rem;
  font-weight: 600;
}

/* Inline Code Snippets */
.a-text code,
.qa-answer code,
p > code,
li > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(44, 38, 28, 0.05);
  padding: 0.16em 0.45em;
  border-radius: 5px;
  color: var(--cambridge-amber);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Code Blocks & Terminal Windows */
.code-block,
pre,
.qa-answer pre {
  background: #1E293B;
  color: #F8FAFC;
  border-radius: 12px;
  padding: 1.25rem 1.45rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.64;
  overflow-x: auto;
  margin: 1.35rem 0;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(44, 38, 28, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.code-block code,
pre code {
  background: transparent !important;
  border: none !important;
  color: inherit !important;
  padding: 0 !important;
  font-size: inherit !important;
}

/* Formula Textbook Box */
.formula-box {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94) 0%, rgba(254, 250, 242, 0.95) 100%);
  border: 1px solid var(--border-parchment);
  border-left: 4px solid var(--cambridge-amber);
  border-radius: 0 14px 14px 0;
  padding: 1.25rem 1.65rem;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--text-main);
  box-shadow: inset 2px 2px 5px rgba(44, 38, 28, 0.02), 0 3px 10px rgba(44, 38, 28, 0.04);
  overflow-x: auto;
}

/* Highlight Text */
.highlight {
  background: rgba(154, 52, 18, 0.12);
  color: var(--cambridge-amber);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  font-weight: 600;
}

/* Sleek Mac Studio Window Containers */
.mac-window {
  background: #0F172A;
  border-radius: 14px;
  overflow: hidden;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.15);
}

.mac-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 1rem;
  background: #1E293B;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mac-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
}

.mac-dot.red { background: #EF4444; }
.mac-dot.yellow { background: #F59E0B; }
.mac-dot.green { background: #10B981; }

.mac-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94A3B8;
  font-weight: 700;
}

.mac-body {
  padding: 0;
  background: #0F172A;
}

.mac-body pre {
  margin: 0;
  border-radius: 0;
  border: none;
  background: transparent !important;
  box-shadow: none;
  padding: 1.25rem 1.45rem;
}

/* ============================================================
   8. TABLES & DIAGRAM CONTAINERS
   ============================================================ */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.6rem 0;
  border: 1px solid var(--border-parchment);
  border-radius: 12px;
  overflow: hidden;
  background: #FFFFFF;
  font-size: 0.93rem;
  box-shadow: 0 4px 14px rgba(44, 38, 28, 0.04);
}

th {
  background: #F4ECE1;
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--text-main);
  padding: 0.85rem 1.2rem;
  border-bottom: 1.5px solid var(--border-parchment);
  border-right: 1px solid rgba(214, 203, 185, 0.6);
  text-align: left;
}

td {
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid rgba(214, 203, 185, 0.45);
  border-right: 1px solid rgba(214, 203, 185, 0.45);
  color: var(--text-body);
  line-height: 1.65;
}

tr:last-child td {
  border-bottom: none;
}

th:last-child,
td:last-child {
  border-right: none;
}

tr:nth-child(even) td {
  background: rgba(250, 246, 238, 0.55);
}

.diagram-container {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-parchment);
  border-radius: 14px;
  padding: 1.85rem;
  margin: 1.6rem 0;
  text-align: center;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.9), 0 4px 12px rgba(44, 38, 28, 0.03);
}

.diagram-caption {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.94rem;
  color: var(--text-muted);
  margin-top: 0.95rem;
}

/* Master Diagram Cards (Constitution & System Diagrams) */
.diagram-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(226, 217, 202, 0.88);
  border-radius: 20px;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 2.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  scroll-margin-top: 96px;
}

.diagram-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.diagram-card h2 {
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-parchment);
  letter-spacing: -0.015em;
}

.diagram-card .mermaid {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid var(--border-parchment);
  border-radius: 12px;
  padding: 1.75rem 1.25rem;
  overflow-x: auto;
  box-shadow: inset 0 1px 2px rgba(44, 38, 28, 0.03);
}

/* ============================================================
   9. RESPONSIVE DESIGN (TABLET & MOBILE)
   ============================================================ */
@media (max-width: 1024px) {
  .layout,
  .qa-layout {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    margin-top: 1.5rem;
  }

  .sidebar,
  .qa-sidebar {
    position: static;
    max-height: none;
  }

  .toc-box ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .toc-box a {
    flex: 1 1 calc(33.333% - 0.5rem);
    min-width: 180px;
  }
}

@media (max-width: 640px) {
  .top-nav {
    flex-direction: column;
    padding: 0.75rem 1rem;
    gap: 0.6rem;
    text-align: center;
  }

  .nav-title {
    font-size: 1.05rem;
  }

  .content,
  .qa-page {
    padding: 1.35rem 1.1rem;
    border-radius: 16px;
  }

  .section-title {
    font-size: 1.5rem;
    margin: 2.25rem 0 1.25rem;
  }

  .qa-card {
    padding: 1.2rem 1.15rem;
    border-radius: 14px;
  }

  .q-text,
  .qa-card__q {
    font-size: 1rem;
  }

  .toc-box a {
    flex: 1 1 100%;
  }
}

/* ============================================================
   10. HIGH-FIDELITY PRINT RENDERING
   ============================================================ */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  .top-nav,
  .sidebar,
  .qa-sidebar {
    display: none !important;
  }

  .layout,
  .qa-layout {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .content,
  .qa-page {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .qa-card {
    break-inside: avoid;
    border: 1px solid #D1D5DB !important;
    box-shadow: none !important;
    background: #FFFFFF !important;
    margin-bottom: 1.5rem !important;
  }
}
