/* ═══════════════════════════════════════════════════════════════════════════
   Formcierge Docs — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg-page:    #f8fafc;
    --bg-content: #ffffff;
    --bg-hover:   #f1f5f9;
    --bg-active:  #faf5ff;

    /* Borders */
    --border:     #e2e8f0;

    /* Brand */
    --brand:       #7c3aed;
    --brand-hover: #6d28d9;
    --brand-light: #ede9fe;

    /* Text */
    --text-primary: #0f172a;
    --text-body:    #475569;
    --text-muted:   #94a3b8;
    --text-sidebar: #64748b;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;

    /* Border radius */
    --radius-sm:     4px;
    --radius-md:     8px;
    --radius-lg:     10px;
    --radius-full:   9999px;
    --radius-circle: 50%;

    /* Layout */
    --header-h:   56px;
    --sidebar-w:  280px;
    --toc-w:      200px;
    --content-max: 720px;
}

/* ── Dark mode tokens ──────────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-page:    #0f1117;
    --bg-content: #181c25;
    --bg-hover:   #232838;
    --bg-active:  #2a2250;

    --border:     #2d3348;

    --brand:       #a78bfa;
    --brand-hover: #c4b5fd;
    --brand-light: #2e1f5e;

    --text-primary: #f1f5f9;
    --text-body:    #94a3b8;
    --text-muted:   #64748b;
    --text-sidebar: #94a3b8;
}

/* Dark: invert Prism okaidia — already dark, just ensure backgrounds blend */
[data-theme="dark"] pre[class*="language-"],
[data-theme="dark"] code[class*="language-"] {
    background: #0d1117;
}

/* Dark: search bar placeholder text */
[data-theme="dark"] .docs-search-placeholder {
    color: var(--text-muted);
}

/* Dark: sidebar/nav backgrounds */
[data-theme="dark"] .docs-sidebar,
[data-theme="dark"] .docs-mobile-nav {
    background: var(--bg-content);
    border-color: var(--border);
}

/* Dark mode toggle button */
.dark-mode-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.dark-mode-toggle:hover {
    background: var(--brand-light);
    color: var(--brand);
    border-color: var(--brand-light);
}
.dark-mode-toggle .icon-sun  { display: none; }
.dark-mode-toggle .icon-moon { display: block; }
[data-theme="dark"] .dark-mode-toggle .icon-sun  { display: block; }
[data-theme="dark"] .dark-mode-toggle .icon-moon { display: none; }

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-body);
    background: var(--bg-page);
    padding-top: var(--header-h);
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Header ────────────────────────────────────────────────────────────── */
.docs-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg-content);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    z-index: 500;
}

.docs-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}
.docs-logo:hover { text-decoration: none; }

.docs-logo-mark {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.docs-logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.docs-logo-badge {
    font-size: 11px;
    background: var(--bg-hover);
    color: var(--text-sidebar);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.docs-search-bar {
    flex: 1;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 7px 12px;
    cursor: text;
    transition: border-color .15s;
}
.docs-search-bar:hover { border-color: var(--brand); }
.docs-search-icon { color: var(--text-muted); flex-shrink: 0; }
.docs-search-placeholder { font-size: 13px; color: var(--text-muted); flex: 1; user-select: none; }
.docs-search-kbd {
    background: var(--bg-hover);
    color: var(--text-sidebar);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: inherit;
    flex-shrink: 0;
}

.docs-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}
.docs-nav a {
    font-size: 13px;
    color: var(--text-sidebar);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s, background .15s;
}
.docs-nav a:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.docs-nav a.active { color: var(--brand); font-weight: 600; }
.docs-nav-cta {
    background: var(--brand) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 14px !important;
    margin-left: 4px;
}
.docs-nav-cta:hover { background: var(--brand-hover) !important; color: #fff !important; text-decoration: none; }

.docs-hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    margin-left: auto;
}
.docs-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.docs-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.docs-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.docs-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Footer ────────────────────────────────────────────────────────────── */
.docs-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 var(--space-xl);
    background: var(--bg-page);
    border-top: 1px solid var(--border);
    margin-top: var(--space-xl);
}
.docs-footer-copy { font-size: 13px; color: var(--text-muted); }
.docs-footer-nav { display: flex; gap: 16px; }
.docs-footer-nav a { font-size: 13px; color: var(--text-sidebar); text-decoration: none; }
.docs-footer-nav a:hover { color: var(--brand); text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.docs-layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
    align-items: stretch;
}

/* Main content area */
.docs-main {
    flex: 1;
    padding: var(--space-xl);
    max-width: var(--content-max);
    min-width: 0;
}
.docs-main--full {
    max-width: 760px;
    margin: 0 auto;
}
.docs-main--wide {
    max-width: 960px;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.docs-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-page);
    border-right: 1px solid var(--border);
    padding: var(--space-lg) 0;
    overflow-y: auto;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    align-self: flex-start;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}
.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}
.docs-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.docs-sidebar-inner { padding-bottom: var(--space-xl); }

.sidebar-section { margin-bottom: var(--space-xs); }

.sidebar-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md) var(--space-xs);
    display: block;
}

