/* ============================================
   GMT Wiki — Monochrome Documentation System
   Linear.app-inspired black-white design
   Inter font family | Light default | Dark mode
   ============================================ */

/* === FONT === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;450;500;600;700;800;900&display=swap');

/* ============================================
   1. CUSTOM PROPERTIES — LIGHT MODE (default)
   ============================================ */
:root {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f5f5f5;
  --bg-sidebar: #f7f7f7;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-active: #e8e8e8;
  --bg-code: #f5f5f5;
  --bg-overlay: rgba(0, 0, 0, 0.35);
  --bg-scrim: rgba(0, 0, 0, 0.5);
  --bg-inset: #ebebeb;

  /* Text */
  --text-primary: #111111;
  --text-secondary: #555555;
  --text-tertiary: #777777;
  --text-muted: #999999;
  --text-faint: #bbbbbb;
  --text-inverse: #ffffff;

  /* Primary palette */
  --primary: #111111;
  --primary-hover: #000000;
  --primary-light: #f0f0f0;
  --primary-border: #d4d4d4;

  /* Semantic — all monochrome */
  --success: #1a1a1a;
  --success-light: #f0f0f0;
  --success-border: #d4d4d4;
  --warning: #333333;
  --warning-light: #f5f5f5;
  --warning-border: #d4d4d4;
  --danger: #1a1a1a;
  --danger-light: #f5f5f5;
  --danger-border: #d4d4d4;
  --info: #444444;
  --info-light: #f5f5f5;
  --info-border: #d4d4d4;
  --neutral: #666666;
  --neutral-light: #f5f5f5;
  --neutral-border: #e0e0e0;

  /* Borders */
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --border-strong: #cccccc;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.09);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.04);

  /* Radius */
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 0.1s;
  --duration: 0.15s;
  --duration-slow: 0.25s;
  --transition: var(--duration) var(--ease);
  --transition-fast: var(--duration-fast) var(--ease);
  --transition-slow: var(--duration-slow) var(--ease);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Consolas',
    'Monaco', monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 28px;
  --font-size-5xl: 36px;
  --line-height-tight: 1.25;
  --line-height-snug: 1.4;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;

  /* Layout */
  --header-height: 52px;
  --sidebar-width: 260px;
  --content-max: 800px;
  --content-padding: 40px;

  /* Gradients */
  --gradient-hero: linear-gradient(180deg, #111111 0%, #1a1a1a 100%);
  --gradient-bar: linear-gradient(90deg, #111 0%, #444 100%);
  --gradient-subtle: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);

  /* Z-index scale */
  --z-sidebar: 900;
  --z-overlay: 899;
  --z-header: 1000;
  --z-toc: 800;
  --z-search: 1200;
  --z-toast: 2000;
  --z-tooltip: 1500;
  --z-progress: 1100;

  /* Aliases for backward compat */
  --accent: var(--primary);
  --bg: var(--bg-primary);
  --card-bg: var(--bg-card);
  --shadow: var(--shadow-sm);
  --text: var(--text-primary);
  --primary-dark: var(--primary-hover);
}

/* ============================================
   2. DARK MODE
   ============================================ */
[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #161616;
  --bg-sidebar: #0e0e0e;
  --bg-card: #161616;
  --bg-hover: #1e1e1e;
  --bg-active: #252525;
  --bg-code: #161616;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-scrim: rgba(0, 0, 0, 0.75);
  --bg-inset: #222222;

  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-tertiary: #888888;
  --text-muted: #666666;
  --text-faint: #444444;
  --text-inverse: #111111;

  --primary: #f0f0f0;
  --primary-hover: #ffffff;
  --primary-light: rgba(255, 255, 255, 0.06);
  --primary-border: rgba(255, 255, 255, 0.15);

  --success: #e0e0e0;
  --success-light: rgba(255, 255, 255, 0.05);
  --success-border: rgba(255, 255, 255, 0.1);
  --warning: #e0e0e0;
  --warning-light: rgba(255, 255, 255, 0.05);
  --warning-border: rgba(255, 255, 255, 0.1);
  --danger: #e0e0e0;
  --danger-light: rgba(255, 255, 255, 0.05);
  --danger-border: rgba(255, 255, 255, 0.1);
  --info: #e0e0e0;
  --info-light: rgba(255, 255, 255, 0.05);
  --info-border: rgba(255, 255, 255, 0.1);
  --neutral-light: rgba(255, 255, 255, 0.04);
  --neutral-border: rgba(255, 255, 255, 0.08);

  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.04);
  --border-strong: rgba(255, 255, 255, 0.18);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.15);

  --gradient-hero: linear-gradient(180deg, #1a1a1a 0%, #111111 100%);
  --gradient-bar: linear-gradient(90deg, #f0f0f0 0%, #777 100%);
  --gradient-subtle: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);

  --accent: #f0f0f0;
  --bg: #0a0a0a;
  --card-bg: #161616;
  --text: #f0f0f0;
  --primary-dark: #ffffff;
}

