/* =============================================================================
   BodyPilot · Reset + base typography
   Mobile-first. iOS safe-area aware.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, dl, dd {
    margin: 0;
    padding: 0;
}

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

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--surface-0);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-weight: var(--weight-regular);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    overscroll-behavior: none;
}

img, svg { display: block; max-width: 100%; }

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    /* iOS Safari otherwise paints buttons as native white pills and
       overrides our `color` with the UA `buttontext` keyword, which
       makes pills like the active tab unreadable (white-on-white). */
    -webkit-appearance: none;
    appearance: none;
}

a { color: inherit; text-decoration: none; }

input, select, textarea {
    font: inherit;
    color: inherit;
    background: transparent;
    border: 0;
    outline: 0;
}

input:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible {
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* ── Headings — only two weights ─────────────────────────────── */
h1, h2, h3, h4, h5, h6 { font-weight: var(--weight-medium); line-height: var(--leading-tight); }
h1 { font-size: var(--text-hero);   letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-large);  letter-spacing: var(--tracking-normal); }
h3 { font-size: var(--text-medium); letter-spacing: var(--tracking-normal); }

p { line-height: var(--leading-normal); }

/* ── ALL-CAPS micro labels ───────────────────────────────────── */
.label {
    font-size: var(--text-label);
    letter-spacing: var(--tracking-uppercase);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: var(--weight-medium);
}

/* ── Tabular-nums helper ─────────────────────────────────────── */
.tabular { font-variant-numeric: tabular-nums; }

/* ── Container / viewport ────────────────────────────────────── */
/* On mobile we tighten the side padding (5→4) to claw back a bit of width
   for tabular content. Bottom padding keeps the final cards visible above
   the iOS Safari toolbar; safe-area-inset-bottom is 0 outside standalone PWA
   so the max() keeps non-PWA users covered too. */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-5);
    padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
    .container { max-width: 480px; padding-left: var(--space-8); padding-right: var(--space-8); }
}
@media (min-width: 1024px) {
    .container { max-width: 520px; }
}

/* ── Skeleton (loading) ──────────────────────────────────────── */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-2) 0%,
        var(--surface-3) 50%,
        var(--surface-2) 100%
    );
    background-size: 200% 100%;
    animation: bp-skeleton 1.6s linear infinite;
    border-radius: var(--radius-md);
}
@keyframes bp-skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Hairline divider helper ─────────────────────────────────── */
.divider-subtle { height: 1px; background: var(--divider-subtle); }
.divider-strong { height: 1px; background: var(--divider-strong); }
