/* ═══════════════════════════════════════════════════════════
   BEZALT · docs.css: documentation layout. Loads after site.css
   and reuses its tokens, buttons, brand lockup and footer.
   ═══════════════════════════════════════════════════════════ */

.docs-body {
    background: var(--bg-1);
}

/* ─────────────────────────────
   HEADER
───────────────────────────── */
.docs-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 10, 8, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.docs-header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.docs-crumb {
    color: var(--text-3);
    font-weight: 500;
    font-size: 15px;
    margin-left: 2px;
}

.docs-topnav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.docs-topnav a {
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.docs-topnav a:hover {
    color: var(--gold);
}

.docs-topnav .ticker-chip--nav {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line-gold-strong);
    border-radius: 999px;
    background: rgba(242, 180, 65, 0.06);
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.docs-topnav .ticker-chip--nav:hover {
    background: rgba(242, 180, 65, 0.14);
    color: var(--gold-bright);
}

.docs-topnav .ticker-chip--nav {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line-gold-strong);
    border-radius: 999px;
    background: rgba(242, 180, 65, 0.06);
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.docs-topnav .ticker-chip--nav:hover {
    background: rgba(242, 180, 65, 0.14);
    color: var(--gold-bright);
}

/* ─────────────────────────────
   LAYOUT
───────────────────────────── */
.docs-layout {
    max-width: 1240px;
    margin: 0 auto;
    padding: 56px var(--gutter) 96px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 64px;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 96px;
}

.docs-sidebar-label {
    margin: 0 0 12px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.docs-toc {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px solid var(--line);
}

.docs-toc a {
    display: block;
    padding: 7px 14px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s;
}

.docs-toc a:hover {
    color: var(--text);
}

.docs-toc a.active {
    color: var(--gold);
    border-left-color: var(--gold);
}

.docs-main {
    min-width: 0;
    max-width: 760px;
}

/* ─────────────────────────────
   TYPOGRAPHY
───────────────────────────── */
.docs-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1;
}

.docs-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(42px, 5vw, 66px);
    line-height: 1.04;
    letter-spacing: -0.015em;
    margin-bottom: 22px;
    text-wrap: balance;
}

.docs-lede {
    font-size: 19px;
    line-height: 1.55;
    color: var(--text-2);
    margin-bottom: 56px;
}

.docs-section {
    padding-top: 24px;
    margin-bottom: 64px;
    scroll-margin-top: 92px;
}

.docs-section h2 {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.12;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.docs-section h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.docs-section p {
    font-size: 16.5px;
    line-height: 1.65;
    color: var(--text-2);
    margin-bottom: 16px;
}

.docs-section p:last-child {
    margin-bottom: 0;
}

.docs-section em {
    color: var(--text);
    font-style: italic;
}

.docs-section strong {
    color: var(--text);
    font-weight: 700;
}

.docs-section p a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(242, 180, 65, 0.35);
}

.docs-section p a:hover {
    border-bottom-color: var(--gold);
}

/* ─────────────────────────────
   COMPONENTS
───────────────────────────── */
.docs-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.docs-tile {
    padding: 22px 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    transition: border-color 0.2s;
}

.docs-tile:hover {
    border-color: var(--line-gold);
}

.docs-tile h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.docs-tile p {
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-3);
    margin: 0;
}

.docs-steps {
    list-style: none;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 22px 0;
}

.docs-steps li {
    counter-increment: step;
    position: relative;
    padding: 20px 22px 20px 74px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--bg-2);
}

.docs-steps li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 22px;
    top: 20px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--gold);
    color: var(--gold-ink);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.docs-steps h3 {
    font-size: 17px;
    margin-bottom: 6px;
}

.docs-steps p {
    font-size: 15px;
    margin: 0;
}

.docs-table-wrap {
    overflow-x: auto;
    margin: 22px 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-2);
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    min-width: 560px;
}

.docs-table caption {
    caption-side: bottom;
    text-align: left;
    padding: 12px 16px 14px;
    color: var(--text-3);
    font-size: 12.5px;
    line-height: 1.5;
    border-top: 1px solid var(--line);
}

.docs-table th,
.docs-table td {
    padding: 13px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
    line-height: 1.45;
}

.docs-table th {
    color: var(--gold);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(242, 180, 65, 0.05);
}

.docs-table td {
    color: var(--text-2);
}

.docs-table td:first-child {
    color: var(--text);
    font-weight: 600;
}

.docs-table--numeric th:nth-child(n+3),
.docs-table--numeric td:nth-child(n+3) {
    white-space: nowrap;
}

.docs-table tbody tr:last-child td {
    border-bottom: 0;
}

.docs-example {
    margin: 22px 0;
    padding: 22px 24px;
    border: 1px solid var(--line-gold);
    border-radius: 16px;
    background: radial-gradient(circle at 0% 0%, rgba(242, 180, 65, 0.08), transparent 45%), var(--bg-2);
}