/* ============================================
   3. RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: var(--line-height-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: rgba(0, 0, 0, 0.1);
  color: inherit;
}
[data-theme="dark"] ::selection {
  background: rgba(255, 255, 255, 0.14);
}

/* Focus */
:focus-visible {
  outline: 1.5px solid var(--text-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Links */
a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--text-secondary);
}

/* Images */
img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lists */
ul,
ol {
  list-style: none;
}

/* Buttons & Inputs */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--text-primary);
  color: var(--text-inverse);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-weight: 600;
  z-index: 9999;
  transition: top var(--transition);
}
.skip-link:focus {
  top: 16px;
}

/* ============================================
   4. READING PROGRESS BAR
   ============================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-bar);
  z-index: var(--z-progress);
  transition: width 0.08s linear;
  pointer-events: none;
  will-change: width;
}

[data-theme="dark"] .reading-progress {
  height: 2px;
  opacity: 0.8;
}

/* ============================================
   5. HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-header);
  transition: box-shadow var(--transition), transform var(--transition-slow),
    background-color var(--transition-slow);
}

.header.scrolled {
  box-shadow: 0 1px 0 var(--border);
}

.header.hidden {
  transform: translateY(-100%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
  max-width: 100%;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  flex-shrink: 0;
}

.logo svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.logo-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.logo-label span {
  color: var(--text-muted);
  font-weight: 500;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  min-width: 160px;
}

.search-bar:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.search-bar svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.search-bar span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
}

.search-bar kbd {
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  line-height: 1.4;
}

/* Theme Toggle */
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Hamburger */
.hamburger {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.hamburger:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.hamburger.active {
  background: var(--bg-hover);
}

/* ============================================
   6. SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  z-index: var(--z-sidebar);
  transition: transform 0.25s var(--ease), background-color var(--transition-slow);
  overscroll-behavior: contain;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* Sidebar Sections */
.sidebar-section {
  margin-bottom: 2px;
  padding: 0 8px;
}

.sidebar-section-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 14px 12px 4px;
  user-select: none;
}

/* Sidebar Links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 5px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 450;
  transition: all var(--transition);
  margin: 1px 0;
  line-height: var(--line-height-snug);
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--text-primary);
  border-radius: 0 2px 2px 0;
}

/* Sidebar Icons */
.sidebar-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  line-height: 1;
}

/* Sidebar Badge */
.sidebar-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-link.active .sidebar-badge {
  background: var(--text-primary);
  color: var(--bg-primary);
}

/* Sidebar Collapsible */
.sidebar-collapse-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
  user-select: none;
  margin: 1px 0;
}

.sidebar-collapse-trigger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-collapse-trigger .arrow {
  font-size: 10px;
  transition: transform var(--transition);
}

.sidebar-collapse-trigger.open .arrow {
  transform: rotate(90deg);
}

.sidebar-collapse-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s var(--ease);
}

