/**
 * Thelis — Section Navigator v2
 * Desktop : "Engineering Depth Cards" — rectangles 3D émergeant du bord gauche
 * Mobile  : pill flottant + drawer ascendant
 */

/* ══ DESKTOP — 3D Card Stack ════════════════════════════════════════════════ */

.thelis-secnav {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    width: 272px; /* largeur explicite — nécessaire pour le collapse */

    display: flex;
    flex-direction: column;
    gap: 5px;

    /* Espace perspective pour l'effet 3D */
    perspective: 1000px;
    perspective-origin: 0% 50%;

    /* Apparition initiale */
    opacity: 0;
    pointer-events: none;
    transition:
        opacity   0.7s  cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.thelis-secnav.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Carte individuelle ─────────────────────────────────────────────────── */

.thelis-secnav__item {
    position: relative;
    width: 272px;
    height: 46px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    overflow: hidden;

    background: rgba(8, 8, 13, 0.86);
    border-left: 3px solid rgba(255, 255, 255, 0.07);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.35);
    border-right: 1px solid rgba(255, 255, 255, 0.04);

    text-decoration: none !important;
    cursor: pointer;

    /* État par défaut — carte inclinée, mais entièrement lisible */
    transform: translateX(-16px) rotateY(-10deg);
    transform-origin: right center;
    transform-style: preserve-3d;

    /* Ombre de profondeur sur le bord visible */
    box-shadow:
        3px 0 12px rgba(0, 0, 0, 0.45),
        inset -1px 0 0 rgba(255, 255, 255, 0.03);

    transition:
        transform   0.56s cubic-bezier(0.34, 1.56, 0.64, 1),
        height      0.46s cubic-bezier(0.22, 1, 0.36, 1),
        background  0.28s ease,
        border-left-color 0.28s ease,
        box-shadow  0.28s ease;

    will-change: transform, height;
}

/* Hover — la carte se redresse légèrement */
.thelis-secnav__item:hover:not(.is-active) {
    transform: translateX(-6px) rotateY(-4deg);
    background: rgba(12, 12, 18, 0.94);
}

/* Active — carte entièrement déployée, face au visiteur */
.thelis-secnav__item.is-active {
    transform: translateX(0) rotateY(0deg) translateZ(6px);
    height: 68px;
    background: rgba(10, 10, 14, 0.97);
    border-left-color: #E8294A;
    box-shadow:
        0  0  0  1px rgba(232, 41, 74, 0.12),
        6px 0  28px rgba(232, 41, 74, 0.18),
        0   8px 32px rgba(0, 0, 0, 0.55),
        inset 1px 0 0 rgba(255, 255, 255, 0.05);
}

/* ── Numéro (toujours visible dans la tranche exposée) ──────────────────── */

.thelis-secnav__num {
    flex-shrink: 0;
    width: 70px;               /* cette largeur reste visible même en tucked */
    padding: 0 10px 0 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.38) !important;
    line-height: 1;
    transition: color 0.28s ease, font-size 0.28s ease;
    text-align: right;
}

.thelis-secnav__item.is-active .thelis-secnav__num {
    color: #E8294A !important;
    font-size: 11px;
}

/* Séparateur vertical entre num et label */
.thelis-secnav__sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    transition: background 0.28s ease, height 0.46s ease;
}

.thelis-secnav__item.is-active .thelis-secnav__sep {
    background: rgba(232, 41, 74, 0.30);
    height: 32px;
}

/* ── Label (partie développée) ──────────────────────────────────────────── */

.thelis-secnav__label {
    flex: 1;
    padding: 0 14px;
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: rgba(255, 255, 255, 0.58) !important; /* lisible sans survol */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    transition: color 0.28s ease, font-size 0.46s cubic-bezier(0.22, 1, 0.36, 1);
}

.thelis-secnav__item:hover:not(.is-active) .thelis-secnav__label {
    color: rgba(255, 255, 255, 0.78) !important;
}

.thelis-secnav__item.is-active .thelis-secnav__label {
    color: rgba(255, 255, 255, 0.92) !important;
    font-size: 13px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
}

/* ── Indicateur de progression (barre verticale interne) ─────────────────── */

.thelis-secnav__item::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 2px;
    height: 60%;
    background: linear-gradient(to bottom, transparent, #E8294A, transparent);
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
}

