/* ==========================================================================
   ONLINE NOTEPAD — Design System
   A world-class design system for the #1 online notepad
   ========================================================================== */

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  transition: all 0.2s ease;
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   2. DESIGN TOKENS — Light Mode (Default)
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-primary: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --bg-inset: #E2E8F0;
  --bg-editor: #FFFFFF;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-inverse: #FFFFFF;

  /* Accent */
  --accent-primary: #6366F1;
  --accent-hover: #4F46E5;
  --accent-subtle: rgba(99, 102, 241, 0.08);
  --accent-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #A855F7 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #9333EA 100%);

  /* Semantic */
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.1);

  /* Borders */
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #6366F1;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-blur: blur(16px);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 800px;
  --header-height: 64px;
  --sidebar-width: 280px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* --------------------------------------------------------------------------
   3. DESIGN TOKENS — Dark Mode
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-primary: #0B0F19;
  --bg-surface: #131825;
  --bg-elevated: #1A2035;
  --bg-inset: #0F1420;
  --bg-editor: #131825;

  --text-primary: #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-inverse: #0F172A;

  --accent-primary: #818CF8;
  --accent-hover: #A5B4FC;
  --accent-subtle: rgba(129, 140, 248, 0.1);

  --border: #1E293B;
  --border-strong: #334155;
  --border-focus: #818CF8;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 30px rgba(129, 140, 248, 0.15);

  --glass-bg: rgba(19, 24, 37, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
}

/* --------------------------------------------------------------------------
   4. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: var(--space-3xl); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); margin-top: var(--space-2xl); }
h4 { font-size: 1.15rem; margin-top: var(--space-xl); }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; }

p {
  margin-top: var(--space-md);
  color: var(--text-secondary);
}

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

small, .text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-center { text-align: center; }

.font-mono { font-family: var(--font-mono); }

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --------------------------------------------------------------------------
   5. LAYOUT
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-4xl);
}

/* --------------------------------------------------------------------------
   6. HEADER
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.nav-main {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) ease;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--accent-subtle);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent-primary);
  background: var(--accent-subtle);
}

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.mobile-menu-btn:hover {
  background: var(--bg-elevated);
}

.hamburger {
  width: 20px;
  height: 14px;
  position: relative;
}

.hamburger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 6px; }
.hamburger span:nth-child(3) { top: 12px; }

.mobile-menu-btn.active .hamburger span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.mobile-menu-btn.active .hamburger span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .hamburger span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 1.15rem;
  transition: all var(--duration-fast) ease;
}

.theme-toggle:hover {
  background: var(--accent-subtle);
  color: var(--accent-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --------------------------------------------------------------------------
   7. HERO SECTION
   -------------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: var(--space-3xl) 0 var(--space-2xl);
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

[data-theme="dark"] .hero::before {
  background: radial-gradient(circle, rgba(129, 140, 248, 0.06) 0%, transparent 70%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--accent-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-primary);
  margin-bottom: var(--space-lg);
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

.hero h1 {
  margin-bottom: var(--space-md);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   8. EDITOR
   -------------------------------------------------------------------------- */
.editor-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.editor-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .editor-wrapper:focus-within {
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(129, 140, 248, 0.08);
}

/* Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 var(--space-sm);
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast) ease;
  white-space: nowrap;
  position: relative;
}

.toolbar-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.toolbar-btn:active {
  transform: scale(0.96);
}

.toolbar-btn.active {
  background: var(--accent-subtle);
  color: var(--accent-primary);
}

.toolbar-btn svg,
.toolbar-btn .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toolbar-btn .btn-label {
  display: inline;
}

/* Tooltip for toolbar buttons */
.toolbar-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 4px 10px;
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-fast) ease;
  z-index: 10;
}

.toolbar-btn[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* Text area */
.editor-textarea {
  width: 100%;
  min-height: 500px;
  padding: var(--space-lg) var(--space-xl);
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-primary);
  background: var(--bg-editor);
  tab-size: 4;
}

.editor-textarea::placeholder {
  color: var(--text-muted);
}

.editor-textarea::selection {
  background: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .editor-textarea::selection {
  background: rgba(129, 140, 248, 0.2);
}

/* Status bar */
.editor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.status-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.status-dot.saving {
  background: var(--warning);
  animation: pulse 1s ease infinite;
}

/* Find & Replace Bar */
.find-replace-bar {
  display: flex;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.find-replace-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.find-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.find-input {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  outline: none;
  width: 180px;
  transition: border-color var(--duration-fast) ease;
}

.find-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.find-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-left: 2px;
}

@media (max-width: 768px) {
  .find-input {
    width: 100%;
    flex: 1;
    min-width: 100px;
  }

  .find-row {
    gap: var(--space-xs);
  }
}

/* Fullscreen mode */
.editor-wrapper.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  border-radius: 0;
  border: none;
}

.editor-wrapper.fullscreen .editor-textarea {
  min-height: calc(100vh - 100px);
}