.sidebar-collapse-content.open {
  max-height: 600px;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  opacity: 0;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ============================================
   7. LAYOUT
   ============================================ */
.layout {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  transition: margin-left 0.25s var(--ease);
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px var(--content-padding) 80px;
}

.content.wide {
  max-width: 960px;
}

.content.narrow {
  max-width: 640px;
}

/* ============================================
   8. BREADCRUMB
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-weight: 500;
  line-height: 1;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--transition);
  padding: 2px 0;
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb .sep {
  color: var(--text-faint);
  user-select: none;
  font-size: 10px;
}

.breadcrumb .current {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============================================
   9. PAGE HEADER
   ============================================ */
.page-title {
  font-size: var(--font-size-4xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: var(--line-height-tight);
  margin-bottom: 8px;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: 8px;
  max-width: 640px;
}

.page-description {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: 20px;
  max-width: 640px;
}

.last-updated {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-meta-divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}

/* ============================================
   10. TAGS
   ============================================ */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: 1px solid;
  line-height: 1.5;
  white-space: nowrap;
}

.tag-green {
  color: var(--text-primary);
  background: var(--success-light);
  border-color: var(--success-border);
}

.tag-orange {
  color: var(--text-primary);
  background: var(--warning-light);
  border-color: var(--warning-border);
}

.tag-red {
  color: var(--text-primary);
  background: var(--danger-light);
  border-color: var(--danger-border);
}

.tag-blue {
  color: var(--text-primary);
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.tag-purple {
  color: var(--text-primary);
  background: var(--neutral-light);
  border-color: var(--neutral-border);
}

.tag-gray,
.tag-neutral {
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-color: var(--border);
}

.tag-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.tag-solid {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}

/* ============================================
   11. INLINE TOC
   ============================================ */
.toc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 28px;
}

.toc-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.toc ul {
  list-style: none;
  padding: 0;
}

.toc li {
  margin-bottom: 1px;
}

.toc li a {
  display: block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
  border-left: 2px solid transparent;
  line-height: var(--line-height-snug);
}

.toc li a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-left-color: var(--text-muted);
}

.toc li.toc-h3 a {
  padding-left: 20px;
  font-size: var(--font-size-xs);
}

