/* Page-level: tokens, reset, base, shared primitives (typography helpers, layout, buttons, progress bar, fade-up animations) */

/* ============================================================
   Design tokens — sourced from tool-redesign/DESIGN.md
   ============================================================ */
:root {
    /* Surfaces */
    --surface: #f8f9ff;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #eff4ff;
    --surface-container: #e5eeff;
    --surface-container-high: #dce9ff;
    --surface-variant: #d3e4fe;

    /* Ink */
    --on-surface: #0b1c30;
    --on-surface-variant: #45464d;
    --outline: #76777d;
    --outline-variant: #c6c6cd;

    /* Brand */
    --primary: #000000;
    --on-primary: #ffffff;
    --primary-container: #131b2e;
    --on-primary-container: #7c839b;

    --secondary: #ff4e41;
    --on-secondary: #ffffff;
    --secondary-container: #fd56a7;

    --tertiary-container: #07006c;
    --on-tertiary-container: #7073ff;

    --inverse-surface: #213145;
    --inverse-on-surface: #eaf1ff;

    --background: #f8f9ff;
    --surface-bright: #f8f9ff;
    --on-background: #0b1c30;
    --error: #ba1a1a;

    /* Accent chip palette (DESIGN.md: icons in 10% tint of hue) */
    --hue-blue: #2563eb;
    --hue-indigo: #4f46e5;
    --hue-purple: #9333ea;
    --hue-orange: #ea580c;
    --hue-teal: #0d9488;
    --hue-rose: #e11d48;
    --hue-green: #10b981;
    --hue-fuchsia: #d946ef;

    /* Gradients & shadows */
    --gradient-hero: linear-gradient(180deg, rgba(241, 228, 255, 0.8) 0%, rgba(255, 255, 255, 0) 100%);
    --gradient-accent: linear-gradient(90deg, #FF4E41 0%, #CC6AF9 100%);
    --shadow-ambient: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-ambient-hover: 0 18px 40px rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 2px 6px rgba(15, 23, 42, 0.05);

    /* Radii */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Spacing & layout */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;
    --container-max: 1280px;
    --gutter: 24px;
    --margin-mobile: 16px;
    --section-pad: 96px;

    /* Typography */
    --font-primary: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* ============================================================
   Reset & base
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--on-surface);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-family: var(--font-primary);
    color: var(--on-surface);
}

p {
    margin: 0;
}

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

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input {
    font-family: inherit;
}

[hidden] {
    display: none !important;
}

/* ============================================================
   Typography helpers (DESIGN.md typography scale)
   ============================================================ */
.display-lg {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.display-md {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.headline-sm {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.body-lg {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
}

.body-md {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.label-bold {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.label-sm {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

.text-muted {
    color: var(--on-surface-variant);
}

.gradient-text {
    background-image: var(--gradient-accent);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ============================================================
   Layout primitives
   ============================================================ */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

.section {
    padding-top: var(--section-pad);
    padding-bottom: var(--section-pad);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

.btn--ghost {
    background: transparent;
    color: var(--on-surface);
    border-color: var(--outline-variant);
}

.btn--ghost:hover {
    background: var(--surface-container-low);
}

.btn--primary {
    background: var(--primary);
    color: var(--on-primary);
}

.btn--primary:hover {
    opacity: 0.9;
}

.btn--lg {
    padding: 16px 32px;
    font-size: 16px;
    box-shadow: var(--shadow-soft);
}

.btn--white {
    background: #ffffff;
    color: var(--primary);
    padding: 16px 24px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
    width: 100%;
}

.btn--white:hover {
    transform: scale(1.03);
}

.btn--cta {
    background: var(--secondary);
    color: #ffffff;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 14px;
    border-radius: var(--radius);
}

.btn--cta:hover {
    opacity: 0.9;
}

.btn--download-primary,
.btn--download-secondary {
    width: 100%;
    padding: 16px 24px;
    font-weight: 700;
    font-size: 15px;
    border-radius: var(--radius);
}

.btn--download-primary {
    background: var(--primary-container);
    color: #ffffff;
}

.btn--download-primary:hover {
    opacity: 0.92;
}

.btn--download-secondary {
    background: #ffffff;
    color: var(--primary-container);
    border: 1.5px solid var(--primary-container);
}

.btn--download-secondary:hover {
    background: var(--surface-container-low);
}

/* ============================================================
   Z-index scale (centralized so layers stack predictably)
   ============================================================ */
:root {
    --z-loading: 100;
    --z-modal-backdrop: 190;
    --z-modal: 200;
    --shadow-modal: 0 8px 32px -8px rgba(15, 23, 42, 0.18);
}

/* ============================================================
   Progress bar (shared by loading takeover and survey modal)
   ============================================================ */
.progress-bar {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--surface-variant);
    overflow: hidden;
}

.progress-bar--lg {
    height: 8px;
}

.progress-bar__fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.25s ease-out;
}

.progress-bar__fill--loading {
    background: linear-gradient(90deg, #312e81 0%, #e11d48 100%);
}

.progress-bar__fill--secondary {
    background: var(--secondary);
}

/* ============================================================
   Row-level fade-up stagger
   ============================================================ */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Any container with .stagger-children cascades its direct children in. */
.stagger-children>* {
    animation: fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stagger-children>*:nth-child(1) {
    animation-delay: 40ms;
}

.stagger-children>*:nth-child(2) {
    animation-delay: 120ms;
}

.stagger-children>*:nth-child(3) {
    animation-delay: 200ms;
}

.stagger-children>*:nth-child(4) {
    animation-delay: 280ms;
}

.stagger-children>*:nth-child(5) {
    animation-delay: 360ms;
}

.stagger-children>*:nth-child(6) {
    animation-delay: 440ms;
}

@media (prefers-reduced-motion: reduce) {
    .stagger-children>* {
        animation: none !important;
    }
}

/* ============================================================
   Responsive — page-level token overrides
   ============================================================ */
@media (max-width: 720px) {
    :root {
        --section-pad: 64px;
        --gutter: 16px;
    }
}