/*
 * Theme "elegance" — design system (spec file 05).
 * Premium chauffeur service: typography-led, calm, spacious, precise.
 * Neutrals carry the design; the driver's primary color signs it
 * (kickers, thin rules, CTAs, hover accents — never flooded areas).
 */

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */

body {
    /* Driver-picked, injected inline as --primary-color (any hue) */
    --primary: var(--primary-color, #153F75);

    /* Derived primary scale */
    --primary-strong: color-mix(in oklab, var(--primary), black 28%);
    --primary-soft: color-mix(in oklab, var(--primary), white 38%);
    --primary-faint: color-mix(in oklab, var(--primary), var(--bg) 90%);

    /* Readable text on primary: near-white on dark primaries, near-black
       on light ones (relative-color lightness threshold trick) */
    --on-primary: #ffffff;
    --on-primary: oklch(from var(--primary) clamp(0.05, (0.66 - l) * 999, 0.99) 0.01 h);

    /* Accent = primary adjusted for text-sized contrast on the page bg */
    --accent: color-mix(in oklab, var(--primary), black 18%);

    /* Light mode: warm off-white base */
    --bg: #faf8f4;
    --bg-elevated: #ffffff;
    --bg-sunken: #f1ede5;
    --text: #1a1a1e;
    --text-muted: #5d5b56;
    --border: #e3ddd1;
    --border-strong: #c9c2b3;
    --header-bg: color-mix(in srgb, #faf8f4 78%, transparent);
    --shadow: 0 1px 2px rgb(26 26 30 / 0.05), 0 12px 32px -12px rgb(26 26 30 / 0.14);

    /* Footer is dark in both modes */
    --footer-bg: #131316;
    --footer-text: #b9b5ac;
    --footer-heading: #f2efe9;
    --footer-border: #26262c;

    --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --font-body: "Inter Variable", Inter, ui-sans-serif, system-ui, sans-serif;

    --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
    --content-width: 72rem;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

body[data-dark-mode="true"] {
    /* Dark mode: near-black base, desaturated accents (saturated primaries
       glow on dark — lift lightness instead of reusing light-mode values) */
    --bg: #101013;
    --bg-elevated: #17171c;
    --bg-sunken: #0b0b0e;
    --text: #f2efe9;
    --text-muted: #a09d95;
    --border: #26262c;
    --border-strong: #3a3a42;
    --header-bg: color-mix(in srgb, #101013 72%, transparent);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -16px rgb(0 0 0 / 0.55);

    --primary-faint: color-mix(in oklab, var(--primary), var(--bg) 88%);
    --accent: color-mix(in oklab, var(--primary), white 28%);
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: 0.005em;
    text-wrap: balance;
    margin: 0 0 0.6em;
}

h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }

p {
    margin: 0 0 1em;
    max-width: 70ch;
}

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

p a, address a, .legal-page a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

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

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

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

/* Scrollbar — visible in both modes.
   IMPORTANT: Chromium ignores CSS custom properties (var()) inside
   ::-webkit-scrollbar pseudo-elements, so the thumb colors below are LITERAL
   (using a token there silently falls back to the default grey bar — which is
   exactly why earlier attempts only showed a generic scrollbar). color-scheme
   pins the native fallback + form controls to the site's own light/dark mode. */
:root { color-scheme: light; }
:root:has(body[data-dark-mode="true"]) { color-scheme: dark; }

/* Firefox (scrollbar-color does accept var(), but literals keep both engines in sync) */
html { scrollbar-width: thin; scrollbar-color: rgb(26 26 30 / 0.32) transparent; }
html:has(body[data-dark-mode="true"]) { scrollbar-color: rgb(255 255 255 / 0.24) transparent; }

/* WebKit / Chromium — literal colors only */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: rgb(26 26 30 / 0.32);
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgb(26 26 30 / 0.5); }

:root:has(body[data-dark-mode="true"])::-webkit-scrollbar-thumb,
:root:has(body[data-dark-mode="true"]) ::-webkit-scrollbar-thumb {
    background-color: rgb(255 255 255 / 0.24);
}
:root:has(body[data-dark-mode="true"])::-webkit-scrollbar-thumb:hover,
:root:has(body[data-dark-mode="true"]) ::-webkit-scrollbar-thumb:hover {
    background-color: rgb(255 255 255 / 0.42);
}

/* ------------------------------------------------------------------ */
/* Signature pieces                                                    */
/* ------------------------------------------------------------------ */

/* Kicker (SUPER_TITLE): small-caps, letterspaced, in the driver's color */
.super-title {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.super-title::before {
    content: "";
    width: 2.2rem;
    height: 1px;
    background-color: var(--accent);
    flex: none;
}

/* CTAs */
.cta,
button.cta {
    display: inline-block;
    padding: 0.85rem 1.9rem;
    background-color: var(--primary);
    color: var(--on-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--primary);
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.25s var(--ease-out-soft), border-color 0.25s var(--ease-out-soft), transform 0.25s var(--ease-out-soft);
}

.cta:hover,
button.cta:hover {
    background-color: var(--primary-strong);
    border-color: var(--primary-strong);
    transform: translateY(-2px);
}

.cta-ghost {
    display: inline-block;
    padding: 0.85rem 1.9rem;
    background-color: transparent;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    transition: border-color 0.25s var(--ease-out-soft), color 0.25s var(--ease-out-soft);
}

.cta-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Centered "view all" CTA under home-page teaser grids */
.section-cta {
    margin-top: clamp(2rem, 5vw, 3.2rem);
    text-align: center;
}

/* Underline sweep on inline links (nav, cards) */
.link-sweep {
    position: relative;
    padding-bottom: 2px;
}

.link-sweep::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s var(--ease-out-soft);
}

.link-sweep:hover::after,
.link-sweep[aria-current]::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Hairline section dividers (theme setting) */
body[data-dividers="true"] .home-section + .home-section {
    border-top: 1px solid var(--border);
}

/* Layout containers */
.container {
    max-width: var(--content-width);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.home-section,
.page-section {
    padding-block: clamp(3.5rem, 9vw, 7.5rem);
}

/* ------------------------------------------------------------------ */
/* Photo treatments (driver photos are unpredictable)                  */
/* ------------------------------------------------------------------ */

.photo-frame {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    background-color: var(--bg-sunken);
}

.photo-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Soft treatment: subtle grain + vignette for cohesion (theme setting) */
body[data-photo-treatment="true"] .photo-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 90px rgb(10 10 12 / 0.22);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* Gradient scrim for text-on-image legibility */
.scrim::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgb(8 8 10 / 0.78) 0%, rgb(8 8 10 / 0.38) 45%, rgb(8 8 10 / 0.18) 100%);
    pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Motion (CSS-first, reduced-motion respected)                        */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {

    /* Scroll-reveal: hidden ONLY when JS is present (html.js set in <head>);
       the RevealObserver island adds .is-visible */
    html.js .reveal {
        opacity: 0;
        transform: translateY(14px);
    }

    html.js .reveal.is-visible {
        opacity: 1;
        transform: none;
        transition: opacity 0.65s var(--ease-out-soft), transform 0.65s var(--ease-out-soft);
        transition-delay: calc(var(--reveal-index, 0) * 80ms);
    }

    /* Hero: slow Ken Burns drift (≥ 20s) */
    .kenburns img {
        animation: elegance-kenburns 26s var(--ease-out-soft) infinite alternate;
    }

    @keyframes elegance-kenburns {
        from { transform: scale(1) translateY(0); }
        to { transform: scale(1.08) translateY(-1.5%); }
    }

    /* Hero title: masked line-by-line slide-up on load */
    .masked-line {
        display: block;
        overflow: hidden;
    }

    .masked-line > span {
        display: block;
        transform: translateY(110%);
        animation: elegance-line-reveal 0.9s var(--ease-out-soft) forwards;
        animation-delay: calc(var(--line-index, 0) * 140ms + 100ms);
    }

    @keyframes elegance-line-reveal {
        to { transform: translateY(0); }
    }

    /* Thin scroll-progress accent line under the sticky header */
    @supports (animation-timeline: scroll()) {
        .scroll-progress {
            position: absolute;
            left: 0;
            bottom: -1px;
            height: 2px;
            width: 100%;
            background-color: var(--accent);
            transform-origin: left;
            transform: scaleX(0);
            animation: elegance-scroll-progress linear forwards;
            animation-timeline: scroll(root);
        }

        @keyframes elegance-scroll-progress {
            to { transform: scaleX(1); }
        }
    }
}

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

    .scroll-progress {
        display: none;
    }
}

/* ------------------------------------------------------------------ */
/* Shared component skins                                              */
/* ------------------------------------------------------------------ */

/* Contact form */
.contact-form p {
    margin-bottom: 1.1rem;
}

.contact-form label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.contact-form input,
.contact-form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.45rem;
    padding: 0.8rem 0.9rem;
    font: inherit;
    color: var(--text);
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    transition: border-color 0.2s var(--ease-out-soft);
}

