/* ============================================================
   N U R O M A T R I X  V2  —  base.css
   Design tokens · themes (dark + light) · reset · typography ·
   utilities. Palette: charcoal gray + soft lavender gray with a
   rose-gold brand accent (no clichéd gradients). Themes switch
   on <html data-theme="dark|light"> — see main.js toggle.
   ============================================================ */

/* ---------- 1. Design tokens (dark theme = default) ---------- */
:root {
    /* Color · charcoal surfaces */
    --bg-0: #0b0c11;
    --bg-1: #12141b;
    --bg-2: #191c25;
    --bg-3: #232735;
    --surface: rgba(var(--st), 0.045);
    --surface-2: rgba(var(--st), 0.085);
    --surface-3: rgba(var(--st), 0.15);
    --glass: rgba(12, 13, 19, 0.78);
    --chrome: rgba(11, 12, 18, 0.8);
    --scrim: rgba(4, 5, 9, 0.62);
    --scrim-strong: rgba(4, 5, 9, 0.86);

    /* Color · RGB channel tokens */
    --st: 236, 234, 255;
    --lt: 240, 242, 250;

    /* Color · accent channels */
    --em: 139, 123, 240;
    --emL: 201, 190, 255;
    --emD: 106, 88, 228;

    /* Color · lines */
    --line: rgba(var(--lt), 0.09);
    --line-2: rgba(var(--lt), 0.17);
    --line-3: rgba(var(--lt), 0.3);

    /* Color · text */
    --text-1: #f1f2f8;
    --text-2: #c4c8d6;
    --text-3: #8d91a3;
    --text-4: #5a5f71;
    --on-accent: #100f1a;

    /* Solid button tokens (inverted by theme) */
    --solid-bg: #f1f2f8;
    --solid-fg: #13121c;

    /* Color · lavender accent ramp */
    --ember-1: #eae6ff;
    --ember-2: #bcaffc;
    --ember-3: #8b7cf0;
    --ember-4: #6c5ce0;
    --ember-5: #463a9e;
    --accent-grad: linear-gradient(135deg, #c9bdff 0%, #8b7cf0 46%, #6756e4 100%);
    --glow: 0 0 0 1px rgba(var(--em), 0.2), 0 8px 42px -8px rgba(var(--em), 0.5);
    --glow-soft: 0 0 0 1px rgba(var(--em), 0.12), 0 10px 60px -18px rgba(var(--em), 0.4);

    /* Color · rose-gold brand + warm support */
    --rose-1: #f4ddcd;
    --rose-2: #e0ae92;
    --rose-3: #c98b6e;
    --rose-4: #a56448;
    --gold: #e8bd72;

    /* Color · status */
    --ok: #6fd9a3;
    --warn: #e8c066;
    --danger: #f08080;
    --info: #8fb7f2;

    /* Ambient glow strength (used by body::before) */
    --ambient: 0.12;

    /* Type families */
    --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;

    /* Fluid type scale */
    --fs-xs: 0.75rem;
    --fs-sm: 0.84375rem;
    --fs-base: 1rem;
    --fs-md: 1.0625rem;
    --fs-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
    --fs-xl: clamp(1.375rem, 1.15rem + 1.1vw, 2rem);
    --fs-2xl: clamp(1.75rem, 1.3rem + 2.2vw, 3rem);
    --fs-3xl: clamp(2.25rem, 1.5rem + 3.8vw, 4.25rem);
    --fs-4xl: clamp(2.75rem, 1.7rem + 5.4vw, 6rem);

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 3rem;
    --sp-8: 4.5rem;
    --sp-9: 6.5rem;
    --sp-10: 8.5rem;

    /* Radii */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 999px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
    --dur: 0.35s;

    /* Layout */
    --header-h: 76px;
    --container: 1280px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --shadow-card: 0 18px 50px -22px rgba(0, 0, 0, 0.55);
    --shadow-pop: 0 30px 90px -30px rgba(0, 0, 0, 0.8);
    --z-nav: 60;
    --z-drawer: 80;
    --z-overlay: 70;
    --z-toast: 120;
    --z-modal: 110;

    color-scheme: dark;
}

/* ---------- Light theme ---------- */
html[data-theme="light"] {
    --bg-0: #f1f0f6;
    --bg-1: #f6f5fa;
    --bg-2: #e9e7f1;
    --bg-3: #dcd9e8;
    --glass: rgba(255, 255, 255, 0.86);

    --st: 24, 22, 40;
    --lt: 24, 22, 40;

    --text-1: #191a24;
    --text-2: #45485a;
    --text-3: #6d7085;
    --text-4: #9b9ead;
    --on-accent: #f6f5fc;

    --solid-bg: #191a24;
    --solid-fg: #f6f5fc;

    --line: rgba(var(--lt), 0.1);
    --line-2: rgba(var(--lt), 0.2);
    --line-3: rgba(var(--lt), 0.38);

    --ember-1: #4a3f9e;
    --ember-2: #6a58d6;
    --ember-3: #7a69e0;
    --ember-4: #8b7cf0;
    --ember-5: #a99bff;
    --accent-grad: linear-gradient(135deg, #8b7cf0 0%, #7a69e0 55%, #6756e4 100%);
    --glow: 0 0 0 1px rgba(var(--em), 0.22), 0 8px 34px -10px rgba(var(--em), 0.45);
    --glow-soft: 0 0 0 1px rgba(var(--em), 0.12), 0 10px 44px -18px rgba(var(--em), 0.32);

    --rose-1: #7c4a33;
    --rose-2: #9c5f42;
    --rose-3: #b2714f;
    --rose-4: #c98b6e;
    --gold: #a87b2f;

    --shadow-card: 0 14px 44px -24px rgba(24, 20, 46, 0.28);
    --shadow-pop: 0 30px 80px -30px rgba(24, 20, 46, 0.35);

    --ambient: 0.1;
    color-scheme: light;
}

/* Theme transitions (skip for reduced motion) */
html.theming *,
html.theming *::before,
html.theming *::after {
    transition: background-color 0.35s var(--ease-io), border-color 0.35s var(--ease-io),
        color 0.2s var(--ease-io), fill 0.3s var(--ease-io) !important;
}

/* ---------- 2. Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--text-1);
    background-color: var(--bg-0);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background-color 0.35s var(--ease-io), color 0.35s var(--ease-io);
    position: relative;
    min-height: 100vh;
}

/* Full-site background video */
.site-bg-video {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -3;
    opacity: 0.82;
    pointer-events: none;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Dark overlay for readability */
.site-bg-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: linear-gradient(180deg,
            rgba(11, 12, 17, 0.25) 0%,
            rgba(11, 12, 17, 0.4) 50%,
            rgba(11, 12, 17, 0.55) 100%);
    pointer-events: none;
    transform: translateZ(0);
}

/* Light theme adjustments */
html[data-theme="light"] .site-bg-video {
    opacity: 0.06;
}

html[data-theme="light"] .site-bg-overlay {
    background: linear-gradient(180deg,
            rgba(241, 240, 246, 0.85) 0%,
            rgba(241, 240, 246, 0.92) 50%,
            rgba(241, 240, 246, 0.98) 100%);
}

/* Ambient page background — charcoal stage + lavender bloom + grain */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    opacity: 0.6;
    background:
        radial-gradient(1200px 720px at 80% -12%, rgba(var(--em), calc(var(--ambient) * 1.3)), transparent 62%),
        radial-gradient(900px 620px at -8% 112%, rgba(var(--emD), calc(var(--ambient) * 1.1)), transparent 58%),
        linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
    pointer-events: none;
    transform: translateZ(0);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.3;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
    transform: translateZ(0);
}

html[data-theme="light"] body::after {
    opacity: 0.22;
}

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

img {
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--ember-3);
    outline-offset: 2px;
    border-radius: 4px;
}