.toc li.toc-h4 a {
  padding-left: 32px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ============================================
   12. FLOATING TOC
   ============================================ */
.floating-toc {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  right: 24px;
  width: 200px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 14px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  z-index: var(--z-toc);
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.floating-toc.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.floating-toc::-webkit-scrollbar {
  width: 2px;
}

.floating-toc::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

.floating-toc-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 6px;
}

.floating-toc ul {
  list-style: none;
  padding: 0;
}

.floating-toc li {
  margin-bottom: 1px;
}

.floating-toc li a {
  display: block;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  transition: all var(--transition);
  border-left: 2px solid transparent;
  line-height: var(--line-height-snug);
}

.floating-toc li a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.floating-toc li a.active {
  color: var(--text-primary);
  font-weight: 600;
  border-left-color: var(--text-primary);
  background: var(--bg-hover);
}

.floating-toc li.sub a {
  padding-left: 14px;
  font-size: 10px;
}

.floating-toc li.sub-sub a {
  padding-left: 24px;
  font-size: 10px;
}

/* ============================================
   13. ARTICLE CONTENT TYPOGRAPHY
   ============================================ */
.content h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-top: 44px;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.content h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text-primary);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.content h4 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 6px;
  color: var(--text-primary);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.content h5 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 4px;
  color: var(--text-primary);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.content p {
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.content ul,
.content ol {
  margin-bottom: 14px;
  padding-left: 22px;
  color: var(--text-secondary);
}

.content ul {
  list-style-type: disc;
}

.content ol {
  list-style-type: decimal;
}

.content li {
  margin-bottom: 4px;
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.content li > ul,
.content li > ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

.content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content em {
  font-style: italic;
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* Anchor links */
.content h2 .anchor,
.content h3 .anchor,
.content h4 .anchor {
  color: var(--text-faint);
  font-weight: 400;
  margin-left: 6px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}

.content h2:hover .anchor,
.content h3:hover .anchor,
.content h4:hover .anchor {
  opacity: 1;
}

.content h2:hover .anchor:hover,
.content h3:hover .anchor:hover,
.content h4:hover .anchor:hover {
  color: var(--text-primary);
}

/* ============================================
   14. BLOCKQUOTES
   ============================================ */
.content blockquote {
  border-left: 2px solid var(--border-strong);
  padding: 10px 18px;
  margin: 18px 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.content blockquote p:last-child {
  margin-bottom: 0;
}

.content blockquote cite {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 6px;
  font-style: normal;
}

/* ============================================
   15. TABLES
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.content table {
  width: 100%;
  font-size: var(--font-size-sm);
}

.content th {
  background: var(--bg-secondary);
  font-weight: 600;
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.content td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-snug);
}

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

.content tbody tr {
  transition: background-color var(--transition-fast);
}

.content tbody tr:hover td {
  background: var(--bg-hover);
}

/* Striped tables */
.content table.striped tbody tr:nth-child(even) td {
  background: var(--bg-secondary);
}

/* Compact table */
.content table.compact th,
.content table.compact td {
  padding: 5px 10px;
  font-size: var(--font-size-xs);
}

/* ============================================
   16. CODE
   ============================================ */
.content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  overflow-x: auto;
  margin: 18px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

.content pre::-webkit-scrollbar {
  height: 4px;
}

.content pre::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

.content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

.content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
  border-radius: 0;
}

/* Code filename label */
.code-filename {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 18px;
}

.code-filename + pre {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.code-copy-btn {
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  color: var(--text-muted);
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.code-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ============================================
   17. INFOBOX
   ============================================ */
.infobox {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border: 1px solid;
}

.infobox-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

.infobox-content {
  flex: 1;
  min-width: 0;
}

.infobox-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 3px;
  color: var(--text-primary);
}

.infobox p {
  font-size: var(--font-size-sm);
  margin-bottom: 3px;
  line-height: var(--line-height-relaxed);
}

.infobox p:last-child {
  margin-bottom: 0;
}

/* Info variants */
.infobox.info {
  background: var(--info-light);
  border-color: var(--info-border);
}

.infobox.warning {
  background: var(--warning-light);
  border-color: var(--warning-border);
}

.infobox.tip {
  background: var(--success-light);
  border-color: var(--success-border);
}

.infobox.danger {
  background: var(--danger-light);
  border-color: var(--danger-border);
}

.infobox.note {
  background: var(--neutral-light);
  border-color: var(--neutral-border);
}

/* ============================================
   18. CARDS
   ============================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.card-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.card-icon {
  font-size: 22px;
  margin-bottom: 10px;
  line-height: 1;
}

.card h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.card p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-snug);
  margin-bottom: 0;
}

.card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-arrow {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.card:hover .card-arrow {
  transform: translateX(3px);
  color: var(--text-primary);
}

/* Card variants */
.card-compact {
  padding: 12px;
}

.card-compact h3 {
  font-size: var(--font-size-sm);
}

.card-elevated {
  border: none;
  box-shadow: var(--shadow-sm);
}

.card-elevated:hover {
  box-shadow: var(--shadow-md);
}

.card-flat {
  border: none;
  background: var(--bg-secondary);
}

.card-flat:hover {
  background: var(--bg-hover);
}

/* ============================================
   19. SUMMARY CARDS
   ============================================ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all var(--transition);
}

.summary-card:hover {
  border-color: var(--border-strong);
}

.summary-card .label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1.1;
}

.summary-card .desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.summary-card .trend {
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.summary-card .trend.up {
  color: var(--text-primary);
}

.summary-card .trend.down {
  color: var(--text-muted);
}

/* ============================================
   20. TIMELINE
   ============================================ */
.timeline {
  position: relative;
  margin: 24px 0;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 22px;
  padding-left: 16px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--text-primary);
  transition: all var(--transition);
  z-index: 1;
}

.timeline-item:first-child::before {
  background: var(--text-primary);
}

.timeline-year {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.timeline-date {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-bottom: 3px;
}

.timeline-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.timeline-text p {
  margin-bottom: 4px;
}

/* ============================================
   21. FLOWCHART / STEPS
   ============================================ */
.flowchart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 24px 0;
}

.flow-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  transition: all var(--transition);
}

.flow-step:hover {
  border-color: var(--border-strong);
}

.flow-step h4 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.flow-step p {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 0;
}

.flow-arrow {
  font-size: 16px;
  color: var(--text-faint);
  padding: 4px 0;
  line-height: 1;
}

/* Steps (horizontal) */
.steps {
  display: flex;
  gap: 0;
  margin: 20px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step-item {
  flex: 1;
  min-width: 140px;
  text-align: center;
  position: relative;
  padding: 16px 12px;
}

.step-item::after {
  content: '';
  position: absolute;
  top: 24px;
  right: 0;
  width: calc(100% - 48px);
  height: 1px;
  background: var(--border);
}

.step-item:last-child::after {
  display: none;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 auto 8px;
  position: relative;
  z-index: 1;
}

.step-item.active .step-number,
.step-item.completed .step-number {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--text-inverse);
}

.step-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================================
   22. HOME HERO
   ============================================ */
body.homepage-wrapper {
  margin-left: 0;
}

body.homepage-wrapper .layout {
  margin-left: 0;
}

.home-hero {
  background: var(--gradient-hero);
  padding: 64px 40px;
  text-align: center;
  color: #f0f0f0;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.home-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.home-hero-title {
  font-size: var(--font-size-5xl);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
  position: relative;
  line-height: var(--line-height-tight);
}

.home-hero-subtitle {
  font-size: var(--font-size-md);
  opacity: 0.7;
  max-width: 600px;
  margin: 0 auto 28px;
  line-height: var(--line-height-relaxed);
  font-weight: 400;
  position: relative;
}

.home-hero-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}

.home-hero-search {
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}

.home-hero-search input {
  width: 100%;
  padding: 12px 18px 12px 40px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f0f0f0;
  font-size: var(--font-size-base);
  transition: all var(--transition);
}

.home-hero-search input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.home-hero-search input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.home-hero-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.4);
}

