/*
 * Falx documentation stylesheet.
 *
 * Shares its design tokens, dark-mode logic, and core component classes
 * (.tile, .btn, .theme-toggle, .code-window/.code, .footer, .global-nav)
 * verbatim with sharkblocks00.com's style.css, so the two sites are the
 * same design system rather than two similar-looking ones. Sections
 * marked "docs-only" below are additions style.css has no equivalent for
 * (the sidebar, reference tables, signature cards, the docs shell layout)
 * and are built from the same tokens rather than new ones.
 */

/* ---------- Tokens (identical to style.css) ---------- */
:root {
    /* motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    /* color */
    --primary: #0066cc;
    --primary-focus: #0071e3;
    --primary-on-dark: #2997ff;
    --link: var(--primary);
    /* text-links and ghost-button outlines: swaps on dark canvas */
    --focus: var(--primary-focus);
    /* keyboard focus ring on light/parchment surfaces */
    --ink: #1d1d1f;
    --on-dark: #ffffff;
    --body-muted: #cccccc;
    --ink-80: #333333;
    --ink-48: #7a7a7a;
    --hairline: #e0e0e0;
    --canvas: #ffffff;
    --parchment: #f5f5f7;
    --tile-1: #272729;
    --tile-3: #252527;
    --black: #000000;

    /* type */
    --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
    --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    /* shape and depth */
    --r-sm: 8px;
    --r-lg: 18px;
    --r-pill: 9999px;
    --shadow-product: rgba(0, 0, 0, 0.22) 3px 5px 30px 0;

    /* layout */
    --nav-h: 44px;
    --content: 980px;
    --gutter: 24px;

    /* docs-only: the docs shell is wider than the marketing site's single
       reading column, to make room for the sidebar */
    --docs-content: 1280px;
    --docs-sidebar-w: 260px;
}

/*
 * Dark mode. Only the tokens for surfaces that change (canvas, parchment,
 * text, hairlines and the two theme-aware accents) are overridden -the
 * black nav bar, the already-dark tiles, and the black code window are
 * deliberately left alone, exactly as on the main site. Applied two ways:
 * [data-theme] once docs.js runs, and prefers-color-scheme as a no-JS
 * fallback -this is the SAME localStorage key ("theme") and the same
 * data-theme attribute the main site's theme-toggle uses, so the two
 * agree once both have been visited in one browser.
 */
:root[data-theme="dark"] {
    --ink: #f5f5f7;
    --ink-80: #c7c7cc;
    --ink-48: #8e8e93;
    --hairline: #424245;
    --canvas: #000000;
    --parchment: #1d1d1f;
    --link: var(--primary-on-dark);
    --focus: var(--primary-on-dark);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #f5f5f7;
        --ink-80: #c7c7cc;
        --ink-48: #8e8e93;
        --hairline: #424245;
        --canvas: #000000;
        --parchment: #1d1d1f;
        --link: var(--primary-on-dark);
        --focus: var(--primary-on-dark);
    }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--nav-h) + 52px + 16px);
    /* nav + sub-nav + breathing room */
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    margin: 0;
    /* docs-only: pages without full-bleed tiles (everything except the
       landing page) read as the parchment "utility surface" the design
       spec uses for store/config pages, with white cards floating on it. */
    background: var(--parchment);
    color: var(--ink);
    font: 400 17px/1.47 var(--font-text);
    letter-spacing: -0.374px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

main {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.tile--dark :focus-visible,
.tile--dark-3 :focus-visible {
    outline-color: var(--primary-on-dark);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 200;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--canvas);
    color: var(--ink);
    font: 400 14px/1.29 var(--font-text);
    text-decoration: none;
}

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

.wrap {
    width: min(100% - (var(--gutter) * 2), var(--content));
    margin-inline: auto;
}

/* ---------- Global nav (identical structure to style.css) ---------- */
.global-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: var(--black);
    color: var(--on-dark);
}

