/*
 * API pages (2026-11-04), loaded by inc/api-pages.php on /api/ and /api/<page>/.
 * Same tokens as the v2 service pages (service-v2.css). Everything sits under .gapi, so the rest
 * of the site is untouched. Phone first: one column, and tables become stacked cards.
 */
body.gis-api-page main.wp-block-group { margin-block-start: 0 !important; }
body.gis-api-page main.wp-block-group > .wp-block-group { padding-top: 0 !important; padding-bottom: 0 !important; }
.wp-block-post-content:has(> .gapi) { padding-left: 0 !important; padding-right: 0 !important; }
.wp-block-post-content > .gapi { max-width: none !important; width: 100%; margin: 0 !important; }

.gapi {
    --ga-ink: #16142b;
    --ga-body: #4b4866;
    --ga-muted: #6b6886;
    --ga-line: #e7e4f3;
    --ga-tint: #f7f6fd;
    --ga-link: #4f3fc9;
    --ga-brand-a: #667eea;
    --ga-brand-b: #764ba2;
    --ga-code-bg: #14122b;
    --ga-radius: 18px;
    --ga-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    color: var(--ga-body);
    background: #ffffff;
    font-family: var(--wp--preset--font-family--manrope, Manrope), system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.65;
    letter-spacing: normal;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}
.gapi *, .gapi *::before, .gapi *::after { box-sizing: border-box; }
.gapi :where(h1, h2, h3, p, ul, ol, dl, dd, figure) { margin: 0; padding: 0; }
.gapi :where(h1, h2, h3) { font-family: inherit; color: var(--ga-ink); }
.gapi a { color: var(--ga-link); text-underline-offset: 3px; }
.gapi :focus-visible { outline: 3px solid var(--ga-brand-a); outline-offset: 2px; border-radius: 8px; }
.gapi code {
    font-family: var(--ga-mono);
    font-size: .88em;
    font-weight: 600;
    padding: .1em .35em;
    border-radius: 6px;
    background: var(--ga-tint);
    color: #3b2fb0;
    overflow-wrap: anywhere;
}
.gapi-wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }

/* Hero: the first paragraph answers the search, so nothing stands in front of it. */
.gapi-hero {
    padding: 28px 0 26px;
    background:
        radial-gradient(520px 320px at 100% 0%, rgba(118, 75, 162, .13), transparent 70%),
        radial-gradient(420px 300px at 0% 30%, rgba(199, 210, 254, .5), transparent 70%),
        linear-gradient(180deg, #fbfaff 0%, #ffffff 100%);
}
.gapi-crumb { display: flex; gap: 8px; margin-bottom: 14px; font-size: 13.5px; color: var(--ga-muted); }
.gapi-crumb a { font-weight: 700; text-decoration: none; }
.gapi-eyebrow {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--ga-line);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ga-ink);
}
.gapi h1 {
    margin-top: 14px;
    max-width: 18em;
    font-size: clamp(30px, 7vw, 48px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -.025em;
    text-wrap: balance;
}
.gapi-answer { margin-top: 14px; max-width: 46em; font-size: 17px; color: var(--ga-ink); }
.gapi-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.gapi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 22px;
    border-radius: 14px;
    font-size: 15.5px;
    font-weight: 800;
    text-decoration: none;
    flex: 1 1 auto;
}
.gapi-btn-primary { color: #ffffff !important; background: linear-gradient(135deg, var(--ga-brand-a), var(--ga-brand-b)); box-shadow: 0 10px 24px -10px rgba(102, 126, 234, .8); }
.gapi-btn-ghost { color: var(--ga-ink) !important; background: #ffffff; border: 1px solid #cfcbe6; }
.gapi-btn-light { color: var(--ga-ink) !important; background: #ffffff; }
.gapi-note { margin-top: 10px; font-size: 13.5px; color: var(--ga-muted); }

/* Body */
.gapi-layout { display: grid; gap: 24px; padding-top: 6px; padding-bottom: 44px; }
.gapi-toc { display: none; }
.gapi-article { min-width: 0; max-width: 780px; }
.gapi-cover { margin-bottom: 18px; border-radius: var(--ga-radius); overflow: hidden; background: var(--ga-tint); }
.gapi-cover img { display: block; width: 100%; height: auto; }
.gapi-article h2 {
    margin-top: 38px;
    margin-bottom: 10px;
    scroll-margin-top: 90px;
    font-size: clamp(22px, 4.6vw, 28px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.015em;
}
.gapi-article h3 { margin-top: 20px; margin-bottom: 6px; font-size: 17.5px; font-weight: 800; }
.gapi-article p { margin-top: 10px; }
.gapi-article ul, .gapi-article ol { margin-top: 10px; padding-inline-start: 22px; }
.gapi-article li { margin-top: 6px; }
.gapi-article li::marker { color: var(--ga-brand-b); font-weight: 800; }

.gapi-facts { padding: 16px 18px; border: 1px solid var(--ga-line); border-radius: var(--ga-radius); background: var(--ga-tint); }
.gapi-article .gapi-facts-title { margin: 0 0 8px; font-size: 15px; font-weight: 800; letter-spacing: 0; }
.gapi-facts dl > div { padding: 8px 0; border-top: 1px solid var(--ga-line); }
.gapi-facts dt { font-size: 12.5px; font-weight: 800; color: var(--ga-muted); }
.gapi-facts dd { font-size: 14.5px; color: var(--ga-ink); overflow-wrap: anywhere; }

/* Code keeps its own scroll, so a long line never widens the page. */
.gapi-code { margin-top: 14px; border-radius: 14px; background: var(--ga-code-bg); overflow: hidden; }
.gapi-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 4px 8px 4px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    font-size: 12.5px;
    font-weight: 700;
    color: #b6b3e0;
}
.gapi-code-head button {
    min-height: 36px;
    padding: 4px 14px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 10px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    cursor: pointer;
}
.gapi-code-head button:hover { background: rgba(255, 255, 255, .1); }
.gapi-code pre {
    margin: 0;
    padding: 14px 16px 16px;
    overflow-x: auto;
    max-height: 560px;
    background: transparent;
    border: 0;
    color: #e8e6ff;
    font-family: var(--ga-mono);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
    white-space: pre;
    tab-size: 2;
}

/* Phone: every row is a small card and every cell names its column. */
.gapi-table { margin-top: 14px; }
.gapi-table table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.gapi-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.gapi-table tr { display: block; margin-bottom: 10px; padding: 8px 14px; border: 1px solid var(--ga-line); border-radius: 14px; background: #ffffff; }
.gapi-table td { display: block; padding: 6px 0; border: 0; color: var(--ga-ink); overflow-wrap: anywhere; }
.gapi-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 800; color: var(--ga-muted); }
.gapi-table td:first-child { font-weight: 800; }

.gapi-faq { margin-top: 12px; }
.gapi-faq details { border: 1px solid var(--ga-line); border-radius: 14px; background: #ffffff; margin-bottom: 10px; }
.gapi-faq summary { padding: 14px 16px; font-weight: 800; color: var(--ga-ink); cursor: pointer; }
.gapi-faq details p { margin: 0; padding: 0 16px 14px; }

.gapi-cards { display: grid; gap: 10px; margin-top: 12px; }
.gapi-card {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--ga-line);
    border-radius: 14px;
    background: #ffffff;
    text-decoration: none;
}
.gapi-card:hover { border-color: var(--ga-brand-a); }
.gapi-card b { display: block; color: var(--ga-ink); font-weight: 800; }
.gapi-card span { display: block; margin-top: 2px; font-size: 14px; color: var(--ga-body); }
.gapi-updated { margin-top: 26px !important; font-size: 13.5px; color: var(--ga-muted); }

.gapi-band { padding: 36px 0; background: linear-gradient(135deg, var(--ga-brand-a), var(--ga-brand-b)); color: #ffffff; }
.gapi-band h2 { font-size: clamp(22px, 5vw, 30px); font-weight: 800; line-height: 1.2; color: #ffffff; }
.gapi-band p { margin: 8px 0 16px; color: #ffffff; }

@media (min-width: 640px) {
    .gapi-btn { flex: 0 0 auto; }
    .gapi-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gapi-facts dl > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; }
    .gapi-table { overflow-x: auto; border: 1px solid var(--ga-line); border-radius: 14px; }
    .gapi-table thead { position: static; width: auto; height: auto; clip: auto; }
    .gapi-table tr { display: table-row; margin: 0; padding: 0; border: 0; border-radius: 0; }
    .gapi-table th { padding: 10px 14px; text-align: start; font-size: 12.5px; font-weight: 800; color: var(--ga-muted); background: var(--ga-tint); }
    .gapi-table td { display: table-cell; padding: 11px 14px; border-top: 1px solid var(--ga-line); vertical-align: top; }
    .gapi-table td[data-label]::before { content: none; }
}
@media (min-width: 1024px) {
    .gapi-hero { padding: 44px 0 34px; }
    .gapi-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 44px; padding-top: 14px; }
    .gapi-toc { display: block; position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; font-size: 14px; }
    .gapi-toc b { display: block; margin-bottom: 6px; color: var(--ga-ink); font-weight: 800; }
    .gapi-toc a { display: block; padding: 5px 0; color: var(--ga-body); text-decoration: none; }
    .gapi-toc a:hover { color: var(--ga-link); }
}