/* Home Sections */
.home-section {
  padding: 36px 40px;
  max-width: 1060px;
  margin: 0 auto;
}

.home-section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.home-section-title .icon {
  font-size: 18px;
}

.home-section-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 16px;
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.home-section-link {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition);
}

.home-section-link:hover {
  color: var(--text-primary);
}

/* ============================================
   23. BUTTONS
   ============================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  background: #f0f0f0;
  color: #111;
  font-weight: 600;
  font-size: var(--font-size-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary svg {
  width: 14px;
  height: 14px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #f0f0f0;
  font-weight: 500;
  font-size: var(--font-size-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.btn-secondary svg {
  width: 14px;
  height: 14px;
}

/* Buttons inside content (on white/light bg) */
.content .btn-primary {
  background: var(--text-primary);
  color: var(--text-inverse);
}

.content .btn-primary:hover {
  background: var(--text-secondary);
}

.content .btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border);
}

.content .btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Button sizes */
.btn-sm {
  padding: 5px 12px;
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--font-size-base);
}

/* Button icon only */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   24. CALCULATOR COMPONENTS
   ============================================ */
.calc-container {
  max-width: 960px;
  margin: 0 auto;
}

.calc-hero {
  background: var(--gradient-hero);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #f0f0f0;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.calc-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.calc-hero h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  margin-bottom: 4px;
  color: #f0f0f0;
  letter-spacing: -0.3px;
}

.calc-hero p {
  font-size: var(--font-size-sm);
  opacity: 0.7;
  color: #f0f0f0;
  margin-bottom: 0;
}

/* Calculator Tabs */
.calc-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.calc-tab {
  padding: 8px 16px;
  border-radius: 5px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  background: none;
  line-height: 1;
}

.calc-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.calc-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Calculator Panels */
.calc-panel {
  display: none;
}

.calc-panel.active {
  display: block;
}

/* Calculator Form */
.calc-form {
  display: grid;
  gap: 16px;
}

.calc-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.calc-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.calc-form-group {
  margin-bottom: 0;
}