.global-nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - (var(--gutter) * 2), var(--docs-content));
    height: 100%;
    margin-inline: auto;
}

.global-nav__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--on-dark);
    font: 600 14px/1 var(--font-text);
    letter-spacing: -0.224px;
    text-decoration: none;
}

.global-nav__brand img {
    display: block;
}

.global-nav__right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.global-nav__links {
    display: flex;
}

.global-nav__links a {
    display: flex;
    align-items: center;
    height: var(--nav-h);
    padding: 0 10px;
    color: var(--body-muted);
    font: 400 12px/1 var(--font-text);
    letter-spacing: -0.12px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.global-nav__links a:hover,
.global-nav__links a[aria-current] {
    color: var(--on-dark);
}

.global-nav__links li:last-child a {
    padding-right: 0;
}

/* ---------- Dark mode toggle (identical to style.css) ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.14);
    color: var(--on-dark);
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.12s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.24);
}

.theme-toggle:active {
    transform: scale(0.92);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

.theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: block;
    }
}

/* docs-only: a second, dark-surfaced toggle variant for use on the sub-nav,
   which sits on a light/parchment bar rather than the black global nav */
.theme-toggle--onlight {
    background: rgba(0, 0, 0, 0.08);
    color: var(--ink);
}

.theme-toggle--onlight:hover {
    background: rgba(0, 0, 0, 0.14);
}

/* ---------- docs-only: sub-nav ---------- */
.sub-nav {
    position: sticky;
    top: var(--nav-h);
    z-index: 90;
    height: 52px;
    background: var(--canvas);
    border-bottom: 1px solid var(--hairline);
}

.sub-nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(100% - (var(--gutter) * 2), var(--docs-content));
    height: 100%;
    margin-inline: auto;
}

