:root {
    --paper: #f3efe5;
    --paper-deep: #e8e1d2;
    --card: #fbf8f0;
    --ink: #16151a;
    --muted: #67625a;
    --line: #d5cebe;
    --violet: #5a4bff;
    --violet-dark: #3b2bd6;
    --acid: #c9f36b;
    --code: #17161d;
    --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
    --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle at 92% 4%, rgba(90, 75, 255, 0.07), transparent 26rem),
        radial-gradient(circle at 6% 44%, rgba(201, 243, 107, 0.12), transparent 20rem);
}

.site-header {
    width: min(1240px, calc(100% - 3rem));
    padding: 1.2rem 0;
}

.site-header .brand img {
    width: 38px;
    height: 38px;
}

.site-header nav {
    gap: 1.35rem;
}

.site-header nav a {
    font-size: 0.9rem;
    position: relative;
}

.site-header nav a:not(.nav-cta)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: -0.45rem;
    height: 2px;
    background: var(--violet);
    transition: right 160ms ease;
}

.site-header nav a:not(.nav-cta):hover::after,
.site-header nav a.active::after {
    right: 0;
}

.site-header nav a.active {
    color: var(--ink);
}

.masthead,
.proof-strip,
.principles,
.api-layout {
    width: min(1240px, calc(100% - 3rem));
    margin: 0 auto;
}

.masthead {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
    padding: clamp(4rem, 9vw, 7.5rem) 0 clamp(3rem, 6vw, 5rem);
}

.masthead::before {
    content: "";
    position: absolute;
    inset: 2rem 0 0;
    z-index: -1;
    pointer-events: none;
    background-image: linear-gradient(90deg, rgba(22, 21, 26, 0.06) 1px, transparent 1px);
    background-size: calc(100% / 12) 100%;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 82%);
}

.masthead-copy {
    position: relative;
}

.masthead h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(4rem, 8.2vw, 7.2rem);
    line-height: 0.88;
    letter-spacing: -0.065em;
    font-weight: 500;
}

.masthead h1 em {
    color: var(--violet);
    font-weight: 400;
}

.masthead .lede {
    max-width: 34rem;
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: clamp(1.02rem, 1.3vw, 1.16rem);
}

.masthead-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.8rem;
}

.install {
    margin-top: 1.2rem;
}

.exchange {
    position: relative;
    background: var(--code);
    color: #f4f1e9;
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(22, 21, 26, 0.22);
    transform: rotate(1.1deg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.exchange::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px dashed rgba(243, 239, 229, 0.16);
    border-radius: 10px;
    pointer-events: none;
}

.exchange-bar,
.exchange-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    font: 0.68rem var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(244, 241, 233, 0.58);
}

.exchange-bar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.exchange-foot {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.exchange-dots {
    display: inline-flex;
    gap: 0.3rem;
}

.exchange-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(244, 241, 233, 0.25);
}