.calc-label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  letter-spacing: 0.1px;
}

.calc-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 3px;
}

.calc-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: all var(--transition);
  line-height: 1.4;
}

.calc-input:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.calc-input::placeholder {
  color: var(--text-faint);
}

.calc-input.error {
  border-color: var(--danger);
}

.calc-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-card);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--transition);
}

.calc-select:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Calculator Checkbox & Radio */
.calc-checkbox,
.calc-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.calc-checkbox input,
.calc-radio input {
  width: 16px;
  height: 16px;
  accent-color: var(--text-primary);
  cursor: pointer;
}

/* Calculator Button */
.calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  width: 100%;
}

.calc-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.calc-btn:active {
  transform: translateY(0);
}

.calc-btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.calc-btn-outline:hover {
  background: var(--bg-hover);
  opacity: 1;
}

/* Calculator Results */
.calc-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
}

.calc-result-card h3 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.calc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--font-size-sm);
}

.calc-result-row:last-child {
  border-bottom: none;
}

.calc-result-label {
  color: var(--text-secondary);
}

.calc-result-value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.calc-result-value.highlight {
  font-size: var(--font-size-md);
  font-weight: 800;
}

.calc-result-value.negative {
  opacity: 0.6;
}

/* Calculator Info Box */
.calc-info-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 16px;
}

.calc-info-box p {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 3px;
  line-height: var(--line-height-relaxed);
}

.calc-info-box p:last-child {
  margin-bottom: 0;
}

.calc-info-box strong {
  color: var(--text-primary);
}

/* Calculator Comparison Table */
.calc-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.calc-comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.calc-comparison-card h4 {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.calc-comparison-card .amount {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.calc-comparison-card .savings {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================
   25. SEARCH MODAL
   ============================================ */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-search);
  justify-content: center;
  padding-top: 100px;
}

.search-overlay.active {
  display: flex;
}

.search-modal {
  width: 540px;
  max-width: 90vw;
  max-height: 70vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-modal-header svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-modal-input {
  flex: 1;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: none;
  outline: none;
}

.search-modal-input::placeholder {
  color: var(--text-muted);
}

.search-modal-close {
  width: 24px;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.search-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-results-list {
  overflow-y: auto;
  max-height: 380px;
  padding: 6px;
}

.search-results-header {
  padding: 10px 12px;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
}

.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  transition: all var(--transition);
  text-decoration: none;
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-item h4 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.search-result-item p {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: var(--line-height-snug);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-item mark {
  background: var(--primary-light);
  color: var(--text-primary);
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-category {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.search-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ============================================
   26. BACK TO TOP
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(16px);
  transition: all var(--transition);
  z-index: var(--z-toc);
  cursor: pointer;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   27. COPY TOAST
   ============================================ */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: var(--font-size-xs);
  font-weight: 500;
  z-index: var(--z-toast);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   28. MODAL / DIALOG
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-search);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s var(--ease);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================
   29. TOOLTIP
   ============================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   30. SKELETON LOADING
   ============================================ */
.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 100%
  );
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-text.short { width: 50%; }
.skeleton-text.long { width: 100%; }

.skeleton-heading {
  height: 24px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
}

/* ============================================
   31. ACCORDION / COLLAPSIBLE
   ============================================ */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border-light);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  width: 100%;
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition);
}

.accordion-trigger:hover {
  background: var(--bg-hover);
}

.accordion-trigger .arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.accordion-item.open .accordion-trigger .arrow {
  transform: rotate(90deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s var(--ease);
}

.accordion-item.open .accordion-content {
  max-height: 500px;
}

.accordion-body {
  padding: 0 16px 14px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

/* ============================================
   32. GLOSSARY
   ============================================ */
.glossary-term {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.glossary-term:last-child {
  border-bottom: none;
}

.glossary-term strong {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

.glossary-term p {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: 0;
}

/* ============================================
   33. PAGINATION
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 32px 0;
}

.pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.pagination-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.pagination-btn.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  font-weight: 600;
}

.pagination-btn.disabled {
  color: var(--text-faint);
  cursor: default;
}

.pagination-btn.disabled:hover {
  background: none;
  color: var(--text-faint);
}

/* ============================================
   34. STATUS DOT / INDICATOR
   ============================================ */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.active {
  background: var(--text-primary);
}

.status-dot.inactive {
  background: var(--border);
}

/* Pulsing variant */
.status-dot.pulse {
  position: relative;
}

.status-dot.pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--text-primary);
  animation: status-pulse 2s infinite;
}

@keyframes status-pulse {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.8); }
}

/* ============================================
   35. DIVIDER
   ============================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================
   36. BADGE
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.5;
}

.badge-solid {
  background: var(--text-primary);
  color: var(--text-inverse);
}

.badge-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-subtle {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* ============================================
   37. AVATAR / ICON CONTAINER
   ============================================ */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.avatar-lg {
  width: 36px;
  height: 36px;
  font-size: var(--font-size-sm);
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-primary);
  margin-left: -6px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   38. EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 40px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ============================================
   39. NOTIFICATION / ALERT BAR
   ============================================ */
.alert-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-align: center;
}

