/* ================================================
   VELOCE — Shared Design System
   ================================================ */

@view-transition { navigation: auto; }

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scrollbar-width: none;
}
html::-webkit-scrollbar { display: none; }

:root {
    /* Brand Colors */
    --ferrari:  #CF1020;
    --mclaren:  #FF8000;
    --bugatti:  #0A0A0A;
    --pagani-gold: #C5A572;
    --porsche:  #C00000;
    --aston:    #037A68;

    /* Neutrals */
    --black:    #0A0A0A;
    --white:    #FAFAF8;
    --gray-100: #F3F2EE;
    --gray-200: #E5E4E0;
    --gray-400: #999999;
    --gray-500: #6B6B6B;
    --gray-900: #1A1A1A;

    /* Fonts */
    --ff-display: 'Syne', sans-serif;
    --ff-serif:   'Cormorant Garamond', serif;
    --ff-body:    'Inter', sans-serif;

    /* Fluid Type — reduced to fit properly */
    --fs-hero:    clamp(2.5rem, 7vw, 6rem);
    --fs-section: clamp(1.6rem, 3.5vw, 3rem);
    --fs-sub:     clamp(1.2rem, 2vw, 1.8rem);
    --fs-body:    clamp(0.85rem, 0.95vw, 1rem);
    --fs-small:   clamp(0.65rem, 0.75vw, 0.75rem);

    /* Spacing */
    --pad-section: clamp(5rem, 12vh, 10rem);
    --pad-container: clamp(1.5rem, 4vw, 5rem);

    /* Easing — Signature curve from Lando Norris SOTD (8.18/10) */
    --ease-primary: cubic-bezier(0.65, 0.05, 0, 1);
    --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth:  cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-cinema:  cubic-bezier(0.65, 0.05, 0, 1);
    --dur-cinema:   0.75s;
}

body {
    font-family: var(--ff-body);
    font-size: var(--fs-body);
    line-height: 1.6;
    overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ── Grain ── */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    background-repeat: repeat;
    background-size: 256px;
    mix-blend-mode: multiply;
}

/* ── Nav ── */
.nav {
    view-transition-name: site-nav;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(1rem, 2vh, 1.5rem) var(--pad-container);
    transition: background 0.5s var(--ease-smooth), box-shadow 0.5s var(--ease-smooth);
}

.nav--scrolled {
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

/* Dark nav variant for dark-bg pages */
.nav--dark.nav--scrolled {
    background: rgba(10, 10, 10, 0.92);
    box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.nav__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav__logo {
    font-family: var(--ff-display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav__links {
    display: flex;
    gap: clamp(1.25rem, 2.5vw, 2.5rem);
}

.nav__link {
    font-family: var(--ff-body);
    font-size: var(--fs-small);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.6;
    position: relative;
    transition: opacity 0.3s;
}

.nav__link:hover { opacity: 1; }

.nav__link::after {
    content: '';
    position: absolute;
    bottom: -3px; left: 0;
    width: 0; height: 1.5px;
    background: currentColor;
    transition: width 0.5s var(--ease-primary);
}

.nav__link:hover::after,
.nav__link--active::after { width: 100%; }
.nav__link--active { opacity: 1; }

/* ── Footer ── */
.footer {
    view-transition-name: site-footer;
    padding: 2rem var(--pad-container);
    border-top: 1px solid rgba(128,128,128,0.1);
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer__copy {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    opacity: 0.4;
}

.footer__craft {
    font-family: var(--ff-serif);
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.4;
}

@media (max-width: 640px) {
    .footer__inner { flex-direction: column; gap: 0.4rem; text-align: center; }
}

/* ── 3D Parallax Driver/Car System ── */
.parallax-3d {
    position: relative;
    perspective: 1000px;
    overflow: hidden;
}

.parallax-3d__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    will-change: transform;
}

.parallax-3d__fg {
    position: relative;
    z-index: 1;
    will-change: transform;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.3));
}

.parallax-3d__fg img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ── View Transitions ── */
html::view-transition-old(site-nav),
html::view-transition-new(site-nav) { animation: none; }

html::view-transition-old(page-hero) {
    animation: vt-out 0.4s var(--ease-smooth) forwards;
}
html::view-transition-new(page-hero) {
    animation: vt-in 0.5s var(--ease-smooth) forwards;
}

@keyframes vt-out { to { opacity: 0; transform: translateY(-20px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(20px); } }

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