/* plumtier.com/docs. Builds on ui.css: same tokens, buttons and type as the product. */

* {
    box-sizing: border-box;
}

:root {
    --pt-font: "Inter", ui-sans-serif, system-ui, sans-serif;
    --pt-font-mono: "JetBrains Mono", ui-monospace, monospace;
    --topbar: 3.75rem;
    --sidebar: 16rem;
    --toc: 13rem;
}

html {
    scroll-padding-top: calc(var(--topbar) + 1.5rem);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: #fbfaff;
    color: var(--pt-text);
    font: 400 1rem/1.7 var(--pt-font);
    -webkit-font-smoothing: antialiased;
}

a {
    color: #6d28d9;
    text-underline-offset: 3px;
}

.skip {
    position: absolute;
    left: -999px;
}

.skip:focus {
    left: 1rem;
    top: 1rem;
    z-index: 100;
}

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar);
    background: color-mix(in oklab, #fbfaff 82%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    box-shadow: 0 1px 0 var(--pt-line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 90rem;
    height: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pt-text);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-docs {
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: #efe6ff;
    color: #6d28d9;
    font-size: 0.75rem;
    font-weight: 700;
}

.topbar-links {
    display: none;
    gap: 0.25rem;
    margin-left: auto;
}

.topbar-links a {
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    color: var(--pt-text-2);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}

.topbar-links a:hover {
    background: rgba(24, 21, 31, 0.05);
    color: var(--pt-text);
}

.topbar .btn {
    margin-left: auto;
}

.menu-button {
    display: grid;
    gap: 5px;
    place-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--pt-text);
}

@media (min-width: 760px) {
    .topbar-links {
        display: flex;
    }

    .topbar .btn {
        margin-left: 0.5rem;
    }
}

/* ---------- Layout ---------- */

.layout {
    display: grid;
    max-width: 90rem;
    margin: 0 auto;
}

.sidebar {
    position: fixed;
    inset: var(--topbar) auto 0 0;
    z-index: 30;
    width: min(18rem, 85vw);
    padding: 1.5rem 1rem 3rem;
    overflow-y: auto;
    background: #fbfaff;
    box-shadow: 1px 0 0 var(--pt-line);
    transform: translateX(-105%);
    transition: transform 220ms var(--pt-ease);
}

.sidebar.is-open {
    transform: none;
    box-shadow: 1px 0 0 var(--pt-line), 20px 0 40px -20px rgba(0, 0, 0, 0.2);
}

.content {
    min-width: 0;
    padding: 2rem 1.25rem 4rem;
}

.toc {
    display: none;
}

@media (min-width: 1000px) {
    .menu-button {
        display: none;
    }

    .layout {
        grid-template-columns: var(--sidebar) minmax(0, 1fr);
    }

    .sidebar {
        position: sticky;
        top: var(--topbar);
        height: calc(100vh - var(--topbar));
        width: auto;
        transform: none;
        box-shadow: none;
        background: transparent;
    }

    .content {
        padding: 2.5rem 3rem 5rem;
    }
}

@media (min-width: 1280px) {
    .layout {
        grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
    }

    .toc {
        display: block;
        position: sticky;
        top: var(--topbar);
        align-self: start;
        max-height: calc(100vh - var(--topbar));
        overflow-y: auto;
        padding: 2.75rem 1rem 2rem 0;
    }
}

/* ---------- Sidebar ---------- */

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    padding: 0 0.75rem 0.375rem;
    color: var(--pt-text-3);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar a {
    display: block;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    color: var(--pt-text-2);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    transition: background-color 150ms, color 150ms;
}

.sidebar a:hover {
    background: rgba(24, 21, 31, 0.05);
    color: var(--pt-text);
}

.sidebar a[aria-current="page"] {
    background: #efe6ff;
    color: #5b21b6;
}

/* ---------- Article ---------- */

.doc {
    max-width: 46rem;
}

.doc h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.625rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.doc-lead {
    margin: 0.75rem 0 2rem;
    color: var(--pt-text-2);
    font-size: 1.1875rem;
    line-height: 1.55;
}

