/* ==========================================================================
   frapAST Project Website Stylesheet
   Modern, accessible, fast, and responsive.
   ========================================================================== */

:root {
    --bg: #F8F9FB;
    --bg-panel: #FFFFFF;
    --bg-panel-subtle: #F2F4F8;
    --ink: #14171C;
    --ink-muted: #4A5260;
    /* Contrast ratio > 5.8:1 on #F8F9FB (WCAG AA pass) */
    --ink-faint: #6A7280;
    /* Contrast ratio > 4.5:1 on #FFFFFF */
    --accent: #0E7C66;
    --accent-ink: #075A49;
    /* Contrast ratio > 7.3:1 (WCAG AAA pass) */
    --accent-soft: #E4F3EF;
    --accent-hover: #0A6352;
    --border: #E2E5EB;
    --border-subtle: #EDF0F5;
    --danger: #C0392B;
    --danger-soft: #FDEEED;
    --warning: #B7791F;
    --warning-soft: #FEF7EA;
    --info: #2B6CB0;
    --info-soft: #EBF8FF;
    --term-bg: #14171C;
    --term-text: #D9DCE1;
    --term-green: #3FBF8F;
    --term-amber: #D8A657;
    --term-red: #E06C75;
    --term-dim: #7C8494;
    --max-w: 1040px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(20, 23, 28, 0.04);
    --shadow-md: 0 4px 16px -4px rgba(20, 23, 28, 0.08);
    --shadow-lg: 0 12px 32px -8px rgba(20, 23, 28, 0.16);
    --focus-ring: 0 0 0 3px rgba(14, 124, 102, 0.35);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.mono {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, Menlo, monospace;
}

a {
    color: var(--accent-ink);
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

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

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: none;
}

input:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
}

/* Accessibility: Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 16px;
    background: var(--ink);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    z-index: 1000;
    font-size: 14px;
    font-weight: 600;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 16px;
}

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

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

nav.top {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(248, 249, 251, 0.94);
}

nav.top .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    padding-bottom: 16px;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--ink);
    border-radius: 6px;
    color: var(--term-green);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
}

.wordmark {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
}

.wordmark span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    font-size: 14.5px;
    color: var(--ink-muted);
    font-weight: 500;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-links a.active {
    color: var(--accent-ink);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.nav-cta-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-github {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink) !important;
    background: var(--bg-panel);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
}

.btn-github:hover {
    background: #fff;
    border-color: #CCD2DC;
    transform: translateY(-1px);
}

.star-count {
    background: var(--bg-panel-subtle);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

/* Mobile Hamburger */
.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--ink);
    cursor: pointer;
    font-size: 18px;
}

.mobile-nav {
    display: none;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    padding: 16px 24px;
}