/* --------------------------------------------------------------------------
   9. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 0 0 rgba(99, 102, 241, 0);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  color: white;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.btn-ghost {
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   10. CARDS
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-link:hover {
  text-decoration: none;
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  margin-bottom: var(--space-md);
  transition: all 0.3s ease;
}

.card:hover .card-icon {
  background: var(--accent-gradient);
  color: white;
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* --------------------------------------------------------------------------
   11. FEATURES SECTION
   -------------------------------------------------------------------------- */
.features {
  padding: var(--space-4xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  margin-top: 0;
}

.section-header p {
  max-width: 600px;
  margin: var(--space-sm) auto 0;
}

.section-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   12. HUB NAVIGATION (Pillar links on homepage)
   -------------------------------------------------------------------------- */
.hub-nav {
  padding: var(--space-4xl) 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-lg);
}

/* --------------------------------------------------------------------------
   13. BREADCRUMBS
   -------------------------------------------------------------------------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-muted);
  transition: color var(--duration-fast) ease;
}

.breadcrumbs a:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.breadcrumbs .separator {
  color: var(--border-strong);
  font-size: 0.7rem;
}

.breadcrumbs .current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   14. CONTENT PAGES (Articles / Guides)
   -------------------------------------------------------------------------- */
.article-content {
  max-width: var(--container-narrow);
  margin: 0 auto;
}

.article-content h2 {
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.article-content h3 {
  margin-top: var(--space-2xl);
}

.article-content p {
  margin-top: var(--space-md);
  line-height: 1.8;
}

.article-content ul,
.article-content ol {
  margin-top: var(--space-md);
  padding-left: var(--space-xl);
}

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

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

.article-content li {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  line-height: 1.7;
}

.article-content blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--accent-primary);
  background: var(--accent-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-primary);
}

.article-content table {
  width: 100%;
  margin-top: var(--space-lg);
  border-collapse: collapse;
  font-size: 0.9rem;
}

.article-content th,
.article-content td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.article-content th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.article-content td {
  color: var(--text-secondary);
}

/* Table of Contents */
.toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
}

.toc-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

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

.toc li {
  margin-top: var(--space-xs);
}

.toc a {
  display: block;
  padding: 4px 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  padding-left: var(--space-md);
  transition: all var(--duration-fast) ease;
}

.toc a:hover {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
  text-decoration: none;
}

/* FAQ Section */
.faq-section {
  margin-top: var(--space-3xl);
}

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

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-lg) 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  gap: var(--space-md);
}

.faq-question:hover {
  color: var(--accent-primary);
}

.faq-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out), padding 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding-bottom: var(--space-lg);
}

.faq-answer p {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Related Content */
.related-content {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}

.related-content h3 {
  margin-top: 0;
  margin-bottom: var(--space-lg);
}

/* --------------------------------------------------------------------------
   15. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand p {
  font-size: 0.9rem;
  margin-top: var(--space-md);
  max-width: 300px;
}

.footer-col-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: color var(--duration-fast) ease;
}

.footer-links a:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-bottom-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-bottom-links a {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-bottom-links a:hover {
  color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   16. TOAST / NOTIFICATION
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  color: var(--text-primary);
  animation: toast-in 0.4s var(--ease-out);
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-exit {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
}

/* --------------------------------------------------------------------------
   17. MODAL / DIALOG
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fade-in 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 100%;
  padding: var(--space-xl);
  transform: scale(0.95);
  transition: transform 0.3s var(--ease-out);
}

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

.modal h3 {
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

/* --------------------------------------------------------------------------
   18. SCROLL TO TOP
   -------------------------------------------------------------------------- */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 80px;
  width: 44px;
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* --------------------------------------------------------------------------
   19. UTILITIES
   -------------------------------------------------------------------------- */
.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;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   20. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .nav-main {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--ease-out);
    z-index: 999;
  }

  .nav-main.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    width: 100%;
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

  .mobile-menu-btn {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .editor-textarea {
    min-height: 350px;
    padding: var(--space-md);
  }

  .toolbar-btn .btn-label {
    display: none;
  }

  .hero {
    padding: var(--space-xl) 0;
  }

  h1 { font-size: 1.75rem; }

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

  .status-group {
    width: 100%;
    justify-content: space-between;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    max-width: 100%;
  }

  .scroll-top-btn {
    right: 16px;
  }
}

@media (max-width: 480px) {
  :root {
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
    --space-4xl: 3rem;
  }

  .editor-toolbar {
    padding: var(--space-xs) var(--space-sm);
  }

  .toolbar-btn {
    padding: 6px 8px;
  }

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

/* --------------------------------------------------------------------------
   21. ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fade-up 0.6s var(--ease-out) both;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* Print */
@media print {
  .site-header,
  .site-footer,
  .editor-toolbar,
  .editor-status,
  .scroll-top-btn,
  .toast-container,
  .theme-toggle {
    display: none !important;
  }

  .editor-textarea {
    border: none;
    box-shadow: none;
    padding: 0;
    min-height: auto;
  }

  body {
    background: white;
    color: black;
  }
}