.doc h2 {
    margin: 2.75rem 0 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.doc h2 .anchor {
    margin-left: 0.375rem;
    color: var(--pt-text-3);
    text-decoration: none;
    opacity: 0;
    transition: opacity 150ms;
}

.doc h2:hover .anchor {
    opacity: 1;
}

.doc p,
.doc ul,
.doc ol {
    margin: 0 0 1rem;
}

.doc ul,
.doc ol {
    padding-left: 1.25rem;
}

.doc li {
    margin: 0.375rem 0;
}

.doc li::marker {
    color: #7a35e0;
}

.doc :not(pre) > code {
    padding: 0.125rem 0.375rem;
    border-radius: 6px;
    background: #f1ecfa;
    color: #4c1d95;
    font: 500 0.84em var(--pt-font-mono);
    overflow-wrap: anywhere;
}

.pill {
    display: inline-block;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: #efe6ff;
    color: #6d28d9;
    font-size: 0.75rem;
    font-weight: 700;
    vertical-align: 0.1em;
}

/* Steps on the quickstart page. */
.steps-list {
    counter-reset: step;
    list-style: none;
    padding: 0 !important;
}

.steps-list > li {
    position: relative;
    margin: 0 0 1rem !important;
    padding-left: 3rem;
    counter-increment: step;
}

.steps-list > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 2.75rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #7a35e0, #e0457b);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
}

.steps-list > li::after {
    content: "";
    position: absolute;
    left: 0.9375rem;
    top: 5.25rem;
    bottom: -1rem;
    width: 2px;
    background: linear-gradient(#e7dcfb, transparent);
}

/* Cards on the intro page. */
.cards {
    display: grid;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
}

@media (min-width: 640px) {
    .cards {
        grid-template-columns: 1fr 1fr;
    }
}

.card-link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.125rem 1.25rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 21, 31, 0.07), 0 6px 16px -12px rgba(24, 21, 31, 0.25);
    color: var(--pt-text);
    text-decoration: none;
    transition: transform 200ms var(--pt-ease), box-shadow 200ms var(--pt-ease);
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(122, 53, 224, 0.35), 0 16px 30px -18px rgba(91, 33, 182, 0.45);
}

.card-link b {
    font-size: 1rem;
}

.card-link span {
    color: var(--pt-text-2);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Tables */
.table {
    width: 100%;
    margin: 1rem 0 1.5rem;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 21, 31, 0.08);
    font-size: 0.9375rem;
}

.table th {
    padding: 0.625rem 0.875rem;
    background: #f7f5fc;
    color: var(--pt-text-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
}

.table td {
    padding: 0.625rem 0.875rem;
    border-top: 1px solid var(--pt-line);
    vertical-align: top;
}

@media (max-width: 640px) {
    .table {
        display: block;
        overflow-x: auto;
    }
}

/* Parameters */
.params {
    margin: 1rem 0 1.5rem;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 21, 31, 0.08);
}

.param {
    padding: 0.875rem 1.125rem;
}

.param + .param {
    border-top: 1px solid var(--pt-line);
}

.param-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
}

.param-head code {
    font-weight: 600 !important;
}

.param-type {
    color: var(--pt-text-3);
    font: 400 0.8125rem var(--pt-font-mono);
}

.param-req,
.param-opt {
    font-size: 0.75rem;
    font-weight: 600;
}

.param-req {
    color: #c2410c;
}

.param-opt {
    color: var(--pt-text-3);
}

.param p {
    margin: 0.25rem 0 0 !important;
    color: var(--pt-text-2);
    font-size: 0.9375rem;
}

/* Endpoint line */
.endpoint {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0 0 1rem;
    padding: 0.5rem 0.875rem 0.5rem 0.5rem;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 21, 31, 0.08);
}

.endpoint code {
    background: none !important;
    padding: 0 !important;
    color: var(--pt-text) !important;
    font-size: 0.9375rem !important;
}