.mobile-nav.open {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-nav a {
    font-size: 15px;
    color: var(--ink-muted);
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.mobile-nav a.active {
    color: var(--accent-ink);
    font-weight: 600;
}

/* ==========================================================================
   HERO & BANNERS
   ========================================================================== */

.hero {
    padding: 72px 0 64px;
}

.hero h1 {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 40px;
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin: 0 0 20px;
    max-width: 18ch;
}

.hero h1 .fade {
    color: var(--ink-faint);
    font-weight: 500;
}

.hero p.lede {
    font-size: 18px;
    color: var(--ink-muted);
    max-width: 58ch;
    margin: 0 0 32px;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.install-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ink);
    color: #fff;
    border-radius: 7px;
    padding: 10px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14.5px;
    box-shadow: var(--shadow-md);
}

.install-pill .prompt {
    color: var(--term-green);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 4px;
    color: #C0C5CE;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    padding: 4px 8px;
    margin-left: 6px;
    transition: all 0.15s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.copy-btn.copied {
    background: var(--accent);
    color: #fff;
}

.link-inline {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--accent-ink);
    text-decoration: none;
    border-bottom: 1.5px solid var(--accent);
    padding-bottom: 2px;
}

.link-inline:hover {
    color: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Page Header for Inner Pages */
.page-head {
    padding: 48px 0 36px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
}

.page-head .breadcrumbs {
    font-size: 13px;
    color: var(--ink-faint);
    margin-bottom: 12px;
    /* Flex so inline SVG separator arrows sit on the same baseline as text */
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.page-head .breadcrumbs .icon {
    width: 12px;
    height: 12px;
    opacity: 0.5;
    flex-shrink: 0;
}

.page-head .breadcrumbs a {
    color: var(--ink-faint);
    /* Prevent the inline-flex on the breadcrumbs container from
       collapsing anchor padding */
    display: inline;
}

.page-head .breadcrumbs a:hover {
    color: var(--ink);
}

.page-head h1 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 10px;
}

.page-head p {
    font-size: 17px;
    color: var(--ink-muted);
    max-width: 65ch;
    margin: 0;
}

/* ==========================================================================
   TERMINAL MOCKUP
   ========================================================================== */

.terminal {
    background: var(--term-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(20, 23, 28, 0.06), 0 16px 36px -12px rgba(20, 23, 28, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #191D24;
}

.terminal-bar .dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #3A3F49;
}

.terminal-bar .dot.red {
    background: #E06C75;
}

.terminal-bar .dot.amber {
    background: #E5C07B;
}

.terminal-bar .dot.green {
    background: #98C379;
}

.terminal-bar .label {
    margin-left: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--term-dim);
}

.terminal-body {
    padding: 22px 24px 26px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--term-text);
    overflow-x: auto;
}

.terminal-body .cmd {
    color: #fff;
    font-weight: 500;
}

.terminal-body .cmd::before {
    content: "$ ";
    color: var(--term-green);
}

.terminal-body .out-dim {
    color: var(--term-dim);
}

.terminal-body .rule {
    color: var(--term-amber);
    font-weight: 600;
}

.terminal-body .ok {
    color: var(--term-green);
    font-weight: 600;
}

.terminal-body .refute {
    color: var(--term-red);
    font-weight: 600;
}

.terminal-body .blank {
    height: 8px;
}

/* ==========================================================================
   SECTIONS & GRIDS
   ========================================================================== */

section {
    padding: 64px 0;
}

section.bordered {
    border-top: 1px solid var(--border);
}

.section-head {
    max-width: 64ch;
    margin-bottom: 36px;
}

.section-head h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 10px;
}

.section-head p {
    font-size: 16px;
    color: var(--ink-muted);
    margin: 0;
}

/* Problem vs Solution 2-Column */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.two-col-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    box-shadow: var(--shadow-sm);
}

.two-col-card h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: var(--ink-faint);
    margin: 0 0 16px;
    font-family: 'JetBrains Mono', monospace;
}

.two-col-card.accent {
    border-color: rgba(14, 124, 102, 0.25);
    background: #FCFDFD;
}

.two-col-card.accent h3 {
    color: var(--accent-ink);
}

.compare-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.compare-row:last-child {
    border-bottom: none;
}

.compare-row .tag {
    flex: 0 0 80px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-faint);
    padding-top: 2px;
}

.compare-row .tag.good {
    color: var(--accent-ink);
}

.compare-row .txt {
    font-size: 14.5px;
    color: var(--ink);
    flex: 1;
}

/* Two Tiers of Proof */
.tiers {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tier-card {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 20px;
    padding: 24px 28px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.tier-card .num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: 8px;
    height: 60px;
    width: 60px;
}

.tier-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.tier-card p {
    margin: 0;
    color: var(--ink-muted);
    font-size: 15px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow-sm);
}

.stat-box .num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 26px;
    color: var(--ink);
    display: block;
    margin-bottom: 4px;
}

.stat-box .cap {
    font-size: 13.5px;
    color: var(--ink-muted);
    line-height: 1.4;
}

/* FAQ Accordion */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.faq-item:hover {
    border-color: #CBD2DC;
}