.sub-nav__title {
    font: 600 21px/1.19 var(--font-display);
    letter-spacing: 0.231px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-nav__title a {
    text-decoration: none;
}

/* docs-only: small live-version pill next to "Falx Docs", fed by includes/github.php */
.version-badge {
    font: 600 11px/1 var(--font-mono) !important;
    letter-spacing: 0 !important;
    color: var(--ink-48) !important;
    background: var(--parchment);
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    padding: 3px 8px;
}

.version-badge:hover {
    color: var(--link) !important;
    border-color: var(--link);
}

.sub-nav__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input {
    height: 36px;
    width: 200px;
    max-width: 40vw;
    padding: 8px 16px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    background: var(--parchment);
    color: var(--ink);
    font: 400 14px/1.29 var(--font-text);
    letter-spacing: -0.224px;
}

.search-input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

/* ---------- Buttons and links (identical to style.css, plus one docs-only variant) ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background: transparent;
    font: 400 17px/1.24 var(--font-text);
    letter-spacing: -0.374px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.12s ease;
}

.btn:active {
    transform: scale(0.95);
}

.btn--primary {
    background: var(--primary);
    color: var(--on-dark);
}

.btn--primary:hover {
    background: var(--primary-focus);
}

.btn--ghost {
    border-color: var(--link);
    color: var(--link);
}

.btn--ghost:hover {
    background: var(--parchment);
}

.btn--ghost-dark {
    border-color: var(--primary-on-dark);
    color: var(--primary-on-dark);
}

.btn--ghost-dark:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* docs-only: the compact dark utility button from the shared design spec
   ({component.button-dark-utility}) -used for the sub-nav's GitHub link */
.btn--dark {
    padding: 8px 15px;
    border-radius: var(--r-sm);
    background: var(--ink);
    color: var(--canvas);
    font: 400 14px/1.29 var(--font-text);
    letter-spacing: -0.224px;
}

:root[data-theme="dark"] .btn--dark {
    background: var(--parchment);
    color: var(--ink);
    border: 1px solid var(--hairline);
}

.btn--sm {
    padding: 8px 15px;
    font-size: 14px;
    border-radius: var(--r-sm);
}

.text-link {
    color: var(--link);
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.text-link--on-dark {
    color: var(--primary-on-dark);
}

.copy a,
.docs-content a,
.card__copy a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.docs-content a:hover {
    text-decoration-thickness: 2px;
}

/* ---------- Tiles (identical to style.css -used on the docs landing page) ---------- */
.tile {
    padding: 80px 0;
    text-align: center;
}

.tile--light {
    background: var(--canvas);
    color: var(--ink);
}

.tile--parchment {
    background: var(--parchment);
    color: var(--ink);
}

.tile--dark {
    background: var(--tile-1);
    color: var(--on-dark);
}

.tile--dark-3 {
    background: var(--tile-3);
    color: var(--on-dark);
}

.hero {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    min-height: calc(60vh - var(--nav-h));
}

.hero .wrap {
    padding-block: 16px;
}

.hero__title {
    font: 600 56px/1.07 var(--font-display);
    letter-spacing: -0.28px;
    text-wrap: balance;
}

.tile__title {
    font: 600 40px/1.1 var(--font-display);
    letter-spacing: 0;
    text-wrap: balance;
}

.lead {
    max-width: 34em;
    margin: 16px auto 0;
    font: 400 28px/1.14 var(--font-display);
    letter-spacing: 0.196px;
    text-wrap: balance;
}

.hero .lead {
    margin-top: 20px;
}

.tile--dark .lead,
.tile--dark-3 .lead {
    color: var(--body-muted);
}

.pill-badge {
    display: inline-block;
    margin-bottom: 20px;
    padding: 6px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    background: var(--parchment);
    color: var(--ink-80);
    font: 600 12px/1 var(--font-text);
    letter-spacing: -0.12px;
}

.tile--dark .pill-badge,
.tile--dark-3 .pill-badge {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--body-muted);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
}

/* ---------- Code window (identical component to style.css, generalised so a
   snippet can stand alone without the tab strip) ---------- */
.code-window {
    max-width: 720px;
    margin: 40px auto 0;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: var(--black);
    box-shadow: var(--shadow-product);
    text-align: left;
}

.code-tabs {
    display: flex;
    gap: 4px;
    padding: 6px 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.code-tabs button {
    flex-shrink: 0;
    appearance: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 10px 14px 12px;
    background: transparent;
    color: var(--body-muted);
    font: 400 13px/1 var(--font-mono);
    cursor: pointer;
    transition: color 0.15s ease;
}

.code-tabs button:hover {
    color: var(--on-dark);
}

.code-tabs button[aria-selected="true"] {
    color: var(--on-dark);
    border-bottom-color: var(--primary-on-dark);
}

.code {
    margin: 0;
    padding: 14px 24px 24px;
    overflow-x: auto;
    text-align: left;
    color: var(--body-muted);
    font: 400 15px/1.65 var(--font-mono);
    tab-size: 4;
}

.code code {
    font: inherit;
}

.code .k {
    color: var(--on-dark);
    font-weight: 600;
}

.code .n,
.code .out {
    color: var(--on-dark);
}

.code .prompt {
    color: var(--ink-48);
}

/* docs-only additions to the same code-window palette, for content the
   marketing site's samples never needed: strings, comments, callables */
.code .s {
    color: #67d88a;
}

.code .c {
    color: var(--ink-48);
    font-style: italic;
}

.code .fn {
    color: var(--primary-on-dark);
}

.code--run {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 14px;
}

/* docs-only: a standalone code block (no tab strip) reuses the code-window
   look directly -this is how nearly every snippet in the guide/reference/
   tutorials renders */
.docs-content pre.code {
    max-width: none;
    margin: 0 0 20px;
    border-radius: var(--r-lg);
    background: var(--black);
    box-shadow: var(--shadow-product);
}

.docs-content pre.code+pre.code {
    margin-top: -4px;
}

/* docs-only: inline `code` snippets, usable both inside .docs-content and
   on the landing page's tiles (feature-grid/card-grid) */
code.inline {
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--hairline);
    color: var(--ink);
    font: 400 0.86em/1.3 var(--font-mono);
}

a:hover code.inline {
    text-decoration: underline;
}

:root[data-theme="dark"] code.inline {
    background: rgba(255, 255, 255, 0.12);
}

.tile--dark code.inline,
.tile--dark-3 code.inline {
    background: rgba(255, 255, 255, 0.14);
    color: var(--on-dark);
}



.facts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 720px;
    margin: 40px auto 0;
}

