/* APIMemo — single stylesheet, no frameworks, no external fonts.
   Theming: a pre-paint script in <head> always sets html[data-theme] to
   "light" or "dark" (stored choice, else device preference), so a single
   [data-theme="dark"] override block is enough — no FOUC, no duplicated
   @media block. */

:root {
    --bg: #FBFAF7;
    --surface: #FFFFFF;
    --ink: #1C2126;
    --ink-soft: #4C555E;
    --ink-faint: #7A828B;
    --line: #E6E2D8;
    --accent: #176B5B;
    --accent-strong: #135A4D;
    --accent-contrast: #FFFFFF;
    --accent-soft: #E3EFEB;
    --gold: #B07F1A;
    --gold-soft: #F7EFDC;
    --badge-pricing-border: #EADFC2;
    --badge-category-border: #CBE0DA;
    --logo-backing: #FBFAF7;
    --method-get-bg: #E3EFEB;    --method-get-fg: #176B5B;
    --method-post-bg: #E2EAF7;   --method-post-fg: #2456A6;
    --method-warn-bg: #F7EFDC;   --method-warn-fg: #B07F1A;
    --method-del-bg: #F8E4E0;    --method-del-fg: #B3422E;
    --radius: 10px;
    --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #14171A;
    --surface: #1C2126;
    --ink: #E9EBED;
    --ink-soft: #ABB4BC;
    --ink-faint: #828B94;
    --line: #2D3339;
    --accent: #4DB6A0;
    --accent-strong: #5FC4AE;
    --accent-contrast: #10211D;
    --accent-soft: #1E2E2A;
    --gold: #D9AC4D;
    --gold-soft: #2C2516;
    --badge-pricing-border: #4A3D1F;
    --badge-category-border: #2C453F;
    --logo-backing: #E9EBED;
    --method-get-bg: #1E332E;    --method-get-fg: #5FC4AE;
    --method-post-bg: #1E2937;   --method-post-fg: #82ABE0;
    --method-warn-bg: #2C2516;   --method-warn-fg: #D9AC4D;
    --method-del-bg: #33201C;    --method-del-fg: #E08D7C;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
}

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

img { max-width: 100%; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 60px;
}

.logo { display: flex; align-items: center; gap: 9px; }
.logo:hover { text-decoration: none; }
.logo-mark { flex: 0 0 auto; display: block; }
.logo-text { font-weight: 800; font-size: 19px; letter-spacing: -0.4px; color: var(--ink); }
.logo-text span { color: var(--accent); }

.site-nav { display: flex; gap: 20px; }
.site-nav a { color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.header-search { margin-left: auto; flex: 0 1 300px; }
.header-search input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    font: inherit;
    font-size: 14px;
    color: var(--ink);
}
.header-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.theme-toggle {
    flex: 0 0 auto;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- hero / home ---------- */

.hero { padding: 64px 0 48px; text-align: center; }
.hero h1 {
    font-size: clamp(30px, 5vw, 44px);
    letter-spacing: -1.2px;
    line-height: 1.15;
    margin: 0 0 14px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--ink-soft); font-size: 18px; max-width: 620px; margin: 0 auto 28px; }

.hero-search { display: flex; max-width: 540px; margin: 0 auto; gap: 8px; }
.hero-search input {
    flex: 1;
    padding: 13px 18px;
    font: inherit;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.hero-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.hero-search button {
    padding: 13px 22px;
    font: inherit;
    font-weight: 700;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-contrast);
    cursor: pointer;
}
.hero-search button:hover { background: var(--accent-strong); }

.hero-stats { margin-top: 22px; color: var(--ink-faint); font-size: 14px; }
.hero-stats strong { color: var(--ink); }

/* ---------- sections / cards ---------- */

.section { padding: 26px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; letter-spacing: -0.5px; margin: 0; }
.section-head a { font-size: 14px; font-weight: 600; white-space: nowrap; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.api-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.api-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(23, 107, 91, .08); }

.api-card-top { display: flex; align-items: center; gap: 10px; }
.api-logo {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    object-fit: cover;
    /* light backing in BOTH themes so transparent dark logos stay visible */
    background: var(--logo-backing);
    flex: 0 0 auto;
}
.api-logo-placeholder {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
    flex: 0 0 auto;
}
.api-card h3 { margin: 0; font-size: 16px; letter-spacing: -0.2px; line-height: 1.3; }
.api-card h3 a { color: var(--ink); }
.api-card h3 a:hover { color: var(--accent); }
.api-card p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }

.api-card-meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    white-space: nowrap;
}
.badge-pricing { background: var(--gold-soft); border-color: var(--badge-pricing-border); color: var(--gold); }
.badge-category { background: var(--accent-soft); border-color: var(--badge-category-border); color: var(--accent); }
.badge-reviewed { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* ---------- category chips ---------- */

.chip-cloud { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0 0 24px; list-style: none; }
.chip-cloud a {
    display: inline-block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}
.chip-cloud a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip-cloud .chip-count { color: var(--ink-faint); font-weight: 400; }

/* ---------- listing pages ---------- */

.page-head { padding: 36px 0 6px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.8px; margin: 0 0 8px; }
.page-head p { color: var(--ink-soft); max-width: 720px; margin: 0; }

.result-count { color: var(--ink-faint); font-size: 14px; margin: 14px 0; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; padding: 18px 0 40px; }
.pagination a, .pagination span {
    min-width: 38px;
    padding: 7px 12px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.pagination .gap { border: 0; background: none; }

/* ---------- article page ---------- */

.breadcrumbs { font-size: 13px; color: var(--ink-faint); padding: 18px 0 0; }
.breadcrumbs a { color: var(--ink-faint); }
.breadcrumbs a:hover { color: var(--accent); }

.api-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
    margin: 16px 0 8px;
}
.api-hero-top { display: flex; gap: 16px; align-items: flex-start; }
.api-hero .api-logo, .api-hero .api-logo-placeholder { width: 56px; height: 56px; font-size: 24px; }
.api-hero h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.8px; line-height: 1.2; margin: 2px 0 6px; }
.api-hero .summary { color: var(--ink-soft); font-size: 17px; max-width: 760px; margin: 6px 0 0; }

.stat-strip { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.stat-strip .stat { font-size: 13px; color: var(--ink-faint); }
.stat-strip .stat strong { display: block; font-size: 17px; color: var(--ink); letter-spacing: -0.3px; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }

.article-body {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px clamp(20px, 4vw, 40px);
    max-width: 860px;
}
.article-body h2 { font-size: 24px; letter-spacing: -0.5px; margin: 34px 0 12px; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { font-size: 18px; margin: 26px 0 10px; }
.article-body p { margin: 0 0 14px; }
.article-body ul, .article-body ol { margin: 0 0 14px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body code {
    font-family: var(--mono);
    font-size: .88em;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 6px;
}
.article-body pre { background: #20262B; color: #E8ECEF; border-radius: 8px; padding: 16px; overflow-x: auto; }
.article-body pre code { background: none; border: 0; color: inherit; padding: 0; }
.article-body table { border-collapse: collapse; width: 100%; margin: 0 0 18px; font-size: 15px; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.article-body th { background: var(--bg); font-weight: 700; }
.article-body blockquote { margin: 0 0 14px; padding: 4px 18px; border-left: 3px solid var(--accent); color: var(--ink-soft); }

.preview-note {
    background: var(--gold-soft);
    border: 1px solid var(--badge-pricing-border);
    border-radius: var(--radius);
    color: var(--gold);
    padding: 12px 18px;
    margin: 16px 0;
    font-size: 14px;
    max-width: 860px;
}

/* ---------- endpoints / pricing tables ---------- */

.data-section { margin: 26px 0; max-width: 860px; }
.data-section h2 { font-size: 22px; letter-spacing: -0.5px; margin: 0 0 14px; }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}
.data-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th { background: var(--bg); font-weight: 700; white-space: nowrap; }
.data-table .route { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.data-table .muted { color: var(--ink-faint); }

.method {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 5px;
    letter-spacing: .4px;
}
.method-get { background: var(--method-get-bg); color: var(--method-get-fg); }
.method-post { background: var(--method-post-bg); color: var(--method-post-fg); }
.method-put, .method-patch { background: var(--method-warn-bg); color: var(--method-warn-fg); }
.method-delete { background: var(--method-del-bg); color: var(--method-del-fg); }
.method-other { background: var(--bg); color: var(--ink-soft); }

.endpoint-group-row th {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .2px;
}

.plan-price { font-weight: 700; white-space: nowrap; }
.plan-limits { margin: 4px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; }

.more-note { color: var(--ink-faint); font-size: 13px; padding: 10px 14px; }

/* ---------- FAQ ---------- */

.faq-list { max-width: 860px; }
.faq-list details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 18px;
    margin-bottom: 10px;
}
.faq-list summary {
    cursor: pointer;
    font-weight: 700;
    padding: 14px 0;
    list-style: none;
    position: relative;
    padding-right: 28px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
    content: '+';
    position: absolute; right: 2px; top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-size: 20px; font-weight: 600;
}
.faq-list details[open] summary::after { content: '–'; }
.faq-list details p { margin: 0 0 16px; color: var(--ink-soft); }

/* ---------- misc ---------- */

.external-link { font-size: 14px; font-weight: 600; }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    color: var(--ink-faint);
    margin: 20px 0 40px;
}

.error-page { text-align: center; padding: 90px 20px; }
.error-page h1 { font-size: 64px; margin: 0; letter-spacing: -2px; color: var(--accent); }
.error-page p { color: var(--ink-soft); }

/* ---------- footer ---------- */

.site-footer {
    margin-top: 56px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 14px;
}
.footer-inner { padding: 28px 20px 34px; display: flex; flex-direction: column; gap: 12px; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-note { color: var(--ink-faint); font-size: 13px; max-width: 760px; }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
    .header-inner { gap: 14px; }
    .site-nav { display: none; }
    .api-hero-top { flex-direction: column; }
    .stat-strip { gap: 14px; }
}
