/* ============================================================
       Catppuccin palettes (mocha / macchiato / frappe / latte)
       https://github.com/catppuccin/catppuccin
       ============================================================ */
html[data-flavor="mocha"] {
    color-scheme: dark;
    --pink: #f5c2e7;
    --accent-rgb: 245, 194, 231;
    --mauve: #cba6f7;
    --red: #f38ba8;
    --peach: #fab387;
    --yellow: #f9e2af;
    --green: #a6e3a1;
    --teal: #94e2d5;
    --sky: #89dceb;
    --blue: #89b4fa;
    --lavender: #b4befe;
    --text: #cdd6f4;
    --subtext-1: #bac2de;
    --subtext-0: #a6adc8;
    --overlay-0: #6c7086;
    --surface-0: #313244;
    --surface-1: #45475a;
    --surface-2: #585b70;
    --base: #1e1e2e;
    --mantle: #181825;
    --crust: #11111b;
}

html[data-flavor="macchiato"] {
    color-scheme: dark;
    --pink: #f5bde6;
    --accent-rgb: 245, 189, 230;
    --mauve: #c6a0f6;
    --red: #ed8796;
    --peach: #f5a97f;
    --yellow: #eed49f;
    --green: #a6da95;
    --teal: #8bd5ca;
    --sky: #91d7e3;
    --blue: #8aadf4;
    --lavender: #b7bdf8;
    --text: #cad3f5;
    --subtext-1: #b8c0e0;
    --subtext-0: #a5adcb;
    --overlay-0: #6e738d;
    --surface-0: #363a4f;
    --surface-1: #494d64;
    --surface-2: #5b6078;
    --base: #24273a;
    --mantle: #1e2030;
    --crust: #181926;
}

html[data-flavor="frappe"] {
    color-scheme: dark;
    --pink: #f4b8e4;
    --accent-rgb: 244, 184, 228;
    --mauve: #ca9ee6;
    --red: #e78284;
    --peach: #ef9f76;
    --yellow: #e5c890;
    --green: #a6d189;
    --teal: #81c8be;
    --sky: #99d1db;
    --blue: #8caaee;
    --lavender: #babbf1;
    --text: #c6d0f5;
    --subtext-1: #b5bfe2;
    --subtext-0: #a5adce;
    --overlay-0: #737994;
    --surface-0: #414559;
    --surface-1: #51576d;
    --surface-2: #626880;
    --base: #303446;
    --mantle: #292c3c;
    --crust: #232634;
}

html[data-flavor="latte"] {
    color-scheme: light;
    --pink: #ea76cb;
    --accent-rgb: 234, 118, 203;
    --mauve: #8839ef;
    --red: #d20f39;
    --peach: #fe640b;
    --yellow: #df8e1d;
    --green: #40a02b;
    --teal: #179299;
    --sky: #04a5e5;
    --blue: #1e66f5;
    --lavender: #7287fd;
    --text: #4c4f69;
    --subtext-1: #5c5f77;
    --subtext-0: #6c6f85;
    --overlay-0: #9ca0b0;
    --surface-0: #ccd0da;
    --surface-1: #bcc0cc;
    --surface-2: #acb0be;
    --base: #eff1f5;
    --mantle: #e6e9ef;
    --crust: #dce0e8;
}