.sidebar-item {
    display: block;
    font-size: 13px;
    color: var(--text-sidebar);
    padding: 6px var(--space-md);
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: color .12s, background .12s;
    line-height: 1.4;
}
.sidebar-item:hover { color: var(--text-primary); background: var(--bg-hover); text-decoration: none; }
.sidebar-item.active {
    color: var(--brand);
    font-weight: 600;
    background: var(--bg-active);
    border-left-color: var(--brand);
}

.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 90;
}

/* ── TOC (Table of Contents) ───────────────────────────────────────────── */
.docs-toc {
    width: var(--toc-w);
    flex-shrink: 0;
    padding: var(--space-xl) var(--space-md);
    border-left: 1px solid var(--border);
    background: var(--bg-content);
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    align-self: flex-start;
}

.toc-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.toc-item {
    display: block;
    font-size: 12px;
    color: var(--text-sidebar);
    padding: 4px 0 4px 8px;
    border-left: 2px solid transparent;
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 2px;
    transition: color .12s;
}
.toc-item:hover { color: var(--brand); text-decoration: none; }
.toc-item.active { color: var(--brand); font-weight: 500; border-left-color: var(--brand); }

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text-body); }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}
.badge-beginner    { background: #f0fdf4; color: #16a34a; }
.badge-intermediate{ background: #eff6ff; color: #2563eb; }
.badge-advanced    { background: var(--bg-active); color: var(--brand); }
.badge-version     { background: var(--bg-hover); color: var(--text-sidebar); }

/* ── Tutorial meta ─────────────────────────────────────────────────────── */
.tutorial-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.tutorial-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 16px;
}

.tutorial-intro {
    font-size: 15px;
    color: var(--text-body);
    line-height: 1.7;
    margin-bottom: 28px;
    border-left: 3px solid var(--border);
    padding-left: var(--space-md);
}

.tutorial-conclusion {
    font-size: 14px;
    color: var(--text-body);
    line-height: 1.7;
    margin-top: 28px;
    padding: var(--space-md);
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* ── Step Cards ────────────────────────────────────────────────────────── */
.tutorial-steps { margin: 0; padding: 0; list-style: none; }

.step-card {
    display: flex;
    gap: var(--space-md);
    background: var(--bg-content);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: var(--space-md);
    scroll-margin-top: calc(var(--header-h) + var(--space-lg));
}

.step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--brand);
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.step-num span {
    font-size: 12px;
    color: #fff;
    font-weight: 700;
    line-height: 1;
}

.step-body-wrap { flex: 1; min-width: 0; }

.step-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.step-body {
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.6;
}
.step-body p { margin-bottom: 8px; }
.step-body p:last-child { margin-bottom: 0; }
.step-body strong { color: var(--text-primary); }

.step-screenshot {
    margin-top: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    max-width: 100%;
}
.step-screenshot img { display: block; width: 100%; }

/* ── Video block ───────────────────────────────────────────────────────── */
.video-block {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) 20px;
    margin: 28px 0;
}
.video-play-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--brand);
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.video-play-icon svg { fill: #fff; margin-left: 3px; }
.video-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.video-info p { font-size: 12px; color: var(--text-sidebar); }
.video-block video {
    display: block;
    width: 100%;
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    border: 1px solid var(--border);
}
.video-block-full {
    flex-direction: column;
    align-items: flex-start;
}

/* ── Tutorial Archive ──────────────────────────────────────────────────── */
.archive-header { margin-bottom: var(--space-lg); }
.archive-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.archive-header p { font-size: 14px; color: var(--text-sidebar); }

.filters-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.filter-label { font-size: 12px; color: var(--text-sidebar); font-weight: 500; margin-right: 2px; }
.filter-btn {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-content);
    color: var(--text-body);
    cursor: pointer;
    font-family: inherit;
    transition: background .12s, color .12s, border-color .12s;
}
.filter-btn:hover { border-color: var(--brand); color: var(--brand); }
.filter-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}
.filter-count {
    display: inline-block;
    font-size: 10px;
    background: rgba(255,255,255,.25);
    padding: 0 5px;
    border-radius: var(--radius-full);
    margin-left: 3px;
}
.filter-btn:not(.active) .filter-count {
    background: var(--bg-hover);
    color: var(--text-muted);
}
.filter-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.tutorial-card {
    background: var(--bg-content);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}
.tutorial-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 16px rgba(124,58,237,.08);
    text-decoration: none;
}
.tutorial-card.hidden { display: none; }

.tc-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--brand);
    margin-bottom: 8px;
}
.tc-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}
.tc-desc {
    font-size: 12px;
    color: var(--text-sidebar);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 12px;
}
.tc-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.no-results-msg {
    display: none;
    font-size: 14px;
    color: var(--text-muted);
    padding: var(--space-xl) 0;
    text-align: center;
    grid-column: 1 / -1;
}
.no-results-msg.visible { display: block; }

/* ── Page titles / content ─────────────────────────────────────────────── */
.docs-page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.2;
}
.docs-page-content { font-size: 15px; color: var(--text-body); line-height: 1.7; }
.docs-page-content h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 24px 0 10px; }
.docs-page-content h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 20px 0 8px; }
.docs-page-content p { margin-bottom: 12px; }
.docs-page-content ul, .docs-page-content ol { padding-left: 20px; margin-bottom: 12px; }
.docs-page-content li { margin-bottom: 4px; }