.facts>div {
    display: flex;
    flex-direction: column-reverse;
    gap: 4px;
}

.facts dd {
    font: 600 21px/1.19 var(--font-display);
    letter-spacing: 0.231px;
}

.facts dt {
    color: var(--body-muted);
    font: 400 14px/1.43 var(--font-text);
    letter-spacing: -0.224px;
}

/* ---------- Cards (same visual language as style.css's .card, generalised) ---------- */
.card {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 48px;
    padding: 40px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    background: var(--canvas);
    text-align: left;
}

.card__title {
    margin-bottom: 12px;
    font: 600 28px/1.14 var(--font-display);
    letter-spacing: 0.196px;
}

.card__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 20px;
}

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

.chips li,
.tag {
    padding: 8px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    background: var(--canvas);
    font: 400 14px/1.43 var(--font-text);
    letter-spacing: -0.224px;
}

.tag {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--ink-48);
    background: var(--parchment);
    border-color: var(--hairline);
}

/* ---------- Footer (identical to style.css) ---------- */
.footer {
    padding: 64px 0;
    background: var(--parchment);
    color: var(--ink-80);
    font: 400 12px/1.4 var(--font-text);
    letter-spacing: -0.12px;
}

.footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 32px;
    width: min(100% - (var(--gutter) * 2), var(--docs-content));
    margin-inline: auto;
}

.footer__links {
    display: flex;
    gap: 24px;
}

.footer a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

/* =======================================================================
   Docs-only layout: the two-column shell (sidebar + reading column), the
   reference/tutorial content typography, and the small set of components
   (tables, signature cards, callouts, pager) style.css has no equivalent
   for. All built from the tokens above, none of their own.
   ======================================================================= */

.docs-shell {
    width: min(100% - (var(--gutter) * 2), var(--docs-content));
    margin-inline: auto;
    display: grid;
    grid-template-columns: var(--docs-sidebar-w) minmax(0, 1fr);
    gap: 48px;
    padding: 40px 0 96px;
}

.docs-sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 52px + 20px);
    align-self: start;
    max-height: calc(100vh - var(--nav-h) - 52px - 40px);
    overflow-y: auto;
    padding-right: 8px;
    font-size: 14px;
}

.docs-sidebar h4 {
    font: 600 12px/1 var(--font-text);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--ink-48);
    margin: 24px 0 8px;
}

.docs-sidebar h4:first-child {
    margin-top: 0;
}

.docs-sidebar ul {
    margin: 0 0 4px;
}

.docs-sidebar li a {
    display: block;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    color: var(--ink-80);
    font: 400 14px/1.4 var(--font-text);
    text-decoration: none;
}

.docs-sidebar li a:hover {
    background: var(--hairline);
}

.docs-sidebar li a[aria-current="page"] {
    background: var(--hairline);
    color: var(--link);
    font-weight: 600;
}

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

.breadcrumbs {
    font: 400 13px/1.4 var(--font-text);
    color: var(--ink-48);
    margin-bottom: 12px;
}

.breadcrumbs a {
    color: var(--ink-48);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--link);
    text-decoration: underline;
}

.docs-content h1 {
    font: 600 34px/1.15 var(--font-display);
    letter-spacing: -0.374px;
    margin: 0 0 8px;
}

