/* ============================================================
   BrightPath Guides — Professional Design System
   Primary: #2563EB | Secondary: #0F172A | BG: #F8FAFC
   Text: #334155 | Accent: #14B8A6
   ============================================================ */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary: #0F172A;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #334155;
  --text-muted: #64748B;
  --text-dark: #0F172A;
  --accent: #14B8A6;
  --accent-light: #CCFBF1;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --max-w: 1120px;
  --header-h: 68px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ========== HEADER ========== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 0 20px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-dark);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--text-dark); }
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #1D4ED8 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.brand-text strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-text small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-dark);
}
.menu-toggle:hover { background: var(--border-light); }
.menu-toggle svg { width: 24px; height: 24px; }

/* Search in header */
.header-search {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  max-width: 220px;
}
.header-search input {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  width: 100%;
  outline: none;
  min-width: 0;
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search button {
  background: var(--primary);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.header-search button:hover { background: var(--primary-dark); }
.header-search button svg { width: 16px; height: 16px; }

/* ========== MAIN ========== */
.main {
  flex: 1;
  padding: 32px 20px 48px;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

/* ========== HERO ========== */
.hero {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDFA 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 12px;
  max-width: 640px;
}
.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 24px;
  line-height: 1.6;
}
.hero .btn {
  margin-right: 10px;
  margin-bottom: 8px;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 600;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  line-height: 1.3;
}
.btn:hover {
  background: var(--primary-dark);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn:active { transform: scale(0.98); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  box-shadow: none;
}
.btn-accent {
  background: var(--accent);
}
.btn-accent:hover {
  background: #0D9488;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}
.btn-muted {
  background: var(--border-light);
  color: var(--text);
}
.btn-muted:hover {
  background: var(--border);
  color: var(--text-dark);
  box-shadow: none;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
}

/* ========== SECTION HEADERS ========== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}
.section-header a {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ========== CARDS / GRID ========== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
  transform: translateY(-2px);
}
.card-thumb .thumb-link {
  display: block;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #E0E7FF 0%, #CFFAFE 100%);
  overflow: hidden;
}
.card-thumb .thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.card:hover .thumb-link img { transform: scale(1.04); }
.card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card .meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.card .meta .cat {
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.card h2 {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.card h2 a {
  color: var(--text-dark);
  text-decoration: none;
}
.card h2 a:hover { color: var(--primary); }
.card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 12px;
  flex: 1;
  line-height: 1.55;
}
.card .more {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: auto;
}
.card .more:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 8px; }

/* ========== ARTICLE PAGE ========== */
.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 36px;
  max-width: 780px;
  margin: 0 auto;
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { font-weight: 500; }
.breadcrumb span { color: var(--border); }
.article .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.article .meta .cat-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.article h1 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
}
.article-hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 8px 0 20px;
}
.byline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.byline .read-time {
  color: var(--accent);
  font-weight: 600;
}
.article-body {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.75;
}
.article-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 28px 0 12px;
  letter-spacing: -0.015em;
}
.article-body h3 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 22px 0 10px;
}
.article-body p { margin-bottom: 14px; }
.article-body ul,
.article-body ol {
  margin: 10px 0 16px 1.5rem;
}
.article-body li { margin-bottom: 6px; }
.article-body a { font-weight: 500; }
.article-body img {
  border-radius: var(--radius-sm);
  margin: 16px 0;
}
.article-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 8px 16px;
  margin: 16px 0;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
}
.article-body th,
.article-body td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
.article-body th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-dark);
}

.author-box {
  margin-top: 32px;
  padding: 18px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.author-box strong {
  display: block;
  color: var(--text-dark);
  font-size: 0.98rem;
  margin-bottom: 4px;
}
.author-box p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.related-section {
  margin-top: 36px;
}
.related-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.back-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  place-items: center;
  box-shadow: var(--shadow-md);
  z-index: 50;
  transition: background 0.15s, transform 0.15s;
}
.back-top:hover { background: var(--primary); transform: translateY(-2px); }
.back-top.visible { display: grid; }
.back-top svg { width: 20px; height: 20px; }