/* ---- Comic Code (shared with c.stupid.cat) ---- */
@font-face {
    font-family: 'Comic Code';
    src: url('https://fonts.doughmination.co.uk/ComicCode-Regular_2022-05-24-151938_hsmz.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Comic Code';
    src: url('https://fonts.doughmination.co.uk/ComicCode-Medium_2022-05-24-151941_ugqm.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Comic Code';
    src: url('https://fonts.doughmination.co.uk/ComicCode-Bold_2022-05-24-152309_zqkm.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

html {
    background: linear-gradient(135deg, var(--base) 0%, var(--mantle) 60%, var(--crust) 100%);
}

body {
    font-family: 'Comic Code', ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text);
    margin: 0;
    padding: clamp(1.25rem, 4vw, 3rem) 1rem 4rem;
    min-height: 100vh;
    background:
        radial-gradient(800px 500px at 100% -5%, rgba(var(--accent-rgb), 0.10), transparent 60%),
        radial-gradient(700px 500px at -5% 110%, rgba(203, 166, 247, 0.10), transparent 60%),
        linear-gradient(135deg, var(--base) 0%, var(--mantle) 60%, var(--crust) 100%);
    background-attachment: fixed;
    line-height: 1.55;
}

.wrap {
    max-width: 880px;
    margin: 0 auto;
}

a {
    color: rgb(var(--accent-rgb));
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---- Theme switcher (top-right) ---- */
.theme-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: 999px;
    background: var(--surface-0);
    border: 1px solid var(--surface-1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.theme-switch button {
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    background-clip: padding-box;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.theme-switch button:hover {
    transform: scale(1.15);
}

.theme-switch button[aria-pressed="true"] {
    border-color: var(--text);
}

.sw-mocha {
    background: #1e1e2e;
    box-shadow: inset 0 0 0 6px #f5c2e7;
}

.sw-macchiato {
    background: #24273a;
    box-shadow: inset 0 0 0 6px #f5bde6;
}

.sw-frappe {
    background: #303446;
    box-shadow: inset 0 0 0 6px #f4b8e4;
}

.sw-latte {
    background: #eff1f5;
    box-shadow: inset 0 0 0 6px #ea76cb;
}

/* ---- Header ---- */
header.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.domain-pill {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: var(--surface-0);
    border: 1px solid var(--surface-1);
    color: var(--subtext-1);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.domain-pill b {
    color: rgb(var(--accent-rgb));
}

header.hero h1 {
    margin: 0;
    font-size: clamp(2rem, 6vw, 2.9rem);
    font-weight: 700;
    color: rgb(var(--accent-rgb));
}

header.hero p.lede {
    margin: 0.9rem auto 0;
    max-width: 620px;
    color: var(--subtext-0);
    font-size: 1rem;
}

header.hero p.lede a {
    color: var(--mauve);
}

/* ---- Nav pills ---- */
nav.jump {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.6rem 0 0;
}

nav.jump a {
    padding: 0.32rem 0.8rem;
    border-radius: 999px;
    background: var(--surface-0);
    border: 1px solid var(--surface-1);
    color: var(--subtext-1);
    font-size: 0.82rem;
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

nav.jump a:hover {
    border-color: rgb(var(--accent-rgb));
    color: var(--text);
    transform: translateY(-2px);
}

/* ---- API cards ---- */
.card {
    background: var(--surface-0);
    border: 1px solid var(--surface-1);
    border-radius: 18px;
    padding: clamp(1.25rem, 3vw, 2rem);
    margin-top: 1.5rem;
    scroll-margin-top: 1.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: rgba(var(--accent-rgb), 0.6);
    box-shadow: 0 8px 28px rgba(var(--accent-rgb), 0.12);
}

.card-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 0.8rem;
    margin-bottom: 0.4rem;
}

.card-head h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text);
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
}

.card-head h2 .dot {
    font-size: 1.1rem;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--crust);
    border: 1px solid var(--green);
    color: var(--green);
}

.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.base-url {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--subtext-0);
    word-break: break-all;
}

.base-url a {
    color: var(--sky);
}

.tagline {
    margin: 0 0 1.2rem;
    color: var(--subtext-0);
}

.card p {
    color: var(--subtext-1);
}

.card p strong {
    color: var(--text);
}

h3.sub {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--overlay-0);
    margin: 1.6rem 0 0.6rem;
    font-weight: 700;
}

/* ---- Endpoint table ---- */
.endpoints {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    border: 1px solid var(--surface-1);
    border-radius: 12px;
    overflow: hidden;
}

.endpoints td {
    padding: 0.6rem 0.8rem;
    border-top: 1px solid var(--surface-1);
    vertical-align: top;
}

.endpoints tr:first-child td {
    border-top: none;
}

.endpoints td.path {
    color: var(--text);
    white-space: nowrap;
}

.endpoints td.desc {
    color: var(--subtext-0);
}

.method {
    display: inline-block;
    min-width: 44px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.5rem;
    border-radius: 7px;
    margin-right: 0.55rem;
    background: rgba(166, 227, 161, 0.14);
    color: var(--green);
    border: 1px solid rgba(166, 227, 161, 0.4);
}

.method.post {
    background: rgba(250, 179, 135, 0.14);
    color: var(--peach);
    border-color: rgba(250, 179, 135, 0.4);
}

.method.ws {
    background: rgba(137, 180, 250, 0.14);
    color: var(--blue);
    border-color: rgba(137, 180, 250, 0.4);
}

/* ---- Code blocks ---- */
pre {
    background: var(--crust);
    border: 1px solid var(--surface-1);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--subtext-1);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

pre .c {
    color: var(--overlay-0);
}

pre .k {
    color: var(--mauve);
}

pre .s {
    color: var(--green);
}

pre .n {
    color: var(--peach);
}

code.inline {
    background: var(--crust);
    border: 1px solid var(--surface-1);
    border-radius: 6px;
    padding: 0.08rem 0.4rem;
    font-size: 0.85em;
    color: var(--text);
}

.grid2 {
    display: grid;
    gap: 1rem;
}

.grid2>div {
    min-width: 0;
}

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

/* ---- Tags + card footer ---- */
.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--surface-1);
}

.tag {
    font-size: 0.72rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--crust);
    border: 1px solid var(--surface-2);
    color: var(--subtext-0);
}

.repo-link {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--mauve);
    font-weight: 500;
}

/* ---- Footer ---- */
footer.site {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    color: var(--subtext-0);
    font-size: 0.85rem;
}

footer.site a {
    color: var(--mauve);
}