/* ============================================
   BASE RESET - CSS Reset and Normalization
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', Oxygen, Ubuntu, Cantarell, sans-serif);
    color: var(--text-primary);
    background: var(--bg-app);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    /* A reset zeroes spacing — app shells fill the viewport and own their own
       insets. The 20px here gave every real app an unwanted outer gap; tester
       pages that want breathing room opt in via `body.tester-page` below. */
    padding: 0;
}

/* Tester-specific body overrides */
body.tester-page {
    padding: 20px;
}

/* Iframe styling for embedded sections */
iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Scrollbars ────────────────────────────────────────────────────────────
   The resting thumb MUST visibly contrast with the track. The previous thumb
   used --border-medium (~5% black on light / 5% white on dark) — effectively
   invisible, so scrolling looked broken. We derive a bold thumb + faint track
   from --text-primary (always near-black on light themes, near-white on dark)
   via color-mix, so both stay legible in every theme with no per-theme
   overrides. Chromium/Edge/Safari are styled through ::-webkit-scrollbar
   (rounded, inset "floating" thumb over a faint track). Firefox has no
   ::-webkit-scrollbar and uses the standard scrollbar-width/-color — but those
   MUST be scoped to Firefox: if Chromium sees them it switches to the standard
   scrollbar path and ignores the richer ::-webkit rules (including our width,
   which is why the gutter came out thin). */
:root {
    --scrollbar-size: 12px;
    --scrollbar-track: color-mix(in srgb, var(--text-primary, #1a1a1a) 7%, transparent);
    --scrollbar-thumb: color-mix(in srgb, var(--text-primary, #1a1a1a) 38%, transparent);
    --scrollbar-thumb-hover: color-mix(in srgb, var(--text-primary, #1a1a1a) 60%, transparent);
}

/* Chromium / Edge / Safari */
::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
    /* Transparent border + padding-box clip insets the thumb into a floating bar. */
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox only — `not selector(::-webkit-scrollbar)` is false in Chromium /
   Safari, so they keep the richer pseudo-element styling above. */
@supports (scrollbar-width: thin) and (not selector(::-webkit-scrollbar)) {
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    }
}

/* Selection styling */
::selection {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

::-moz-selection {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

