﻿/* data-api.css — the /data-api reference page (EW2027).
   Loads dashboard.css alongside it for the dialog styles. Prefix: api- */

.api-page {
    --api-gold: var(--ew-gold, #DDB785);
    --api-line: var(--border, #d6dce6);
    --api-soft: color-mix(in srgb, var(--text, #323232) 5%, transparent);
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 16px 80px;
    color: var(--text, #323232);
}

    .api-page :is(a, button, input):focus-visible {
        outline: 2px solid var(--api-gold);
        outline-offset: 2px;
    }

/* ---- head ---- */
.api-head {
    margin-bottom: 20px;
}

.api-title {
    font-size: clamp(1.7rem, 3.6vw, 2.3rem);
    font-weight: 800;
    margin: 0 0 6px;
}

.api-sub {
    margin: 0;
    color: var(--text-muted, #5b6472);
    font-size: 1rem;
    max-width: 60ch;
}

/* ---- contents ---- */
.api-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 0 4px;
    border-top: 1px solid var(--api-line);
    border-bottom: 1px solid var(--api-line);
    margin-bottom: 32px;
}

    .api-toc a {
        font-size: 0.82rem;
        font-weight: 700;
        color: var(--text-muted, #5b6472);
        text-decoration: none;
        padding: 5px 11px;
        border-radius: 999px;
    }

        .api-toc a:hover {
            background: var(--api-soft);
            color: var(--api-gold);
        }

/* ---- sections ---- */
.api-section {
    margin-bottom: 44px;
    scroll-margin-top: 80px;
}

    .api-section h2 {
        font-size: 1.3rem;
        font-weight: 800;
        margin: 0 0 12px;
        padding-bottom: 8px;
        border-bottom: 2px solid var(--api-gold);
    }

    .api-section h3 {
        font-size: 1rem;
        font-weight: 800;
        margin: 26px 0 8px;
    }

    .api-section p {
        line-height: 1.65;
        margin: 0 0 12px;
        max-width: 72ch;
    }

.api-note {
    font-size: 0.87rem;
    color: var(--text-muted, #5b6472);
}

.api-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.7;
    max-width: 72ch;
}

    .api-list li {
        margin-bottom: 6px;
    }

.api-quote {
    margin: 0 0 14px;
    padding: 12px 16px;
    border-left: 3px solid var(--api-gold);
    background: var(--api-soft);
    border-radius: 0 8px 8px 0;
    font-size: 0.97rem;
    line-height: 1.6;
}

/* ---- tables ---- */
.api-tablewrap {
    overflow-x: auto;
    border: 1px solid var(--api-line);
    border-radius: 10px;
    margin-bottom: 14px;
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

    .api-table th,
    .api-table td {
        padding: 9px 12px;
        text-align: left;
        border-bottom: 1px solid var(--api-line);
        vertical-align: top;
    }

    .api-table thead th {
        font-size: 0.76rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted, #5b6472);
        background: var(--api-soft);
    }

/* Headers wrap rather than forcing the table wider than its column. A nowrap header
       is what pushed this table into a horizontal scrollbar inside the site's container. */
.api-table-access th,
.api-table-access td {
    padding: 8px 9px;
}

.api-table-access thead th {
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    line-height: 1.25;
}

.api-table tbody tr:last-child td,
.api-table tbody tr:last-child th {
    border-bottom: 0;
}

.api-table tbody th[scope="row"] {
    font-weight: 800;
}

/* the reader's own tier */
.api-table tr.is-you {
    background: color-mix(in srgb, var(--api-gold) 13%, transparent);
}

.api-yes {
    color: var(--ew-green, #0F8A3B);
    font-weight: 700;
}

/* the qualifier under a Yes — present but quiet, so the column reads as access
   first and limits second */
.api-fine {
    display: block;
    font-size: 0.74rem;
    font-weight: 400;
    color: var(--text-muted, #5b6472);
    margin-top: 1px;
}

.api-no {
    color: var(--text-muted, #5b6472);
}

/* ---- code ---- */
.api-code {
    margin: 0 0 14px;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--text, #323232) 8%, transparent);
    border: 1px solid var(--api-line);
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.84rem;
    line-height: 1.55;
}

.api-page code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.api-page :not(pre) > code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--api-soft);
}

/* ---- keys ---- */
.api-signin {
    padding: 22px;
    border: 1px dashed var(--api-line);
    border-radius: 10px;
    text-align: center;
}

    .api-signin p {
        margin: 0 0 12px;
    }

.api-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--api-gold);
    border-radius: 8px;
    background: var(--api-gold);
    color: #1b1b1b;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

    .api-btn:disabled {
        opacity: 0.6;
        cursor: progress;
    }

.api-keys-head {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.api-input {
    flex: 1 1 260px;
    padding: 9px 12px;
    border: 1px solid var(--api-line);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text, #323232);
    font: inherit;
    font-size: 0.9rem;
}

    .api-input:focus {
        outline: none;
        border-color: var(--api-gold);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--api-gold) 25%, transparent);
    }

.api-hint {
    font-size: 0.82rem;
    color: var(--text-muted, #5b6472);
    margin: 0 0 14px;
}

.api-status {
    margin: 0 0 12px;
    font-size: 0.87rem;
    color: var(--text-muted, #5b6472);
}

    .api-status.is-error {
        color: var(--ew-red, #e13232);
        font-weight: 600;
    }

.api-keylist {
    border: 1px solid var(--api-line);
    border-radius: 10px;
    overflow: hidden;
}

.api-loading,
.api-empty {
    margin: 0;
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted, #5b6472);
    font-size: 0.9rem;
}

.api-key {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--api-line);
    align-items: center;
}

    .api-key:last-child {
        border-bottom: 0;
    }

    .api-key.is-revoked {
        opacity: 0.55;
    }

.api-key-main {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.api-key-prefix {
    font-weight: 700;
}

.api-key-label {
    font-size: 0.86rem;
    color: var(--text-muted, #5b6472);
}

.api-key-tag {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--api-soft);
    color: var(--text-muted, #5b6472);
}

.api-key-meta {
    grid-column: 1;
    font-size: 0.76rem;
    color: var(--text-muted, #5b6472);
}

.api-revoke {
    grid-row: 1 / span 2;
    grid-column: 2;
    padding: 6px 12px;
    border: 1px solid var(--api-line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted, #5b6472);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

    .api-revoke:hover {
        border-color: var(--ew-red, #e13232);
        color: var(--ew-red, #e13232);
        background: color-mix(in srgb, var(--ew-red, #e13232) 10%, transparent);
    }

/* the one-time key display */
.api-newkey {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--api-gold);
    border-radius: 9px;
    background: color-mix(in srgb, var(--api-gold) 10%, transparent);
    margin-bottom: 4px;
}

    .api-newkey code {
        flex: 1 1 auto;
        word-break: break-all;
        font-size: 0.84rem;
        font-weight: 700;
        background: none;
        padding: 0;
    }

@media (max-width: 600px) {
    .api-key {
        grid-template-columns: 1fr;
    }

    .api-revoke {
        grid-row: auto;
        grid-column: 1;
        justify-self: start;
        margin-top: 6px;
    }

    .api-newkey {
        flex-direction: column;
        align-items: stretch;
    }
}
