body {
  overflow: hidden;
  cursor: ew-resize;
}

#timeline {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: var(--timeline-h);
  overflow: hidden;
  z-index: 90;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 14, 14, .92);
}

.timeline-inner {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  align-items: flex-end;
  height: 100%;
  will-change: transform;
}

.tick {
  position: relative;
  width: 42px;
  flex-shrink: 0;
}

.tick::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  background: #353535;
}

.tick.major::before { height: 13px; }
.tick.minor::before { height: 6px; }

.tick-label {
  position: absolute;
  left: 7px;
  bottom: 15px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-ui);
  color: var(--text-dim);
}

.playhead {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: white;
  z-index: 20;
  opacity: .95;
  box-shadow: 0 0 14px rgba(255, 255, 255, .18);
}

.playhead::after {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 7px solid white;
}

.timeline-project-marker {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 100%;
  z-index: 18;
  pointer-events: none;
}

.timeline-project-marker::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 0px;
  background: rgba(255, 255, 255, .38);
  box-shadow: 0 0 12px rgba(255, 255, 255, .12);
}

.timeline-project-marker::after {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 7px solid rgba(255, 255, 255, .9);
  opacity: .9;
}

.timeline-project-label {
  position: absolute;
  top: 8px;
  left: 8px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  color: var(--text-soft);
}

main {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding-top: calc(var(--header-h) + var(--timeline-h));
}

.scene {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.track-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  transform-origin: center center;
  will-change: transform;
}

.track {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  height: 100%;
  padding: 0 18vw;
}

.project {
  width: var(--card-width);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .6s ease;
}

.media-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}

.project-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid #222;
  box-shadow: var(--shadow-project);
}

.project-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  filter: brightness(.82) contrast(1.02) saturate(.9);
  transition: transform 1.4s var(--ease), filter 1.4s var(--ease);
  pointer-events: none;
  z-index: 1;
}

.project-video:hover,
.project-image:hover {
  transform: scale(1.025);
  filter: brightness(.92) contrast(1.03) saturate(.94);
}

.project-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  pointer-events: none;
}

.project-top,
.project-bottom {
  display: flex;
  justify-content: space-between;
}

.project-meta,
.project-timecode {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  color: var(--text-soft);
}

.project-title {
  font-size: clamp(1.1rem, 1.8vw, 1.8rem);
  font-weight: 500;
  letter-spacing: -.035em;
}

.scrub-hint {
  position: fixed;
  right: var(--page-padding);
  bottom: calc(var(--footer-h) + 18px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  pointer-events: none;
}

.scrub-text,
.scrub-subtext {
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
}

.scrub-text {
  writing-mode: vertical-lr;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.scrub-subtext {
  font-size: .58rem;
  color: var(--text-dim);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  cursor: pointer;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  transition: color var(--transition-fast) ease;
  margin: 0 5px;
}

.nav-item.active {
  color: white;
  text-shadow: 0 0 12px rgba(255, 255, 255, .12);
}

/* ========== LIGHTBOX STYLES ========== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 13, 13, 0.96);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  visibility: hidden;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.lightbox-content {
  position: relative;
  z-index: 2;
  width: min(92vw, 1100px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  transition: transform .3s var(--ease), opacity .3s ease;
}

.lightbox.active .lightbox-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.2rem;
  gap: 1rem;
}

.lightbox-header > div {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.lightbox-title {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-weight: 500;
  letter-spacing: -.035em;
  color: var(--text);
  margin: 0;
}

.lightbox-category {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: var(--tracking-ui);
}

.lightbox-close {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: .6rem 1.2rem;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  transition: all .2s ease;
  flex-shrink: 0;
}

.lightbox-close:hover {
  background: var(--bg);
  border-color: var(--mono);
  color: white;
}

.lightbox-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.lightbox-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem;
}

.lightbox-timecode {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
  letter-spacing: var(--tracking-ui);
}

.lightbox-full-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: var(--tracking-ui);
  transition: color .2s ease;
}

.lightbox-full-link:hover {
  color: white;
}


/* ========== HAMBURGER MENU (global — visible mobile only) ========== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  z-index: 1100;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--text);
  transition: transform .3s var(--ease), opacity .2s ease, width .3s var(--ease);
  transform-origin: center;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
  width: 0;
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ========== DRAWER MENU ========== */
#mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(280px, 80vw);
  height: 100%;
  z-index: 1050;
  background: #0d0d0d;
  border-left: 1px solid var(--line);
  padding: calc(var(--header-h) + 1.5rem) var(--page-padding) 2rem;
  flex-direction: column;
  gap: 0;
  transform: translateX(100%);
  transition: transform .38s var(--ease);
  will-change: transform;
  overflow-y: auto;
}

#mobile-drawer.open {
  transform: translateX(0);
}

#drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .35s ease;
}

#drawer-backdrop.open {
  opacity: 1;
}

.drawer-label {
  font-family: var(--font-mono);
  font-size: .58rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: .8rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--text-soft);
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
  transition: color .2s ease;
}

.drawer-nav-item:first-of-type {
  border-top: none;
}

.drawer-nav-item:active,
.drawer-nav-item.active {
  color: var(--text);
}

.drawer-nav-meta {
  font-family: var(--font-mono);
  font-size: .58rem;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  color: var(--text-dim);
}