.docs-content .dek {
    font: 400 19px/1.4 var(--font-text);
    letter-spacing: -0.224px;
    color: var(--ink-80);
    margin: 0 0 32px;
}

.docs-content h2 {
    font: 600 24px/1.2 var(--font-display);
    margin: 48px 0 16px;
    padding-top: 8px;
    border-top: 1px solid var(--hairline);
    scroll-margin-top: 140px;
}

.docs-content h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.docs-content h3 {
    font: 600 19px/1.3 var(--font-display);
    margin: 32px 0 12px;
    scroll-margin-top: 140px;
}

.docs-content p {
    margin: 0 0 16px;
}

.docs-content ul,
.docs-content ol {
    margin: 0 0 16px;
    padding-left: 22px;
    list-style: initial;
}

.docs-content ol {
    list-style: decimal;
}

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

.docs-content strong {
    font-weight: 600;
}

.docs-content em {
    font-style: italic;
}

/* docs-only: rendered Markdown from includes/markdown.php (changelog & roadmap) */
.md-content h2,
.md-content h3 {
    scroll-margin-top: 140px;
}

ul.md-list {
    list-style: none;
    padding-left: 0;
    margin: 0 0 16px;
}

ul.md-list li {
    position: relative;
    padding-left: 26px;
    margin-bottom: 8px;
}

ul.md-list li::before {
    content: "–";
    position: absolute;
    left: 4px;
    color: var(--ink-48);
}

ul.md-list li.md-check::before {
    content: "";
}

ul.md-list li.md-check::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 4px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--ink-48);
    border-radius: 4px;
    background: var(--canvas);
    font: 700 10px/1 var(--font-text);
    color: var(--canvas);
}

ul.md-list li.md-check--done::after {
    content: "✓";
    border-color: var(--link);
    background: var(--link);
}

ul.md-list li.md-check--done {
    color: var(--ink-80);
}

.callout {
    border-radius: var(--r-lg);
    padding: 16px 20px;
    margin: 24px 0;
    font: 400 15px/1.5 var(--font-text);
    border: 1px solid var(--hairline);
    background: var(--canvas);
}

.callout strong {
    display: block;
    margin-bottom: 4px;
}

.callout--warn {
    border-color: #caa23a;
    background: rgba(202, 162, 58, 0.08);
}

.callout--info {
    border-color: var(--link);
    background: rgba(0, 102, 204, 0.06);
}

:root[data-theme="dark"] .callout--info {
    background: rgba(41, 151, 255, 0.08);
}

/* docs-only: a callout meant for a permanently-dark tile (like .tile--dark-3
   on the landing page) -always-white text/border, the same "ignore the
   theme toggle" treatment style.css gives .btn--ghost-dark / .text-link--on-dark.
   Placed after .callout--warn/.callout--info so it wins when combined, e.g.
   class="callout callout--warn callout--ondark". */
.callout--ondark {
    text-align: left;
    color: var(--on-dark) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.callout--ondark a {
    color: var(--primary-on-dark);
}

table.ref-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 24px;
    font-size: 15px;
}

table.ref-table th,
table.ref-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--hairline);
    vertical-align: top;
}

table.ref-table th {
    font: 600 12px/1 var(--font-text);
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ink-48);
}

table.ref-table code {
    white-space: nowrap;
}

.sig-card {
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    margin: 0 0 28px;
    overflow: hidden;
    background: var(--canvas);
}

.sig-card__head {
    padding: 14px 20px;
    background: var(--parchment);
    border-bottom: 1px solid var(--hairline);
    font: 600 15px/1.3 var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sig-card__badge {
    font: 600 11px/1 var(--font-text);
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--ink-48);
    background: var(--hairline);
    padding: 3px 9px;
    border-radius: var(--r-pill);
}

.sig-card__body {
    padding: 18px 20px;
}

.sig-card__body p:last-child {
    margin-bottom: 0;
}

.sig-card__body pre.code {
    margin-top: 12px;
}