/* ========== STATIC PAGES ========== */
.page-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 36px;
  max-width: 780px;
  margin: 0 auto;
}
.page-box h1 {
  font-size: clamp(1.4rem, 3vw, 1.7rem);
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}
.page-box h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 28px 0 10px;
  letter-spacing: -0.01em;
}
.page-box h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 20px 0 8px;
}
.page-box p {
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.7;
}
.page-box ul, .page-box ol {
  margin: 8px 0 14px 1.4rem;
  color: var(--text);
}
.page-box li { margin-bottom: 6px; line-height: 1.6; }
.page-box a { font-weight: 500; }

.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
}
.contact-form {
  margin-top: 16px;
  max-width: 520px;
}
.contact-form .btn { margin-top: 8px; }

.input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: inherit;
  margin-bottom: 12px;
  background: var(--surface);
  color: var(--text-dark);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.alert-err {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}
.alert-ok {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

/* ========== FOOTER ========== */
.site-footer {
  background: var(--secondary);
  color: #94A3B8;
  padding: 48px 0 28px;
  font-size: 0.88rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-bottom: 32px;
}
.footer-brand strong {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
}
.footer-brand p {
  color: #94A3B8;
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 280px;
}
.footer-col h4 {
  color: #E2E8F0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  color: #94A3B8;
  padding: 3px 0;
  font-size: 0.88rem;
  text-decoration: none;
}
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid #1E293B;
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #64748B;
}
.footer-bottom a { color: #94A3B8; }
.footer-bottom a:hover { color: #fff; }

/* ========== COOKIE BAR ========== */
.cookie-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--secondary);
  color: #E2E8F0;
  z-index: 9999;
  font-size: 0.88rem;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}
.cookie-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cookie-inner p {
  flex: 1;
  margin: 0;
  min-width: 200px;
  line-height: 1.5;
}
.cookie-inner a { color: #93C5FD; }
.cookie-inner .btn {
  flex-shrink: 0;
  background: #fff;
  color: var(--secondary);
  border: none;
}
.cookie-inner .btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: none;
}

/* ========== AD SLOTS ========== */
.ad-slot { margin: 20px auto; text-align: center; }
.ad-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94A3B8;
  margin-bottom: 6px;
}
.ad-ph {
  min-height: 50px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #94A3B8;
  font-size: 12px;
  background: var(--bg);
}
.ad-ph-box { min-height: 120px; max-width: 300px; margin: 0 auto; }

/* ========== 404 ========== */
.error-page {
  text-align: center;
  padding: 60px 20px;
}
.error-page h1 {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.error-page p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1.1rem;
}

/* ========== TOC ========== */
.toc {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 0 24px;
}
.toc strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-dark);
  margin-bottom: 8px;
}
.toc ol {
  margin: 0 0 0 1.2rem;
  font-size: 0.9rem;
}
.toc a { color: var(--text); }
.toc a:hover { color: var(--primary); }

/* ========== CATEGORY PILLS ========== */
.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.cat-pills a {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
}
.cat-pills a:hover,
.cat-pills a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  text-decoration: none;
}

/* ========== RESPONSIVE ========== */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

@media (max-width: 768px) {
  .menu-toggle { display: grid; place-items: center; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 16px 16px;
    gap: 2px;
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 12px 14px;
    width: 100%;
    border-radius: var(--radius-sm);
  }
  .header-search {
    display: none;
  }
  .site-header .nav { position: relative; }
  .hero { padding: 28px 22px; }
  .article, .page-box {
    padding: 24px 18px 28px;
    border-radius: var(--radius);
  }
  .main { padding: 24px 16px 40px; }
  .cookie-inner { flex-direction: column; align-items: stretch; }
  .cookie-inner .btn { width: 100%; text-align: center; justify-content: center; }
  .back-top { bottom: 20px; right: 16px; }
  .btn { min-height: 44px; }
  .input { font-size: 16px; }
}