.drawer-footer {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.drawer-footer a {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: var(--tracking-ui);
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color .2s ease;
  padding: .3rem 0;
}

.drawer-footer a:hover {
  color: var(--text);
}

/* ========== RESPONSIVE MOBILE / TABLETTE ========== */
@media (max-width: 900px) {

  /* ── Body : override le overflow:hidden global ── */
  body {
    overflow: visible !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    cursor: auto;
    /* Empêche le body::before/after de bloquer les touches */
  }

  /* ── Header ── */
  header {
    position: fixed;
    height: var(--header-h);
    padding: 0 var(--page-padding);
    z-index: 1000;
    background: rgba(13, 13, 13, 0.98);
    backdrop-filter: blur(14px);
    /* S'assure que le contenu du header est cliquable */
    pointer-events: auto;
  }

  .header-left {
    gap: 0;
    pointer-events: auto;
  }

  .logo {
    font-size: .88rem;
  }

  .header-description,
  .header-separator,
  .status {
    display: none;
  }

  .header-right {
    display: none;
  }

  /* Hamburger visible et cliquable */
  .hamburger {
    display: flex;
    position: relative;
    z-index: 1200;
    pointer-events: auto;
  }

  /* Drawer visible */
  #mobile-drawer {
    display: flex;
    pointer-events: auto;
  }

  #drawer-backdrop {
    display: block;
    pointer-events: none; /* seulement cliquable quand .open */
  }

  #drawer-backdrop.open {
    pointer-events: auto;
  }

  /* ── Timeline cachée ── */
  #timeline {
    display: none;
  }

  .timeline-inner {
    will-change: auto;
  }

  .sequence-indicator,
  .system-message,
  .scrub-hint {
    display: none;
  }

  /* ── Layout main vertical ── */
  main {
    position: static;
    width: 100%;
    height: auto;
    min-height: 100svh;
    overflow: visible;
    padding-top: var(--header-h);
  }

  .scene {
    position: static;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  /* Neutraliser le stacking context créé par will-change */
  .track-wrapper {
    position: static;
    width: 100%;
    height: auto;
    transform: none !important;
    will-change: auto !important;
    display: block;
  }

  .track {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
    height: auto;
    padding: 1.2rem var(--page-padding) calc(var(--footer-h) + 2rem);
  }

  /* ── Cards projet ── */
  .project {
    width: 100%;
    opacity: 1 !important;
    transition: none;
  }

  .project-frame {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 28px rgba(0,0,0,.3);
    border: 1px solid #222;
  }

  .media-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .project-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: none;
    filter: brightness(.85);
    transition: none;
  }

  .project-overlay {
    padding: .85rem;
  }

  .project-title {
    font-size: clamp(.9rem, 3.8vw, 1.15rem);
    letter-spacing: -.025em;
  }

  .project-meta,
  .project-timecode {
    font-size: .56rem;
  }

  .project-link {
    display: block;
  }

  .project-link:active .project-frame {
    filter: brightness(1.08);
    transform: scale(.993);
    transition: transform .1s ease, filter .1s ease;
  }

  /* ── Footer ── */
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-h);
    z-index: 100;
    flex-direction: row;
    justify-content: center;
    padding: 0 var(--page-padding);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #0d0d0d;
  }

  .footer-left {
    display: none;
  }

  .footer-links {
    display: flex;
    flex-wrap: nowrap;
    gap: .6rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-items: center;
  }

  .footer-links::-webkit-scrollbar { display: none; }

  .footer-links a {
    font-family: var(--font-mono);
    font-size: .56rem;
    letter-spacing: var(--tracking-ui);
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
    transition: color .2s ease;
  }

  .footer-links a:active {
    color: var(--text);
  }

  /* ── Page transition désactivée ── */
  #page-transition-overlay {
    display: none;
  }

  /* ── Lightbox mobile ── */
  .lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(10, 10, 10, .97);
    align-items: flex-end;
    padding: 0;
  }

  .lightbox-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-height: 92svh;
    max-width: none;
    gap: 0;
    transform: translateY(30px);
    opacity: 0;
    transition: transform .35s var(--ease), opacity .3s ease;
    display: flex;
    flex-direction: column;
    background: #0d0d0d;
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
  }

  .lightbox.active .lightbox-content {
    transform: translateY(0);
    opacity: 1;
  }

  /* Drag handle */
  .lightbox-content::before {
    content: "";
    display: block;
    width: 36px;
    height: 3px;
    background: var(--line);
    border-radius: 2px;
    margin: .8rem auto .4rem;
    flex-shrink: 0;
  }

  .lightbox-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: .6rem var(--page-padding) .8rem;
    gap: .8rem;
    border-bottom: none;
  }

  .lightbox-header > div {
    gap: .15rem;
  }

  .lightbox-category {
    font-size: .56rem;
  }

  .lightbox-title {
    font-size: clamp(.9rem, 4vw, 1.2rem);
    letter-spacing: -.025em;
  }

  .lightbox-close {
    padding: .5rem .9rem;
    font-size: .6rem;
    min-height: 36px;
    min-width: 72px;
  }

  .lightbox-video-wrapper {
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    aspect-ratio: 16/9;
    flex-shrink: 0;
  }

  .lightbox-footer {
    padding: .8rem var(--page-padding);
    padding-bottom: calc(.8rem + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: #111;
    border-top: 1px solid var(--line);
  }

  .lightbox-timecode {
    font-size: .56rem;
  }

  .lightbox-full-link {
    font-size: .6rem;
    padding: .5rem .9rem;
    border: 1px solid var(--line);
    min-height: 36px;
    display: flex;
    align-items: center;
  }
}

/* ── Très petits écrans ── */
@media (max-width: 380px) {
  .track {
    padding-left: .85rem;
    padding-right: .85rem;
  }
}