.faq-question {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 18px 22px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: inherit;
}

.faq-question .icon {
    width: 16px;
    height: 16px;
    stroke: var(--ink-faint);
    transition: transform 0.2s ease, stroke 0.2s ease;
    flex-shrink: 0;
}

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

.faq-answer {
    display: none;
    padding: 0 22px 20px;
    color: var(--ink-muted);
    font-size: 15px;
    line-height: 1.65;
    border-top: 1px solid var(--border-subtle);
    padding-top: 16px;
}

.faq-item.open .faq-answer {
    display: block;
}

/* Get Started Steps */
.steps-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.step-line {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
}

.step-line .step-label {
    font-size: 13.5px;
    color: var(--ink-faint);
    flex: 0 0 130px;
    font-weight: 600;
}

.step-line code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--ink);
    flex: 1;
    background: var(--bg-panel-subtle);
    padding: 4px 10px;
    border-radius: 4px;
}

/* Founder Note Card */
.note-card {
    background: #FAFBFD;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 24px 28px;
}

.note-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 10px;
}

.note-card p {
    color: var(--ink-muted);
    font-size: 15px;
    margin-bottom: 12px;
}

.note-card p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   DOCS & RULE REFERENCE
   ========================================================================== */

.docs-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 48px;
    padding: 40px 0 80px;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
}

.docs-nav-group {
    margin-bottom: 24px;
}

.docs-nav-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    margin-bottom: 10px;
    font-family: 'JetBrains Mono', monospace;
}

.docs-nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.docs-nav-links a {
    display: block;
    font-size: 14.5px;
    color: var(--ink-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.docs-nav-links a:hover {
    background: var(--bg-panel);
    color: var(--ink);
}

.docs-nav-links a.active {
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 600;
}

.docs-content {
    min-width: 0;
}

.docs-content h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 600;
    margin: 36px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.docs-content h2:first-child {
    margin-top: 0;
}

.docs-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 10px;
}

.docs-content p,
.docs-content ul,
.docs-content ol {
    margin-bottom: 16px;
    color: var(--ink-muted);
    font-size: 15.5px;
}

.docs-content ul,
.docs-content ol {
    padding-left: 24px;
}

.docs-content li {
    margin-bottom: 6px;
}

.code-block {
    position: relative;
    background: #0b1120;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 16px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    line-height: 1.6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    min-width: 0;
    margin: 18px 0 24px;
    border: 1px solid #1e293b;
    /* Prevent the absolute copy btn from being cut off on small screens */
    padding-top: 44px;
}

.code-block pre,
.code-block code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    display: block;
}

.code-block .copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    /* Minimum 44x44 tap target per WCAG */
    min-height: 32px;
    min-width: 64px;
    padding: 6px 10px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.code-block .copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* Terminal & CLI Code Syntax Highlighting (Authentic Theme) */