/* ── Hook blocks ───────────────────────────────────────────────────────── */
.hooks-header { margin-bottom: var(--space-lg); }
.hooks-header h1 { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.hooks-header p { font-size: 14px; color: var(--text-sidebar); }

.hook-type-filter { display: flex; gap: 6px; margin-bottom: var(--space-lg); }

.hook-block {
    background: var(--bg-content);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.hook-name {
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: 6px;
}

.hook-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}
.hook-type-badge.action { background: #fef3c7; color: #92400e; }
.hook-type-badge.filter { background: #dbeafe; color: #1e40af; }

.hook-description {
    font-size: 14px;
    color: var(--text-body);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.hook-params { margin-bottom: var(--space-md); }
.hook-params-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.hook-param-row {
    display: flex;
    gap: 12px;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.hook-param-row:last-child { border-bottom: none; }
.hook-param-name { font-family: 'Courier New', monospace; color: var(--brand); min-width: 100px; }
.hook-param-type { color: var(--text-sidebar); min-width: 70px; font-style: italic; }
.hook-param-desc { color: var(--text-body); flex: 1; }

.hook-since { font-size: 11px; color: var(--text-muted); margin-bottom: var(--space-md); }

.hook-code {
    background: #0f172a;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.hook-code pre {
    margin: 0;
    padding: var(--space-md);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}

/* ── Changelog ─────────────────────────────────────────────────────────── */
.changelog-header { margin-bottom: 40px; }
.changelog-header h1 { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.changelog-header p { font-size: 14px; color: var(--text-sidebar); }

.changelog-list { max-width: 720px; }

.changelog-entry {
    border-left: 2px solid var(--border);
    padding-left: 28px;
    margin-bottom: 48px;
    position: relative;
}
.changelog-entry::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--brand);
    border: 2px solid var(--bg-content, #fff);
    border-radius: var(--radius-circle);
    box-shadow: 0 0 0 2px var(--brand);
    position: absolute;
    left: -6px;
    top: 7px;
}

.cl-version { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.cl-date { font-size: 12px; color: var(--text-muted); }

.cl-entries {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}

.cl-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.6;
}
.cl-entry:last-child { border-bottom: none; }
.cl-entry:hover { background: var(--bg-hover); }

.cl-entry-text { flex: 1; }

.cl-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 2px;
    min-width: 46px;
}
.cl-tag.new      { background: #f0fdf4; color: #16a34a; }
.cl-tag.fix      { background: #fff7ed; color: #c2410c; }
.cl-tag.change   { background: #eff6ff; color: #2563eb; }
.cl-tag.breaking { background: #fef2f2; color: #dc2626; }

/* ── Getting Started ───────────────────────────────────────────────────── */
.gs-header { margin-bottom: 32px; }
.gs-header h1 { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.gs-header p { font-size: 15px; color: var(--text-sidebar); }

.gs-section { margin-bottom: 36px; }
.gs-section h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.gs-section-body { font-size: 14px; color: var(--text-body); line-height: 1.7; margin-bottom: var(--space-md); }
.gs-section-body p { margin-bottom: 10px; }
.gs-code-block {
    background: #0f172a;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-sm);
}
.gs-code-block pre {
    margin: 0;
    padding: var(--space-md);
    overflow-x: auto;
    font-size: 13px;
    color: #a5f3fc;
    line-height: 1.6;
}

/* ── Search Modal ──────────────────────────────────────────────────────── */
.search-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(15,23,42,.55);
    padding: calc(var(--header-h) + 32px) var(--space-xl) var(--space-xl);
    overflow-y: auto;
}
.search-modal.open { display: flex; flex-direction: column; align-items: center; }

.search-modal-box {
    background: var(--bg-content);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.search-modal-input-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text-primary);
    font-family: inherit;
    background: transparent;
}
.search-modal-input::placeholder { color: var(--text-muted); }
.search-modal-esc {
    font-size: 11px;
    background: var(--bg-hover);
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-sm) 0;
}
.search-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 16px 4px;
}
.search-result-item {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    cursor: pointer;
    transition: background .1s;
    text-decoration: none;
    border-left: 2px solid transparent;
}
.search-result-item:hover,
.search-result-item.focused {
    background: var(--bg-page);
    border-left-color: var(--brand);
    text-decoration: none;
}
.search-result-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.search-result-excerpt { font-size: 12px; color: var(--text-sidebar); line-height: 1.4; }
.search-result-meta { display: flex; gap: 6px; margin-top: 4px; }
.search-status {
    padding: var(--space-md) 16px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ── code inline ───────────────────────────────────────────────────────── */
code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    background: var(--bg-hover);
    color: var(--text-primary);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* Reset inline code styles inside code blocks — lets Prism.js take over */
pre code {
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
    text-decoration: none;
}

/* ── Copy button ────────────────────────────────────────────────────────── */
.hook-code,
.gs-code-block {
    position: relative;
}
.code-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.6);
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 11px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    z-index: 2;
}
.code-copy-btn:hover {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}
.code-copy-btn.copied {
    background: rgba(74,222,128,0.15);
    border-color: rgba(74,222,128,0.4);
    color: #4ade80;
}
.code-copy-btn svg {
    flex-shrink: 0;
}
/* nudge pre so text doesn't hide under the copy button */
.hook-code pre,
.gs-code-block pre {
    padding-right: 72px;
}

/* ── Admin bar offset ───────────────────────────────────────────────────── */
body.fc-has-adminbar {
    padding-top: calc(var(--header-h) + 32px);
}
body.fc-has-adminbar .docs-header {
    top: 32px;
}
body.fc-has-adminbar .docs-sidebar {
    top: calc(var(--header-h) + 32px);
    height: calc(100vh - var(--header-h) - 32px);
}
body.fc-has-adminbar .docs-toc {
    top: calc(var(--header-h) + 32px);
    height: calc(100vh - var(--header-h) - 32px);
}
body.fc-has-adminbar .docs-layout {
    min-height: calc(100vh - var(--header-h) - 32px);
}
body.fc-has-adminbar .search-modal {
    padding-top: calc(var(--header-h) + 32px + 32px);
}

/* ── Hook detail sections ───────────────────────────────────────────────── */
.hook-section-label,
.hook-meta-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}

.hook-source-files {
    margin-bottom: var(--space-md);
}
.hook-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hook-source-file {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-sidebar);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
}
.hook-source-file svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.hook-use-cases {
    margin-top: var(--space-lg);
}
.hook-use-case {
    margin-bottom: var(--space-lg);
}
.hook-use-case-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

/* ── Search popular panel ───────────────────────────────────────────────── */
.search-popular {
    padding: var(--space-sm) 0;
}
.search-popular-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 16px 6px;
}
.search-popular-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    border-left: 2px solid transparent;
    transition: background .1s;
}
.search-popular-item:hover {
    background: var(--bg-page);
    border-left-color: var(--brand);
    text-decoration: none;
}
.search-popular-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.search-popular-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 99px;
    font-weight: 600;
}
.search-popular-badge.action {
    background: rgba(59,130,246,0.12);
    color: #3b82f6;
}
.search-popular-badge.filter {
    background: rgba(168,85,247,0.12);
    color: #a855f7;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */

/* Mobile-only elements — hidden by default */
.docs-mobile-search,
.sidebar-mobile-primary,
.docs-mobile-nav { display: none; }
.sidebar-mobile-divider { display: none; }

/* ── Large tablet / narrow desktop (≤ 1200px) ─────────────────────────── */
@media (max-width: 1200px) {
    .docs-toc { display: none; }
    .docs-main { max-width: none; }
}

/* ── Tablet (≤ 960px) ─────────────────────────────────────────────────── */
@media (max-width: 960px) {
    :root { --sidebar-w: 240px; }
    .hp-steps { grid-template-columns: 1fr 1fr; }
    .hp-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile (≤ 768px) ─────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* ── Header ── */
    .docs-header { padding: 0 14px; gap: 8px; }
    .docs-search-bar { display: none; }
    .docs-nav { display: none; }
    .docs-hamburger { display: flex; margin-left: 6px; }
    .docs-mobile-search {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-sidebar);
        border-radius: var(--radius-sm);
        margin-left: auto;
        transition: background .15s, color .15s;
        flex-shrink: 0;
    }
    .docs-mobile-search:hover { background: var(--bg-hover); color: var(--text-primary); }

    /* ── Sidebar — offcanvas ── */
    .docs-sidebar {
        position: fixed;
        top: var(--header-h);
        left: -100%;
        height: calc(100vh - var(--header-h));
        z-index: 100;
        width: 280px;
        transition: left .22s ease;
        background: var(--bg-content);
        box-shadow: 4px 0 24px rgba(0,0,0,.12);
        border-right: 1px solid var(--border);
    }
    .docs-sidebar.open { left: 0; }
    .docs-sidebar-overlay.open { display: block; }

    /* Mobile primary nav inside sidebar */
    .sidebar-mobile-primary { display: block; }
    .sidebar-item-cta { color: var(--brand) !important; font-weight: 600; }
    .sidebar-mobile-divider {
        display: block;
        height: 1px;
        background: var(--border);
        margin: 6px var(--space-md) 10px;
    }

    /* ── Mobile nav drawer (pages without sidebar) ── */
    .docs-mobile-nav {
        display: block;
        position: fixed;
        top: var(--header-h);
        left: -100%;
        width: 280px;
        height: calc(100vh - var(--header-h));
        background: var(--bg-content);
        border-right: 1px solid var(--border);
        z-index: 100;
        overflow-y: auto;
        transition: left .22s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,.12);
    }
    .docs-mobile-nav.open { left: 0; }
    .docs-mobile-nav-inner { padding: var(--space-md) 0 var(--space-xl); }
    .docs-mobile-nav-item {
        display: block;
        font-size: 14px;
        color: var(--text-sidebar);
        padding: 10px var(--space-md);
        border-left: 2px solid transparent;
        text-decoration: none;
        transition: color .12s, background .12s;
    }
    .docs-mobile-nav-item:hover,
    .docs-mobile-nav-item.active {
        color: var(--brand);
        background: var(--bg-active);
        border-left-color: var(--brand);
        text-decoration: none;
    }
    .docs-mobile-nav-cta { font-weight: 700; color: var(--brand) !important; margin-top: 4px; }

    /* ── Layout ── */
    .docs-main { padding: var(--space-md); }
    .docs-footer {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: var(--space-md);
        margin-top: var(--space-md);
    }

    /* ── Typography ── */
    .tutorial-title { font-size: 22px; }
    .archive-header h1,
    .hooks-header h1,
    .changelog-header h1,
    .gs-header h1,
    .docs-page-title { font-size: 20px; }

    /* ── Tutorial archive ── */
    .tutorials-grid { grid-template-columns: 1fr 1fr; }
    .filters-bar { gap: 4px; }
    .filter-divider { display: none; }

    /* ── Hook blocks ── */
    .hook-param-row { flex-direction: column; gap: 2px; padding: 8px 0; }
    .hook-param-name,
    .hook-param-type { min-width: unset; font-style: normal; }
    .hook-param-type { color: var(--text-muted); font-size: 11px; }
    .hook-param-desc { font-size: 12px; }
    .hook-block { padding: var(--space-md); }
    .hook-name { font-size: 14px; word-break: break-all; }

    /* ── Step cards ── */
    .step-card { gap: 10px; padding: 14px; }

    /* ── Changelog ── */
    .changelog-list { max-width: none; }
    .changelog-entry { padding-left: 20px; }

    /* ── Search modal ── */
    .search-modal { padding: calc(var(--header-h) + 12px) var(--space-sm) var(--space-sm); }
    .search-modal-box {
        border-radius: var(--radius-md);
        max-height: calc(100vh - var(--header-h) - 24px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .search-results-list { overflow-y: auto; }

    /* ── Homepage ── */
    .hp-hero { padding: 44px var(--space-md) 36px; }
    .hp-hero h1 { font-size: 28px; }
    .hp-hero-sub { font-size: 14px; }
    .hp-inner { padding: 0 var(--space-md); }
    .hp-steps { grid-template-columns: 1fr; gap: 0; }
    .hp-bottom { grid-template-columns: 1fr; gap: 32px; padding-bottom: 40px; }
    .hp-nav-section { padding: 36px 0 32px; }
    .hp-quickstart { padding: 32px 0; }

    /* ── Doc topic archive rows ── */
    .doc-topic-row-cta { display: none; }

    /* ── Admin bar + mobile combined ── */
    body.fc-has-adminbar .docs-sidebar,
    body.fc-has-adminbar .docs-mobile-nav {
        top: calc(var(--header-h) + 32px);
        height: calc(100vh - var(--header-h) - 32px);
    }
}

/* ── Small phones (≤ 480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .docs-logo-badge { display: none; }
    .tutorials-grid { grid-template-columns: 1fr; }
    .hp-cards { grid-template-columns: 1fr; }
    .hp-hero h1 { font-size: 24px; }
    .hp-hero-sub { font-size: 13px; }
    .hp-search-trigger-text { font-size: 12px; }
    .tutorial-title { font-size: 20px; }
    .step-card { flex-direction: column; gap: 8px; }
    .step-num { margin-top: 0; }
    .video-block { flex-direction: column; align-items: flex-start; gap: 10px; }
    .hook-code pre,
    .gs-code-block pre { font-size: 12px; padding: 12px; }
    .cl-entry { padding: 8px 12px; }
    .cl-tag { min-width: 38px; font-size: 9px; padding: 2px 6px; }
    .search-modal { padding: calc(var(--header-h) + 8px) 8px 8px; }
    .search-modal-box { max-height: calc(100vh - var(--header-h) - 16px); }
    .tutorial-card { padding: 14px; }
    .tutorial-intro { padding-left: var(--space-sm); }
    .docs-main { padding: 14px; }
    .hp-bottom { padding-bottom: 32px; }
    .gs-section h2 { font-size: 17px; }
    .hook-use-case-title { font-size: 13px; }
}

/* ── Search v2 — filter chips + result cards ──────────────────────────── */

.search-filter-chips {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.search-chip {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 12px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
    line-height: 1.6;
    font-family: inherit;
}
.search-chip:hover {
    border-color: var(--brand);
    color: var(--brand);
}
.search-chip.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.search-result-card {
    display: block;
    background: var(--bg-card, var(--bg-sidebar));
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 4px 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-decoration: none;
}
.search-result-card:hover,
.search-result-card.is-active {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 5%, transparent);
    outline: none;
}

.search-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.search-result-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}
.search-result-type--hook      { background: rgba(124,58,237,.12);  color: #7c3aed; }
.search-result-type--tutorial  { background: rgba(14,165,233,.12);  color: #0284c7; }
.search-result-type--changelog { background: rgba(16,185,129,.12);  color: #059669; }
.search-result-type--doc       { background: rgba(245,158,11,.12);  color: #b45309; }
.search-result-type--page      { background: rgba(100,116,139,.12); color: #475569; }

.search-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.search-card-excerpt {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-card mark,
.search-card-title mark,
.search-card-excerpt mark {
    background: none;
    color: var(--brand);
    font-weight: 700;
}

/* ── Doc Topics — archive rows + single article prose ─────────────────── */

.doc-topic-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}
.doc-topic-row:last-child { border-bottom: none; }
.doc-topic-row:hover .doc-topic-row-title { color: var(--brand); }

.doc-topic-row-body { flex: 1; min-width: 0; }

.doc-topic-row-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: color .15s;
}

.doc-topic-row-excerpt {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.doc-topic-row-cta {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
    flex-shrink: 0;
}

.doc-topic-content h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 28px 0 10px;
    color: var(--text-primary);
}
.doc-topic-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 20px 0 8px;
    color: var(--text-primary);
}
.doc-topic-content p,
.doc-topic-content li {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary, var(--text-primary));
}
.doc-topic-content ul,
.doc-topic-content ol { padding-left: 20px; margin: 8px 0 16px; }
.doc-topic-content pre {
    background: var(--bg-code, #f6f8fa);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    margin: 12px 0 20px;
}
.doc-topic-content code {
    background: var(--bg-code, #f6f8fa);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 12px;
}
.doc-topic-content pre code { background: none; padding: 0; }
.doc-topic-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 16px 0;
}
.doc-topic-content th,
.doc-topic-content td {
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border);
}
.doc-topic-content th { background: var(--bg-sidebar); font-weight: 600; }

/* ── Homepage ──────────────────────────────────────────────────────────── */

.docs-main--home {
    padding: 0;
    max-width: none;
    margin: 0;
}

/* Hero */
.hp-hero {
    text-align: center;
    padding: 72px var(--space-xl) 56px;
    background: linear-gradient(180deg, #f5f3ff 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}
.hp-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 20px;
}
.hp-hero h1 {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.025em;
    color: var(--text-primary);
    margin: 0 auto 18px;
    max-width: 560px;
}
.hp-hero-sub {
    font-size: 16px;
    color: var(--text-sidebar);
    max-width: 500px;
    margin: 0 auto 36px;
    line-height: 1.65;
}
.hp-search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
    background: var(--bg-content);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    padding: 11px 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: border-color .15s, box-shadow .15s;
}
.hp-search-trigger:hover,
.hp-search-trigger:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px #ede9fe;
    outline: none;
}
.hp-search-trigger svg { color: var(--text-muted); flex-shrink: 0; }
.hp-search-trigger-text {
    flex: 1;
    font-size: 13.5px;
    color: var(--text-muted);
    text-align: left;
    user-select: none;
}
.hp-search-trigger kbd {
    font-size: 11px;
    background: var(--bg-hover);
    color: var(--text-sidebar);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: inherit;
}

/* Inner content wrapper */
.hp-inner {
    max-width: 940px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

/* Shared section label */
.hp-section-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Navigation cards */
.hp-nav-section { padding: 52px 0 44px; border-bottom: 1px solid var(--border); }

.hp-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.hp-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-content);
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .12s;
}
.hp-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 18px rgba(124,58,237,.1);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}
.hp-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: #ede9fe;
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 4px;
}
.hp-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.hp-card-desc {
    font-size: 12.5px;
    color: var(--text-sidebar);
    line-height: 1.6;
    flex: 1;
}
.hp-card-arrow {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    margin-top: 4px;
}
.hp-card--cta {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    border-color: transparent;
}
.hp-card--cta .hp-card-icon { background: rgba(255,255,255,.2); color: #fff; }
.hp-card--cta .hp-card-title { color: #fff; }
.hp-card--cta .hp-card-desc { color: rgba(255,255,255,.82); }
.hp-card--cta .hp-card-arrow { color: rgba(255,255,255,.9); }
.hp-card--cta:hover {
    border-color: transparent;
    box-shadow: 0 6px 24px rgba(124,58,237,.35);
}

/* Quick start */
.hp-quickstart { padding: 44px 0; border-bottom: 1px solid var(--border); }
.hp-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.hp-step { display: flex; flex-direction: column; gap: 8px; }
.hp-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}
.hp-step-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.hp-step-desc { font-size: 13px; color: var(--text-sidebar); line-height: 1.6; }
.hp-step code {
    background: var(--bg-hover);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: ui-monospace, monospace;
}
.hp-step-link { font-size: 12px; font-weight: 600; color: var(--brand); }
.hp-step-link:hover { color: var(--brand-hover); text-decoration: none; }

/* Bottom panels */
.hp-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    padding: 44px 0 64px;
}
.hp-panel {}