.alert-bar + .header {
  top: 33px;
}

.alert-bar + .header + .reading-progress {
  top: 33px;
}

.alert-bar + .header + .sidebar {
  top: calc(var(--header-height) + 33px);
}

.alert-bar-close {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 14px;
  transition: color var(--transition);
}

.alert-bar-close:hover {
  color: var(--text-primary);
}

/* ============================================
   40. HOME EXTRAS
   ============================================ */
/* Horizontal Timeline */
.home-timeline {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 12px 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.home-timeline::-webkit-scrollbar {
  display: none;
}

.home-timeline-point {
  flex: 0 0 auto;
  width: 140px;
  text-align: center;
  position: relative;
  padding: 16px 10px;
  scroll-snap-align: start;
}

.home-timeline-point::after {
  content: '';
  position: absolute;
  top: 24px;
  right: 0;
  width: calc(100% - 48px);
  height: 1px;
  background: var(--border);
}

.home-timeline-point:last-child::after {
  display: none;
}

.home-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-primary);
  margin: 0 auto 10px;
  border: 2px solid var(--bg-primary);
  position: relative;
  z-index: 1;
}

.home-timeline-year {
  font-size: var(--font-size-base);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.home-timeline-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: var(--line-height-snug);
}

/* Tool Cards */
.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.tool-card:hover {
  border-color: var(--border-strong);
  transform: translateX(3px);
}

.tool-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.tool-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1px;
}