.thelis-secnav__item.is-active::after {
    transform: translateY(-50%) scaleY(1);
    opacity: 0.6;
}

/* ── Face arrière (pseudo 3D) ───────────────────────────────────────────── */

.thelis-secnav__item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(232, 41, 74, 0.06) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.thelis-secnav__item.is-active::before {
    opacity: 1;
}

/* Mode compact — homepage (> 7 sections) : hauteur réduite pour tenir dans le viewport */
.thelis-secnav--compact .thelis-secnav__item {
    height: 36px;
}
.thelis-secnav--compact .thelis-secnav__item.is-active {
    height: 58px;
}
.thelis-secnav--compact .thelis-secnav__label {
    font-size: 10.5px;
}
.thelis-secnav--compact .thelis-secnav__item.is-active .thelis-secnav__label {
    font-size: 12px;
}
.thelis-secnav--compact {
    gap: 3px;
}

/* ── Adaptive mode — nav on dark section background ────────────────────────
   Triggered by JS adding .thelis-secnav--on-dark when section luminance < 0.45
   Cards flip to opaque warm-white; text uses full dark-on-light contrast.
   ─────────────────────────────────────────────────────────────────────────── */

.thelis-secnav--on-dark .thelis-secnav__item {
    background: rgba(248, 246, 243, 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left-color: rgba(17, 17, 24, 0.12);
    border-top-color: rgba(17, 17, 24, 0.07);
    border-bottom-color: rgba(17, 17, 24, 0.16);
    border-right-color: rgba(17, 17, 24, 0.07);
    box-shadow:
        4px 0 24px rgba(0, 0, 0, 0.42),
        inset -1px 0 0 rgba(17, 17, 24, 0.06);
}

.thelis-secnav--on-dark .thelis-secnav__item:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.99);
}

.thelis-secnav--on-dark .thelis-secnav__item.is-active {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-left-color: #E8294A;
    box-shadow:
        0  0  0  1px rgba(232, 41, 74, 0.18),
        6px 0  28px rgba(232, 41, 74, 0.26),
        0   8px 28px rgba(0, 0, 0, 0.35),
        inset 1px 0 0 rgba(17, 17, 24, 0.06);
}

/* Numbers — AAA contrast on white */
.thelis-secnav--on-dark .thelis-secnav__num {
    color: rgba(17, 17, 24, 0.38) !important;
}

.thelis-secnav--on-dark .thelis-secnav__item.is-active .thelis-secnav__num {
    color: #E8294A !important;
}

/* Separator */
.thelis-secnav--on-dark .thelis-secnav__sep {
    background: rgba(17, 17, 24, 0.14);
}

.thelis-secnav--on-dark .thelis-secnav__item.is-active .thelis-secnav__sep {
    background: rgba(232, 41, 74, 0.35);
}

/* Labels — minimum 4.5:1 on the warm-white background */
.thelis-secnav--on-dark .thelis-secnav__label {
    color: rgba(17, 17, 24, 0.65) !important;  /* ~6.8:1 */
}

.thelis-secnav--on-dark .thelis-secnav__item:hover:not(.is-active) .thelis-secnav__label {
    color: rgba(17, 17, 24, 0.84) !important;  /* ~10:1 */
}

.thelis-secnav--on-dark .thelis-secnav__item.is-active .thelis-secnav__label {
    color: rgba(17, 17, 24, 0.92) !important;  /* ~12:1 AAA */
}