.docs-example-label {
    margin: 0 0 14px !important;
    color: var(--gold);
    font-size: 11px !important;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.docs-example dl {
    display: grid;
    gap: 0;
}

.docs-example dl > div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 15px;
}

.docs-example dl > div:last-child {
    border-bottom: 0;
}

.docs-example dt {
    color: var(--text-3);
}

.docs-example dd {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.docs-list {
    margin: 18px 0 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-2);
    font-size: 16px;
    line-height: 1.6;
}

.docs-list li::marker {
    color: var(--gold);
}

.docs-faq {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.docs-faq > div {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-2);
}

.docs-faq dt {
    font-size: 16.5px;
    font-weight: 700;
    margin-bottom: 8px;
}

.docs-faq dd {
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.6;
}

.docs-footer-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

/* ─────────────────────────────
   RESPONSIVE
───────────────────────────── */
@media (max-width: 900px) {
    .docs-layout {
        grid-template-columns: 1fr;
        gap: 32px;
        padding-top: 36px;
    }
    .docs-sidebar {
        position: static;
    }
    .docs-toc {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        border-left: 0;
    }
    .docs-toc a {
        padding: 7px 12px;
        margin: 0;
        border: 1px solid var(--line);
        border-radius: 999px;
        font-size: 13px;
    }
    .docs-toc a.active {
        border-color: var(--gold);
    }
    .docs-grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    }
}

@media (max-width: 640px) {
    .docs-topnav {
        display: none;
    }
    .docs-lede {
        font-size: 17px;
        margin-bottom: 40px;
    }
    .docs-section {
        margin-bottom: 48px;
    }
    .docs-section h2 {
        font-size: 26px;
    }
    .docs-steps li {
        padding: 18px 18px 18px 64px;
    }
    .docs-steps li::before {
        left: 16px;
        top: 18px;
        width: 32px;
        height: 32px;
    }
    .docs-example dl > div {
        flex-direction: column;
        gap: 4px;
    }
    .docs-example dd {
        text-align: left;
    }
    .docs-footer-cta .btn {
        flex: 1;
        width: auto;
    }
}

/* ── page links + no-JS mobile menu ── */
.docs-topnav a.is-current {
    color: var(--gold);
}

.docs-menu {
    display: none;
    position: relative;
}

.docs-menu summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.docs-menu summary::-webkit-details-marker {
    display: none;
}

.docs-menu[open] summary {
    border-color: var(--gold);
}

.docs-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    padding: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--bg-2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    z-index: 60;
}

.docs-menu-list a {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.docs-menu-list a:hover,
.docs-menu-list a.is-current {
    color: var(--gold);
    background: rgba(242, 180, 65, 0.07);
}

@media (max-width: 640px) {
    .docs-menu {
        display: block;
    }
}

/* ── quick-link cards at the top of docs ── */
.docs-quick {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 48px;
}

.docs-quick a {
    display: block;
    padding: 18px 18px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-2);
    text-decoration: none;
    transition: border-color 0.2s, transform 0.2s var(--ease);
}

.docs-quick a:hover {
    border-color: var(--line-gold);
    transform: translateY(-2px);
}

.docs-quick strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 6px;
}

.docs-quick span {
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .docs-quick {
        grid-template-columns: 1fr;
    }
}

/* ── function reference tables ── */
.docs-table--ref {
    table-layout: fixed;
}

.docs-table--ref th:first-child,
.docs-table--ref td:first-child {
    width: 42%;
}

.docs-table--ref th:nth-child(2),
.docs-table--ref td:nth-child(2) {
    width: 18%;
}

.docs-table--ref td:first-child {
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--gold-bright);
    overflow-wrap: anywhere;
}

.docs-meta {
    margin-top: -40px;
    margin-bottom: 40px;
    color: var(--text-4);
    font-size: 12.5px;
}

/* ── whitepaper figures & numbering ── */
.paper-abstract {
    margin: 0 0 48px;
    padding: 24px 26px;
    border: 1px solid var(--line-gold);
    border-radius: 18px;
    background: radial-gradient(circle at 0% 0%, rgba(242, 180, 65, 0.08), transparent 45%), var(--bg-2);
}

.paper-abstract h2 {
    font-family: var(--font) !important;
    font-weight: 700;
    font-size: 12px !important;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    border: 0 !important;
    padding: 0 !important;
    margin-bottom: 12px !important;
}

.paper-abstract p {
    font-size: 16px;
    line-height: 1.65;
    color: var(--text-2);
    margin: 0;
}

.paper-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin: -28px 0 44px;
    color: var(--text-3);
    font-size: 13px;
}

.paper-meta strong {
    color: var(--text);
    font-weight: 600;
}

.figure {
    margin: 26px 0;
    padding: 18px 18px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #070604;
}

.figure svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Diagrams keep a legible minimum width on small screens and scroll sideways
   instead of shrinking their 11 px labels below readability. */
