/*
 * home.css — effets exclusivement utilisés sur la home page
 *
 * Chargé UNIQUEMENT dans home.html via {% block extra_head %}.
 * Composants ici = jamais utilisés ailleurs.
 *
 * Contenu :
 *   - .hero-display : H1 Fraunces 900 wonk italic massif
 *   - .hero-grid-asym : grid 60/40 hero asymétrique
 *   - .studio-monitor : bloc bordeaux dashboard "studio monitor"
 *   - .scanline / .heartbeat / .kpi-trend : effets vivants du monitor
 *   - .hero-blob-* : gradients flous décoratifs (parallax curseur)
 *   - .magnetic : attraction du bouton vers le curseur
 *   - .card-glow : radial-gradient qui suit le curseur dans une card
 *   - .reveal / .reveal-in : fade-up au scroll (IntersectionObserver)
 *   - .svg-path-progress : path SVG qui se dessine au scroll
 *   - .marquee-track : bandeau infini techs
 * Note : le curseur custom (.cursor-dot) est désormais global,
 *        défini dans css/cursor.css et chargé via base.html.
 */


/* ============================================================
 * HERO DISPLAY — Fraunces medium (500) éditorial sobre
 * ============================================================ */
.hero-display {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2.75rem, 7vw, 6rem);
    line-height: 1.02;
    letter-spacing: -0.015em;
    color: #13234f; /* secondary-900 — bleu marine pour les mots non-italiques */
}

.hero-display em {
    font-style: italic;
    font-weight: 500;
    color: #5a1224;
    display: inline-block;
}


/* ============================================================
 * HERO GRID ASYMÉTRIQUE — 55% texte / 45% wireframe
 * ============================================================ */
.hero-grid-asym {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 56px;
    align-items: center;
}

@media (max-width: 1024px) {
    .hero-grid-asym {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}


/* ============================================================
 * WIREFRAME SVG — schéma de site tracé à la main (style brouillon)
 * Strokes animés par GSAP (stroke-dashoffset → 0)
 * Annotations Caveat manuscrites superposées
 * ============================================================ */
.wireframe-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 6;
    max-width: 560px;
    margin-left: auto;
}

.wireframe-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    color: #5a1224;
    /* Caché jusqu'à ce que JS ait mesuré les longueurs (évite le flash initial). */
    opacity: 0;
    transition: opacity 0.35s ease-out;
}

.wireframe-svg.is-ready {
    opacity: 1;
}

/* Tous les paths/lignes du wireframe : trait fin bordeaux qui se trace */
.wireframe-svg .stroke-path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* Variants : strokes plus fins (annotations flèches) ou plus épais (highlights) */
.wireframe-svg .stroke-thin {
    stroke-width: 1;
    opacity: 0.55;
}

.wireframe-svg .stroke-fill {
    fill: #5a1224;
    fill-opacity: 0.06;
    stroke: #5a1224;
    stroke-width: 1.4;
}

/* Préparation animation : dash gap énorme, élément invisible quelque soit sa longueur.
   JS pose ensuite stroke-dasharray = vraie longueur et anime dashoffset → 0. */
.wireframe-svg .draw-on-load {
    stroke-dasharray: 0 9999;
}

/* Annotations Caveat manuscrites positionnées en absolu sur le wrap */
.wireframe-note {
    position: absolute;
    font-family: "Caveat", cursive;
    font-weight: 600;
    color: #5a1224;
    line-height: 1.1;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    white-space: nowrap;
}

.wireframe-note-sm {
    font-size: 22px;
}

.wireframe-note-md {
    font-size: 28px;
}

.wireframe-note-lg {
    font-size: 38px;
    line-height: 0.95;
}

.wireframe-note-accent {
    color: #6b8169;
}

/* Petit emoji crayon / stylo dans la signature */
.wireframe-note .pen {
    display: inline-block;
    transform: rotate(-12deg);
    margin-left: 4px;
}


/* ============================================================
 * HERO TEXT REVEAL — préparation des éléments à animer au load
 * (GSAP les anime via timeline)
 * ============================================================ */
.hero-anim-init {
    opacity: 0;
    transform: translateY(14px);
}

.hero-anim-init-static {
    opacity: 0;
}


/* ============================================================
 * SERVICES SCROLL HORIZONTAL — pinned + scrub GSAP ScrollTrigger
 * Desktop (md+) : section pin verticalement, track flex-row se déplace en X
 * Mobile        : scroll horizontal natif avec scroll-snap
 * ============================================================ */
