/*
 * DollarTraq Developers.
 * Public Sans (the US federal design system's face, as on the FMCSA data this
 * API is built from) for everything but code; JetBrains Mono for code only.
 * The four decision colours mean decisions and nothing else.
 */

:root {
    --ink: #0E2235;
    --ink-soft: #3B5268;
    --ink-faint: #6B7F92;
    --paper: #F7F9FB;
    --surface: #FFFFFF;
    --line: #D9E1E8;
    --line-soft: #E9EEF2;
    --brand: #005EA4;
    --brand-strong: #00487F;
    --brand-wash: #E7F0F8;
    --code-bg: #0E2235;
    --code-ink: #E3EBF2;

    --approved: #1F7A4D;   --approved-wash: #E4F3EA;
    --review: #946200;     --review-wash: #FBF1D9;
    --high-risk: #B9480F;  --high-risk-wash: #FCE9DD;
    --rejected: #B42318;   --rejected-wash: #FBE5E3;

    --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --topbar: 60px;
    --radius-s: 4px;
    --radius-m: 8px;
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 16px/1.65 var(--sans);
    font-feature-settings: 'tnum' 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 2px; }

code, pre { font-family: var(--mono); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

.topbar {
    position: sticky; top: 0; z-index: 20;
    height: var(--topbar);
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.wordmark { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.wordmark-logo { display: block; height: 34px; width: auto; }
.wordmark-text {
    padding-left: 14px;
    border-left: 1px solid var(--line);
    font-size: 15px; font-weight: 600; letter-spacing: -0.005em; line-height: 24px;
}

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
    padding: 6px 12px; border-radius: var(--radius-s);
    color: var(--ink-soft); text-decoration: none; font-size: 15px; font-weight: 500;
}
.topnav a:hover { color: var(--ink); background: var(--line-soft); }
.topnav a.current { color: var(--ink); font-weight: 600; }
.status-link { display: inline-flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--approved); box-shadow: 0 0 0 3px var(--approved-wash); }

/* ---------- Three columns ---------- */

.docs {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr) 216px;
    gap: 48px;
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
}

.sidenav {
    position: sticky; top: var(--topbar);
    align-self: start;
    height: calc(100vh - var(--topbar));
    overflow-y: auto;
    padding: 28px 8px 40px 0;
    border-right: 1px solid var(--line);
}

.nav-groups, .nav-groups ul { list-style: none; margin: 0; padding: 0; }
.nav-groups > li + li { margin-top: 22px; }
.nav-group { margin: 0 0 6px; padding-left: 12px; font-size: 13px; font-weight: 700; color: var(--ink); }
.nav-groups a {
    display: block; padding: 5px 12px;
    border-left: 2px solid transparent;
    color: var(--ink-soft); text-decoration: none; font-size: 14.5px; line-height: 1.45;
}
.nav-groups a:hover { color: var(--ink); background: var(--line-soft); }
.nav-groups a[aria-current="page"] { color: var(--brand-strong); font-weight: 600; border-left-color: var(--brand); background: var(--brand-wash); }

.sidenav-toggle { display: none; }

.content { min-width: 0; max-width: 46rem; padding: 40px 0 64px; }

.toc {
    position: sticky; top: calc(var(--topbar) + 28px);
    align-self: start;
    padding-top: 28px;
    font-size: 13.5px;
}
.toc-title { margin: 0 0 8px; font-weight: 700; font-size: 13px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-faint); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--brand-strong); border-left-color: var(--brand); }

/* ---------- Type ---------- */

h1 { margin: 0 0 20px; font-size: 2.25rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; }

.prose { font-size: 1rem; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--ink-faint); }
.prose strong { font-weight: 650; }

.prose h2 {
    margin: 2.6em 0 0.7em; padding-top: 1.4em;
    border-top: 1px solid var(--line);
    font-size: 1.5rem; line-height: 1.25; font-weight: 750; letter-spacing: -0.018em;
}
.prose h3 { margin: 2em 0 0.5em; font-size: 1.15rem; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
.prose h3 code { font-size: 0.95em; }

.prose .anchor { margin-left: 8px; color: var(--line); text-decoration: none; font-weight: 400; opacity: 0; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; color: var(--ink-faint); }

.lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); max-width: 36rem; }

