/* Scout Mono : absente → fallback Suisse Int'l Mono / monospace */
@font-face {
  font-family: "Scout Mono";
  src: local("Scout Mono Medium"), local("ScoutMono-Medium"),
       url("../fonts/ScoutMono-Medium.woff2") format("woff2"),
       url("../fonts/ScoutMono-Medium.otf") format("opentype");
  font-weight: 500;
}

:root {
  --chalk: #faf9f5;
  --menu-bg: #f1f1f1;
  --moonstone: #1b2226;
  --fog: #e1e9ed;
  --harvest-orange: #ff5432;

  /* 1u = 1px de la maquette 1440 (recalculé en JS) */
  --u: calc(100vw / 1440);
  /* taille d'un prototype en plein écran, et échelle des vignettes (550 / 1440) */
  --vw: 100vw;
  --vh: 100vh;
  --k: 0.381944;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--menu-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }

/* ---------- Menu ---------- */
.menu {
  position: fixed;
  inset: 0;
  background: var(--menu-bg);
}

/* Index (gauche, centré verticalement) */
.index {
  position: absolute;
  left: calc(56 * var(--u)); /* tiret de l'item actif aligné sur la marge 32 */
  top: 50%;
  z-index: 1; /* au-dessus de la liste (sinon elle capte les clics) */
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: calc(11.83 * var(--u));
}
.index__item {
  position: relative;
  display: flex;
  gap: calc(12 * var(--u));
  height: calc(9 * var(--u));
  align-items: center;
  font-family: "Scout Mono", "Suisse Int'l Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: calc(10 * var(--u));
  line-height: 0.9;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--moonstone);
  opacity: 0.3;
  transition:
    opacity 0.5s var(--ease-out) var(--d, 0s),
    translate 0.9s var(--ease-out) var(--d, 0s),
    transform 0.5s var(--ease-out);
}
.index__item::before { /* tiret orange de l'item actif */
  content: "";
  position: absolute;
  left: calc(-23 * var(--u));
  top: 50%;
  width: calc(12 * var(--u));
  height: 1px;
  background: var(--harvest-orange);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--ease-out);
}
.index__item:hover { opacity: 0.6; }
.index__item.is-active {
  opacity: 1;
  transform: translateX(calc(24 * var(--u)));
}
.index__item.is-active::before { transform: scaleX(1); }
/* Petit espace entre les groupes de prototypes */
.index__item--group-start { margin-top: calc(12 * var(--u)); }

/* Liste des vignettes (scroll vertical, centrée) */
.list {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(8 * var(--u));
  padding: calc(88 * var(--u)) 0;
  /* assez d'espace en bas pour que la dernière vignette puisse remonter à 88 */
  padding-bottom: max(calc(88 * var(--u)), calc(var(--vh) - 88 * var(--u) - var(--vh) * var(--k)));
}
.list::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  flex: none;
  width: calc(var(--vw) * var(--k));
  height: calc(var(--vh) * var(--k));
  cursor: pointer;
  transition:
    opacity 0.6s var(--ease-out) var(--d, 0s),
    translate 1s var(--ease-out) var(--d, 0s);
}
/* 100 entre deux groupes de prototypes (8 de gap + 92) */
.card--group-start { margin-top: calc(92 * var(--u)); }


/* Le prototype lui-même, à taille plein écran, réduit par scale */
.frame {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--vw);
  height: var(--vh);
  transform-origin: 0 0;
  transform: scale(var(--k));
  background: var(--moonstone);
  overflow: hidden;
}
.frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none; /* vignette : le clic va à la carte */
}
/* Plein écran */
.frame.is-full {
  position: fixed;
  transform: none;
  z-index: 10;
}
.frame.is-full iframe { pointer-events: auto; }
/* Pendant une transition : ni le proto ni la liste ne captent le scroll / les clics */
.shell.is-animating .frame iframe,
.shell.is-animating .list { pointer-events: none; }
.shell.is-animating .list { overflow: hidden; }

/* Loader (dans la frame → suit la transition) */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--moonstone);
  transition: opacity 0.6s var(--ease-out), visibility 0s linear 0.6s;
}
.loader::after {
  content: "";
  width: 120px;
  height: 1px;
  background:
    linear-gradient(90deg, transparent, var(--chalk), transparent) no-repeat -120px 0 / 120px 1px,
    rgba(250, 249, 245, 0.15);
  animation: loader-sweep 1.2s var(--ease) infinite;
}
@keyframes loader-sweep {
  to { background-position: 120px 0, 0 0; }
}
.frame.is-ready .loader {
  opacity: 0;
  visibility: hidden;
}

/* État "prototype ouvert" : le reste du menu disparaît.
   À l'ouverture du menu, vignettes et items reviennent en cascade (--d posé en JS). */
.shell.is-open .index__item {
  opacity: 0;
  translate: 0 calc(12 * var(--u));
  pointer-events: none;
}
.shell.is-open .card:not(.is-current) {
  opacity: 0;
  translate: 0 calc(56 * var(--u));
  pointer-events: none;
}
.shell.is-open .list { overflow: hidden; }

/* ---------- Déclencheur (bas gauche) ---------- */
.trigger { position: fixed; inset: 0; pointer-events: none; z-index: 20; }

.trigger__btn {
  position: absolute;
  /* tailles fixes en px : le bouton ne rétrécit pas avec la fenêtre */
  left: 18px;
  bottom: 18px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--fog);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
}
/* Icône "=" : 2 traits 8.5×1.5, espacés de 4 (svg Figma) */
.trigger__lines {
  position: relative;
  flex: none;
  width: 10px;
  height: 5.5px;
}
.trigger__lines span {
  position: absolute;
  left: 0.75px;
  right: 0.75px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--moonstone);
}
.trigger__lines span:first-child { top: 0; }
.trigger__lines span:last-child { bottom: 0; }

/* Hover : seule la couleur de fond change */
.trigger__btn { transition: opacity 0.25s var(--ease-out), transform 0.5s var(--ease-out), background-color 0.15s ease; }
.trigger__btn:hover { background: var(--harvest-orange); }

.trigger.is-visible .trigger__btn { opacity: 1; transform: none; pointer-events: auto; }
.shell:not(.is-open) .trigger { display: none; }
