/* ========================================
   BASE STYLES
   Reset, design tokens, typography, and base elements
   Consumed by: all pages; module/sandbox/keywords override sections as needed.
   ======================================== */

/* MARK: - Design tokens (UCSF-inspired gradient, dark canvas, light nav chips) */
:root {
    /* Page gradient: lighter UCSF-family blue at top, deeper navy at bottom */
    --color-bg-top: #0d4a73;
    --color-bg-bottom: #021526;
    --color-page-gradient: linear-gradient(180deg, var(--color-bg-top) 0%, var(--color-bg-bottom) 100%);

    /* Text on gradient */
    --color-text-primary: #f8fafc;
    --color-text-muted: rgba(248, 250, 252, 0.78);
    --color-text-subtle: rgba(248, 250, 252, 0.62);

    /* Links: light blue on dark for WCAG contrast */
    --color-link: #93c5fd;
    --color-link-hover: #bfdbfe;

    /* Text on light surfaces (cards, nav, bubbles) */
    --color-text-inverse: #0f172a;
    --color-text-inverse-muted: #475569;

    /* Accent (UCSF digital / brand-adjacent) */
    --color-accent: #0071ad;
    --color-accent-deep: #052049;

    /* Main column width: shared by .wireframe-container and .header so edges align */
    --layout-max-width: 1200px;
    /* Outer viewport inset (left/right): same for fixed nav and main shell */
    --layout-gutter: clamp(16px, 4vw, 32px);
    /* Inner horizontal inset from the main column edge: sections, .header inner, page-header bar, footer, etc.
       Matches .header padding-inline so logo/nav line up with body copy on wide viewports. */
    --section-padding-x: clamp(1rem, 4vw, 5rem);

    /* Floating chrome */
    --radius-floating: 16px;
    --radius-panel: 12px;
    --shadow-floating: 0 12px 40px rgba(0, 0, 0, 0.28);
    --shadow-floating-strong: 0 16px 48px rgba(0, 0, 0, 0.38);

    /* Fixed floating header layout (used by layout.css + components.css).
       Height matches logo row (44px) + vertical padding (32px) + small buffer.
       Extra slack avoids first paint obscuring content under the bar. */
    --header-float-gap: 20px;
    --header-height-est: 80px;
    --site-header-offset: calc(var(--header-float-gap) + var(--header-height-est) + 16px);
}

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

/* Reserves scrollbar space so modal open (overflow:hidden) does not cause layout shift */
html {
    scrollbar-gutter: stable;
    background: var(--color-bg-bottom);
    min-height: 100%;
}

/* Base Typography */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    padding: 0;
    color: var(--color-text-primary);
    line-height: 1.6;
    background: var(--color-page-gradient);
    background-attachment: fixed;
}

/* Headings: light text on dark page canvas */
h1, h2, h3, h4, h5, h6 {
    font-weight: bold;
    line-height: 1.2;
    color: var(--color-text-primary);
}

h1 {
    font-size: 2.5em;
}

h2 {
    font-size: 2em;
}

h3 {
    font-size: 1.5em;
}

/* Paragraphs */
p {
    margin-bottom: 1em;
}

/* Links */
a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Lists */
ul, ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
}

/* MARK: - Focus (keyboard visibility on dark background) */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 3px;
}

/* MARK: - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