.tool-desc {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.tool-arrow {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.tool-card:hover .tool-arrow {
  transform: translateX(3px);
  color: var(--text-primary);
}

/* Home Footer */
.home-footer {
  text-align: center;
  padding: 28px 40px;
  border-top: 1px solid var(--border);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.home-footer a {
  color: var(--text-secondary);
}

.home-footer a:hover {
  color: var(--text-primary);
}

/* Topic cards */
.card-grid.home-cards {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card.topic-card {
  display: flex;
  flex-direction: column;
}

.card.topic-card .card-icon {
  font-size: 20px;
}

.card.topic-card h3 {
  font-size: var(--font-size-sm);
}

.card.topic-card p {
  font-size: var(--font-size-xs);
  flex: 1;
}

/* ============================================
   41. ANIMATIONS
   ============================================ */
.animate-fade-in {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.animate-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-fade-in-up {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-scale-in {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-bounce);
}

.animate-scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.stagger > *:nth-child(1) { transition-delay: 0s; }
.stagger > *:nth-child(2) { transition-delay: 0.04s; }
.stagger > *:nth-child(3) { transition-delay: 0.08s; }
.stagger > *:nth-child(4) { transition-delay: 0.12s; }
.stagger > *:nth-child(5) { transition-delay: 0.16s; }
.stagger > *:nth-child(6) { transition-delay: 0.20s; }
.stagger > *:nth-child(7) { transition-delay: 0.24s; }
.stagger > *:nth-child(8) { transition-delay: 0.28s; }

.stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reading-progress {
    transition: none;
  }
}

/* ============================================
   42. UTILITY CLASSES
   ============================================ */
/* Display */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visible { display: block !important; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Grid */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 2px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-40 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 2px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

/* Text */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-mono { font-family: var(--font-mono); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Width */
.w-full { width: 100%; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-xl { max-width: 576px; }

/* ============================================
   43. RESPONSIVE
   ============================================ */

/* Hide floating TOC on medium screens */
@media (max-width: 1280px) {
  .floating-toc {
    display: none;
  }
}

/* Tablet — collapse sidebar */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .hamburger {
    display: flex;
  }

  .layout {
    margin-left: 0;
  }

  .search-bar kbd {
    display: none;
  }

  .search-bar span {
    display: none;
  }

  .search-bar {
    min-width: 32px;
    padding: 5px 8px;
    justify-content: center;
  }

  .card-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --content-padding: 20px;
  }

  .content {
    padding: 24px 20px 60px;
  }

  .page-title {
    font-size: var(--font-size-3xl);
  }

  .content h2 {
    font-size: var(--font-size-xl);
  }

  .home-hero {
    padding: 40px 20px;
  }

  .home-hero-title {
    font-size: var(--font-size-3xl);
  }

  .home-hero-subtitle {
    font-size: var(--font-size-base);
  }

  .home-section {
    padding: 24px 20px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .card-grid-2,
  .card-grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .search-modal {
    margin: 16px;
    border-radius: var(--radius-lg);
  }

  .search-overlay {
    padding-top: 60px;
    align-items: flex-start;
  }

  .calc-grid-2,
  .calc-grid-3 {
    grid-template-columns: 1fr;
  }

  .calc-comparison {
    grid-template-columns: 1fr;
  }

  .calc-hero {
    padding: 20px;
  }

  .calc-hero h1 {
    font-size: var(--font-size-xl);
  }

  .calc-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    margin: 16px;
    max-height: 90vh;
  }

  .steps {
    flex-direction: column;
    align-items: flex-start;
  }

  .step-item::after {
    display: none;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .home-hero {
    padding: 32px 16px;
  }

  .home-hero-title {
    font-size: var(--font-size-2xl);
  }

  .home-hero-subtitle {
    font-size: var(--font-size-sm);
  }

  .page-title {
    font-size: var(--font-size-xl);
  }

  .content {
    padding: 20px 16px 60px;
  }

  .home-section {
    padding: 20px 16px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .breadcrumb {
    font-size: var(--font-size-xs);
  }

  .tools-grid .tool-card {
    padding: 12px;
  }

  .home-footer {
    padding: 20px 16px;
  }
}

/* ============================================
   43. REGULATION FULL TEXT PAGE
   ============================================ */
.regulation-preamble {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 32px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.regulation-preamble h2 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.regulation-preamble p { margin-bottom: 8px; }
.bab-header {
  margin: 48px 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text-primary);
}
.bab-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.bab-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}
.pasal {
  margin-bottom: 28px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.pasal:hover { border-color: var(--text-muted); }
.pasal-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pasal-text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-primary);
}
.toc-bab { margin-bottom: 4px; }
.toc-bab a { font-weight: 600; font-size: 13px; }

/* ============================================
   44. PRINT STYLES
   ============================================ */
@media print {
  .header,
  .sidebar,
  .sidebar-overlay,
  .floating-toc,
  .back-to-top,
  .reading-progress,
  .search-overlay,
  .modal-overlay,
  .copy-toast,
  .alert-bar,
  .hamburger {
    display: none !important;
  }

  .layout {
    margin-left: 0 !important;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.5;
  }

  .content {
    max-width: 100%;
    padding: 0;
  }

  .content h2 {
    page-break-after: avoid;
    break-after: avoid;
  }

  .content pre {
    border: 1px solid #ddd;
    overflow-wrap: break-word;
    white-space: pre-wrap;
  }

  .card,
  .infobox,
  .calc-result-card {
    border: 1px solid #ddd;
    box-shadow: none;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  .no-print {
    display: none !important;
  }
}