.services-pin-wrap {
    position: relative;
    /* La hauteur est calculée dynamiquement par GSAP (100vh + scroll horizontal) */
}

.services-pin-target {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.services-track-mask {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.services-track {
    display: flex;
    align-items: stretch;
    gap: 48px;
    height: 100%;
    /* Padding = (50vw − moitié d'une card) → 1ère card centrée à x=0,
       et avec la formule JS basée sur les centres, la dernière finit centrée aussi.
       clamp(180px, 26vw, 310px) = moitié de la card (clamp(360px, 52vw, 620px)). */
    padding-left: max(48px, calc(50vw - clamp(180px, 26vw, 310px)));
    padding-right: max(48px, calc(50vw - clamp(180px, 26vw, 310px)));
    will-change: transform;
}

.service-card {
    flex: 0 0 auto;
    width: clamp(360px, 52vw, 620px);
    height: 100%;
    max-height: 640px;
    border-radius: 18px;
    padding: 36px 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(12, 15, 26, 0.08);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.45s;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 48px -24px rgba(12, 15, 26, 0.25);
}

.service-card .service-glyph {
    position: absolute;
    top: -0.08em;
    right: -0.02em;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(220px, 30vw, 380px);
    line-height: 0.8;
    letter-spacing: -0.05em;
    opacity: 0.07;
    pointer-events: none;
    user-select: none;
}

/* Variants couleur — rythme visuel cream/marine/cream/bordeaux */
.service-card-cream {
    background: #fbf9f3; /* cream-50 */
    color: #0c0f1a;
}
.service-card-cream .service-glyph { color: #5a1224; opacity: 0.08; }

.service-card-marine {
    background: #13234f; /* secondary-900 */
    color: #f5efe0;
    border-color: rgba(245, 239, 224, 0.1);
}
.service-card-marine .service-glyph { color: #e2a8a0; opacity: 0.12; }

.service-card-bordeaux {
    background: #5a1224; /* primary-700 */
    color: #f5efe0;
    border-color: rgba(245, 239, 224, 0.1);
}
.service-card-bordeaux .service-glyph { color: #e2a8a0; opacity: 0.12; }

/* Mobile : scroll horizontal natif avec snap */
@media (max-width: 767px) {
    .services-pin-target {
        height: auto;
        overflow: visible;
    }
    .services-track-mask {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        /* Cacher la scrollbar mais garder fonctionnelle */
        scrollbar-width: none;
    }
    .services-track-mask::-webkit-scrollbar { display: none; }
    .services-track {
        height: auto;
        padding: 0 24px;
    }
    .service-card {
        scroll-snap-align: center;
        width: 88vw;
        height: auto;
        min-height: 540px;
    }
}


/* Progress indicator services (dots en bas) */
.services-progress {
    display: flex;
    gap: 12px;
    align-items: center;
}

.services-progress-dot {
    width: 28px;
    height: 4px;
    border-radius: 2px;
    background: rgba(12, 15, 26, 0.15);
    transition: background 0.4s ease;
}

.services-progress-dot.is-active {
    background: #5a1224;
}


/* ============================================================
 * HERO BACKGROUND — décor "carnet d'architecte"
 *   - 4 croix de mires aux coins (repères d'imprimeur)
 *   - 2 lignes de construction verticales fines (style marge éditoriale)
 *   - 1 grand glyphe filigrane bottom-left (signature)
 * ============================================================ */

/* Croix de mires aux coins (style repère d'imprimerie) */
.hero-mark {
    position: absolute;
    width: 28px;
    height: 28px;
    pointer-events: none;
    color: #5a1224;
    opacity: 0.32;
}

.hero-mark::before,
.hero-mark::after {
    content: "";
    position: absolute;
    background: currentColor;
}

.hero-mark::before {
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}

.hero-mark::after {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}

.hero-mark-tl { top: 18px; left: 18px; }
.hero-mark-tr { top: 18px; right: 18px; }
.hero-mark-bl { bottom: 18px; left: 18px; }
.hero-mark-br { bottom: 18px; right: 18px; }


/* Lignes de construction verticales — fines, traversantes */
.hero-rule-v {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(19, 35, 79, 0.08) 12%,
        rgba(19, 35, 79, 0.08) 88%,
        transparent 100%);
    pointer-events: none;
}

.hero-rule-v-1 { left: 25%; }
.hero-rule-v-2 { left: 75%; }


/* Grand glyphe "C" filigrane (signature studio) — bottom-left */
.hero-glyph-bg {
    position: absolute;
    bottom: -8%;
    left: -4%;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(280px, 32vw, 460px);
    line-height: 0.8;
    color: rgba(19, 35, 79, 0.04);
    user-select: none;
    pointer-events: none;
    z-index: 0;
}


/* Micro-label coin top-right — référence édition */
.hero-edition-label {
    position: absolute;
    top: 56px;
    right: 56px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(19, 35, 79, 0.42);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-edition-label::before {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .hero-mark { width: 18px; height: 18px; opacity: 0.25; }
    .hero-mark-tl, .hero-mark-tr { top: 12px; }
    .hero-mark-bl, .hero-mark-br { bottom: 12px; }
    .hero-mark-tl, .hero-mark-bl { left: 12px; }
    .hero-mark-tr, .hero-mark-br { right: 12px; }
    .hero-rule-v { display: none; }
    .hero-edition-label { display: none; }
    .hero-glyph-bg { font-size: clamp(220px, 50vw, 320px); }
}


/* ============================================================
 * MAGNETIC — bouton attiré par le curseur (subtle)
 * Activé via JS qui ajoute --mx / --my en CSS vars
 * ============================================================ */
.magnetic {
    transform: translate3d(var(--mx, 0), var(--my, 0), 0);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}


/* ============================================================
 * CARD-GLOW — radial-gradient qui suit le curseur dans une card
 * Activé via JS qui pose --gx / --gy sur la card au mousemove
 * ============================================================ */
.card-glow {
    position: relative;
    isolation: isolate;
}

.card-glow::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        450px circle at var(--gx, 50%) var(--gy, 50%),
        rgba(90, 18, 36, 0.18),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.card-glow:hover::before {
    opacity: 1;
}

.card-glow > * {
    position: relative;
    z-index: 2;
}


/* ============================================================
 * REVEAL — fade-up au scroll (IntersectionObserver pose .reveal-in)
 * ============================================================ */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-in {
    opacity: 1;
    transform: translateY(0);
}

/* Reveal cascade pour les enfants */
.reveal-stagger > .reveal {
    transition-delay: calc(var(--stagger, 0) * 80ms);
}


/* ============================================================
 * SVG PATH PROGRESS — ligne qui se dessine au scroll
 * Utilisée dans la section méthode pour relier les 4 steps
 * ============================================================ */
.svg-path-progress path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.svg-path-progress.in-view path {
    stroke-dashoffset: 0;
}


/* ============================================================
 * MARQUEE-TRACK — bandeau infini stack technique
 * Utilise les keyframes 'marquee' du tailwind.config.js
 * ============================================================ */
.marquee-track {
    display: flex;
    gap: 64px;
    width: max-content;
    animation: marquee 50s linear infinite;
    will-change: transform;
}

.marquee-track:hover {
    animation-play-state: paused;
}

/* Fade left/right sur les bords du marquee */
.marquee-mask {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 80px, #000 calc(100% - 80px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 80px, #000 calc(100% - 80px), transparent 100%);
}


/* ============================================================
 * HERO TITLE — réglages typographie fins (Instrument Serif)
 * ============================================================ */
.hero-title {
    font-feature-settings: "liga", "dlig", "calt", "ss01";
}

.hero-title em {
    font-style: italic;
    color: #5a1224;
}


/* ============================================================
 * COLLAGE-ASYM — grille asymétrique sobre pour les 3 réalisations
 * Pas de rotation grossière. Juste 3 cards avec un décalage de hauteur
 * subtle pour casser la régularité.
 * ============================================================ */
.realisations-asym {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

.realisations-asym > :nth-child(2) {
    margin-top: 48px;
}

@media (max-width: 900px) {
    .realisations-asym {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .realisations-asym > :nth-child(2) {
        margin-top: 0;
    }
}


/* ============================================================
 * NOISE OVERLAY — léger grain papier sur le hero (optionnel)
 * Donne du caractère "imprimé" sans bruit visuel
 * ============================================================ */
.noise-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.04;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}


/* ============================================================
 * ACCESSIBILITY — reduce motion override pour les animations home
 * (la règle globale est dans global.css, ici on neutralise spécifiquement)
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .hero-blob,
    .magnetic,
    .cursor-dot,
    .marquee-track {
        animation: none !important;
        transform: none !important;
    }
    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
    .svg-path-progress path {
        stroke-dashoffset: 0 !important;
    }
}
