/* ==============================================
   Homepage — Charles Savio — v3 (Three.js)
   ============================================== */

:root {
    --bg:        #050505;
    --bg-2:      #0e0e10;
    --ink:       #f5f5f5;
    --ink-dim:   #888;
    --ink-faint: #2a2a2a;
    --accent:    #FF5A36;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }


/* ==============================================
   HEADER
   ============================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    border-bottom: 1px solid var(--ink-faint);
    position: relative;
    z-index: 10;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.brand-dot {
    width: 9px; height: 9px;
    background: var(--accent);
    border-radius: 2px;
    transform: rotate(45deg);
    box-shadow: 0 0 12px var(--accent);
}
.page-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.page-meta .sep { color: var(--ink-faint); }
.live { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink); }
.live-dot {
    width: 6px; height: 6px;
    background: #6ee7a7;
    border-radius: 50%;
    box-shadow: 0 0 8px #6ee7a7;
    animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}


/* ==============================================
   HERO
   ============================================== */
.hero {
    padding: 4rem 2.5rem 1.5rem;
    max-width: 1100px;
}
.kicker {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-dim);
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
    animation: fade-up 0.8s ease-out 0.1s both;
}
.hero-title {
    font-size: clamp(2.4rem, 5.2vw, 4.4rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
    animation: fade-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}
.hero-title em {
    font-style: italic;
    font-weight: 400;
    background: linear-gradient(120deg, #FFB74A, #FF5A36, #FF2D70);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-sub {
    font-size: 1rem;
    color: var(--ink-dim);
    max-width: 48ch;
    animation: fade-up 0.9s ease-out 0.5s both;
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ==============================================
   STAGE — Canvas Three.js
   ============================================== */
.stage {
    position: relative;
    height: 78vh;
    min-height: 600px;
    margin: 1.5rem 2.5rem 4rem;
    background: #050505;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--ink-faint);
}

#scene-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loader pendant le chargement */
.loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.6s ease;
}
.loader.hidden {
    opacity: 0;
}
.loader-dot {
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    animation: live-pulse 1s ease-in-out infinite;
}


/* ==============================================
   ÉTIQUETTES (overlay HTML positionné par JS)
   ============================================== */
.labels {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.tile-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(14, 14, 16, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: var(--ink);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    pointer-events: auto;
    cursor: pointer;
}
.tile-label.visible {
    opacity: 1;
}
.label-id {
    font-size: 0.58rem;
    color: var(--ink-dim);
    letter-spacing: 0.14em;
}
.label-name {
    font-weight: 600;
    color: var(--ink);
}
.tile-label:hover {
    border-color: rgba(255,255,255,0.25);
    transform: translate(-50%, -50%) scale(1.05);
}


/* ==============================================
   UI CORNER
   ============================================== */
.ui-corner {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}
.ui-btn {
    width: 38px; height: 38px;
    background: rgba(20, 20, 22, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
}
.ui-btn:hover {
    background: rgba(40, 40, 42, 0.95);
    transform: scale(1.08);
}


/* ==============================================
   LISTE TEXTUELLE
   ============================================== */
.list-section {
    padding: 2rem 2.5rem 3rem;
    max-width: 800px;
}
.list-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-dim);
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--ink-faint);
}
.exercises-list {
    list-style: none;
    counter-reset: ex;
}
.exercises-list li {
    counter-increment: ex;
    border-bottom: 1px solid var(--ink-faint);
}
.exercises-list a {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1.1rem 0;
    font-size: 1.05rem;
    color: var(--ink);
    transition: color 0.3s ease, padding-left 0.3s ease;
}
.exercises-list a::before {
    content: "0" counter(ex);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-dim);
    min-width: 2rem;
}
.exercises-list a span {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-right: 0.5rem;
}
.exercises-list a::after {
    content: "↗";
    margin-left: auto;
    color: var(--ink-dim);
    transition: transform 0.3s ease, color 0.3s ease;
}
.exercises-list a:hover {
    padding-left: 0.5rem;
    color: #fff;
}
.exercises-list a:hover::after {
    color: var(--accent);
    transform: translate(4px, -4px);
}


/* ==============================================
   FOOTER
   ============================================== */
.page-footer {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 2.5rem;
    border-top: 1px solid var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}


/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 880px) {
    .stage { height: 60vh; margin: 1.5rem 1rem 3rem; }
    .tile-label { font-size: 0.6rem; padding: 0.4rem 0.7rem; }
    .hero, .list-section, .page-header, .page-footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}
@media (max-width: 600px) {
    .stage { height: 50vh; min-height: 400px; }
    .page-meta .sep { display: none; }
    .page-meta { gap: 0.4rem; font-size: 0.68rem; }
}