/* Latest releases */
.hp-release {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background .1s;
}
.hp-release:last-of-type { border-bottom: none; }
.hp-release:hover .hp-release-ver { color: var(--brand); }
.hp-release-ver { font-size: 13px; font-weight: 700; color: var(--text-primary); transition: color .15s; min-width: 48px; }
.hp-release-date { font-size: 12px; color: var(--text-muted); flex: 1; }
.hp-release-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-sidebar);
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

/* Hook list */
.hp-hook-list { display: flex; flex-direction: column; gap: 2px; }
.hp-hook-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: var(--text-body);
    text-decoration: none;
    transition: background .1s, color .1s;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.hp-hook-link:hover { background: #ede9fe; color: var(--brand); text-decoration: none; }
.hp-hook-type {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.hp-hook-type--action { background: #ede9fe; color: #7c3aed; }
.hp-hook-type--filter { background: #ecfdf5; color: #059669; }

/* "More" link */
.hp-panel-more {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    margin-top: 16px;
    text-decoration: none;
}
.hp-panel-more:hover { color: var(--brand-hover); text-decoration: none; }

/* ── Homepage — dark mode overrides ─────────────────────────────────────── */
[data-theme="dark"] .hp-hero {
    background: linear-gradient(180deg, rgba(124,58,237,.12) 0%, transparent 100%);
}
[data-theme="dark"] .hp-search-trigger:hover,
[data-theme="dark"] .hp-search-trigger:focus {
    box-shadow: 0 0 0 3px rgba(124,58,237,.25);
}
[data-theme="dark"] .hp-card-icon {
    background: var(--brand-light);
}
[data-theme="dark"] .hp-card:hover {
    box-shadow: 0 4px 18px rgba(124,58,237,.2);
}
[data-theme="dark"] .hp-hook-type--action {
    background: rgba(124,58,237,.2);
    color: var(--brand);
}
[data-theme="dark"] .hp-hook-type--filter {
    background: rgba(5,150,105,.2);
    color: #34d399;
}
[data-theme="dark"] .hp-hook-link:hover {
    background: rgba(124,58,237,.15);
}

/* ── Homepage — mobile responsive ───────────────────────────────────────── */

/* At 768px — homepage grid resets (must come after base styles above) */
@media (max-width: 768px) {
    .hp-hero {
        padding: 40px var(--space-md) 32px;
    }
    .hp-search-trigger {
        width: 100%;
        max-width: 100%;
        min-height: 44px;
    }
    .hp-search-trigger kbd {
        display: none;
    }
    /* Cards: 2-col on tablet, 1-col below 560px */
    .hp-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .hp-card {
        padding: 16px;
        gap: 6px;
    }
    /* Steps: 1-col with dividers */
    .hp-steps {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .hp-step {
        padding: 18px 0;
        border-bottom: 1px solid var(--border);
    }
    .hp-step:last-child {
        border-bottom: none;
    }
    /* Bottom panels: stack vertically */
    .hp-bottom {
        grid-template-columns: 1fr;
        gap: 32px;
        padding-bottom: 40px;
    }
}

/* At 560px: switch cards to 1-col earlier — 2-col too tight */
@media (max-width: 560px) {
    .hp-hero h1 {
        font-size: 26px;
    }
    .hp-hero-sub {
        font-size: 14px;
    }
    .hp-cards {
        grid-template-columns: 1fr;
    }
}

/* At 480px: tighten further */
@media (max-width: 480px) {
    .hp-hero {
        padding: 32px var(--space-md) 28px;
    }
    .hp-hero-eyebrow {
        font-size: 10px;
    }
    .hp-inner {
        padding: 0 var(--space-md);
    }
    .hp-nav-section {
        padding: 28px 0 24px;
    }
    .hp-quickstart {
        padding: 24px 0;
    }
    .hp-section-label {
        margin-bottom: 14px;
    }
    /* Hook link: allow name to truncate */
    .hp-hook-link {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        gap: 6px;
    }
    .hp-release {
        gap: 8px;
    }
    .hp-release-count {
        display: none;
    }
}

/* ── Tutorial prev / next navigation ────────────────────────────────────── */
.tutorial-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.tutorial-nav-prev,
.tutorial-nav-next {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    min-width: 0;
    max-width: 48%;
    transition: border-color .15s, background .15s;
}
.tutorial-nav-prev { align-items: flex-start; }
.tutorial-nav-next { align-items: flex-end;   margin-left: auto; }
.tutorial-nav-prev:hover,
.tutorial-nav-next:hover {
    border-color: var(--brand);
    background: #eff6ff;
    text-decoration: none;
}
.tutorial-nav-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.tutorial-nav-title {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

/* ── Tutorial screenshots & lightbox ─────────────────────────────────────── */
.fc-tutorial-screenshot {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    margin: 12px 0;
}
.fc-screenshot-link {
    display: inline-block;
    width: 100%;
    cursor: zoom-in;
    text-decoration: none;
    border-radius: 6px;
    overflow: hidden;
    transition: opacity .15s;
}
.fc-screenshot-link:hover { opacity: .88; }

/* ══════════════════════════════════════════════════════════════════════════
   §── Responsive polish (mobile-first improvements)
   ══════════════════════════════════════════════════════════════════════════ */

/* Prevent horizontal scroll bleed */
html,
body { overflow-x: hidden; }

/* ── Close buttons — sidebar & mobile nav ─────────────────────────────── */
.docs-sidebar-close,
.docs-mobile-nav-close {
    display: none; /* shown only in mobile breakpoints below */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    flex-shrink: 0;
}
.docs-sidebar-close:hover,
.docs-mobile-nav-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ── Sidebar close — show inside sidebar on mobile ────────────────────── */
.docs-sidebar-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
}

/* ── Mobile nav header (title + close) ────────────────────────────────── */
.docs-mobile-nav-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.docs-mobile-nav-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ── Touch targets: sidebar items 44 px min-height ────────────────────── */
.sidebar-item {
    min-height: 36px;
}

/* ── Touch target: mobile search button ───────────────────────────────── */
.docs-mobile-search {
    min-width: 44px;
    min-height: 44px;
}

/* ── Code blocks: smooth touch scroll ─────────────────────────────────── */
.hook-code pre,
.gs-code-block pre,
.doc-topic-content pre {
    -webkit-overflow-scrolling: touch;
}

/* ── Tables: scrollable on small screens ──────────────────────────────── */
.doc-topic-content table,
.gs-section table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Tutorial prev/next: allow text to wrap ───────────────────────────── */
.tutorial-nav-title {
    white-space: normal;
    word-break: break-word;
}

/* ── Filter pills: allow horizontal scroll on narrow screens ──────────── */
.filters-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
}
.filters-bar::-webkit-scrollbar { display: none; }

/* ── Medium phones (≤ 640px) — between existing 768px and 480px ────────── */
@media (max-width: 640px) {

    /* Tutorials grid: 1 col (already 1 col at 480px but too tight at 600px) */
    .tutorials-grid { grid-template-columns: 1fr; }

    /* Show mobile nav header + close button */
    .docs-mobile-nav-header { display: flex; }

    /* Show sidebar close button when sidebar is open */
    .docs-sidebar-close { display: flex; }

    /* Mobile nav inner: add top padding to account for header */
    .docs-mobile-nav .docs-mobile-nav-inner {
        padding-top: 4px;
    }

    /* Sidebar items: increase padding for easier tap */
    .sidebar-item {
        padding: 8px 14px;
        min-height: 40px;
        display: flex;
        align-items: center;
    }

    /* Tutorial nav: stack on very narrow screens */
    .tutorial-nav {
        flex-direction: column;
        gap: 10px;
    }
    .tutorial-nav-prev,
    .tutorial-nav-next {
        max-width: 100%;
        align-items: flex-start;
        margin-left: 0;
    }

    /* Homepage cards: 1 col */
    .hp-cards { grid-template-columns: 1fr; }

    /* Reduce content padding */
    .docs-main { padding: 16px; }
    .docs-main--wide { padding: 16px; }

    /* Reduce tutorial content padding */
    .tutorial-intro { padding-left: var(--space-sm); }

    /* Sidebar relative position for close button */
    .docs-sidebar { position: relative; }
}

/* ── 768px breakpoint additions ───────────────────────────────────────── */
@media (max-width: 768px) {
    /* Show mobile nav header (for close button) */
    .docs-mobile-nav-header { display: flex; }

    /* Show sidebar close button */
    .docs-sidebar-close { display: flex; }

    /* Sidebar needs relative positioning for absolute close button */
    .docs-sidebar { position: relative; }

    /* Filter pills: allow wrap at this size */
    .filters-bar { flex-wrap: wrap; }

    /* Ensure mobile search has good touch target */
    .docs-mobile-search {
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ── Heading anchor links ──────────────────────────────────────────────── */
.heading-anchor {
    display: inline-block;
    margin-left: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
    opacity: 0;
    transition: opacity .15s;
    font-size: .85em;
    vertical-align: middle;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor {
    opacity: 1;
}
.heading-anchor:hover {
    color: var(--brand);
    text-decoration: none;
}

/* ── Generic Page (Privacy Policy, Terms & Conditions, etc.) ─────────── */

.page-layout {
    flex: 1;
    min-width: 0;
}

/* Hero band */
.page-hero {
    border-bottom: 1px solid var(--border);
    padding: 40px 0 32px;
    background: var(--bg-content);
}
.page-hero-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

/* Breadcrumb */
.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.page-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}
.page-breadcrumb a:hover {
    color: var(--brand);
    text-decoration: none;
}
.page-breadcrumb span[aria-current="page"] {
    color: var(--text-body);
}

.page-hero-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 10px;
    line-height: 1.2;
}
.page-hero-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}
.page-hero-meta time {
    color: var(--text-body);
}

/* Body */
.page-body {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--space-xl);
}

/* Prose */
.page-content {
    font-size: 15px;
    color: var(--text-body);
    line-height: 1.75;
}
.page-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 40px 0 12px;
    padding-top: 4px;
}
.page-content h2:first-child {
    margin-top: 0;
}
.page-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 10px;
}
.page-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 8px;
}
.page-content p {
    margin-bottom: 16px;
}
.page-content p:last-child {
    margin-bottom: 0;
}
.page-content ul,
.page-content ol {
    padding-left: 22px;
    margin-bottom: 16px;
}
.page-content li {
    margin-bottom: 6px;
}
.page-content a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.page-content a:hover {
    color: var(--brand-hover);
    text-decoration: underline;
}
.page-content strong {
    font-weight: 600;
    color: var(--text-primary);
}
.page-content em {
    font-style: italic;
}
.page-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 36px 0;
}
.page-content blockquote {
    border-left: 3px solid var(--brand);
    padding: 14px 18px;
    margin: 24px 0;
    background: var(--bg-hover);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-body);
    font-style: italic;
}
.page-content blockquote p:last-child {
    margin-bottom: 0;
}
.page-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    color: var(--text-primary);
}
.page-content pre {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 20px;
}
.page-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
}
.page-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 20px;
    display: block;
    overflow-x: auto;
}
.page-content th,
.page-content td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.page-content th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-hover);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.page-content tr:last-child td {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
    .page-hero {
        padding: 28px 0 24px;
    }
    .page-hero-inner {
        padding: 0 var(--space-md);
    }
    .page-hero-title {
        font-size: 24px;
    }
    .page-body {
        padding: var(--space-lg) var(--space-md);
    }
}
@media (max-width: 480px) {
    .page-hero-title {
        font-size: 22px;
    }
    .page-content {
        font-size: 14px;
    }
}