@media (max-width: 480px) {
  .brand-text small { display: none; }
  .hero h1 { font-size: 1.35rem; }
  .grid { gap: 14px; }
}

/* Print */
@media print {
  .site-header, .site-footer, .cookie-bar, .back-top, .ad-slot, .menu-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .article, .page-box { border: none; box-shadow: none; }
}

/* ========== UX: Progress & tools ========== */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 200;
  transition: width 0.05s linear;
}
.read-progress-wrap {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 201;
  pointer-events: none;
}
.article-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}
.article-tools .btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-sans);
  text-decoration: none;
}
.article-tools .btn-tool:hover {
  background: var(--bg);
  border-color: #CBD5E1;
  color: var(--text-dark);
  text-decoration: none;
}
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--secondary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 300;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
a[target="_blank"]::after {
  content: "↗";
  font-size: 0.7em;
  margin-left: 3px;
  opacity: 0.55;
}

/* ========== Dark mode ========== */
html.theme-dark {
  color-scheme: dark;
}
html.theme-dark {
  --primary: #3B82F6;
  --primary-dark: #60A5FA;
  --primary-light: #1E3A5F;
  --secondary: #0B1220;
  --bg: #0F172A;
  --surface: #1E293B;
  --text: #CBD5E1;
  --text-muted: #94A3B8;
  --text-dark: #F1F5F9;
  --accent: #2DD4BF;
  --accent-light: #134E4A;
  --border: #334155;
  --border-light: #1E293B;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}
html.theme-dark body { background: var(--bg); color: var(--text); }
html.theme-dark .site-header { background: var(--surface); border-color: var(--border); }
html.theme-dark .brand { color: var(--text-dark); }
html.theme-dark .brand-text small { color: var(--text-muted); }
html.theme-dark .nav-links a { color: var(--text); }
html.theme-dark .nav-links a:hover,
html.theme-dark .nav-links a.active { background: var(--primary-light); color: var(--primary-dark); }
html.theme-dark .hero {
  background: linear-gradient(135deg, #1E3A5F 0%, #134E4A 100%);
  border-color: var(--border);
}
html.theme-dark .hero h1 { color: var(--text-dark); }
html.theme-dark .card,
html.theme-dark .article,
html.theme-dark .page-box {
  background: var(--surface);
  border-color: var(--border);
}
html.theme-dark .card h2 a { color: var(--text-dark); }
html.theme-dark .card h2 a:hover { color: var(--primary-dark); }
html.theme-dark .input {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-dark);
}
html.theme-dark .site-footer { background: #020617; }
html.theme-dark .cookie-bar { background: #020617; }
html.theme-dark .menu-toggle { color: var(--text-dark); }
html.theme-dark .header-search {
  background: var(--bg);
  border-color: var(--border);
}
html.theme-dark .header-search input { color: var(--text-dark); }
html.theme-dark .article-tools .btn-tool {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
html.theme-dark .empty-state {
  background: var(--surface);
  border-color: var(--border);
}
html.theme-dark .author-box,
html.theme-dark .contact-card,
html.theme-dark .toc {
  background: var(--bg);
  border-color: var(--border);
}
html.theme-dark .cat-pills a {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Theme toggle button */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-dark);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
html.theme-dark .theme-toggle .icon-moon { display: none; }
html.theme-dark .theme-toggle .icon-sun { display: block; }

@media (max-width: 768px) {
  .theme-toggle { order: 1; }
}

/* Page enter animation */
@keyframes bpFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.main {
  animation: bpFadeIn 0.35s ease-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .main { animation: none; }
  .scroll-progress { transition: none; }
  html { scroll-behavior: auto; }
}