.t-header { color: #94a3b8; font-weight: 700; }
.t-cmd { color: #f8fafc; font-weight: 700; }
.t-subcmd { color: #34d399; font-weight: 600; }
.t-flag { color: #fbbf24; font-weight: 500; }
.t-kw { color: #c084fc; font-weight: 500; }
.t-decorator { color: #fbbf24; font-weight: 600; }
.t-comment { color: #64748b; font-style: italic; }
.t-str { color: #86efac; }
.t-prompt { color: #10b981; font-weight: 700; }
.t-pass { color: #34d399; font-weight: 600; }
.t-fail { color: #f87171; font-weight: 600; }
.t-warn { color: #fbbf24; font-weight: 600; }

/* Rules Filter UI */
.rules-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.rules-search-input {
    flex: 1 1 200px;
    max-width: 360px;
    min-width: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.5;
    height: 36px;
}

.rules-search-input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.rules-search-input::placeholder {
    color: var(--ink-faint);
}

/* Custom Dropdown Component for Rules Page (Pure Custom UI - No OS native popup) */
.custom-select-wrap {
    position: relative;
    user-select: none;
}

.custom-select-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    min-width: 150px;
    height: 100%;
}

.custom-select-trigger:hover,
.custom-select-wrap.open .custom-select-trigger {
    border-color: #cbd5e1;
    background: #ffffff;
}

.custom-select-trigger .icon {
    width: 14px;
    height: 14px;
    color: var(--ink-faint);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.custom-select-wrap.open .custom-select-trigger .icon {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: 300px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
}

.custom-select-wrap.open .custom-select-menu {
    display: flex;
    animation: select-pop 0.12s ease;
}

@keyframes select-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    font-size: 13.5px;
    color: var(--ink);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.custom-select-item:hover {
    background: var(--bg-panel-subtle);
    color: var(--ink);
}

.custom-select-item.selected {
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 600;
}

.custom-select-item .item-check {
    width: 14px;
    height: 14px;
    color: var(--accent-ink);
    opacity: 0;
    flex-shrink: 0;
}

.custom-select-item.selected .item-check {
    opacity: 1;
}

/* Documentation Hub Grid on Homepage */
.docs-hub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
}

@media (max-width: 960px) {
    .docs-hub-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .docs-hub-grid {
        grid-template-columns: 1fr;
    }
}

.docs-hub-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.docs-hub-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.docs-hub-card .card-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.docs-hub-card .card-icon-wrap .icon {
    width: 20px;
    height: 20px;
}

.docs-hub-card h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.docs-hub-card h3 .arrow-icon {
    width: 14px;
    height: 14px;
    color: var(--ink-faint);
    transition: transform 0.15s ease, color 0.15s ease;
}

.docs-hub-card:hover h3 .arrow-icon {
    transform: translateX(3px);
    color: var(--accent);
}

.docs-hub-card p {
    font-size: 14px;
    color: var(--ink-muted);
    line-height: 1.5;
    margin: 0;
}

.rule-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rule-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
}

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

.rule-card.highlighted {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.rule-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rule-id-link {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 17px;
    color: var(--ink);
}

.rule-id-link:hover {
    color: var(--accent);
}

.badge-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge.critical {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge.high {
    background: #FEF0ED;
    color: #C05621;
}

.badge.medium {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge.low {
    background: var(--info-soft);
    color: var(--info);
}

.badge.tier2 {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.badge.tier1 {
    background: #EDF2F7;
    color: #4A5568;
}

.badge.static {
    background: #F7FAFC;
    color: #718096;
    border: 1px solid var(--border);
}

.badge.disabled {
    background: #EDF2F7;
    color: #A0AEC0;
}

.rule-desc {
    font-size: 15px;
    color: var(--ink-muted);
    margin-bottom: 16px;
    line-height: 1.55;
}

.rule-diff-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

.diff-pane {
    overflow-x: auto;
}

.diff-pane-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 6px;
}

.diff-pane-title.vuln {
    color: var(--danger);
}

.diff-pane-title.safe {
    color: var(--accent-ink);
}

.diff-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.55;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #e5e7eb;
}

/* ==========================================================================
   GITHUB ACTION CONFIG GENERATOR
   ========================================================================== */

.action-generator-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    margin: 24px 0 36px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

.form-group .form-hint {
    font-size: 12.5px;
    color: var(--ink-faint);
    margin-top: 4px;
}

.form-control {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer {
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    padding: 56px 0 36px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
}

.footer-brand p {
    font-size: 14px;
    color: var(--ink-muted);
    margin-top: 10px;
    max-width: 32ch;
    line-height: 1.5;
}

.footer-col {
    display: flex;
    flex-direction: column;
}

.footer-col h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    margin-bottom: 16px;
    font-family: 'JetBrains Mono', monospace;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-col a {
    font-size: 14px;
    color: var(--ink-muted);
}

.footer-col a:hover {
    color: var(--ink);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--ink-faint);
    flex-wrap: wrap;
    gap: 12px;
}

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */

@media (max-width: 860px) {
    .docs-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-top: 28px;
    }

    .docs-sidebar {
        position: static;
        border-bottom: 1px solid var(--border);
        padding-bottom: 20px;
        margin-bottom: 8px;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
        align-items: flex-start;
    }

    .docs-nav-group {
        margin-bottom: 0;
        min-width: 180px;
    }

    .action-generator-grid {
        grid-template-columns: 1fr;
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 36px 24px;
    }

    .rule-diff-box {
        grid-template-columns: 1fr;
    }

    .rules-search-bar {
        gap: 8px;
    }
}

@media (max-width: 680px) {

    .nav-links,
    .nav-cta-group .btn-github {
        display: none;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
    }

    .hero h1 {
        font-size: 30px;
        max-width: none;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

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

    .tier-card .num {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .rules-search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-select-trigger {
        width: 100%;
    }

    .page-head {
        padding: 28px 0 24px;
    }

    .page-head h1 {
        font-size: 24px;
    }

    .docs-sidebar {
        /* On narrow phones: collapse into a horizontal scroll strip */
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 12px;
    }

    .docs-sidebar .docs-nav-group {
        display: inline-block;
        vertical-align: top;
        min-width: 160px;
        margin-right: 24px;
        white-space: normal;
    }

    /* Make the mobile nav toggle visible */
    .mobile-toggle {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
    }
}

/* ==========================================================================
   ICONS (inline SVG, no emoji)
   ========================================================================== */

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.14em;
    flex-shrink: 0;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

.icon-md {
    width: 18px;
    height: 18px;
}

/* GitHub star / issue badge icon */
.star-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.star-count .icon {
    width: 12px;
    height: 12px;
    stroke: none;
    fill: currentColor;
}

/* Copy buttons get an icon + label, with a check state on success */
.copy-btn,
.copy-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.copy-btn .icon,
.copy-code-btn .icon {
    width: 12px;
    height: 12px;
}

/* Terminal proof states, rendered as icon + label instead of raw glyphs */
.terminal-body .ok,
.terminal-body .refute {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.terminal-body .ok .icon,
.terminal-body .refute .icon {
    width: 13px;
    height: 13px;
    stroke-width: 2.4;
}

/* Link arrow icon (replaces literal arrow characters) */
.link-inline,
.btn-github,
.faq-answer a,
.docs-content a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.docs-content a,
.faq-answer a {
    display: inline;
}

.link-inline .icon,
.btn-github .icon-external {
    width: 13px;
    height: 13px;
}

/* ==========================================================================
   NAV DROPDOWN (custom component, not a native <select>)
   ========================================================================== */

.nav-links {
    position: relative;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font: inherit;
    font-size: 14.5px;
    color: var(--ink-muted);
    font-weight: 500;
    padding: 4px 0;
    cursor: pointer;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.nav-dropdown-trigger:hover,
.nav-item.open .nav-dropdown-trigger {
    color: var(--ink);
}

/* Active page — Docs trigger gets the same underline as active nav links */
.nav-dropdown-trigger.active {
    color: var(--accent-ink);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.nav-item.open .nav-dropdown-trigger .icon {
    transform: rotate(180deg);
}

.nav-dropdown-trigger .icon {
    width: 13px;
    height: 13px;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: -12px;
    min-width: 280px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: none;
    z-index: 200;
    /* Prevent the panel from going off-screen to the right */
    max-width: min(340px, 90vw);
}

.nav-item.open .nav-dropdown-panel {
    display: block;
    animation: dropdown-in 0.12s ease;
}

@keyframes dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-dropdown-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--ink);
}

.nav-dropdown-link:hover,
.nav-dropdown-link:focus-visible {
    background: var(--bg-panel-subtle);
    color: var(--ink);
}

.nav-dropdown-link .icon {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    color: var(--accent-ink);
    flex-shrink: 0;
}

.nav-dropdown-link .nav-dropdown-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.nav-dropdown-link .nav-dropdown-text span {
    display: block;
    font-size: 12.5px;
    color: var(--ink-faint);
    margin-top: 1px;
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 4px;
}

/* Mobile: dropdown becomes an inline expandable group */
.mobile-nav-group {
    border-bottom: 1px solid var(--border-subtle);
}

.mobile-nav-group-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    font: inherit;
    font-size: 15px;
    color: var(--ink-muted);
    font-weight: 500;
    padding: 8px 0;
    cursor: pointer;
}

.mobile-nav-group-trigger .icon {
    width: 14px;
    height: 14px;
    transition: transform 0.15s ease;
}

.mobile-nav-group.open .mobile-nav-group-trigger .icon {
    transform: rotate(180deg);
}

.mobile-nav-group-panel {
    display: none;
    flex-direction: column;
    padding: 0 0 10px 14px;
    gap: 2px;
}

.mobile-nav-group.open .mobile-nav-group-panel {
    display: flex;
}

.mobile-nav-group-panel a {
    border-bottom: none;
    padding: 7px 0;
    font-size: 14px;
    color: var(--ink-faint);
}

.mobile-nav-group-panel a:hover {
    color: var(--ink);
}

.mobile-toggle .icon {
    width: 18px;
    height: 18px;
    display: block;
}

.mobile-toggle .icon-close {
    display: none;
}

.mobile-toggle[aria-expanded="true"] .icon-menu {
    display: none;
}

.mobile-toggle[aria-expanded="true"] .icon-close {
    display: block;
}

/* ==========================================================================
   404 PAGE
   ========================================================================== */

.error-page {
    text-align: center;
    padding: 100px 24px 120px;
}

.error-page .error-icon {
    width: 56px;
    height: 56px;
    color: var(--accent);
    margin: 0 auto 20px;
}

.error-page .error-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 64px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.error-page h1 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 14px;
}

.error-page p {
    color: var(--ink-muted);
    max-width: 46ch;
    margin: 0 auto 32px;
    font-size: 16px;
}

.error-page .error-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.error-page .error-actions .install-pill {
    padding: 10px 18px;
    background: var(--ink);
}

.error-suggestions {
    max-width: 480px;
    margin: 0 auto;
    text-align: left;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}

.error-suggestions h2 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 12px;
}

.error-suggestions ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.error-suggestions a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-radius: 6px;
    font-size: 14.5px;
    color: var(--ink);
}

.error-suggestions a:hover {
    background: var(--bg-panel-subtle);
}

.error-suggestions a .icon {
    width: 14px;
    height: 14px;
    color: var(--ink-faint);
}

/* ==========================================================================
   MISC POLISH
   ========================================================================== */

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.docs-content thead tr {
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel-subtle);
}

.docs-content th {
    padding: 10px 14px;
    text-align: left;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.docs-content td {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.docs-content tbody tr:last-child td {
    border-bottom: none;
}

.docs-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
}

.docs-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.docs-panel-header .eyebrow {
    font-size: 13px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-ink);
}

.docs-panel-header .eyebrow-link {
    font-size: 12.5px;
}

.community-action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 860px) {
    .community-action-grid {
        grid-template-columns: 1fr;
    }
}

.community-btn-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.community-btn-card:hover {
    border-color: #cbd5e1;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.community-btn-card .icon {
    width: 24px;
    height: 24px;
    color: var(--accent-ink);
    flex-shrink: 0;
}

.community-btn-card div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.community-btn-card strong {
    font-size: 14.5px;
    color: var(--ink);
    font-weight: 600;
}

.community-btn-card span {
    font-size: 12.5px;
    color: var(--ink-muted);
}

.quick-jump-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--bg-panel-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 40px;
}

.quick-jump-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'JetBrains Mono', monospace;
}

.quick-jump-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--accent-ink);
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.quick-jump-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

@media (max-width: 680px) {
    .nav-dropdown-panel {
        left: 0;
    }
}