
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
  display: flex; align-items: center;
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); }
.logo { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--fs-lg); letter-spacing: -0.01em; flex-shrink: 0; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--gradient-accent);
  display: grid; place-items: center; flex-shrink: 0; font-size: 16px;
  box-shadow: var(--shadow-glow-blue);
}
.nav-links { display: flex; align-items: center; gap: var(--space-5); font-size: var(--fs-sm); font-weight: 600; }
.nav-links a { color: var(--text-secondary); transition: color var(--duration-fast) var(--ease-out); white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-primary); }
.nav-actions { display: flex; align-items: center; gap: var(--space-3); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: var(--space-2); color: var(--text-primary); }
@media (max-width: 980px) {
  .nav-links { position: absolute; top: var(--header-height); left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 0; background: var(--bg-primary); border-bottom: 1px solid var(--border); padding: 0 var(--space-6); max-height: 0; overflow: hidden; transition: max-height var(--duration-base) var(--ease-out); }
  .nav-links.nav-open { max-height: 480px; padding-block: var(--space-4); }
  .nav-links a { padding-block: var(--space-3); width: 100%; }
  .nav-toggle { display: block; }
}

/* Theme toggle — icon switch, top-right of header */
.theme-toggle {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; flex-shrink: 0; display: grid; place-items: center;
  transition: background var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out), transform var(--duration-fast) var(--ease-out);
  color: var(--text-primary);
}
.theme-toggle:hover { border-color: var(--accent-primary); transform: translateY(-1px); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.8rem 1.6rem; border-radius: var(--radius-button);
  font-size: var(--fs-sm); font-weight: 700; border: 1px solid transparent; cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), filter var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--accent-primary); color: var(--on-accent); box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow-blue); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent-primary); color: var(--accent-primary); background: var(--bg-card-hover); transform: translateY(-1px); }
.btn-sm { padding: 0.55rem 1.1rem; font-size: var(--fs-xs); }
.btn-lg { padding: 1rem 2.1rem; font-size: var(--fs-base); }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--space-5);
  transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
}
.card-interactive:hover { transform: translateY(-5px); border-color: var(--accent-primary); box-shadow: var(--shadow-lg); }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: var(--space-6); box-shadow: var(--shadow-md); }

.tool-card { display: flex; flex-direction: column; gap: var(--space-3); }
.tool-card-icon {
  width: 46px; height: 46px; border-radius: var(--radius-input);
  background: rgba(11,95,255,0.10); border: 1px solid rgba(11,95,255,0.22);
  display: grid; place-items: center; color: var(--accent-primary); font-size: 21px;
}
.tool-card h4 { font-size: var(--fs-base); }
.tool-card p { font-size: var(--fs-sm); margin: 0; }
.tool-card .tool-link { margin-top: auto; font-size: var(--fs-sm); font-weight: 700; color: var(--accent-primary); display: inline-flex; align-items: center; gap: var(--space-1); }

.section-head { max-width: 680px; margin-bottom: var(--space-7); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { margin-top: var(--space-2); }
.section-head h1 { margin-top: var(--space-2); }

.category-section { margin-bottom: var(--space-8); scroll-margin-top: calc(var(--header-height) + var(--space-4)); }
.category-section:last-child { margin-bottom: 0; }
.category-section-title { display: flex; align-items: center; gap: var(--space-3); font-size: var(--fs-xl); margin-bottom: var(--space-5); color: var(--accent-primary); }
.category-section-title svg { flex-shrink: 0; color: var(--accent-primary); }
.category-section-title span { color: var(--text-primary); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
@media (max-width: 960px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-7); background: var(--bg-secondary); }
.footer-grid { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: var(--space-6); margin-bottom: var(--space-7); }
.footer-col h5 { font-size: var(--fs-sm); margin-bottom: var(--space-3); color: var(--text-primary); }
.footer-col a { display: block; font-size: var(--fs-sm); color: var(--text-secondary); padding-block: var(--space-1); transition: color var(--duration-fast); }
.footer-col a:hover { color: var(--accent-primary); }
/* Categories column: all 11 categories as a single plain vertical link
   list split across two columns, instead of each category getting its own
   separate boxed footer-col (which looked segregated/fragmented). */
.footer-cat-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-5); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: var(--space-5); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-muted); flex-wrap: wrap; gap: var(--space-3); }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

.hero { position: relative; overflow: hidden; padding-block: var(--space-9) var(--space-8); }
.hero::before { content: ""; position: absolute; inset: 0; background: var(--gradient-glow); pointer-events: none; }
.hero-content { position: relative; max-width: 740px; }
.hero h1 { margin-bottom: var(--space-4); }
.hero p.lead { font-size: var(--fs-lg); margin-bottom: var(--space-6); }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.breadcrumb { color: var(--text-muted); font-size: var(--fs-sm); padding-top: var(--space-5); display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-primary); }