.prose :not(pre) > code {
    padding: 0.1em 0.35em;
    background: var(--line-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    font-size: 0.86em;
    color: var(--ink);
    white-space: nowrap;
}

.prose blockquote {
    margin: 1.4em 0; padding: 14px 18px;
    background: var(--brand-wash);
    border-left: 3px solid var(--brand);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
    color: var(--ink);
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */

.prose table {
    width: 100%; margin: 1.2em 0 1.6em;
    border-collapse: collapse;
    font-size: 0.92rem;
    display: block; overflow-x: auto;
}
.prose th {
    text-align: left; padding: 9px 14px 9px 0;
    border-bottom: 2px solid var(--ink);
    font-weight: 700; white-space: nowrap;
}
.prose td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose td:first-child code { white-space: nowrap; }

/* ---------- Code ---------- */

.prose pre {
    position: relative;
    margin: 1.2em 0 1.6em;
    padding: 16px 18px;
    background: var(--code-bg); color: var(--code-ink);
    border-radius: var(--radius-m);
    font-size: 13.5px; line-height: 1.6;
    overflow-x: auto;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; white-space: pre; }

.copy {
    position: absolute; top: 8px; right: 8px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.08); color: var(--code-ink);
    border: 1px solid rgba(255,255,255,0.16); border-radius: var(--radius-s);
    font: 500 12px/1.4 var(--sans); cursor: pointer;
}
.copy:hover { background: rgba(255,255,255,0.16); }

.code-tabs { margin: 1.2em 0 1.6em; border-radius: var(--radius-m); background: var(--code-bg); overflow: hidden; }
.code-tabs pre { margin: 0; border-radius: 0; }
.tablist { display: flex; gap: 2px; padding: 6px 6px 0; background: #0A1A29; overflow-x: auto; }
.tablist button {
    padding: 7px 14px;
    background: none; border: 0; border-radius: var(--radius-s) var(--radius-s) 0 0;
    color: #9DB0C2; font: 500 13px/1.4 var(--sans); cursor: pointer; white-space: nowrap;
}
.tablist button:hover { color: #fff; }
.tablist button[aria-selected="true"] { background: var(--code-bg); color: #fff; }

/* highlight.js tokens, tuned to the navy ground */
.hljs-string, .hljs-attr + .hljs-string { color: #9FD6B0; }
.hljs-keyword, .hljs-built_in, .hljs-literal { color: #8EC5F2; }
.hljs-number { color: #F4C27A; }
.hljs-attr, .hljs-property { color: #C7B8F5; }
.hljs-comment { color: #7D92A6; font-style: italic; }
.hljs-variable, .hljs-template-variable { color: #F2A99B; }

/* ---------- Decisions ---------- */

.decision {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.85em; font-weight: 650; line-height: 1.6;
    white-space: nowrap;
}
.decision::first-letter { text-transform: uppercase; }
.decision-approved { background: var(--approved-wash); color: var(--approved); }
.decision-review { background: var(--review-wash); color: var(--review); }
.decision-high_risk { background: var(--high-risk-wash); color: var(--high-risk); }
.decision-rejected { background: var(--rejected-wash); color: var(--rejected); }

/* ---------- Buttons ---------- */

.button {
    display: inline-block;
    padding: 11px 18px;
    background: var(--brand); color: #fff;
    border-radius: var(--radius-s);
    font-weight: 600; font-size: 15px; text-decoration: none;
}
.button:hover { background: var(--brand-strong); color: #fff; }
.button-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.button-quiet:hover { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-faint); }

/* ---------- Overview hero: a carrier's door, and its score ---------- */

.hero {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px;
    padding-bottom: 48px; margin-bottom: 8px;
}
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.1rem); line-height: 1.06; letter-spacing: -0.035em; max-width: 14ch; margin-bottom: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; }

.door {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas: "panel readout" "request readout" "picker picker";
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    overflow: hidden;
}

/* Regulation door lettering: heavy, tight, high contrast on a painted panel. */
.door-panel {
    grid-area: panel;
    padding: 26px 26px 22px;
    background: linear-gradient(180deg, #FDFEFE 0%, #EEF2F5 100%);
    border-bottom: 1px solid var(--line);
}
.door-name { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.door-number {
    margin: 0;
    font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 800; line-height: 1;
    letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.door-mc { margin: 8px 0 0; font-size: 1.15rem; font-weight: 700; letter-spacing: 0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }

.door-request {
    grid-area: request;
    margin: 0; padding: 14px 26px;
    background: var(--code-bg); color: var(--code-ink);
    font-size: 13px; overflow-x: auto;
}

.readout {
    grid-area: readout;
    display: flex; flex-direction: column; gap: 14px;
    padding: 26px;
    border-left: 1px solid var(--line);
}
.readout-score { display: flex; align-items: baseline; gap: 12px; }
.readout-number { font-size: 4.2rem; font-weight: 800; line-height: 0.9; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.readout-grade { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.readout-body .decision { font-size: 14px; }
.readout-verdict { margin: 10px 0 8px; font-weight: 600; }
.readout-reasons { margin: 0; padding-left: 1.1em; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.readout-reasons li + li { margin-top: 4px; }
.readout-reasons:empty { display: none; }

.door-picker {
    grid-area: picker;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: var(--paper);
}
.door-picker::before { content: 'Try a sandbox carrier:'; margin-right: 6px; font-size: 13.5px; color: var(--ink-soft); }
.door-picker button {
    padding: 5px 11px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius-s);
    font: 500 13px/1.4 var(--mono); cursor: pointer;
}
.door-picker button:hover { border-color: var(--ink-faint); }
.door-picker button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* One moment of motion: the score settling when a carrier is chosen. */
.readout.is-changing .readout-number { animation: settle 420ms cubic-bezier(.2,.8,.2,1); }
@keyframes settle { from { opacity: 0.2; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Pager & footer ---------- */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.pager a {
    display: block; padding: 14px 18px;
    border: 1px solid var(--line); border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink); text-decoration: none; font-weight: 600;
}
.pager a:hover { border-color: var(--brand); }
.pager span { display: block; font-size: 13px; font-weight: 500; color: var(--ink-faint); }
.pager-next { grid-column: 2; text-align: right; }

.pagefoot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-faint); }
.pagefoot p { margin: 0 0 8px; }

/* ---------- Reference ---------- */

.is-reference { background: #fff; }
.reference { min-height: calc(100vh - var(--topbar)); }

/* ---------- Narrow screens ---------- */

@media (max-width: 1180px) {
    .docs { grid-template-columns: 232px minmax(0, 1fr); gap: 40px; }
    .toc { display: none; }
}

@media (max-width: 860px) {
    .docs { display: block; padding: 0 16px; }
    .sidenav { display: none; }
    .sidenav-toggle {
        display: block;
        margin: 16px 0 0;
        border: 1px solid var(--line); border-radius: var(--radius-m);
        background: var(--surface);
    }
    .sidenav-toggle summary { padding: 10px 14px; font-weight: 600; cursor: pointer; }
    .sidenav-toggle .nav-groups { padding: 4px 4px 14px; }
    .content { padding-top: 24px; }
    h1 { font-size: 1.85rem; }
    .topbar { padding: 0 16px; }
    .wordmark-logo { height: 28px; }
    .topnav a { white-space: nowrap; }
    .status-link { display: none !important; }
    .wordmark { gap: 10px; }
    .wordmark-text { padding-left: 10px; font-size: 14px; }
    .topnav a { padding: 6px 8px; font-size: 14px; }

    .door { grid-template-columns: minmax(0, 1fr); grid-template-areas: "panel" "request" "readout" "picker"; }
    .readout { border-left: 0; border-top: 1px solid var(--line); }
    .readout-number { font-size: 3.4rem; }
    .pager { grid-template-columns: 1fr; }
    .pager-next { grid-column: 1; }
}

@media (max-width: 420px) {
    .wordmark-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .readout.is-changing .readout-number { animation: none; }
    html { scroll-behavior: auto; }
}