.exchange-dots i:first-child { background: #ff7b69; }
.exchange-dots i:nth-child(2) { background: #ffc85a; }
.exchange-dots i:last-child { background: var(--acid); }

.exchange-live {
    color: var(--acid);
}

.exchange-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
    gap: 0.8rem;
    align-items: stretch;
    padding: 1.35rem 1.15rem;
}

.exchange-pane {
    min-width: 0;
}

.pane-label {
    margin: 0 0 0.6rem;
    color: rgba(244, 241, 233, 0.48);
    font: 0.66rem var(--mono);
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.exchange-pane pre {
    margin: 0;
    padding: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(244, 241, 233, 0.86);
    font-size: 0.67rem;
    line-height: 1.8;
    overflow-x: auto;
    box-shadow: none;
}

.exchange-pane pre code {
    color: inherit;
}

.request-pane pre code {
    color: #d5d0ff;
}

.exchange-flow {
    align-self: center;
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    color: var(--acid);
    font: 0.58rem var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.exchange-flow i {
    display: block;
    width: 1px;
    height: 58px;
    background: repeating-linear-gradient(to bottom, var(--acid) 0 4px, transparent 4px 8px);
    position: relative;
}

.exchange-flow i::after {
    content: "";
    position: absolute;
    left: -3px;
    bottom: -1px;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 5px solid var(--acid);
}

.response-pane {
    display: flex;
    flex-direction: column;
}

.response-pane .price-widget {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem;
    border: 1px solid rgba(201, 243, 107, 0.32);
    border-radius: 8px;
    background: rgba(201, 243, 107, 0.055);
}

.response-pane .price-kicker {
    color: var(--acid);
}

.response-pane .price-value {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    letter-spacing: -0.06em;
    line-height: 1;
}

.response-pane .price-meta {
    color: rgba(244, 241, 233, 0.58);
    font-size: 0.7rem;
}

.response-pane .price-meta code {
    color: rgba(244, 241, 233, 0.78);
    background: rgba(255, 255, 255, 0.06);
}

.price-loading {
    min-height: 7rem;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: rgba(244, 241, 233, 0.5);
    font: 0.75rem var(--mono);
}

.proof-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 1.35rem 0;
}

.proof-strip div {
    padding-left: 1.4rem;
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.proof-strip div:first-child {
    padding-left: 0;
    border-left: 0;
}

.proof-strip strong {
    font-family: var(--serif);
    font-size: 1.9rem;
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1;
}

.proof-strip span {
    color: var(--muted);
    font-size: 0.75rem;
}

.principles {
    padding: clamp(3.5rem, 7vw, 6rem) 0;
    border-bottom: 1px solid var(--line);
}

.principles-head {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 2rem;
    align-items: end;
    margin-bottom: 2.5rem;
}

.principles-head h2 {
    margin: 0;
    max-width: 34rem;
    font-family: var(--serif);
    font-size: clamp(2.2rem, 4.5vw, 3.8rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    font-weight: 500;
}

.principle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.principle {
    background: var(--card);
    padding: clamp(1.3rem, 3vw, 2rem);
}

.principle-num {
    display: block;
    margin-bottom: 1.8rem;
    color: var(--violet);
    font: 0.7rem var(--mono);
}

.principle h3 {
    margin: 0 0 0.55rem;
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 500;
    letter-spacing: -0.03em;
}

.principle p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.api-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    padding-top: clamp(3rem, 6vw, 5rem);
}

.api-sidebar {
    top: 1.5rem;
}

.api-sidebar .eyebrow {
    color: var(--violet-dark);
}

.api-search {
    font-family: var(--sans);
}

.api-content {
    max-width: 760px;
}

.reference-intro {
    padding-bottom: 1.6rem;
}

.reference-intro h2 {
    max-width: 40rem;
    font-size: clamp(2.4rem, 4.5vw, 3.8rem);
}

.reference-intro .lede {
    max-width: 44rem;
}

.api-content h2 {
    font-family: var(--serif);
    font-weight: 500;
}

.api-content h3 {
    font-family: var(--sans);
    font-weight: 600;
}

.api-content table {
    font-size: 0.86rem;
}

.api-content th {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.api-content td:first-child {
    color: var(--ink);
}

.api-content pre {
    border-radius: 8px;
    background: var(--code);
}

.api-content .code-copy {
    font-family: var(--mono);
}

.api-content a {
    color: var(--violet-dark);
}

.api-content .button {
    color: var(--paper);
}

.api-content .button.ghost {
    color: var(--ink);
}

.api-content .button.ghost:hover {
    color: var(--paper);
}

.api-empty {
    font-family: var(--sans);
}

footer {
    width: min(1240px, calc(100% - 3rem));
}

@media (max-width: 980px) {
    .masthead {
        grid-template-columns: 1fr;
        padding-top: 3.5rem;
    }

    .exchange {
        max-width: 700px;
        transform: none;
    }

    .principles-head {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .principle-grid {
        grid-template-columns: 1fr;
    }

    .api-layout {
        grid-template-columns: 1fr;
    }

    .api-content {
        max-width: none;
    }
}

@media (max-width: 620px) {
    .masthead,
    .proof-strip,
    .principles,
    .api-layout,
    .site-header,
    footer {
        width: min(100% - 2rem, 1240px);
    }

    .masthead h1 {
        font-size: clamp(3rem, 14vw, 4.8rem);
    }

    .proof-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .proof-strip div:nth-child(3) {
        border-left: 0;
        padding-left: 0;
    }

    .exchange-body {
        grid-template-columns: 1fr;
    }

    .exchange-flow {
        grid-template-columns: auto auto;
        justify-content: center;
        align-items: center;
        gap: 0.6rem;
    }

    .exchange-flow i {
        width: 52px;
        height: 1px;
        background: repeating-linear-gradient(to right, var(--acid) 0 4px, transparent 4px 8px);
    }

    .exchange-flow i::after {
        left: auto;
        right: -1px;
        bottom: -2px;
        border-left: 5px solid var(--acid);
        border-top: 3px solid transparent;
        border-bottom: 3px solid transparent;
        border-right: 0;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-header nav {
        flex-wrap: wrap;
    }

    .api-sidebar nav {
        grid-template-columns: 1fr;
    }

    .api-sidebar nav a {
        min-height: 44px;
    }
}

.api-sidebar nav a.active {
    background: var(--ink);
    color: var(--paper);
}

.principles-note {
    max-width: 21rem;
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

@media (max-width: 620px) {
    .site-header {
        gap: 0.8rem;
    }

    .site-header nav {
        width: 100%;
        gap: 0.75rem;
        font-size: 0.84rem;
    }

    .site-header nav .nav-cta {
        padding: 0.3rem 0.65rem;
    }
}