.trust-bar { display: flex; gap: var(--space-7); flex-wrap: wrap; padding-block: var(--space-6); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.trust-stat .stat-value { font-size: var(--fs-2xl); font-weight: 800; }
.trust-stat .stat-label { font-size: var(--fs-sm); color: var(--text-secondary); }

.tool-frame-wrap {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: var(--space-6); box-shadow: var(--shadow-md);
}

.prose { max-width: 760px; }
.prose p { margin-bottom: var(--space-4); font-size: var(--fs-base); }
.prose h2 { margin-top: var(--space-7); margin-bottom: var(--space-3); }
.prose h3 { margin-top: var(--space-7); margin-bottom: var(--space-3); }
.prose a { color: var(--accent-primary); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--accent-primary-dark); }
.tip-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.tip-list li { list-style: none; display: flex; gap: var(--space-3); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-input); padding: var(--space-4); font-size: var(--fs-sm); color: var(--text-secondary); }
.tip-list li::before { content: "→"; color: var(--accent-primary); font-weight: 800; flex-shrink: 0; }
.faq-item { border-bottom: 1px solid var(--border); padding-block: var(--space-5); }
.faq-item h3, .faq-item h4 { font-size: var(--fs-base); margin-top: 0; margin-bottom: var(--space-2); }
.faq-item p { margin: 0; }
.step-list { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); padding: 0; }
.step-list li { counter-increment: step; display: flex; gap: var(--space-3); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-input); padding: var(--space-4); font-size: var(--fs-sm); color: var(--text-secondary); }
.step-list li::before { content: counter(step); flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-primary); color: var(--on-accent); font-size: var(--fs-xs); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.prose-table-wrap { overflow-x: auto; margin: var(--space-4) 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-input); overflow: hidden; }
.prose th, .prose td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.prose th { background: var(--bg-secondary); font-weight: 700; color: var(--text-primary); }
.prose tr:last-child td { border-bottom: none; }

.blog-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--space-2); }
.article-meta { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--space-6); }

/* ---------------------------------------------------------------------------
   Persistent left sidebar (global site chrome, present on every page).
   Layout: .site-body-layout is a flex row of [.site-sidebar, .site-main-col],
   inserted as a sibling wrapper around the existing <main>. On narrow
   viewports the sidebar becomes an off-canvas drawer toggled by a floating
   button, so it never squeezes page content into a thin column.
--------------------------------------------------------------------------- */
.site-body-layout { display: flex; align-items: flex-start; }
.site-main-col { flex: 1 1 0%; min-width: 0; }

.site-sidebar {
  width: 272px; flex-shrink: 0;
  position: sticky; top: var(--header-height);
  /* max-height (not height) so the sidebar only ever grows to its own
     natural content size — using a fixed height here previously forced
     the whole two-column flex row to be at least full-viewport-tall on
     EVERY page, even short ones (like blog posts), leaving a large blank
     gap between short content and the footer. max-height still caps and
     scrolls the sidebar internally on the rare page where its own content
     (many expanded categories) would otherwise exceed the viewport. */
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
}
.sidebar-scroll { padding: var(--space-5) var(--space-4) var(--space-7); }
.sidebar-heading {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 var(--space-2) var(--space-3);
}
.sidebar-category + .sidebar-category { margin-top: var(--space-1); }

.sidebar-cat-row { display: flex; align-items: stretch; border-radius: var(--radius-input); }
.sidebar-cat-link {
  /* This is a <button> (categories no longer navigate anywhere), so the
     browser's default button chrome — border, background, font — needs an
     explicit reset here, same as .sidebar-cat-toggle already has, or it
     shows through as an unwanted boxy border around the category name. */
  background: none; border: none; cursor: pointer; font-family: inherit; text-align: left;
  flex: 1; display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-2); border-radius: var(--radius-input);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.sidebar-cat-link:hover { background: var(--bg-card-hover); color: var(--accent-primary); }
.sidebar-cat-link.active-cat { color: var(--accent-primary); }
.sidebar-cat-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-cat-name { flex: 1; }
.sidebar-cat-toggle {
  display: grid; place-items: center; width: 36px; flex-shrink: 0;
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  border-radius: var(--radius-input);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.sidebar-cat-toggle:hover { background: var(--bg-card-hover); color: var(--accent-primary); }
.sidebar-chevron { transition: transform var(--duration-base) var(--ease-out); }
.sidebar-category.open > .sidebar-cat-row .sidebar-chevron { transform: rotate(90deg); }
.sidebar-category.open > .sidebar-cat-row .sidebar-cat-toggle { color: var(--accent-primary); }

.sidebar-tool-list {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-base) var(--ease-out);
}
.sidebar-category.open .sidebar-tool-list { grid-template-rows: 1fr; }
.sidebar-tool-list-inner { overflow: hidden; display: flex; flex-direction: column; padding-left: var(--space-6); }
.sidebar-tool-list a {
  padding: var(--space-2) var(--space-2); margin-block: 1px;
  font-size: var(--fs-sm); color: var(--text-secondary); border-radius: var(--radius-input);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.sidebar-tool-list a:hover { background: var(--bg-card-hover); color: var(--accent-primary); }
.sidebar-tool-list a.active { color: var(--accent-primary); font-weight: 700; background: rgba(11,95,255,0.10); }

.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 980px) {
  .site-body-layout { display: block; }
  .site-sidebar {
    position: fixed; top: 0; left: 0; z-index: 200;
    width: 82vw; max-width: 320px; height: 100vh;
    padding-top: var(--header-height);
    transform: translateX(-100%);
    transition: transform var(--duration-base) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .site-sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 190;
    background: rgba(8, 12, 24, 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity var(--duration-base) var(--ease-out);
  }
  .sidebar-backdrop.active { opacity: 1; pointer-events: auto; }
  .sidebar-toggle {
    display: flex; align-items: center; gap: var(--space-2);
    position: fixed; left: var(--space-4); bottom: var(--space-4); z-index: 210;
    background: var(--accent-primary); color: var(--on-accent); border: none;
    padding: 0.75rem 1.2rem; border-radius: var(--radius-pill);
    font-size: var(--fs-sm); font-weight: 700; box-shadow: var(--shadow-lg); cursor: pointer;
  }
}