@media (max-width: 640px) {
    .figure {
        padding: 14px 14px 12px;
    }
    .figure-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
        padding: 0 4px;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), rgba(0, 0, 0, 0.6));
        mask-image: linear-gradient(to right, #000 calc(100% - 24px), rgba(0, 0, 0, 0.6));
    }
    .figure-scroll svg {
        min-width: 600px;
    }
}

.figure figcaption {
    margin-top: 12px;
    color: var(--text-3);
    font-size: 12.5px;
    line-height: 1.5;
}

.figure figcaption strong {
    color: var(--text-2);
}

.eq {
    margin: 16px 0;
    padding: 14px 18px;
    border-left: 3px solid var(--gold);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0 10px 10px 0;
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    overflow-x: auto;
}

/* ── FAQ ── */
.faq-tools {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0 0 32px;
}

.faq-search {
    flex: 1;
    height: 50px;
    padding: 0 16px 0 44px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #0A0907 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a938a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center / 20px;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
}

.faq-search:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(242, 180, 65, 0.18);
}

.faq-toggle {
    height: 50px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.faq-toggle:hover {
    border-color: var(--gold);
}

.faq-group {
    margin-bottom: 44px;
    scroll-margin-top: 92px;
}

.faq-group h2 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.faq-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-2);
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.faq-item[open] {
    border-color: var(--line-gold);
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 48px 16px 18px;
    position: relative;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(242, 180, 65, 0.12);
    color: var(--gold);
    font-size: 18px;
    font-weight: 500;
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-item .faq-body {
    padding: 0 18px 18px;
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.6;
}

.faq-body p + p {
    margin-top: 10px;
}

.faq-body a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px solid rgba(242, 180, 65, 0.35);
}

.faq-empty {
    display: none;
    padding: 24px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    color: var(--text-3);
    text-align: center;
}

.faq-hidden {
    display: none !important;
}

.faq-count {
    color: var(--text-4);
    font-size: 12.5px;
    margin: -22px 0 26px;
}

@media (max-width: 640px) {
    .faq-tools {
        flex-direction: column;
        align-items: stretch;
    }
    .paper-meta {
        margin-top: -20px;
    }
    .docs-meta {
        margin-top: -28px;
        margin-bottom: 32px;
    }
}

/* ─────────────────────────────
   PRINT · docs, whitepaper, FAQ, terminal
   Black on white, chrome removed, figures kept as rendered.
───────────────────────────── */
@media print {
    :root {
        --text: #000;
        --text-2: #1a1a1a;
        --text-3: #3d3d3d;
        --text-4: #5a5a5a;
        --bg: #fff;
        --bg-1: #fff;
        --bg-2: #fff;
        --bg-3: #f4f2ee;
        --line: #d9d5cc;
        --line-strong: #bdb7ab;
        --line-gold: #c9a24a;
        --gold: #8a5a00;
        --gold-bright: #8a5a00;
        --gold-ink: #000;
    }
    .docs-header,
    .docs-sidebar,
    .docs-menu,
    .footer,
    .skip-link,
    .docs-footer-cta,
    .docs-quick,
    .faq-tools,
    .faq-count,
    .faq-empty,
    .term-actions {
        display: none !important;
    }
    html,
    body,
    .docs-body {
        background: #fff !important;
        color: #000;
    }
    .docs-layout {
        display: block;
        max-width: none;
        padding: 0;
    }
    .docs-main {
        max-width: none;
    }
    .docs-title .highlight,
    .highlight {
        background: none;
        color: #000;
        padding: 0;
    }
    .docs-section,
    .faq-group {
        break-inside: auto;
    }
    .docs-section h2,
    .docs-section h3,
    .faq-group h2 {
        break-after: avoid;
    }
    .docs-tile,
    .docs-table-wrap,
    .docs-example,
    .docs-steps li,
    .faq-item,
    .callout {
        break-inside: avoid;
        background: #fff !important;
        box-shadow: none;
    }
    .docs-table th {
        background: #f0ede6 !important;
    }
    .code,
    .eq {
        background: #f6f4ef !important;
        color: #000;
        border-color: #d9d5cc;
        white-space: pre-wrap;
        word-break: break-word;
    }
    .code .c { color: #6b6b6b; }
    .code .k { color: #8a5a00; }
    .code .t { color: #1f4f8f; }
    .figure {
        background: #070604 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        break-inside: avoid;
    }
    .figure figcaption { color: #cfc9bd; }
    .figure figcaption strong { color: #fff; }
    .figure-scroll { overflow: visible; mask-image: none; -webkit-mask-image: none; }
    .figure-scroll svg { min-width: 0; }
    .faq-item summary::after { display: none; }
    .docs-section p a,
    .faq-body a {
        color: #000;
        border-bottom: 0;
        text-decoration: underline;
    }
    .docs-section p a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #5a5a5a;
    }
}
