/* =========================================================
   CBQ.cool v3 · Editorial Warm Paper + Warm Obsidian Design System
   Strict cohesive palette · High-craft typography · Zero FOUC
   ========================================================= */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-tint: #f3efe6;
  --surface-hover: #f7f4ec;
  --border: #e7e2d8;
  --border-strong: #d4cdc0;
  --ink: #181715;
  --ink-2: #524d46;
  --ink-muted: #847d72;
  --accent: #0f6b56;
  --accent-hover: #0a5241;
  --accent-soft: #e6f4ef;
  --gold: #b45309;
  --gold-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --code-bg: #1e1d1a;
  --code-bar: #2a2824;
  --code-ink: #f3efe6;
  --shadow-sm: 0 1px 2px rgba(24, 23, 21, 0.04);
  --shadow-md: 0 10px 28px -8px rgba(24, 23, 21, 0.08);
  --shadow-lg: 0 24px 54px -16px rgba(24, 23, 21, 0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #121210;
  --surface: #1a1a17;
  --surface-tint: #23221d;
  --surface-hover: #25241f;
  --border: #2c2b25;
  --border-strong: #3e3c34;
  --ink: #f4f1ea;
  --ink-2: #bab4a9;
  --ink-muted: #868075;
  --accent: #34d399;
  --accent-hover: #10b981;
  --accent-soft: rgba(52, 211, 153, 0.12);
  --gold: #f59e0b;
  --gold-soft: rgba(245, 158, 11, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --code-bg: #151512;
  --code-bar: #201f1b;
  --code-ink: #ede9df;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 30px -8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 28px 60px -16px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-rendering: optimizeLegibility;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { width: min(100% - 2rem, 1140px); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2rem, 780px); margin-inline: auto; }
.muted { color: var(--ink-muted); }
.ink-2 { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Reading Progress Bar */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  z-index: 90;
  transition: width 60ms linear;
}

/* Sticky Frosted Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .brand-mark { color: #091914; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-link {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 150ms, color 150ms;
}
.nav-link:hover, .nav-link[aria-current="page"] {
  background: var(--surface-tint);
  color: var(--ink);
}
.nav-link[aria-current="page"] { font-weight: 600; color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 0.86rem;
  transition: border-color 150ms, color 150ms, background 150ms;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--ink); background: var(--surface-hover); }
.kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.38rem;
  border-radius: 5px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}
.pro-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 150ms, transform 150ms;
}
.pro-pill:hover { background: var(--accent-hover); transform: translateY(-1px); }
[data-theme="dark"] .pro-pill { color: #081a14; }

.mobile-menu-btn { display: none; }
.mobile-drawer {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0.75rem 1rem 1rem;
}
.mobile-drawer.open { display: flex; flex-direction: column; gap: 0.35rem; }

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  transition: transform 150ms, background 150ms, border-color 150ms, box-shadow 150ms;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
[data-theme="dark"] .btn-primary { color: #081a14; }
.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.btn-sm { min-height: 34px; padding: 0.35rem 0.8rem; font-size: 0.84rem; border-radius: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.62rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-tint);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }

/* Hero Masthead */
.hero-section {
  padding: clamp(2.8rem, 6vw, 4.6rem) 0 clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(60rem 26rem at 82% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 65%),
    radial-gradient(45rem 22rem at 12% 0%, color-mix(in srgb, var(--gold) 8%, transparent), transparent 65%);
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.15rem;
}
.hero-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  max-width: 22ch;
}
.hero-sub {
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0 0 1.65rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.hero-stats {
  margin-top: 2rem;
  padding-top: 1.35rem;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.6rem;
}
.stat-item strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.2;
}
.stat-item span { font-size: 0.82rem; color: var(--ink-muted); }

/* Sections & Cards */
.sec { padding: clamp(2rem, 4.5vw, 3.4rem) 0; }
.sec-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}
.sec-title {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  margin: 0;
  letter-spacing: -0.015em;
}
.sec-link { font-size: 0.9rem; font-weight: 600; color: var(--accent); }
.sec-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1.15rem, 2.5vw, 1.65rem);
  box-shadow: var(--shadow-sm);
}

/* Bento Grids */
.bento-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.bento-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.bento-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }

.pillar-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 180ms, border-color 180ms, box-shadow 180ms;
}
.pillar-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.pillar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
.pillar-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-muted); }
.pillar-card h3 { margin: 0 0 0.45rem; font-size: 1.05rem; font-family: var(--font-serif); }
.pillar-card p { margin: 0; font-size: 0.86rem; color: var(--ink-2); line-height: 1.55; }

/* Featured Roadmap Cards */
.featured-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.4rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 180ms, border-color 180ms, box-shadow 180ms;
}
.featured-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.featured-num {
  font-family: var(--font-serif);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.08em;
}
.featured-card h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.14rem;
  line-height: 1.4;
}
.featured-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: auto;
}

/* Tool Showcase Cards */
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.4rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 180ms, border-color 180ms, box-shadow 180ms;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}
.tool-card h3 { margin: 0; font-size: 1.08rem; font-family: var(--font-serif); }
.tool-card p { margin: 0; font-size: 0.89rem; color: var(--ink-2); }
.tool-go { margin-top: auto; font-size: 0.86rem; font-weight: 600; color: var(--accent); }

/* Editorial Article Stream */
.article-stream {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.stream-item {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.25rem 1.4rem;
  border-top: 1px solid var(--border);
  transition: background 140ms;
}
.stream-item:first-child { border-top: 0; }
.stream-item:hover { background: var(--surface-hover); }
.stream-item h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.14rem;
  line-height: 1.42;
}
.stream-item:hover h3 { color: var(--accent); }
.stream-excerpt {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-chip {
  font-size: 0.76rem;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-tint);
  color: var(--ink-2);
}

/* Filter Toolbar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.pill-tabs { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pill-tab {
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  transition: all 140ms;
}
.pill-tab:hover { border-color: var(--border-strong); color: var(--ink); }
.pill-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
[data-theme="dark"] .pill-tab.active { color: #081a14; }

.search-form { display: flex; gap: 0.5rem; flex: 1; max-width: 340px; }
.input {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: center; margin-top: 1.8rem; }
.pager a, .pager span {
  min-width: 38px;
  height: 38px;
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 500;
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
[data-theme="dark"] .pager .current { color: #081a14; }

/* Article Reading Layout */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 2.2rem;
  align-items: start;
  padding: 1.8rem 0 3rem;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--ink-muted);
  margin-bottom: 1.1rem;
}
.breadcrumb a:hover { color: var(--accent); }

.article-paper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 4vw, 2.8rem);
  box-shadow: var(--shadow-sm);
}
.article-header { padding-bottom: 1.5rem; margin-bottom: 1.8rem; border-bottom: 1px solid var(--border); }
.article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3.4vw, 2.35rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
  margin: 0.8rem 0 1rem;
}
.article-summary-box {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  background: var(--surface-tint);
  border-left: 3px solid var(--accent);
  font-size: 0.94rem;
  color: var(--ink-2);
}

/* Editorial Prose */
.prose {
  font-size: var(--prose-size, 17px);
  line-height: 1.88;
  color: var(--ink);
  max-width: 68ch;
  overflow-wrap: anywhere;
}
.prose.size-lg { --prose-size: 19px; }
.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.42em;
  line-height: 1.35;
  margin: 2.1em 0 0.8em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 84px;
}
.prose h3 {
  font-family: var(--font-serif);
  font-size: 1.18em;
  margin: 1.65em 0 0.6em;
  scroll-margin-top: 84px;
}
.prose p { margin: 0 0 1.2em; }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.45em; }
.prose li { margin-bottom: 0.42em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 0.9rem 1.2rem;
  background: var(--surface-tint);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  color: var(--ink-2);
}
.prose img {
  display: block;
  margin: 1.5rem auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
}
.prose th { background: var(--surface-tint); font-weight: 600; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  padding: 0.14em 0.4em;
  border-radius: 5px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
}

