/*
 * Bidscope type and spacing system: one font, one scale, one wordmark.
 *
 * Loaded last on every public page, the sign-up flow (/start, /join, /subscribe)
 * and the server-rendered sign-in page, so the older layers (redesign.css,
 * platform-design-system.css, auth.css, theme.css, marketing-rhythm.css) can no
 * longer disagree about sizes. The workspace (/app, /preview) keeps its own scale:
 * every rule here is scoped to pages without `.workspace-frame`.
 *
 * Rules
 *   Font      Inter for everything. --font-heading exists so headings can move to
 *             another face (e.g. Fraunces) by changing one line.
 *   Sizes     13 · 14 · 16 · 17 · 18 · 24 · 32 on phones; headings grow on wider
 *             screens. Body text is never under 16px, small print never under 13px.
 *   Leading   text 1.6, headings 1.1–1.3.
 *   Spacing   the 8px scale: 4 · 8 · 12 · 16 · 24 · 32 · 48 · 64 · 96.
 *             Phones: 20px side gutter, 56px between sections (marketing-rhythm.css).
 *
 * Specificity: `html:root:root body:not(:has(.workspace-frame))` lifts these rules
 * above the older layers without !important.
 */

:root {
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-heading: var(--font-sans);

    --fs-small: 0.8125rem; /* 13px: badges, footnotes, table details */
    --fs-ui: 0.875rem; /* 14px: hints, links under fields, header button */
    --fs-body: 1rem; /* 16px */
    --fs-lead: 1.0625rem; /* 17px: the paragraph under a page heading */
    --fs-h3: 1.125rem; /* 18px */
    --fs-h2: 1.5rem; /* 24px */
    --fs-h1: 2rem; /* 32px */
    --fs-wordmark: 1.25rem; /* 20px */

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;
}
@media (min-width: 641px) {
    :root {
        --fs-h3: 1.1875rem; /* 19px */
        --fs-h2: clamp(1.625rem, 1.2rem + 1.3vw, 2.25rem); /* 26 -> 36px */
        --fs-h1: clamp(2.25rem, 1.35rem + 2.6vw, 3.25rem); /* 36 -> 52px */
        --fs-lead: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem); /* 17 -> 19px */
        --fs-wordmark: 1.375rem; /* 22px */
    }
}

/* ---- One font ---- */
html:root:root body:not(:has(.workspace-frame)) {
    font-family: var(--font-sans);
}
html:root:root body:not(:has(.workspace-frame)) :is(.marketing-page, .ref-auth, .auth-page, .auth-card, #root > div) {
    font-family: var(--font-sans);
}
html:root:root body:not(:has(.workspace-frame)) :is(h1, h2, h3, h4) {
    font-family: var(--font-heading);
}
html:root:root body:not(:has(.workspace-frame)) :is(input, button, select, textarea) {
    font-family: inherit;
}

/* ---- The wordmark: the same mark, size and weight in every header ---- */
html:root:root body:not(:has(.workspace-frame)) .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-heading);
    font-size: var(--fs-wordmark);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}
html:root:root body:not(:has(.workspace-frame)) .brand > span {
    font: inherit;
    letter-spacing: inherit;
}
html:root:root body:not(:has(.workspace-frame)) .brand > svg {
    flex: none;
    width: 34px;
    height: auto;
}
@media (min-width: 641px) {
    html:root:root body:not(:has(.workspace-frame)) .brand > svg {
        width: 38px;
    }
}

/* Sign-up, subscribe and sign-in use the same 16px base as the public pages
   (the denser --ui-scale is for the workspace only). */
html:root:not(:has(.workspace-frame)) {
    --ui-scale: 1;
}

/* ---- Headings ---- */
html:root:root body:not(:has(.workspace-frame)) main h1,
html:root:root body:not(:has(.workspace-frame)) :is(.auth-content, .ref-auth) h1 {
    font-size: var(--fs-h1);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}
/* Step pages (subscribe, start) are a narrow column: their heading tops out at 36px. */
html:root:root body:not(:has(.workspace-frame)) :not(.marketing-page) > main h1,
html:root:root body:not(:has(.workspace-frame)) :is(.start-page, .auth-content, .ref-auth) h1 {
    font-size: min(var(--fs-h1), 2.25rem);
}
html:root:root body:not(:has(.workspace-frame)) main h2:not(.ref-visual *) {
    font-size: var(--fs-h2);
    line-height: 1.2;
    letter-spacing: -0.02em;
}
html:root:root body:not(:has(.workspace-frame)) main h3:not(.ref-visual *) {
    font-size: var(--fs-h3);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Headings break into even lines instead of leaving one word on the last line. */
html:root:root body:not(:has(.workspace-frame)) :is(h1, h2, h3) {
    text-wrap: balance;
}

/* ---- Text ---- */
html:root:root body:not(:has(.workspace-frame)) :is(.ref-hero-copy > p, .public-page-heading > p, .ref-faq-hero p, .auth-description, .auth-content > p:first-of-type) {
    font-size: var(--fs-lead);
    line-height: 1.6;
}

/* ---- Small print: 13px floor (14px for things people tap) ---- */
html:root:root body:not(:has(.workspace-frame))
    :is(
        .plan-trial,
        .ref-popular,
        .plan-topup-trigger,
        .plan-topup p,
        .plan-topup strong,
        .ref-comparison-detail,
        .ref-comparison th,
        .ref-billing button span,
        .cta-banner p,
        .coverage-ledger-heading span,
        .coverage-channel-context,
        .coverage-source-footnote,
        .coverage-source-group small,
        .quick-plan-step,
        .quick-plan-option-name,
        .quick-plan-trial-pill,
        .quick-plan-setup,
        .auth-field-hint,
        .text-xs,
        [class*='text-[10px]'],
        [class*='text-[11px]'],
        [class*='text-[12px]']
    ) {
    font-size: var(--fs-small);
}
html:root:root body:not(:has(.workspace-frame)) :is(.auth-options a, .site-header-actions .bs-button, .site-header-actions .login-link) {
    font-size: var(--fs-ui);
}
