/*
 * Styles for the scribekit drop-in components (BlogOverview + BlogPage).
 *
 * Theming: every colour reads from a `--scribekit-*` custom property with a sensible light-theme
 * default, e.g. `var(--scribekit-primary, #2563EB)`. Override any of them from your own CSS to
 * match your brand, e.g. `:root { --scribekit-primary: #6D5DF6; }`. Class names are namespaced
 * `.scribekit-*`, and MDX body tags are scoped under `.scribekit-prose`, so nothing here leaks into the
 * rest of your site.
 */

/* --- Overview: post grid --- */
.scribekit-overview {
    max-width: var(--scribekit-overview-width, 1040px);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) clamp(16px, 5vw, 40px);
}

.scribekit-empty {
    text-align: center;
    color: var(--scribekit-ink-muted, #4a5568);
    font-size: 18px;
}

.scribekit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.scribekit-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 26px 26px 24px;
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 16px;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    animation: scribekit-rise 0.5s ease both;
}

.scribekit-card:hover {
    transform: translateY(-3px);
    border-color: var(--scribekit-primary, #2563eb);
    box-shadow: var(--scribekit-card-shadow, 0 14px 34px -18px rgba(11, 27, 54, 0.35));
}

/* Hero thumbnail: full-bleed across the top of the card (negative margins cancel the card's
   26px padding). `height:auto` scales the 1200x630 hero down to the card width at its ratio. */
.scribekit-card-image {
    display: block;
    width: calc(100% + 52px);
    /* Guard the full-bleed width against a host `img { max-width: 100% }` reset, which would
       otherwise clamp it back to the card content width and leave a gap down the card's edge. */
    max-width: none;
    height: auto;
    margin: -26px -26px 18px;
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid var(--scribekit-border, #e5eaf0);
}

.scribekit-card-date {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-card-title {
    margin: 10px 0 0;
    font-size: 21px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-card-desc {
    margin: 12px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-card-more {
    margin-top: auto;
    padding-top: 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--scribekit-primary, #2563eb);
}

/* Card meta row: date and reading time side by side (a dot separates them). */
.scribekit-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-card-readtime {
    position: relative;
    padding-left: 16px;
}

.scribekit-card-readtime::before {
    content: "·";
    position: absolute;
    left: 5px;
}

/* Category badges on a card. */
.scribekit-card-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.scribekit-cat {
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--scribekit-primary, #2563eb);
    background: var(--scribekit-bg-subtle, #f7f9fc);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 999px;
}

/* --- Overview: search + category-filter toolbar --- */
.scribekit-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 28px;
}

.scribekit-search {
    flex: 1 1 240px;
    min-width: 0;
    padding: 11px 16px;
    font: inherit;
    font-size: 15px;
    color: var(--scribekit-ink, #0b1b36);
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.scribekit-search:focus {
    outline: none;
    border-color: var(--scribekit-primary, #2563eb);
    box-shadow: 0 0 0 3px var(--scribekit-focus-ring, rgba(37, 99, 235, 0.18));
}

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

.scribekit-filter {
    padding: 8px 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--scribekit-ink-muted, #4a5568);
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.scribekit-filter:hover {
    color: var(--scribekit-ink, #0b1b36);
    border-color: var(--scribekit-primary, #2563eb);
}

.scribekit-filter-active {
    color: var(--scribekit-on-primary, #ffffff);
    background: var(--scribekit-primary, #2563eb);
    border-color: var(--scribekit-primary, #2563eb);
}

/* --- Overview: infinite-scroll "load more" --- */
.scribekit-loadmore-row {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.scribekit-loadmore {
    padding: 11px 24px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--scribekit-primary, #2563eb);
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.scribekit-loadmore:hover {
    color: var(--scribekit-on-primary, #ffffff);
    background: var(--scribekit-primary, #2563eb);
    border-color: var(--scribekit-primary, #2563eb);
}

/* The IntersectionObserver target; sits at the end of the list to trigger the next batch. */
.scribekit-sentinel {
    width: 1px;
    height: 1px;
}

/* --- Post --- */
.scribekit-post {
    max-width: var(--scribekit-post-width, 760px);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) clamp(16px, 5vw, 40px) clamp(48px, 8vw, 80px);
}

.scribekit-back {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--scribekit-primary, #2563eb);
    text-decoration: none;
}

.scribekit-back:hover {
    text-decoration: underline;
}

.scribekit-post-title {
    margin: 18px 0 0;
    font-weight: 300;
    font-size: clamp(2.1rem, 3.2vw + 1rem, 3.25rem);
    letter-spacing: -0.03em;
    line-height: 1.12;
    color: var(--scribekit-ink, #0b1b36);
}

/* Meta row under the title: category badge, then dot-separated date / author / reading time. */
.scribekit-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 16px 0 0;
    font-size: 15px;
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-post-cat {
    display: inline-flex;
    align-items: center;
    /* A touch of extra separation from the first text item, on top of the row's gap. */
    margin-right: 6px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--scribekit-primary, #2563eb);
    background: var(--scribekit-primary-subtle, #eef2ff);
    border-radius: 999px;
}

/* A dot only between two consecutive text items - never after the badge. */
.scribekit-post-metaitem + .scribekit-post-metaitem::before {
    content: "·";
    margin-right: 10px;
    color: var(--scribekit-border, #cbd5e1);
}

/* Author in the meta row: a small round avatar (when the post has one) beside the name. */
.scribekit-post-author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* The flex gap already spaces the dot; trim its margin so it matches the plain items' 10px. */
.scribekit-post-metaitem + .scribekit-post-author::before {
    margin-right: 2px;
}

/* The author's name as a link (`author-url`), in the meta row and the bio alike: inherits the
   surrounding colour and weight so a linked byline reads exactly like a plain one until hovered. */
.scribekit-author-link {
    color: inherit;
    font: inherit;
    text-decoration: none;
}

.scribekit-author-link:hover {
    text-decoration: underline;
}

.scribekit-post-author-avatar {
    display: block;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    object-fit: cover;
}

.scribekit-post-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    margin: 28px 0 36px;
}

/* MDX body typography (scoped under .scribekit-prose so bare tag selectors don't leak). */
.scribekit-prose {
    margin: 28px 0 0;
}

.scribekit-prose h2 {
    margin: 44px 0 14px;
    font-size: clamp(1.5rem, 1.6vw + 0.9rem, 1.9rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose h3 {
    margin: 32px 0 10px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose p {
    margin: 0 0 18px;
    font-size: 17px;
    line-height: 1.75;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose ul,
.scribekit-prose ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.scribekit-prose li {
    margin: 0 0 8px;
    font-size: 17px;
    line-height: 1.7;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose a {
    color: var(--scribekit-primary, #2563eb);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.scribekit-prose strong {
    font-weight: 600;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose blockquote {
    margin: 28px 0;
    padding: 4px 0 4px 22px;
    border-left: 3px solid var(--scribekit-primary, #2563eb);
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose blockquote p {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.scribekit-prose img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 8px 0 20px;
}

/* Inline code + fenced code blocks (the latter was unstyled in the source project). */
.scribekit-prose code {
    padding: 2px 6px;
    background: var(--scribekit-bg-subtle, #f7f9fc);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 6px;
    font-family: var(--scribekit-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 0.9em;
}

.scribekit-prose pre {
    margin: 0 0 20px;
    padding: 16px 18px;
    background: var(--scribekit-bg-subtle, #f7f9fc);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 10px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}

.scribekit-prose pre code {
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Tables (GFM pipe tables, enabled by default via `shared/mdx.ts` - see `withGfm`). */
.scribekit-prose table {
    width: 100%;
    margin: 0 0 20px;
    border-collapse: collapse;
    font-size: 15px;
    overflow-x: auto;
    display: block;
}

.scribekit-prose th,
.scribekit-prose td {
    padding: 10px 14px;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    text-align: left;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-prose th {
    background: var(--scribekit-bg-subtle, #f7f9fc);
    font-weight: 600;
}

.scribekit-prose hr {
    margin: 40px 0;
    border: 0;
    border-top: 1px solid var(--scribekit-border, #e5eaf0);
}

/* --- Post: author bio --- */
/* Closes the article when the post has an author: a divider, then a plain avatar + text row
   (deliberately no card background or border). */
.scribekit-author-bio {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 64px;
    padding-top: 40px;
    border-top: 1px solid var(--scribekit-border, #e5eaf0);
}

.scribekit-author-bio-avatar {
    display: block;
    flex: none;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    object-fit: cover;
}

.scribekit-author-bio-body {
    flex: 1;
    min-width: 0;
}

.scribekit-author-bio-label {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--scribekit-ink-subtle, #94a3b8);
}

.scribekit-author-bio-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-author-bio-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
    font-size: 14px;
    color: var(--scribekit-ink-subtle, #94a3b8);
}

.scribekit-author-bio-cat {
    font-weight: 600;
    color: var(--scribekit-primary, #2563eb);
}

/* Dot only when a category precedes the publish date. */
.scribekit-author-bio-cat + .scribekit-author-bio-date::before {
    content: "·";
    margin: 0 9px;
    color: var(--scribekit-border, #cbd5e1);
}

/* --- Post + sidebar layout --- */
/* Two-column shell: the post keeps its reading width, the sidebar sits in a fixed rail. */
.scribekit-post-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--scribekit-post-width, 760px)) var(--scribekit-sidebar-width, 240px);
    gap: clamp(24px, 4vw, 56px);
    max-width: calc(var(--scribekit-post-width, 760px) + var(--scribekit-sidebar-width, 240px) + 56px);
    margin: 0 auto;
    align-items: start;
}

/* Inside the two-column shell the article no longer centres itself. */
.scribekit-post-layout .scribekit-post {
    margin: 0;
    max-width: none;
}

.scribekit-sidebar {
    position: sticky;
    top: clamp(16px, 4vw, 40px);
    align-self: start;
    padding: clamp(24px, 5vw, 48px) 0;
    font-size: 14px;
}

.scribekit-sidebar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

/* Section eyebrow ("On this page" / "Similar pages"): a small uppercase, tracked label that
   reads as a heading by style rather than size, so it never blends into the items below it. */
.scribekit-sidebar-toggle,
.scribekit-sidebar-heading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--scribekit-ink-subtle, #94a3b8);
    cursor: default;
}

.scribekit-sidebar-body {
    margin-top: 16px;
}

/* The 2px rail is the ul's left border (track); the active link paints its own segment of it.
   ponytail: static per-item marker, not a JS-measured sliding fill - upgrade to a moving rail
   only if the animated slide between headings is wanted. */
.scribekit-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
    border-left: 2px solid var(--scribekit-border, #e5eaf0);
}

.scribekit-toc li {
    margin: 0;
}

.scribekit-toc-sub {
    padding-left: 14px;
}

.scribekit-toc-link {
    display: block;
    margin-left: -2px;
    padding: 7px 0 7px 16px;
    border-left: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--scribekit-ink-muted, #4a5568);
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease, font-weight 0.15s ease;
}

.scribekit-toc-link:hover {
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-toc-link.is-active {
    font-weight: 600;
    color: var(--scribekit-primary, #2563eb);
    border-left-color: var(--scribekit-primary, #2563eb);
}

.scribekit-similar {
    margin-top: 28px;
}

.scribekit-sidebar-heading {
    margin-bottom: 14px;
    padding-left: 2px;
}

.scribekit-similar-list {
    display: flex;
    flex-direction: column;
}

/* Each similar post is a quiet row: title + category · date, with an arrow that leans in on hover. */
.scribekit-similar-card {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 12px;
    color: inherit;
    text-decoration: none;
}

/* Straight full-width divider: a border-top on the card would follow the highlight's radius and
   curve at the ends, so draw the rule with a pseudo-element that ignores any corner rounding. */
.scribekit-similar-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-top: 1px solid var(--scribekit-border, #e5eaf0);
}

/* Hover highlight as an inset overlay (behind the text) so it floats clear of the dividers above
   and below instead of butting right up against them. */
.scribekit-similar-card::after {
    content: "";
    position: absolute;
    inset: 6px 0;
    z-index: -1;
    border-radius: 12px;
    background: transparent;
    transition: background 0.15s ease;
}

.scribekit-similar-card:hover::after {
    background: var(--scribekit-bg-subtle, #f7f9fc);
}

.scribekit-similar-body {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
}

.scribekit-similar-title {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-similar-meta {
    display: flex;
    align-items: center;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--scribekit-ink-subtle, #94a3b8);
}

.scribekit-similar-cat {
    font-weight: 600;
    color: var(--scribekit-primary, #2563eb);
}

/* Dot only when a category precedes the date. */
.scribekit-similar-cat + .scribekit-similar-date::before {
    content: "·";
    margin: 0 7px;
    color: var(--scribekit-border, #cbd5e1);
}

.scribekit-similar-arrow {
    flex: none;
    margin-top: 2px;
    font-size: 14px;
    color: var(--scribekit-ink-subtle, #94a3b8);
    transition: transform 0.18s ease, color 0.18s ease;
}

.scribekit-similar-card:hover .scribekit-similar-arrow {
    transform: translateX(3px);
    color: var(--scribekit-primary, #2563eb);
}

/* Mobile: collapse to one column; the sidebar becomes a collapsible bar above the article. */
@media (max-width: 1080px) {
    .scribekit-post-layout {
        grid-template-columns: minmax(0, 1fr);
        max-width: var(--scribekit-post-width, 760px);
    }

    .scribekit-sidebar {
        position: static;
        order: -1;
        margin-bottom: 8px;
        padding: clamp(16px, 5vw, 24px);
        border: 1px solid var(--scribekit-border, #e5eaf0);
        border-radius: 12px;
        background: var(--scribekit-bg-subtle, #f7f9fc);
    }

    .scribekit-sidebar-toggle {
        cursor: pointer;
    }

    /* Chevron only appears on mobile, where the toggle actually collapses the body. */
    .scribekit-sidebar-toggle::after {
        content: "";
        display: inline-block;
        width: 7px;
        height: 7px;
        margin-left: 4px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.18s ease;
    }

    .scribekit-sidebar-toggle[aria-expanded="true"]::after {
        transform: rotate(-135deg);
    }

    .scribekit-sidebar-body {
        display: none;
    }

    .scribekit-sidebar-body.is-open {
        display: block;
    }
}

/* Entrance animation for cards; disabled when the visitor prefers reduced motion. */
@keyframes scribekit-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scribekit-card {
        animation: none;
    }

    .scribekit-toc-link,
    .scribekit-sidebar-toggle::after,
    .scribekit-similar-card::after,
    .scribekit-similar-arrow,
    .scribekit-search,
    .scribekit-filter,
    .scribekit-loadmore {
        transition: none;
    }
}

/* =================================================================================
   Docs
   The docs components implement the SwiftGuard Docs design: a full-width app of a top
   tab bar, a left navigation, a centered article, and a right "on this page" minimap.
   Colours reuse the shared `--scribekit-*` palette; a few docs-only tokens (`--scribekit-violet`,
   `--scribekit-border-strong`, `--scribekit-font-sans`, the layout widths, `--scribekit-code-*`)
   default here and can be overridden like any other. Classes are namespaced
   `.scribekit-docs-*` / `.scribekit-doc*`; the MDX body reuses `.scribekit-prose`.
   ================================================================================= */

/* --- Docs app shell. Compose it in your route layout:
   <div class="scribekit-docs">
     <DocsTabs/>                                  (top tab bar, full width)
     <div class="scribekit-docs-body">
       <DocsSidebar/>                             (left nav)
       <main class="scribekit-docs-main"> ...DocsPage or DocsIndex... </main>
     </div>
   </div>                                                                            --- */
.scribekit-docs {
    display: flex;
    flex-direction: column;
    /* Full-width app by default; set --scribekit-docs-max-width to cap and centre the whole shell. */
    max-width: var(--scribekit-docs-max-width, none);
    margin-inline: auto;
    min-height: var(--scribekit-docs-min-height, auto);
    color: var(--scribekit-ink, #0b1b36);
    background: var(--scribekit-surface, #ffffff);
    font-family: var(--scribekit-font-sans, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* The docs UI assumes `box-sizing: border-box`; scope it to the docs subtree (and the palette, which
   renders as a sibling of the shell) so the layout is correct even when the host app ships no global
   reset. Without it, padding falls outside the grid tracks and the index section cards overflow and
   wrap oddly. */
.scribekit-docs,
.scribekit-docs *,
.scribekit-docs *::before,
.scribekit-docs *::after,
.scribekit-docs-palette-backdrop,
.scribekit-docs-palette-backdrop *,
.scribekit-docs-palette-backdrop *::before,
.scribekit-docs-palette-backdrop *::after {
    box-sizing: border-box;
}

/* The command palette portals visually outside `.scribekit-docs` (a sibling of the shell, so it can
   overlay the whole viewport), so it cannot inherit the shell's font. Set it here so the palette
   matches the docs even when the host `body` font differs (or is unset). */
.scribekit-docs-palette-backdrop {
    font-family: var(--scribekit-font-sans, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

.scribekit-docs-body {
    display: flex;
    align-items: stretch;
    min-height: var(--scribekit-docs-body-min-height, 60vh);
}

/* The sticky columns (left nav, right ToC) must start exactly where the sticky chrome above them
   ends, or they slide underneath it as the article scrolls. Which chrome exists is a render-time
   fact (DocsTabs renders nothing for a single tab), so derive the offset from the DOM: each rule
   below matches only when that chrome is actually present as a sibling. `--scribekit-docs-content-top`
   stays the consumer's override and always wins (e.g. a docs shell under an app-level header). */
.scribekit-docs-body {
    --scribekit-docs-chrome-top: 0px;
}

.scribekit-docs-navbar ~ .scribekit-docs-body {
    --scribekit-docs-chrome-top: var(--scribekit-docs-navbar-height, 64px);
}

.scribekit-docs-tabbar ~ .scribekit-docs-body {
    --scribekit-docs-chrome-top: var(--scribekit-docs-tabbar-height, 47px);
}

.scribekit-docs-navbar ~ .scribekit-docs-tabbar ~ .scribekit-docs-body {
    --scribekit-docs-chrome-top: calc(var(--scribekit-docs-navbar-height, 64px) + var(--scribekit-docs-tabbar-height, 47px));
}

.scribekit-docs-main {
    flex: 1;
    min-width: 0;
    display: flex;
}

/* --- Docs top tab bar (only rendered when getNavTree reports more than one tab) --- */
.scribekit-docs-tabbar {
    position: sticky;
    top: var(--scribekit-docs-tabbar-top, 0);
    z-index: 25;
    display: flex;
    align-items: center;
    height: var(--scribekit-docs-tabbar-height, 47px);
    padding: 0 22px;
    border-bottom: 1px solid var(--scribekit-border-strong, #eaeef4);
    background: var(--scribekit-surface, #ffffff);
    overflow-x: auto;
    scrollbar-width: none;
}

.scribekit-docs-tabbar::-webkit-scrollbar {
    display: none;
}

/* With a navbar above it, the tab bar sticks below the navbar rather than at the viewport top. */
.scribekit-docs-navbar ~ .scribekit-docs-tabbar {
    top: var(--scribekit-docs-tabbar-top, var(--scribekit-docs-navbar-height, 64px));
}

.scribekit-docs-tabbar-inner {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 100%;
}

.scribekit-docs-tab {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 13px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--scribekit-ink-soft, #5a6b82);
    text-decoration: none;
    transition: color 0.15s ease;
}

.scribekit-docs-tab:hover {
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-tab.is-active {
    color: var(--scribekit-ink, #0b1b36);
    font-weight: 600;
}

/* The sliding underline; positioned in JS from the active tab's offset/width. */
.scribekit-docs-tab-indicator {
    position: absolute;
    bottom: -1px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(90deg, var(--scribekit-primary, #2563eb), var(--scribekit-violet, #6d5df6));
    transition: left 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Docs left navigation --- */
.scribekit-docs-nav {
    flex: 0 0 var(--scribekit-docs-nav-width, 300px);
    width: var(--scribekit-docs-nav-width, 300px);
    border-right: 1px solid var(--scribekit-border-strong, #eaeef4);
    background: var(--scribekit-docs-nav-bg, linear-gradient(180deg, #fcfdfe, #fbfcfe));
}

.scribekit-docs-nav-inner {
    position: sticky;
    top: var(--scribekit-docs-content-top, var(--scribekit-docs-chrome-top, 0px));
    max-height: calc(100vh - var(--scribekit-docs-content-top, var(--scribekit-docs-chrome-top, 0px)));
    overflow-y: auto;
    padding: 22px 16px 40px;
}

/* --- Docs top bar (DocsNavbar) --- */
.scribekit-docs-navbar {
    position: sticky;
    top: var(--scribekit-docs-navbar-top, 0);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 20px;
    height: var(--scribekit-docs-navbar-height, 64px);
    padding: 0 22px;
    border-bottom: 1px solid var(--scribekit-border-strong, #eaeef4);
    background: var(--scribekit-navbar-bg, rgba(255, 255, 255, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.scribekit-docs-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    text-decoration: none;
}

/*
 * The nav-drawer button. It sits in the TOP BAR rather than in the sidebar so a phone spends one
 * bar of chrome instead of two - the sidebar's own "Documentation" toggle used to occupy a second
 * 72px strip above every page, and expanding it pushed the article down instead of overlaying it.
 * Hidden above the layout breakpoint, where the sidebar is a permanent column and there is nothing
 * to open. `DocsNavbar` renders it only when a `DocsSidebar` is actually mounted.
 */
.scribekit-docs-navbar-burger {
    display: none;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--scribekit-ink, #0b1b36);
    cursor: pointer;
}

.scribekit-docs-navbar-burger:hover {
    background: var(--scribekit-bg-subtle, #f7f9fc);
}

.scribekit-docs-navbar-burger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.scribekit-docs-burger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 19px;
}

.scribekit-docs-burger-bar {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    /* Animated so the bars morph into the cross instead of the icon popping between two shapes. */
    transition:
        transform 0.24s cubic-bezier(0.165, 0.84, 0.44, 1),
        opacity 0.16s ease;
}

/* Open: the outer bars converge and cross, the middle one fades out beneath them. */
.scribekit-docs-navbar-burger[aria-expanded="true"] .scribekit-docs-burger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.scribekit-docs-navbar-burger[aria-expanded="true"] .scribekit-docs-burger-bar:nth-child(2) {
    opacity: 0;
}

.scribekit-docs-navbar-burger[aria-expanded="true"] .scribekit-docs-burger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/*
 * The drawer's dimmed backdrop. Rendered only while the drawer is open, and only in drawer mode.
 * The `min-width` reset below is the safety net for a reader who opens the drawer on a phone and
 * then rotates to a tablet: the state survives the resize, and without this the backdrop would sit
 * over a desktop layout whose sidebar is a permanent column with no way to dismiss it.
 */
.scribekit-docs-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(16, 18, 48, 0.42);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: scribekit-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1081px) {
    .scribekit-docs-nav-backdrop {
        display: none;
    }
}

/*
 * Drawer header: the nav's title and its close button, shown in place of the inline toggle.
 *
 * HIDDEN BY DEFAULT and switched on only inside the drawer breakpoint below. The markup renders at
 * every width (whether the sidebar is a drawer is a JS decision, not a media query), so without this
 * a desktop reader got a "Documentation ✕" header above a permanent sidebar column - a close button
 * for something that cannot be closed.
 */
.scribekit-docs-nav-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--scribekit-border, #e5eaf0);
}

.scribekit-docs-nav-head-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--scribekit-ink, #0b1b36);
}

/*
 * The drawer's search FIELD (not the bar's icon). Drawer chrome, so hidden by default and switched
 * on inside the drawer breakpoint - the desktop sidebar column sits under a navbar that already has
 * its own search box, and a second one there would just be a duplicate.
 */
.scribekit-docs-nav-search {
    display: none;
    margin-top: 14px;
}

.scribekit-docs-nav-search .scribekit-docs-search-trigger {
    width: 100%;
    max-width: none;
}

.scribekit-docs-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    margin-right: -6px;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--scribekit-ink-muted, #4a5568);
    cursor: pointer;
}

.scribekit-docs-nav-close:hover {
    background: var(--scribekit-bg-subtle, #f7f9fc);
    color: var(--scribekit-ink, #0b1b36);
}

/*
 * The `footer` slot, pinned below the nav groups. It exists for the chrome the top bar cannot fit,
 * so it is shown exactly when the bar has given up on it: on a phone (below) or whenever the bar
 * measures itself cramped (see the `data-cramped` rules above). Above that, the bar has the room
 * back and shows the controls itself.
 *
 * Hidden by default rather than by the consumer, because a consumer hiding their own content here
 * leaves this wrapper's border and margin behind: an empty ruled box under the nav. See
 * `DocsSidebarProps.footer`.
 */
.scribekit-docs-nav-foot {
    display: none;
    /* A COLUMN: this is where the top bar's actions go on a phone, and a CTA reads as a CTA at full
       width. A row would shrink each one toward its label and line up three different shapes. */
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--scribekit-border, #e5eaf0);
}

@media (max-width: 640px) {
    .scribekit-docs-nav-foot {
        display: flex;
    }
}

.scribekit-docs-navbar-logo {
    display: inline-flex;
    align-items: center;
    flex: none;
}

.scribekit-docs-navbar-logo svg,
.scribekit-docs-navbar-logo img,
.scribekit-docs-navbar-logo > * {
    height: 100%;
    width: auto;
    display: block;
}

.scribekit-docs-navbar-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-navbar-pill {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--scribekit-violet, #6d5df6);
    background: var(--scribekit-violet-subtle, #f0eefe);
    border: 1px solid var(--scribekit-violet-line, #e4e0fc);
    padding: 2px 8px;
    border-radius: 999px;
}

.scribekit-docs-navbar-search {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.scribekit-docs-navbar-search .scribekit-docs-search-trigger {
    max-width: var(--scribekit-docs-navbar-search-width, 440px);
    /*
     * A FLOOR, and it is what makes the auto-hide fire at all. The slot is `flex: 1`, so without one
     * the field just keeps giving up width to whatever the actions need - measured at 71px on a
     * 660px window, a search box narrower than its own placeholder, while the CTA beside it sat at
     * full size. Below this width the row is genuinely out of room and the ACTIONS are what should
     * go, which is the decision `DocsNavbar` makes (it reads this value; see that effect).
     */
    min-width: 200px;
}

.scribekit-docs-navbar-spacer {
    flex: 1;
}

.scribekit-docs-navbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 0 0 auto;
    font-size: 14px;
}

/*
 * TOO NARROW FOR THE ACTIONS. `DocsNavbar` measures the row and sets `data-cramped` when the brand,
 * the search and the menu button no longer leave room for them - see the effect in that file for why
 * this is measured rather than a breakpoint.
 *
 * The two rules are ONE decision and must stay together: the actions leave the bar, and the drawer's
 * `footer` slot - where the consumer renders the same controls - is what shows them instead. Ship the
 * first without the second and a narrow window simply loses the CTA.
 */
.scribekit-docs-navbar[data-cramped] .scribekit-docs-navbar-right {
    display: none;
}

.scribekit-docs-navbar[data-cramped] ~ * .scribekit-docs-nav-foot {
    display: flex;
}

/* Fallback styling for RAW top-level <a> actions - a bare, unstyled link a consumer dropped into
   `actions`. Two guards keep it from reaching anything else: a direct child (`>`) excludes the
   nested language-menu links, and `:not([class])` excludes every link that carries styling of its
   own - DocsNavbarButton (whose variant classes would otherwise have to out-specify this) and, just
   as importantly, ANY custom-styled button a consumer passes. `actions` accepts arbitrary nodes, so
   a consumer's own CTA is a first-class case: this rule used to repaint it (it out-specifies a
   single-class CSS module, 0-2-1 vs 0-1-0), silently turning e.g. a white-on-gradient pill's label
   muted grey. A styled link now keeps its own colour; only a genuinely raw one gets the fallback. */
.scribekit-docs-navbar-right > a:not([class]) {
    color: var(--scribekit-ink-muted, #4a5568);
    text-decoration: none;
}

.scribekit-docs-navbar-right > a:not([class]):hover {
    color: var(--scribekit-ink, #0b1b36);
}

/* --- Docs navbar language picker (DocsLanguagePicker) --- */
.scribekit-docs-lang {
    position: relative;
    display: inline-flex;
}

.scribekit-docs-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--scribekit-ink-subtle, #9aa6b6);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.scribekit-docs-lang-trigger:hover {
    background: var(--scribekit-bg-subtle, #f7f9fc);
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-docs-lang-flag {
    display: inline-flex;
    flex: none;
}

.scribekit-docs-lang-flag svg {
    display: block;
    width: 22px;
    height: auto;
}

.scribekit-docs-lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 40;
    min-width: 190px;
    padding: 6px;
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 12px;
    box-shadow: var(--scribekit-menu-shadow, 0 14px 40px -12px rgba(11, 27, 54, 0.28));
    animation: scribekit-pop 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scribekit-docs-lang-heading {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-docs-lang-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--scribekit-ink, #0b1b36);
    font-size: 14px;
    text-decoration: none;
}

.scribekit-docs-lang-item:hover {
    background: var(--scribekit-bg-subtle, #f4f6fa);
}

.scribekit-docs-lang-item.is-active {
    font-weight: 600;
}

.scribekit-docs-lang-item .scribekit-docs-lang-flag svg {
    width: 25px;
}

.scribekit-docs-lang-name {
    flex: 1;
    min-width: 0;
}

.scribekit-docs-lang-check {
    flex: none;
    color: var(--scribekit-primary, #2563eb);
}

/* Navbar action buttons (DocsNavbarButton): link / primary / secondary, per the design. */
.scribekit-docs-navbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid transparent;
    background: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.scribekit-docs-navbar-btn-icon {
    display: inline-flex;
    flex: none;
}

.scribekit-docs-navbar-btn-link {
    padding: 0;
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-docs-navbar-btn-link:hover {
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-navbar-btn-primary {
    height: 38px;
    padding: 0 16px;
    border-radius: 9px;
    background: var(--scribekit-ink, #0b1b36);
    color: var(--scribekit-on-ink, #ffffff);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(11, 27, 54, 0.2);
}

.scribekit-docs-navbar-btn-primary:hover {
    background: var(--scribekit-ink-hover, #15264a);
    color: var(--scribekit-on-ink, #ffffff);
}

.scribekit-docs-navbar-btn-secondary {
    height: 34px;
    padding: 0 14px;
    border-radius: 9px;
    border-color: var(--scribekit-border, #e5eaf0);
    background: var(--scribekit-surface, #ffffff);
    color: var(--scribekit-ink-muted, #4a5568);
    font-weight: 500;
}

.scribekit-docs-navbar-btn-secondary:hover {
    border-color: var(--scribekit-primary-soft, #c7d2fe);
    background: var(--scribekit-bg-subtle, #f7f9fc);
    color: var(--scribekit-ink, #0b1b36);
}

/* Search trigger: the ⌘K launcher - a quiet field-like button that opens the palette. */
.scribekit-docs-search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    color: var(--scribekit-ink-subtle, #94a3b8);
    background: var(--scribekit-bg-subtle, #f7f9fc);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 11px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.scribekit-docs-search-trigger:hover {
    border-color: var(--scribekit-primary-soft, #c7d2fe);
    background: var(--scribekit-surface, #ffffff);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}

.scribekit-docs-search-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.scribekit-docs-kbd-group {
    display: flex;
    gap: 4px;
    flex: none;
}

.scribekit-docs-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: var(--scribekit-surface, #ffffff);
    font: inherit;
    font-size: 11px;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

/* Mobile-only collapse toggle (hidden on wide viewports by the media query below). */
.scribekit-docs-nav-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 40px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--scribekit-ink, #0b1b36);
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 10px;
    cursor: pointer;
}

.scribekit-docs-group + .scribekit-docs-group {
    margin-top: 22px;
}

.scribekit-docs-group-label {
    padding: 0 10px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-docs-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.scribekit-docs-navitem {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--scribekit-nav-ink, #475569);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.scribekit-docs-navitem:hover {
    color: var(--scribekit-ink, #0b1b36);
    background: var(--scribekit-docs-nav-hover, #f1f4f9);
}

.scribekit-docs-navitem.is-active {
    color: var(--scribekit-primary, #2563eb);
    font-weight: 600;
    background: var(--scribekit-primary-subtle, #edf2fe);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12), 0 1px 2px rgba(37, 99, 235, 0.08);
}

.scribekit-docs-navitem-icon {
    display: inline-flex;
    flex: none;
    color: currentColor;
}

/* --- Docs command palette (⌘K) --- */
.scribekit-docs-palette-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 20px 20px;
    background: var(--scribekit-scrim, rgba(11, 27, 54, 0.32));
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.scribekit-docs-palette {
    width: 100%;
    max-width: 580px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 16px;
    box-shadow: var(--scribekit-palette-shadow, 0 24px 70px rgba(11, 27, 54, 0.28));
    animation: scribekit-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scribekit-docs-palette-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    padding: 16px 18px;
    border-bottom: 1px solid var(--scribekit-border, #eef1f6);
    color: var(--scribekit-ink-subtle, #94a3b8);
}

.scribekit-docs-palette-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font: inherit;
    font-size: 16px;
    color: var(--scribekit-ink, #0b1b36);
    background: transparent;
}

.scribekit-docs-palette-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.scribekit-docs-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--scribekit-ink, #0b1b36);
    text-decoration: none;
}

.scribekit-docs-palette-item.is-active {
    background: var(--scribekit-bg-subtle, #f4f6fa);
}

.scribekit-docs-palette-item-icon {
    display: inline-flex;
    flex: none;
    color: var(--scribekit-primary, #2563eb);
}

.scribekit-docs-palette-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.scribekit-docs-palette-item-crumb {
    flex: none;
    font-size: 12px;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-docs-palette-empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 14px;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

/* --- Docs page: centered article + right ToC column --- */
.scribekit-docs-page {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.scribekit-doc {
    flex: 1;
    min-width: 0;
    max-width: var(--scribekit-doc-width, 760px);
    margin: 0 auto;
    padding: 44px clamp(24px, 4vw, 56px) 120px;
}

.scribekit-doc-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-doc-crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.scribekit-doc-crumb-sep {
    display: inline-flex;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-doc-crumb-current {
    color: var(--scribekit-ink-muted, #4a5568);
}

.scribekit-doc-title {
    margin: 0;
    font-size: clamp(2rem, 1.4vw + 1.5rem, 2.25rem);
    font-weight: 600;
    letter-spacing: -0.028em;
    line-height: 1.12;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-doc-lead {
    margin: 14px 0 0;
    max-width: 62ch;
    font-size: 18.5px;
    line-height: 1.6;
    color: var(--scribekit-ink-soft, #5a6b82);
}

.scribekit-doc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

.scribekit-doc-readpill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--scribekit-primary, #2563eb);
    background: var(--scribekit-primary-subtle, #edf2fe);
    border: 1px solid var(--scribekit-primary-line, #dbe4fe);
    border-radius: 999px;
}

.scribekit-doc-updated {
    font-size: 12px;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-doc-divider {
    height: 1px;
    margin: 32px 0;
    background: var(--scribekit-border, #eef1f6);
}

/* Hero image: opens the body, below the header block. `height:auto` scales the 1200x630 hero to the
   column width at its ratio; the divider above already supplies the top gap. */
.scribekit-doc-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    margin: 0 0 32px;
}

/* Docs MDX body: the design's tighter scale (scoped to .scribekit-doc so the blog's prose is
   untouched). scroll-margin clears the sticky tab bar when jumping to an anchor. */
.scribekit-doc .scribekit-prose {
    margin: 0;
}

.scribekit-doc .scribekit-prose h2 {
    margin: 44px 0 12px;
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    scroll-margin-top: calc(var(--scribekit-docs-content-top, var(--scribekit-docs-chrome-top, 0px)) + 24px);
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-doc .scribekit-prose h3 {
    margin: 30px 0 8px;
    font-size: 16px;
    font-weight: 600;
    scroll-margin-top: calc(var(--scribekit-docs-content-top, var(--scribekit-docs-chrome-top, 0px)) + 24px);
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-doc .scribekit-prose p,
.scribekit-doc .scribekit-prose li {
    font-size: 16px;
    line-height: 1.72;
    color: var(--scribekit-ink-body, #41506a);
}

/* Docs code blocks pick up the design's dark slab (scoped to .scribekit-doc so the blog's light
   code blocks are untouched). Consumers who add rehype-pretty-code style over the top of it. */
.scribekit-doc .scribekit-prose pre {
    background: var(--scribekit-code-bg, #0b1b36);
    border-color: var(--scribekit-code-border, #10203f);
    color: var(--scribekit-code-ink, #c7d2fe);
    border-radius: 14px;
}

/* --- Docs page: "was this page helpful?" --- */
.scribekit-docs-feedback {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--scribekit-border, #eef1f6);
}

.scribekit-docs-feedback-q {
    font-size: 14px;
    color: var(--scribekit-ink-body, #41506a);
}

.scribekit-docs-feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 14px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--scribekit-nav-ink, #475569);
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 9px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.scribekit-docs-feedback-btn:hover {
    color: var(--scribekit-ink, #0b1b36);
    border-color: var(--scribekit-primary-soft, #c7d2fe);
}

.scribekit-docs-feedback-btn.is-active {
    color: var(--scribekit-primary, #2563eb);
    border-color: var(--scribekit-primary-soft, #c7d2fe);
    background: var(--scribekit-primary-subtle, #edf2fe);
}

.scribekit-docs-feedback-thanks {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--scribekit-success, #15a34a);
}

/* --- Docs page: prev / next --- */
.scribekit-docs-prevnext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 26px;
}

.scribekit-docs-prevnext-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    border-radius: 14px;
    background: var(--scribekit-surface, #ffffff);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.scribekit-docs-prevnext-card:hover {
    border-color: var(--scribekit-primary-soft, #c7d2fe);
    box-shadow: 0 4px 16px rgba(11, 27, 54, 0.06);
}

.scribekit-docs-prevnext-next {
    align-items: flex-end;
    text-align: right;
}

.scribekit-docs-prevnext-spacer {
    display: block;
}

.scribekit-docs-prevnext-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-docs-prevnext-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--scribekit-ink, #0b1b36);
}

/* --- Docs page: right "on this page" minimap --- */
.scribekit-docs-toc {
    flex: 0 0 var(--scribekit-docs-toc-width, 250px);
    width: var(--scribekit-docs-toc-width, 250px);
    border-left: 1px solid var(--scribekit-border-strong, #eaeef4);
    background: var(--scribekit-surface, #ffffff);
}

.scribekit-docs-toc-inner {
    position: sticky;
    top: var(--scribekit-docs-content-top, var(--scribekit-docs-chrome-top, 0px));
    max-height: calc(100vh - var(--scribekit-docs-content-top, var(--scribekit-docs-chrome-top, 0px)));
    overflow-y: auto;
    padding: 44px 22px 40px;
}

.scribekit-docs-toc-title {
    margin-bottom: 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--scribekit-ink-subtle, #9aa6b6);
}

.scribekit-docs-toc-list {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* The blue bar that slides to the active section (translateY/height set in JS). */
.scribekit-docs-toc-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    border-radius: 2px;
    background: var(--scribekit-primary, #2563eb);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s ease, opacity 0.2s ease;
}

.scribekit-docs-toc-link {
    display: block;
    padding: 6px 0 6px 16px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--scribekit-toc-ink, #64748b);
    text-decoration: none;
    transition: color 0.12s ease;
}

.scribekit-docs-toc-link:hover {
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-toc-link.is-active {
    color: var(--scribekit-primary, #2563eb);
    font-weight: 600;
}

.scribekit-docs-toc-sub {
    padding-left: 28px;
}

/* --- Docs index / landing --------------------------------------------------------------------
 * Three independent sections (`.scribekit-docs-hero`, `.scribekit-docs-topics`,
 * `.scribekit-docs-recent`) plus the wrapper `DocsIndex` stacks them in. Each section is styled
 * standalone - none reaches into a parent for width, spacing or colour - because a consumer is
 * expected to drop one into a page of their own, in any order, between bands the kit never sees.
 * That is also why vertical rhythm is `margin-top` on the sections rather than a `gap` on a
 * container that may not exist.
 */
.scribekit-docs-index {
    /* Fill the flex `.scribekit-docs-main` (like `.scribekit-doc` does), then cap + centre. Without
       `flex: 1` the index shrinks to its content's min width and the `margin: 0 auto` centres that
       narrow block, leaving every grid inside it stuck at one column. */
    flex: 1;
    min-width: 0;
    max-width: var(--scribekit-docs-index-width, 1080px);
    margin: 0 auto;
    padding: clamp(20px, 3vw, 40px) clamp(18px, 3vw, 32px) 96px;
}

/* --- Index hero ---
 * PLAIN IS THE BASE, `.is-card` is the addition. Written that way round because the plain hero is
 * the default and the common case: a consumer who wants bare content on the page should not have
 * to un-set a border, a fill, a shadow and a radius to get it.
 */
.scribekit-docs-hero {
    position: relative;
}

.scribekit-docs-hero.is-card {
    overflow: hidden;
    border-radius: 26px;
    border: 1px solid var(--scribekit-border, #e5eaf0);
    background: var(--scribekit-hero-bg, linear-gradient(160deg, #f7f8fe 0%, #f4f1fd 46%, #fbf3f8 100%));
    box-shadow: var(--scribekit-hero-shadow, 0 20px 48px rgba(40, 30, 120, 0.06));
}

/* Two off-centre colour washes. Separate from the base gradient so a consumer can restyle the
   panel's fill without losing the depth, or blank these out with `--scribekit-hero-glow: none`. */
.scribekit-docs-hero-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(
        --scribekit-hero-glow,
        radial-gradient(46% 60% at 8% 0%, rgba(37, 99, 235, 0.11) 0%, transparent 70%),
        radial-gradient(40% 56% at 96% 12%, rgba(196, 105, 158, 0.12) 0%, transparent 72%)
    );
}

/* The graph-paper wash, faded out downwards so it never reaches the text baseline. */
.scribekit-docs-hero-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    background-image: linear-gradient(rgba(20, 24, 58, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 24, 58, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 70%);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 70%);
}

.scribekit-docs-hero-rule {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--scribekit-hero-rule, linear-gradient(90deg, #2563eb, #6d5df6 38%, #9a55d0 68%, #c4699e 100%));
}

/*
 * Plain: no inset at all, so the title starts on the same left edge as the sections below it -
 * a padded plain hero is the tell-tale sign of a card whose background was merely removed.
 * The bottom padding is the gap to the next section, and is the one part both variants share.
 */
/* NO bottom padding here: the plain hero's spacing to the next band is that band's own
   `margin-top`. Padding here would stack on top of it and read as a hole in the page. The card
   variant sets its own padding below, because there the space is the panel's inner inset. */
.scribekit-docs-hero-body {
    position: relative;
    max-width: 780px;
}

.is-card > .scribekit-docs-hero-body {
    padding: clamp(28px, 4vw, 52px) clamp(22px, 3.4vw, 48px) clamp(26px, 3.4vw, 44px);
}

.scribekit-docs-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border: 1px solid var(--scribekit-primary-soft, #c7d2fe);
    border-radius: 999px;
    background: var(--scribekit-primary-subtle, #edf2fe);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--scribekit-primary, #2563eb);
}

/*
 * On the card the pill sits ON a gradient, and the brand tint is translucent - so it would read as
 * a different colour at each end of the hero. Near-solid white instead, which is stable across the
 * whole width.
 */
.is-card .scribekit-docs-hero-eyebrow {
    background: rgba(255, 255, 255, 0.8);
}

.scribekit-docs-hero-title {
    margin: 20px 0 0;
    font-family: var(--scribekit-font-display, inherit);
    font-size: clamp(2.15rem, 4.4vw, 3.15rem);
    font-weight: 500;
    letter-spacing: -0.038em;
    line-height: 1.03;
    color: var(--scribekit-ink, #0b1b36);
    text-wrap: pretty;
}

.scribekit-docs-hero-desc {
    margin: 16px 0 0;
    max-width: 60ch;
    font-size: clamp(16px, 1.2vw, 18px);
    line-height: 1.6;
    color: var(--scribekit-ink-soft, #5a6b82);
    text-wrap: pretty;
}

.scribekit-docs-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 11px;
    margin-top: 28px;
}

.scribekit-docs-hero-action {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 50px;
    padding: 0 24px;
    border-radius: 14px;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.scribekit-docs-hero-action.is-primary {
    background: var(--scribekit-hero-cta, linear-gradient(120deg, #2563eb, #6d5df6 62%, #8a54d8));
    color: var(--scribekit-on-primary, #ffffff);
    box-shadow: 0 12px 28px rgba(74, 79, 225, 0.3);
}

.scribekit-docs-hero-action.is-primary:hover {
    color: var(--scribekit-on-primary, #ffffff);
    box-shadow: 0 16px 36px rgba(74, 79, 225, 0.4);
}

.scribekit-docs-hero-action.is-secondary {
    padding: 0 22px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--scribekit-border-strong, rgba(20, 24, 58, 0.11));
    color: var(--scribekit-nav-ink, #475569);
    font-weight: 600;
}

.scribekit-docs-hero-action.is-secondary:hover {
    background: var(--scribekit-surface, #ffffff);
    border-color: var(--scribekit-primary-soft, #c7d2fe);
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-hero-action-icon {
    display: inline-flex;
    align-items: center;
    opacity: 0.7;
}

.scribekit-docs-hero-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 22px;
    font-size: 13px;
    font-weight: 600;
    color: var(--scribekit-ink-faint, #8189a8);
}

.scribekit-docs-hero-stat {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.scribekit-docs-hero-stat-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--scribekit-ink-subtle, #cbd5e1);
}

.scribekit-docs-hero-stat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--scribekit-success, #15a34a);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--scribekit-success, #15a34a) 14%, transparent);
}

/* --- Browse by topic --- */
.scribekit-docs-topics {
    margin-top: clamp(36px, 4.4vw, 56px);
}

.scribekit-docs-topics-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.scribekit-docs-topics-heading,
.scribekit-docs-recent-heading {
    margin: 0;
    font-family: var(--scribekit-font-display, inherit);
    font-size: clamp(1.35rem, 2vw, 1.7rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-topics-filter {
    display: flex;
    align-items: center;
    gap: 9px;
    /* Pushes the box to the trailing edge while it shares a line with the heading. NOTE it is NOT
       self-cancelling on wrap: a flex item alone on a wrapped line still has free space beside it,
       so the auto margin strands the box against the right edge with a gap to its left. The media
       query at the foot of this section is what undoes it. */
    margin-left: auto;
    height: 42px;
    padding: 0 14px;
    min-width: min(260px, 100%);
    border-radius: 12px;
    background: var(--scribekit-surface, #ffffff);
    border: 1.5px solid var(--scribekit-border, #e5eaf0);
    box-shadow: 0 6px 16px rgba(40, 30, 120, 0.05);
    color: var(--scribekit-ink-faint, #8189a8);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.scribekit-docs-topics-filter.is-focused {
    border-color: var(--scribekit-primary, #2563eb);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--scribekit-primary, #2563eb) 12%, transparent);
}

.scribekit-docs-topics-filter-icon {
    flex: none;
}

.scribekit-docs-topics-filter-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--scribekit-ink, #0b1b36);
}

/* Safari draws its own clear button on `type=search`; ours is the one that resets React state. */
.scribekit-docs-topics-filter-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.scribekit-docs-topics-filter-clear {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: var(--scribekit-bg-subtle, #f1f2fa);
    color: var(--scribekit-ink-faint, #8189a8);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.scribekit-docs-topics-filter-clear:hover {
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-topic-grid {
    display: grid;
    /* auto-FIT + `1fr` so however many topics land on a row, they share the full column width
       instead of leaving a ragged gap at the trailing edge. */
    grid-template-columns: repeat(auto-fit, minmax(288px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

/* The one case `1fr` gets wrong: a single topic would stretch to the whole column, and a card is a
   list of page rows with the chevron pinned to the trailing edge - so a full-width one puts
   hundreds of pixels of dead space between each label and its arrow. Cap that card alone. */
.scribekit-docs-topic-grid:has(> :only-child) {
    max-width: 420px;
}

/* Every tinted surface on a card derives from ONE custom property, set inline per topic, so a
   consumer recolours a whole card by changing a single value (or restyles every card at once by
   setting `--scribekit-topic-accent` on an ancestor). */
.scribekit-docs-topic-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 16px;
    border-radius: 20px;
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    box-shadow: 0 12px 30px rgba(40, 30, 120, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.scribekit-docs-topic-card:hover {
    box-shadow: 0 20px 40px rgba(40, 30, 120, 0.1);
    border-color: color-mix(in srgb, var(--scribekit-topic-accent, #5b57f2) 30%, transparent);
}

.scribekit-docs-topic-wash {
    position: absolute;
    top: -46px;
    right: -34px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, color-mix(in srgb, var(--scribekit-topic-accent, #5b57f2) 10%, transparent) 0%, transparent 70%);
}

.scribekit-docs-topic-icon {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    line-height: 1;
    color: var(--scribekit-topic-accent, #5b57f2);
    background: color-mix(in srgb, var(--scribekit-topic-accent, #5b57f2) 10%, transparent);
}

.scribekit-docs-topic-title {
    position: relative;
    display: block;
    margin-top: 14px;
    font-family: var(--scribekit-font-display, inherit);
    font-size: 16.5px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--scribekit-ink, #0b1b36);
    text-decoration: none;
    transition: color 0.15s ease;
}

.scribekit-docs-topic-title:hover {
    color: var(--scribekit-topic-accent, #5b57f2);
}

.scribekit-docs-topic-blurb {
    position: relative;
    display: block;
    margin-top: 6px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--scribekit-ink-faint, #8189a8);
}

.scribekit-docs-topic-pages {
    position: relative;
    display: flex;
    flex-direction: column;
    margin-top: 14px;
    border-top: 1px solid var(--scribekit-border, #e5eaf0);
}

.scribekit-docs-topic-page {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--scribekit-nav-ink, #475569);
    text-decoration: none;
    border-bottom: 1px solid var(--scribekit-border, #e5eaf0);
    transition: color 0.15s ease, padding-left 0.15s ease;
}

.scribekit-docs-topic-page:hover {
    color: var(--scribekit-topic-accent, #5b57f2);
    padding-left: 4px;
}

.scribekit-docs-topic-bullet {
    width: 5px;
    height: 5px;
    flex: none;
    border-radius: 50%;
    background: var(--scribekit-topic-accent, #5b57f2);
    opacity: 0.5;
}

/* The label is the only flexible cell, so a long title ellipsizes instead of shoving the chevron
   out of the card. `min-width: 0` is what lets a flex child shrink below its content width. */
.scribekit-docs-topic-page-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scribekit-docs-topic-page svg,
.scribekit-docs-topic-count svg {
    flex: none;
}

.scribekit-docs-topic-page svg {
    margin-left: auto;
    color: var(--scribekit-ink-subtle, #cbd5e1);
}

.scribekit-docs-topic-count {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 7px;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--scribekit-topic-accent, #5b57f2);
}

.scribekit-docs-topic-count:hover svg {
    transform: translateX(3px);
}

.scribekit-docs-topic-count svg {
    transition: transform 0.18s ease;
}

/* --- Filter results (replaces the grid while a query is typed) --- */
.scribekit-docs-results {
    margin-top: 18px;
    border-radius: 20px;
    background: var(--scribekit-surface, #ffffff);
    border: 1px solid var(--scribekit-border, #e5eaf0);
    box-shadow: 0 12px 30px rgba(40, 30, 120, 0.05);
    overflow: hidden;
}

.scribekit-docs-results-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--scribekit-border, #e5eaf0);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--scribekit-ink-faint, #8189a8);
}

.scribekit-docs-result {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 15px 20px;
    text-decoration: none;
    border-bottom: 1px solid var(--scribekit-border, #e5eaf0);
    transition: background-color 0.15s ease;
}

.scribekit-docs-result:last-child {
    border-bottom: 0;
}

.scribekit-docs-result:hover {
    background: var(--scribekit-bg-subtle, #f7f8fe);
}

.scribekit-docs-result-text {
    min-width: 0;
    flex: 1;
}

.scribekit-docs-result-title {
    display: block;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-result-desc {
    display: block;
    margin-top: 4px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--scribekit-ink-faint, #8189a8);
}

.scribekit-docs-result-tag {
    flex: none;
    margin-top: 2px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--scribekit-topic-accent, #5b57f2);
    background: color-mix(in srgb, var(--scribekit-topic-accent, #5b57f2) 10%, transparent);
}

.scribekit-docs-results-empty {
    padding: 30px 20px;
    text-align: center;
}

.scribekit-docs-results-empty-title {
    font-family: var(--scribekit-font-display, inherit);
    font-size: 16px;
    font-weight: 600;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-results-empty-hint {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--scribekit-ink-faint, #8189a8);
}

.scribekit-docs-results-empty-btn {
    margin-top: 16px;
    height: 40px;
    padding: 0 18px;
    border-radius: 11px;
    border: 1px solid var(--scribekit-border-strong, rgba(20, 24, 58, 0.11));
    background: var(--scribekit-surface, #ffffff);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--scribekit-nav-ink, #475569);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.scribekit-docs-results-empty-btn:hover {
    border-color: var(--scribekit-primary, #2563eb);
    color: var(--scribekit-ink, #0b1b36);
}

/* --- Recently updated --- */
.scribekit-docs-recent {
    margin-top: clamp(36px, 4.4vw, 56px);
}

.scribekit-docs-recent-list {
    display: flex;
    flex-direction: column;
    margin-top: 14px;
}

.scribekit-docs-recent-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 12px;
    border-radius: 13px;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.scribekit-docs-recent-row:hover {
    background: var(--scribekit-bg-subtle, #f7f8fe);
}

.scribekit-docs-recent-date {
    flex: none;
    width: 56px;
    font-family: var(--scribekit-font-display, inherit);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--scribekit-ink-faint, #8189a8);
}

.scribekit-docs-recent-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--scribekit-ink, #0b1b36);
}

.scribekit-docs-recent-tag {
    flex: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--scribekit-ink-faint, #8189a8);
}

/*
 * Narrow: the topic heading and its filter box stop sharing a line. Drop the auto margin so the
 * box spans the column instead of hanging off the right edge with dead space beside it, and let a
 * recent row's date and tag wrap rather than crushing the title between them.
 */
@media (max-width: 560px) {
    .scribekit-docs-topics-filter {
        width: 100%;
        margin-left: 0;
    }

    .scribekit-docs-recent-row {
        flex-wrap: wrap;
        gap: 4px 10px;
    }

    .scribekit-docs-recent-title {
        /* Own line, full width: at this size the ellipsis would otherwise eat most of the title. */
        flex: 1 0 100%;
        order: 3;
        white-space: normal;
    }
}

/* --- Docs: mobile (stack the app; collapse the left nav; hide the right minimap) --- */
@media (max-width: 1080px) {
    .scribekit-docs-body {
        flex-direction: column;
    }

    .scribekit-docs-nav {
        flex: none;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--scribekit-border-strong, #eaeef4);
    }

    .scribekit-docs-nav-inner {
        position: static;
        max-height: none;
        overflow: visible;
        padding: clamp(14px, 4vw, 20px);
    }

    .scribekit-docs-navbar-burger {
        display: inline-flex;
    }

    .scribekit-docs-nav-toggle {
        display: inline-flex;
    }

    .scribekit-docs-groups {
        display: none;
        margin-top: 12px;
    }

    .scribekit-docs-groups.is-open {
        display: block;
    }

    /*
     * DRAWER MODE - an off-canvas panel, used whenever the sidebar sits under a provider (i.e. inside
     * a `DocsSearchProvider`), which is every real docs app. The rules above stay for the standalone
     * case, where the sidebar owns its own toggle and has no hamburger to be opened from.
     *
     * The difference is not decoration. The inline version was a full-width bar that pushed the
     * ARTICLE down the page when it expanded, so on a phone opening the nav moved the thing you were
     * reading; a drawer overlays instead, and the page is exactly where you left it when it closes.
     */
    .scribekit-docs-nav.is-drawer {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: min(378px, 90vw);
        border-bottom: 0;
        border-right: 1px solid var(--scribekit-border-strong, #eaeef4);
        /* A brand-tinted wash down the first 150px, so the panel opens as a surface of its own
           rather than a white rectangle laid over a white page. */
        background:
            linear-gradient(180deg, rgba(109, 93, 246, 0.07), rgba(109, 93, 246, 0) 150px),
            var(--scribekit-surface, #ffffff);
        /* -104%, not -100%: the extra 4% carries the open panel's shadow off-screen with it. */
        transform: translateX(-104%);
        transition: transform 0.44s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .scribekit-docs-nav.is-drawer.is-open {
        transform: none;
        box-shadow: 30px 0 70px rgba(20, 24, 58, 0.18);
    }

    /*
     * A COLUMN whose middle section scrolls. The panel used to scroll as one piece, which took the
     * search field and the CTA off-screen the moment a reader scrolled the nav - the two controls
     * they are most likely to want after looking through it. Now only the groups move.
     */
    .scribekit-docs-nav.is-drawer .scribekit-docs-nav-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: none;
        overflow: hidden;
        padding: 0;
    }

    /* Inside the drawer the groups are always laid out; the PANEL is what slides. */
    .scribekit-docs-nav.is-drawer .scribekit-docs-groups {
        display: block;
        flex: 1;
        /* Without this a flex child refuses to shrink below its content, so the panel grows past the
           screen and the footer is pushed off the bottom instead of the list scrolling. */
        min-height: 0;
        overflow-y: auto;
        margin: 0;
        padding: 2px 12px 20px;
    }

    /* The drawer's own header - a brand and a close button - replaces the inline toggle here. */
    .scribekit-docs-nav.is-drawer .scribekit-docs-nav-head {
        display: flex;
        flex: none;
        margin: 0;
        padding: 16px 16px 14px 20px;
        border-bottom: 0;
    }

    .scribekit-docs-nav.is-drawer .scribekit-docs-nav-close {
        width: 36px;
        height: 36px;
        margin-right: 0;
        border-radius: 11px;
    }

    .scribekit-docs-nav.is-drawer .scribekit-docs-nav-search {
        display: block;
        flex: none;
        margin: 0;
        padding: 2px 18px 16px;
    }

    .scribekit-docs-nav.is-drawer .scribekit-docs-nav-search .scribekit-docs-search-trigger {
        height: 44px;
        padding: 0 13px;
        border-width: 1.5px;
        border-radius: 13px;
        font-size: 15px;
    }

    /* Roomier rows than the desktop column: this is a thumb target, not a pointer target. */
    .scribekit-docs-nav.is-drawer .scribekit-docs-navitem {
        padding: 11px 10px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
    }

    .scribekit-docs-nav.is-drawer .scribekit-docs-navitem.is-active {
        position: relative;
        font-weight: 700;
        background: linear-gradient(120deg, rgba(37, 99, 235, 0.09), rgba(109, 93, 246, 0.09));
        box-shadow: inset 0 0 0 1px rgba(91, 87, 242, 0.16);
    }

    /* The spine down the active row - what makes "you are here" readable at a glance in a list
       that is otherwise all the same shape. */
    .scribekit-docs-nav.is-drawer .scribekit-docs-navitem.is-active::before {
        content: "";
        position: absolute;
        left: 0;
        top: 11px;
        bottom: 11px;
        width: 3px;
        border-radius: 3px;
        background: linear-gradient(180deg, var(--scribekit-primary, #2563eb), var(--scribekit-violet, #6d5df6));
    }

    .scribekit-docs-nav.is-drawer .scribekit-docs-group-label {
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: 0.13em;
    }

    .scribekit-docs-nav.is-drawer .scribekit-docs-group + .scribekit-docs-group {
        margin-top: 22px;
    }

    /*
     * Pinned to the bottom of the panel, and paying out `env(safe-area-inset-bottom)` so the CTA
     * clears the home indicator instead of sitting under it.
     */
    .scribekit-docs-nav.is-drawer .scribekit-docs-nav-foot {
        flex: none;
        margin: 0;
        padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, var(--scribekit-surface, #ffffff), var(--scribekit-bg-subtle, #f7f9fc));
    }

    .scribekit-docs-page {
        flex-direction: column;
    }

    /*
     * `width: 100%` is what makes the article fill this column, and it is NOT redundant with
     * `align-items: stretch` above. Turning the row into a column turns `.scribekit-doc`'s
     * `margin: 0 auto` into AUTO CROSS-AXIS MARGINS, and per flexbox a item with an auto margin on
     * the cross axis is never stretched - so the article silently fell back to shrink-to-fit and
     * came out 2px wider than its container, which is enough to make every docs page on a 360px
     * phone scroll sideways. (`align-self: stretch` does not fix it, for the same reason; only
     * giving the cross size an explicit value does.) In the row layout above, `width` is the MAIN
     * size and `flex-basis: 0%` outranks it, so this line changes nothing there.
     */
    .scribekit-doc {
        width: 100%;
    }

    .scribekit-docs-toc {
        display: none;
    }
}

/*
 * PHONE. The top bar is one flex row of three groups, and the brand and the actions were both
 * `flex: 0 0 auto` - so on a 390px screen their ~530px did not shrink the bar, it widened the
 * DOCUMENT. Every docs page scrolled sideways, and the right-hand actions sat past the edge of the
 * screen where they could not be reached at all.
 *
 * Everything below is that budget being paid down, least-valuable first: the decorative "Docs" pill
 * goes, the wordmark shrinks, the search collapses to its icon, and the gaps tighten. The brand also
 * becomes SHRINKABLE (`flex: 0 1 auto` + `min-width: 0` + ellipsis), which is the actual guarantee -
 * whatever a consumer puts in `actions`, the row can no longer widen the document; the wordmark
 * truncates instead. That leaves roughly 250px for the consumer's own actions on a 390px phone -
 * enough for a search, a picker and a CTA, not for a full desktop action set. `DocsNavbarButton`
 * takes a `className` so an `actions` list longer than that can hide its own extras here.
 */
@media (max-width: 640px) {
    .scribekit-docs-navbar {
        gap: 6px;
        /* Asymmetric: the brand is text and wants the inset, the trailing icon buttons carry their
           own padding and would look exiled at the same distance from the edge. */
        padding: 0 14px 0 18px;
    }

    .scribekit-docs-navbar-pill {
        display: none;
    }

    /*
     * The wordmark STAYS (smaller). A lone mark reads as an anonymous icon - nothing on the page
     * then says whose documentation this is - and the hamburger freed the room to keep it.
     */
    .scribekit-docs-navbar-brand {
        flex: 0 1 auto;
        min-width: 0;
        gap: 8px;
    }

    .scribekit-docs-navbar-name {
        font-size: 15px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /*
     * A BARE ICON - no field, no tile. As a `flex: 1` field it was handed whatever the overflowing
     * row had left over, which was exactly ZERO pixels: the button was in the DOM, correct and
     * labelled, and no phone could see or tap it. Boxing it instead put a second filled control
     * next to the hamburger and made the little bar look busy, so it is now just the glyph. It
     * loses only the placeholder and a ⌘K hint for a key combination no phone keyboard has, and the
     * drawer carries a full search FIELD anyway; `aria-label` still carries the accessible name.
     */
    .scribekit-docs-navbar-search {
        flex: none;
        /* The row has no flexible item left, so this is what still pins search + menu right. */
        margin-left: auto;
    }

    .scribekit-docs-navbar-search .scribekit-docs-search-trigger {
        width: 40px;
        height: 40px;
        /* Drops the desktop floor - here the control IS the icon, and 200px of it is the whole bar. */
        min-width: 0;
        padding: 0;
        justify-content: center;
        border-color: transparent;
        border-radius: 12px;
        background: transparent;
        /* Muted, not ink: it is the quieter of the two glyphs beside it, and the menu button is the
           one a reader should find first. */
        color: var(--scribekit-ink-muted, #4a5568);
    }

    .scribekit-docs-navbar-search .scribekit-docs-search-trigger:hover {
        border-color: transparent;
        background: var(--scribekit-bg-subtle, #f7f9fc);
        box-shadow: none;
    }

    .scribekit-docs-navbar-search .scribekit-docs-search-trigger-text,
    .scribekit-docs-navbar-search .scribekit-docs-kbd-group {
        display: none;
    }

    /* No ⌘K hint on a phone - there is no ⌘ key to press. The placeholder stays; that is the label. */
    .scribekit-docs-nav-search .scribekit-docs-kbd-group {
        display: none;
    }

    .scribekit-docs-navbar-right {
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scribekit-docs-palette {
        animation: none;
    }

    .scribekit-docs-tab-indicator,
    .scribekit-docs-toc-indicator,
    .scribekit-docs-search-trigger,
    .scribekit-docs-tab,
    .scribekit-docs-navitem,
    .scribekit-docs-toc-link,
    .scribekit-docs-feedback-btn,
    .scribekit-docs-prevnext-card,
    .scribekit-docs-hero-action,
    .scribekit-docs-topics-filter,
    .scribekit-docs-topic-card,
    .scribekit-docs-topic-title,
    .scribekit-docs-topic-page,
    .scribekit-docs-topic-count svg,
    .scribekit-docs-result,
    .scribekit-docs-recent-row,
    .scribekit-docs-burger-bar,
    .scribekit-docs-nav.is-drawer {
        transition: none;
    }

    .scribekit-docs-nav-backdrop {
        animation: none;
    }
}

/* The drawer's backdrop fading up, so the page dims into place instead of snapping dark. */
@keyframes scribekit-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Shared pop-in for the command palette. */
@keyframes scribekit-pop {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