.contact-form textarea {
    /* Default height = min height, so the field can only be resized upward */
    height: 8rem;
    min-height: 8rem;
    max-height: 22rem;
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.contact-form button[type="submit"] {
    padding: 0.85rem 1.9rem;
    background-color: var(--primary);
    color: var(--on-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--primary);
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.25s var(--ease-out-soft);
}

.contact-form button[type="submit"]:hover {
    background-color: var(--primary-strong);
}

.contact-form button[type="submit"]:disabled {
    opacity: 0.55;
    cursor: default;
}

.contact-form-status:not(:empty) {
    padding: 0.7rem 0.9rem;
    border-left: 2px solid var(--accent);
    background-color: var(--primary-faint);
    font-size: 0.95rem;
}

/* Map island */
.map-island {
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.map-island-placeholder {
    background-color: var(--bg-sunken);
    border: 0;
    color: var(--text);
    font: inherit;
}

.map-island-placeholder span {
    font-family: var(--font-display);
    font-size: 1.4rem;
}

.map-island-placeholder small {
    color: var(--text-muted);
}

.map-island-container {
    height: 420px;
}

/* Gallery + lightbox */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
    gap: 0.6rem;
}

.gallery-item {
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    overflow: hidden;
    border-radius: 2px;
}

.gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform 0.5s var(--ease-out-soft);
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* Full-viewport dialog so the image is reliably centered both axes
   (the default modal centering doesn't, with a shrink-to-fit dialog) */
.gallery-lightbox {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
}

.gallery-lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox::backdrop {
    background: rgb(8 8 10 / 0.88);
}

.gallery-lightbox img {
    max-width: 92vw;
    max-height: 86vh;
    object-fit: contain;
}

.gallery-lightbox button {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 2.8rem;
    height: 2.8rem;
    border: 1px solid rgb(255 255 255 / 0.3);
    border-radius: 50%;
    background: rgb(8 8 10 / 0.5);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-lightbox .gallery-lightbox-previous { left: 1rem; }
.gallery-lightbox .gallery-lightbox-next { right: 1rem; }

.gallery-lightbox .gallery-lightbox-close {
    top: 1.5rem;
    right: 1rem;
    transform: none;
}

/* Booking iframe */
.booking-iframe {
    border: 1px solid var(--border);
    border-radius: 2px;
}

/* Consent banner */
.consent-banner {
    position: fixed;
    inset-inline: 1rem;
    bottom: 1rem;
    z-index: 60;
    max-width: 30rem;
    margin-inline: auto;
    padding: 1.1rem 1.3rem;
    background-color: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
    font-size: 0.92rem;
}

.consent-banner p {
    margin: 0 0 0.9rem;
}

.consent-banner a {
    color: var(--accent);
    text-decoration: underline;
}

.consent-banner-actions {
    display: flex;
    gap: 0.7rem;
}

/* Equal-weight Accept / Refuse (CNIL) */
.consent-banner-actions button {
    flex: 1;
    padding: 0.6rem 1rem;
    font: inherit;
    font-weight: 600;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    background-color: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.consent-banner-actions button:hover {
    border-color: var(--accent);
}