/* Red progress bar — unchanged */
.thelis-secnav--on-dark .thelis-secnav__item::after {
    background: linear-gradient(to bottom, transparent, #E8294A, transparent);
}

/* Active shimmer — subtle red wash on the left edge */
.thelis-secnav--on-dark .thelis-secnav__item.is-active::before {
    background: linear-gradient(90deg, rgba(232, 41, 74, 0.07) 0%, transparent 55%);
    opacity: 1;
}

/* ── Toggle collapse ────────────────────────────────────────────────────── */

.thelis-secnav__toggle {
    position: absolute;
    right: -28px;
    top: 50%;
    transform: translateY(-50%);

    width: 28px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(8, 8, 13, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: none;
    border-radius: 0 4px 4px 0;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.45);

    cursor: pointer;
    color: rgba(255, 255, 255, 0.45) !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1;
    padding: 0;

    transition:
        color      0.25s ease,
        background 0.25s ease,
        right      0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.thelis-secnav__toggle:hover {
    background: rgba(14, 14, 20, 0.97);
    color: var(--thelis-red, #E8294A) !important;
}

/* Flèche rotate au collapse */
.thelis-secnav__toggle-arrow {
    display: inline-block;
    transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── État collapsé — tout le nav glisse, le toggle suit ─────────────────── */

.thelis-secnav--collapsed {
    transform: translateX(-272px) translateY(-50%);
}

/* Items non cliquables quand masqués, toggle reste actif */
.thelis-secnav--collapsed .thelis-secnav__item {
    pointer-events: none;
}

.thelis-secnav--collapsed .thelis-secnav__toggle {
    pointer-events: auto;
}

.thelis-secnav--collapsed .thelis-secnav__toggle-arrow {
    transform: rotate(180deg);
}

/* Mode on-dark — toggle aussi */
.thelis-secnav--on-dark .thelis-secnav__toggle {
    background: rgba(248, 246, 243, 0.97);
    border-color: rgba(17, 17, 24, 0.10);
    color: rgba(17, 17, 24, 0.55) !important;
}

.thelis-secnav--on-dark .thelis-secnav__toggle:hover {
    color: #E8294A !important;
}

/* Desktop uniquement */
@media (max-width: 1023px) {
    .thelis-secnav { display: none !important; }
}

/* ══ MOBILE — Timeline Strip ════════════════════════════════════════════════
   Barre horizontale fixe en bas — toutes les sections visibles d'un coup d'œil.
   Scroll horizontal pour naviguer, section active mise en valeur.
   ══════════════════════════════════════════════════════════════════════════ */

.thelis-secstrip {
    display: none;               /* affiché via media query */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;

    background: rgba(7, 7, 11, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 2px solid #E8294A;

    /* Safe area iPhone */
    padding-bottom: env(safe-area-inset-bottom, 0px);

    opacity: 0;
    transform: translateY(100%);
    transition:
        opacity   0.5s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, opacity;
}

.thelis-secstrip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Inner scroll container ─────────────────────────────────────────────── */

.thelis-secstrip__inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 64px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 12px;
    gap: 0;
}

.thelis-secstrip__inner::-webkit-scrollbar { display: none; }

/* ── Fade edges indiquant le scroll possible ────────────────────────────── */

.thelis-secstrip::before,
.thelis-secstrip::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    z-index: 1;
    pointer-events: none;
}

.thelis-secstrip::before {
    left: 0;
    background: linear-gradient(to right, rgba(7, 7, 11, 0.90), transparent);
}

.thelis-secstrip::after {
    right: 0;
    background: linear-gradient(to left, rgba(7, 7, 11, 0.90), transparent);
}

/* ── Section item (bouton) ──────────────────────────────────────────────── */

.thelis-secstrip__item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px;
    min-width: 52px;
    background: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
    transition: background 0.25s ease;
}

.thelis-secstrip__item:active {
    background: rgba(255, 255, 255, 0.04);
}

/* Indicateur rouge sous l'item actif */
.thelis-secstrip__item::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 20px;
    height: 2px;
    background: #E8294A;
    border-radius: 1px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thelis-secstrip__item.is-active::after {
    transform: translateX(-50%) scaleX(1);
}

/* ── Numéro ──────────────────────────────────────────────────────────────── */

.thelis-secstrip__num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.22) !important;
    line-height: 1;
    transition: color 0.25s ease;
}

.thelis-secstrip__item.is-active .thelis-secstrip__num {
    color: #E8294A !important;
}

/* ── Label ───────────────────────────────────────────────────────────────── */

.thelis-secstrip__label {
    font-family: 'Syne', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.32) !important;
    white-space: nowrap;
    line-height: 1;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.25s ease, max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.thelis-secstrip__item.is-active .thelis-secstrip__label {
    color: rgba(255, 255, 255, 0.90) !important;
    max-width: 120px;
    font-size: 12px;
}

/* ── Connecteur entre items ─────────────────────────────────────────────── */

.thelis-secstrip__conn {
    flex-shrink: 0;
    width: 10px;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    display: block;
    margin: 0 1px;
    position: relative;
    top: -4px;           /* aligne visuellement sur les numéros */
}

/* Mobile uniquement */
@media (min-width: 1024px) {
    .thelis-secstrip { display: none !important; }
}
@media (max-width: 1023px) {
    .thelis-secstrip { display: block; }
}
