/* ───────────────────────────────────────────────────────────────────────────
   CaptchaPress Documentation — Static Template
   Standalone styles (no inline CSS). Theme: light / dark.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── JetBrains Mono (code) — local subset ── */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url('../fonts/jetbrains-mono/JetBrainsMono-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url('../fonts/jetbrains-mono/JetBrainsMono-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Theme tokens ── */
:root {
    --background: #f8fafc;
    --foreground: #0f172a;
    --card: #ffffff;
    --popover: #ffffff;
    --primary: #4f46e5;
    --primary-foreground: #ffffff;
    --secondary: #f1f5f9;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #eef2ff;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #818cf8;
    --radius: 0.5rem;
    --sidebar: #ffffff;
    --sidebar-border: #e2e8f0;

    --tok-kw: #7c3aed;
    --tok-var: #2563eb;
    --tok-str: #16a34a;
    --tok-class: #b45309;
    --tok-comment: #9ca3af;
}

html.dark {
    --background: #0d1117;
    --foreground: #e2e8f0;
    --card: #161b22;
    --popover: #161b22;
    --primary: #818cf8;
    --primary-foreground: #0d1117;
    --secondary: #1e2533;
    --muted: #1a2030;
    --muted-foreground: #8892a4;
    --accent: #1e253a;
    --border: #2a3448;
    --input: #2a3448;
    --ring: #818cf8;
    --sidebar: #0f1520;
    --sidebar-border: #2a3448;

    --tok-kw: #c792ea;
    --tok-var: #82aaff;
    --tok-str: #c3e88d;
    --tok-class: #ffcb6b;
    --tok-comment: #546e7a;
}

/* ── Base ── */
* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

*:hover {
    scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

*:hover::-webkit-scrollbar-thumb {
    background: var(--border);
}

html {
    font-size: 16px;
    font-family: YekanBakh, system-ui, sans-serif;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
    font-family: YekanBakh, system-ui, sans-serif;

}

a {
    color: inherit;
}

.font-mono,
code,
pre,
.ic {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Layout ── */
.container-xl {
    max-width: 1280px;
    margin-inline: auto;
}

/* ── Header ── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--background) 90%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-inline: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: linear-gradient(to bottom right, #6366f1, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.brand-name {
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1;
}

.brand-tag {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

/* ── Search ── */
.search-wrap {
    flex: 1;
    max-width: 24rem;
    margin-inline: auto;
}

.search-box {
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding-inline-start: 0.75rem;
    padding-inline-end: 2.25rem;
    padding-block: 0.5rem;
    font-size: 0.875rem;
    color: var(--foreground);
    font-family: YekanBakh;
    transition: all .15s ease;
}

#searchInput::placeholder {
    color: var(--muted-foreground);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent);
}

.search-count {
    position: absolute;
    inset-inline-start: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--muted-foreground);
    background: var(--card);
    padding: 1px 6px;
    border-radius: 999px;
    display: none;
    left: 48px;
    right: inherit;
}

/* ── Header buttons ── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--muted);
    color: var(--muted-foreground);
    border: none;
    cursor: pointer;
    transition: all .15s ease;
}

.icon-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}

.menu-btn {
    display: none;
}

/* ── Body grid ── */
.body-grid {
    display: flex;
    position: relative;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 30;
    display: none;
}

/* ── Sidebar ── */
.sidebar {
    order: 1;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    width: 18rem;
    flex-shrink: 0;
    border-inline-start: 1px solid var(--sidebar-border);
    overflow-y: auto;
    background: transparent;
}

.sidebar-inner {
    padding: 1rem 1rem 2rem;
}

.sidebar-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.75rem;
    padding-inline: 0.75rem;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-align: right;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    font-family: YekanBakh;
    transition: all .15s ease;
}

.nav-item-btn:hover {
    color: var(--foreground);
    background: var(--accent);
}

.nav-item-btn.active {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    font-weight: 500;
}

.nav-item-btn .chevron {
    flex-shrink: 0;
    transition: transform .2s ease;
}

.nav-item-btn.open .chevron {
    transform: rotate(180deg);
}