.feature-grid,
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 24px 0;
    text-align: left;
}

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

.tile .feature-grid,
.tile .card-grid {
    margin-top: 56px;
}

.feature-card,
.card-link {
    display: block;
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    padding: 24px;
    background: var(--canvas);
    text-decoration: none;
}

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

.feature-card h3,
.card-link h3 {
    font: 600 17px/1.24 var(--font-text);
    letter-spacing: -0.374px;
    margin: 0 0 8px;
    color: var(--ink);
}

.feature-card p,
.card-link p {
    font: 400 14px/1.43 var(--font-text);
    color: var(--ink-80);
    margin: 0;
}

.pager {
    display: flex;
    gap: 16px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--hairline);
}

.pager a {
    flex: 1;
    display: block;
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    padding: 14px 18px;
    text-decoration: none;
    color: var(--ink);
}

.pager a:hover {
    background: var(--canvas);
    border-color: var(--link);
}

.pager__prev {
    text-align: left;
}

.pager__next {
    text-align: right;
}

/* docs-only: the Errors & Error Codes reference page */
.error-search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0 8px;
    padding: 14px 20px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    background: var(--canvas);
}

.error-search-box label {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.error-search-box .search-input {
    flex: 1;
    width: auto;
    max-width: none;
    height: 40px;
}

.error-search-status {
    font-size: 13px;
    color: var(--ink-48);
    margin: 0 0 24px;
    min-height: 1em;
}

h2.error-group {
    scroll-margin-top: 140px;
}

.error-card.is-hidden,
h2.error-group.is-hidden {
    display: none;
}

.error-card.is-highlighted {
    animation: falx-error-flash 1.6s ease;
}

@keyframes falx-error-flash {
    0% {
        box-shadow: 0 0 0 3px var(--link);
    }

    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.sig-card__badge--dead {
    color: var(--ink-48);
    background: var(--hairline);
    font-style: italic;
}

.sig-card__badge--crash {
    color: #a3540f;
    background: rgba(202, 130, 58, 0.18);
}

:root[data-theme="dark"] .sig-card__badge--crash {
    color: #ffb066;
    background: rgba(202, 130, 58, 0.22);
}

.code-caption-inline {
    margin: -12px 0 16px;
    font-size: 13px;
    color: var(--ink-48);
}

.pager__label {
    display: block;
    font: 400 12px/1 var(--font-text);
    color: var(--ink-48);
    margin-bottom: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1068px) {
    .hero__title {
        font-size: 40px;
        line-height: 1.1;
        letter-spacing: 0;
    }
}

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

    .docs-sidebar {
        position: static;
        max-height: none;
    }

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

@media (max-width: 735px) {
    .tile {
        padding: 48px 0;
    }

    .lead {
        font: 400 21px/1.24 var(--font-display);
        letter-spacing: 0.231px;
    }

    .code-window {
        margin-top: 32px;
    }

    .facts {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 32px;
        margin-top: 32px;
    }

    .footer {
        padding: 40px 0;
    }

    .sub-nav__title {
        font-size: 17px;
    }

    .search-input {
        display: none;
    }
}

@media (max-width: 640px) {

    .hero__title,
    .tile__title {
        font-size: 34px;
    }

    .code,
    .code-tabs {
        padding-inline: 18px;
    }

    .code {
        font-size: 13px;
    }

    .code--run {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 419px) {

    .hero__title,
    .tile__title {
        font-size: 28px;
    }

    :root {
        --gutter: 16px;
    }

    .global-nav__brand {
        font-size: 12px;
    }

    .global-nav__right {
        gap: 10px;
    }

    .global-nav__links {
        display: none;
    }

    /* docs-only: too many links for the smallest phones; the sub-nav's section title remains */
}

@media (prefers-reduced-motion: reduce) {

    .btn,
    .theme-toggle {
        transition: none;
    }

    .btn:active,
    .theme-toggle:active {
        transform: none;
    }
}