/* macOS Code Blocks */
.code-box {
  margin: 1.45rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid #302d27;
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: var(--code-bar);
  border-bottom: 1px solid #36332c;
}
.code-dots { display: inline-flex; gap: 6px; }
.code-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; background: #5a554c; }
.code-dots i:nth-child(1) { background: #ef6b5b; }
.code-dots i:nth-child(2) { background: #e8b34a; }
.code-dots i:nth-child(3) { background: #53b868; }
.code-lang { font-family: var(--font-mono); font-size: 0.72rem; color: #b5afa4; letter-spacing: 0.06em; }
.code-copy {
  border: 1px solid #49453c;
  background: transparent;
  color: #e2ddd3;
  font-size: 0.75rem;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}
.code-copy:hover { background: rgba(255, 255, 255, 0.08); }
.code-box pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--code-ink);
}
.code-box pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

/* Paywall Gate */
.paywall-fade {
  position: relative;
  margin-top: -4.5rem;
  padding-top: 5.5rem;
  background: linear-gradient(180deg, transparent 0%, var(--surface) 45%);
}
.paywall-box {
  border: 1px solid var(--gold);
  background: color-mix(in srgb, var(--gold-soft) 45%, var(--surface));
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-align: center;
}
.paywall-box h3 { font-family: var(--font-serif); margin: 0.5rem 0 0.5rem; font-size: 1.35rem; }
.paywall-box p { color: var(--ink-2); max-width: 48ch; margin: 0 auto 1.25rem; font-size: 0.94rem; }

/* Sticky TOC Sidebar */
.toc-aside { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 1rem; }
.toc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}
.toc-title { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); margin: 0 0 0.7rem; }
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; max-height: 55vh; overflow-y: auto; }
.toc-list a {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-2);
  padding: 0.25rem 0.55rem;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  line-height: 1.4;
}
.toc-list a.lv-3 { padding-left: 1.1rem; font-size: 0.81rem; }
.toc-list a:hover, .toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Action Bar & Prev/Next */
.article-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.prev-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.6rem; }
.pn-card {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 150ms;
}
.pn-card:hover { border-color: var(--accent); }
.pn-label { font-size: 0.78rem; color: var(--ink-muted); display: block; margin-bottom: 0.25rem; }
.pn-title { font-family: var(--font-serif); font-size: 0.96rem; font-weight: 600; }

/* Pricing Cards */
.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: stretch; }
.plan-card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
}
.plan-card.highlight {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-md);
}
.plan-price {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 0.9rem 0 0.4rem;
}
.plan-price small { font-family: var(--font-sans); font-size: 0.9rem; font-weight: 500; color: var(--ink-muted); }
.plan-features { list-style: none; padding: 0; margin: 1.25rem 0 1.6rem; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.92rem; color: var(--ink-2); }
.plan-features li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

/* Interactive Tools Workspace */
.tool-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-sm);
}
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.meter-track { height: 8px; border-radius: 999px; background: var(--surface-tint); overflow: hidden; margin-top: 0.4rem; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 150ms, background 150ms; }
.serp-box {
  background: #fff;
  color: #202124;
  border: 1px solid #dadce0;
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  font-family: Arial, sans-serif;
}
.serp-url { font-size: 13px; color: #4d5156; margin-bottom: 4px; word-break: break-all; }
.serp-title { font-size: 20px; line-height: 1.3; color: #1a0dab; margin: 0 0 6px; font-weight: 400; }
.serp-desc { font-size: 14px; line-height: 1.55; color: #4d5156; margin: 0; }
.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  cursor: pointer;
}
.chip-toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Command Palette Modal (Cmd+K) */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 16, 0.56);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
}
.cmdk-backdrop.open { display: flex; }
.cmdk-dialog {
  width: min(100%, 600px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.cmdk-input { flex: 1; border: 0; background: transparent; font-size: 1rem; outline: none; }
.cmdk-results { max-height: 56vh; overflow-y: auto; padding: 0.5rem; }
.cmdk-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  font-size: 0.92rem;
}
.cmdk-item:hover { background: var(--surface-tint); }
.cmdk-foot { padding: 0.55rem 1rem; border-top: 1px solid var(--border); font-size: 0.76rem; color: var(--ink-muted); display: flex; justify-content: space-between; }

/* Lightbox & Toast & Back-to-Top (AdSense-safe bottom: 84px) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 9, 0.86);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1.15rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 130;
  transition: opacity 180ms, transform 180ms;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.btt-btn {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  z-index: 50;
}
.btt-btn.show { opacity: 1; pointer-events: auto; }
.btt-btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }

/* Footer */
.site-footer {
  margin-top: 3.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2.6rem 0 2rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
.footer-col h4 { font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); margin: 0 0 0.8rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.9rem; color: var(--ink-2); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .bento-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-3, .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: 1fr; }
  .toc-aside { position: static; order: -1; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .nav-links, .hide-sm { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .bento-4, .bento-3, .bento-2, .pricing-grid, .tool-grid, .prev-next, .footer-grid { grid-template-columns: 1fr; }
  .search-form { max-width: 100%; }
}