.nav-children {
    margin-inline-end: 1rem;
    margin-top: 2px;
    border-inline-end: 1px solid var(--border);
    padding-inline-end: 0.75rem;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.nav-children.open {
    display: flex;
}

.nav-child-btn {
    width: 100%;
    text-align: right;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    font-family: YekanBakh;
    transition: all .15s ease;
}

.nav-child-btn:hover {
    color: var(--foreground);
    background: var(--accent);
}

.nav-child-btn.active {
    color: var(--primary);
    font-weight: 500;
}

.nav-item-wrap.search-hidden {
    display: none;
}

/* ── Main content ── */
.main-content {
    order: 2;
    flex: 1;
    min-width: 0;
    padding: 2.5rem 2rem;
    max-width: 48rem;
    margin-inline: auto;
}

/* ── Hero ── */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.hero-sub {
    font-size: 1rem;
    color: var(--muted-foreground);
    margin: 0 0 1.5rem;
    line-height: 1.6;
}

.hero-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.stat-card {
    border-radius: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

/* ── Typography ── */
strong {
    color: var(--foreground);
    font-weight: 600;
}

.divider {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

h2.doc-h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 3rem 0 1rem;
    padding-top: 0.5rem;
    scroll-margin-top: 5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

h2.doc-h2 .bar {
    display: inline-block;
    width: 4px;
    height: 28px;
    border-radius: 999px;
    background: var(--primary);
    flex-shrink: 0;
}

h3.doc-h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    scroll-margin-top: 5rem;
}

p.doc-p {
    color: var(--muted-foreground);
    line-height: 2;
    margin: 0.75rem 0;
}

/* ── Inline code ── */
.ic {
    font-size: 0.75rem;
    background: var(--muted);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 0.375rem;
    color: var(--primary);
    direction: ltr;
    display: inline-block;
}

/* ── Lists ── */
ol.doc-ol {
    list-style: decimal;
    list-style-position: inside;
    margin: 1rem 0;
    padding-inline-start: 0.5rem;
    color: var(--muted-foreground);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

ol.doc-ol > li {
    line-height: 2;
}

ul.doc-ul {
    list-style: none;
    margin: 1rem 0;
    padding-inline-start: 0.5rem;
    color: var(--muted-foreground);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

ul.doc-ul > li {
    display: flex;
    gap: 0.5rem;
    line-height: 2;
}

ul.doc-ul > li .bullet {
    margin-top: 2px;
    flex-shrink: 0;
    color: var(--primary);
    font-size: 0.75rem;
}

/* ── Tables ── */
.table-wrap {
    margin: 1.25rem 0;
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

table.doc-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

table.doc-table thead tr {
    background: var(--muted);
    border-bottom: 1px solid var(--border);
}

table.doc-table th {
    padding: 0.75rem 1rem;
    text-align: right;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
}

table.doc-table td {
    padding: 0.75rem 1rem;
    color: var(--muted-foreground);
    line-height: 1.8;
    border-bottom: 1px solid var(--border);
}

table.doc-table tbody tr:last-child td {
    border-bottom: 0;
}

table.doc-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ── Callouts ── */
.callout {
    margin: 1.25rem 0;
    border-radius: 0.75rem;
    border: 1px solid;
    border-inline-start-width: 4px;
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    line-height: 2;
    color: var(--muted-foreground);
}

.callout .callout-icon {
    margin-inline-end: 0.5rem;
    font-size: 1rem;
}

.callout-info {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(129, 140, 248, 0.4);
    border-inline-start-color: #818cf8;
}

.callout-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(251, 191, 36, 0.4);
    border-inline-start-color: #fbbf24;
}

.callout-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(248, 113, 113, 0.4);
    border-inline-start-color: #f87171;
}

/* ── Style cards grid ── */
.cards-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.style-card {
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: var(--card);
    padding: 1rem;
    transition: border-color .15s ease;
}

.style-card:hover {
    border-color: color-mix(in srgb, var(--primary) 50%, transparent);
}

.style-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.style-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
}

.style-card-desc {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.8;
    margin: 0;
}

/* ── FAQ ── */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-card {
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    padding: 1.25rem;
    transition: border-color .15s ease;
}

.faq-card:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
}

.faq-q {
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 20px;
    margin-bottom: 12px;
}

.faq-q .q-mark {
    color: var(--primary);
    font-size: 0.875rem;
}

.faq-body {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.9;
}

.faq-body ul.doc-ul {
    margin: 0;
}

/* ── Code blocks ── */
.code-block {
    position: relative;
    margin: 1.25rem 0;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: var(--muted);
    border-bottom: 1px solid var(--border);
}

.code-lang {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: YekanBakh;
    transition: all .15s ease;
}

.copy-btn:hover {
    color: var(--foreground);
    background: var(--accent);
}

.copy-btn.copied {
    color: #22c55e;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
    padding: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.7;
    background: var(--card);
    color: var(--foreground);
    direction: ltr;
    text-align: left;
}

/* Syntax tokens */
.tok-kw {
    color: var(--tok-kw);
}

.tok-var {
    color: var(--tok-var);
}

.tok-str {
    color: var(--tok-str);
}

.tok-class {
    color: var(--tok-class);
}

.tok-comment {
    color: var(--tok-comment);
    font-style: italic;
}

/* ── Footer ── */
.doc-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.doc-footer .foot-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ── Search highlight ── */
mark.search-highlight {
    background: #fde047;
    color: #1f2937;
    border-radius: 3px;
    padding: 0 2px;
}

mark.search-highlight.current {
    background: #f97316dd;
    color: #fff;
}

html.dark mark.search-highlight {
    background: #facc15;
    color: #1f2937;
}

.curved-img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
    margin: 8px 0;
}


.curved-small-img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    margin: 8px 0;
}

/* ── Icons ── */
.icon {
    display: inline-block;
    vertical-align: middle;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 64px;
        inset-inline-end: 0;
        z-index: 40;
        background: var(--sidebar);
        transform: translateX(100%);
        transition: transform .3s ease;
    }

    html[dir="rtl"] .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .header-inner {
        padding-inline: 1rem;
        gap: 0.75rem;
    }

    .brand-tag {
        display: none;
    }

    .hero-title {
        font-size: 1.875rem;
    }

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

    .cards-2 {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 2rem 1.25rem;
    }
}