.method {
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    font: 700 0.75rem var(--pt-font-mono);
    letter-spacing: 0.04em;
}

.method-post {
    background: #dcfce7;
    color: #15803d;
}

.method-get {
    background: #e0edff;
    color: #1d4ed8;
}

/* Callouts */
.callout {
    display: flex;
    gap: 0.75rem;
    margin: 1.25rem 0;
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.callout strong {
    flex-shrink: 0;
}

.callout div > :last-child {
    margin-bottom: 0;
}

.callout-note {
    background: #eef4ff;
}

.callout-note strong {
    color: #1d4ed8;
}

.callout-tip {
    background: #f1ecfa;
}

.callout-tip strong {
    color: #6d28d9;
}

.callout-warn {
    background: #fff4e5;
}

.callout-warn strong {
    color: #c2410c;
}

/* Code */
.code {
    position: relative;
    margin: 1rem 0 1.5rem;
    overflow: hidden;
    border-radius: 0.875rem;
    background: #17141d;
    box-shadow: 0 16px 32px -20px rgba(23, 20, 29, 0.6);
}

.code-tabs,
.code-title {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 4.5rem 0 0.5rem;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
    overflow-x: auto;
}

.code-title {
    padding: 0.625rem 1rem;
    color: #a9a3b6;
    font: 500 0.8125rem var(--pt-font-mono);
}

.code-tabs button {
    padding: 0.375rem 0.75rem 0.5rem;
    border: 0;
    border-radius: 8px 8px 0 0;
    background: transparent;
    color: #a9a3b6;
    font: 500 0.8125rem var(--pt-font);
    cursor: pointer;
    white-space: nowrap;
}

.code-tabs button:hover {
    color: #fff;
}

.code-tabs button[aria-selected="true"] {
    color: #fff;
    box-shadow: inset 0 -2px 0 #a777fb;
}

.code-copy {
    position: absolute;
    top: 0.4375rem;
    right: 0.5rem;
    padding: 0.25rem 0.625rem;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #d6d1e0;
    font: 500 0.75rem var(--pt-font);
    cursor: pointer;
}

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

.code pre {
    margin: 0;
    padding: 1rem 1.125rem 1.125rem;
    overflow-x: auto;
    color: #ece8f4;
    font: 400 0.8125rem/1.7 var(--pt-font-mono);
    tab-size: 4;
}

.tk-key {
    color: #c4a5ff;
}

.tk-str {
    color: #ffc28f;
}

.tk-num {
    color: #7ee0c3;
}

.tk-kw {
    color: #ff8fbf;
}

.tk-com {
    color: #8a8497;
    font-style: italic;
}

/* Table of contents */
.toc-title {
    margin-bottom: 0.5rem;
    color: var(--pt-text-3);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.toc a {
    display: block;
    padding: 0.25rem 0 0.25rem 0.75rem;
    border-left: 2px solid var(--pt-line);
    color: var(--pt-text-2);
    font-size: 0.8125rem;
    line-height: 1.4;
    text-decoration: none;
}

.toc a:hover {
    color: var(--pt-text);
}

.toc a.is-active {
    border-left-color: #7a35e0;
    color: #5b21b6;
    font-weight: 600;
}

/* Previous / next */
.pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    max-width: 46rem;
    margin-top: 3.5rem;
}

.pager a {
    display: flex;
    flex-direction: column;
    padding: 0.875rem 1.125rem;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(24, 21, 31, 0.08);
    color: var(--pt-text);
    font-weight: 600;
    text-decoration: none;
    transition: box-shadow 200ms;
}

.pager a:hover {
    box-shadow: 0 0 0 1px rgba(122, 53, 224, 0.45);
}

.pager small {
    color: var(--pt-text-3);
    font-weight: 500;
}

.pager-next {
    grid-column: 2;
    text-align: right;
}

.doc-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    max-width: 46rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pt-line);
    color: var(--pt-text-3);
    font-size: 0.8125rem;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .card-link {
        transition: none;
    }
}