ul[role="list"],
ol[role="list"] {
    list-style: none;
    padding: 0;
}

table {
    border-collapse: collapse;
    width: 100%;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: var(--sp-7) 0;
}

::selection {
    background: rgba(var(--em), 0.45);
    color: var(--text-1);
}

::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

::-webkit-scrollbar-track {
    background: var(--bg-0);
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-3) 40%, transparent);
    border-radius: 8px;
    border: 2px solid var(--bg-0);
}

::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--text-3) 65%, transparent);
}

html[data-theme="light"] ::selection {
    background: rgba(var(--em), 0.3);
}

/* ---------- 3. Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.01em;
    text-wrap: balance;
    margin: 0;
}

h1 {
    font-size: var(--fs-3xl);
    font-weight: 500;
}

h2 {
    font-size: var(--fs-2xl);
    font-weight: 500;
}

h3 {
    font-size: var(--fs-xl);
    font-weight: 500;
}

h4 {
    font-size: var(--fs-lg);
    font-weight: 600;
}

h5 {
    font-size: var(--fs-md);
    font-weight: 600;
}

p {
    max-width: 62ch;
}

strong {
    font-weight: 650;
}

.text-serif {
    font-family: var(--font-serif);
}

.text-gradient {
    background: linear-gradient(105deg, var(--text-1) 0%, var(--ember-2) 55%, var(--rose-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead {
    font-size: var(--fs-lg);
    color: var(--text-2);
    line-height: 1.55;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ember-3);
}

.eyebrow::before {
    content: "";
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--ember-3), var(--rose-3));
}

.muted {
    color: var(--text-3);
}

.tiny {
    font-size: var(--fs-sm);
}

.dim {
    color: var(--text-4);
}

/* ---------- 4. Layout primitives ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.container-narrow {
    width: 100%;
    max-width: 880px;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section {
    padding-block: var(--sp-8);
    position: relative;
}

.section--tight {
    padding-block: var(--sp-5);
}

.section--sm {
    padding-block: var(--sp-5) var(--sp-6);
}

.section-head {
    max-width: 740px;
    margin-bottom: var(--sp-6);
    display: grid;
    gap: var(--sp-3);
}

.section-head--center {
    margin-inline: auto;
    text-align: center;
}

.section-head--center .eyebrow {
    justify-content: center;
}

.section-head--center .eyebrow::after {
    content: "";
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--ember-3), var(--rose-3));
}

.section-head .lead {
    margin-top: var(--sp-1);
}

.stack {
    display: grid;
    gap: var(--sp-4);
}

.stack--sm {
    gap: var(--sp-2);
}

.row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.row--between {
    justify-content: space-between;
}

.grid {
    display: grid;
    gap: var(--sp-5);
}

.grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid--center {
    align-items: center;
}

.divider {
    height: 1px;
    background: var(--line);
    border: 0;
}

/* ---------- 5. Utilities ---------- */
.hidden,
[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.center {
    text-align: center;
}

.mt-2 {
    margin-top: var(--sp-2);
}

.mt-3 {
    margin-top: var(--sp-3);
}

.mt-4 {
    margin-top: var(--sp-4);
}

.mt-5 {
    margin-top: var(--sp-5);
}

.mt-6 {
    margin-top: var(--sp-6);
}

.mt-7 {
    margin-top: var(--sp-7);
}

.mb-4 {
    margin-bottom: var(--sp-4);
}

.mb-6 {
    margin-bottom: var(--sp-6);
}

.w-full {
    width: 100%;
}

.nowrap {
    white-space: nowrap;
}

.link {
    color: var(--ember-3);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--ember-3) 40%, transparent);
    transition: color var(--dur) var(--ease-io), text-decoration-color var(--dur) var(--ease-io);
}

.link:hover {
    color: var(--ember-2);
    text-decoration-color: var(--ember-2);
}

.skeleton {
    border-radius: var(--r-md);
    background: linear-gradient(100deg, rgba(var(--lt), 0.05) 40%, rgba(var(--lt), 0.12) 50%, rgba(var(--lt), 0.05) 60%);
    background-size: 200% 100%;
    animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

/* Reveal-on-scroll (guarded by html.js — visible without JS) */
.js [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
    will-change: opacity, transform;
}

.js [data-reveal].is-in {
    opacity: 1;
    transform: none;
    will-change: auto;
}

.js [data-reveal][data-reveal-delay="1"] {
    transition-delay: 0.08s;
}

.js [data-reveal][data-reveal-delay="2"] {
    transition-delay: 0.16s;
}

.js [data-reveal][data-reveal-delay="3"] {
    transition-delay: 0.24s;
}

.js [data-reveal][data-reveal-delay="4"] {
    transition-delay: 0.32s;
}

@media (prefers-reduced-motion: reduce) {
    .js [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}