@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

@font-face {
  font-family: 'EP Kaisho';
  src: url('assets/fonts/EPKAISHO.woff2') format('woff2'),
       url('assets/fonts/EPKAISHO.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --black: #000000;
  --white: #ffffff;
  --grey-block: #f8f8f8;
  --green: #bbffbb;

  --font-display: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-logo: 'Helvetica Now Display', -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: 'EP Kaisho', 'Space Mono', 'SF Mono', Menlo, monospace;

  --sidebar-width: 280px;
  --ticker-height: 20px;

  /* Référence de design (grille, node Figma 2:13) : largeur/hauteur de la
     zone de contenu (frame 1920px - menu 128px), utilisées pour convertir
     les coordonnées Figma en % dans script.js */
  --grid-design-w: 1792;
  --grid-design-h: 1519;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-display);
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }

/* ---------- Layout ---------- */
.page {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  align-items: start;
  min-height: 100vh;
  padding-bottom: var(--ticker-height);
}

/* ---------- Sidebar (logo + nav), sticky ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px 10px;
  overflow-y: auto;
}

.logo {
  font-family: var(--font-logo);
  font-weight: 400;
  font-size: clamp(28px, 3.2vw, 46px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 28px 0;
  white-space: nowrap;
}

.site-nav {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.9;
}

.nav-item { margin-bottom: 0; }

/* Items N-1 (DESIGN, MUSIC, FONTS, TOOLS) : toujours en majuscules,
   pas de glyphe +/- (le Figma n'en affiche pas, seuls les sous-items
   sont préfixés par le glyphe └─) */
.nav-link {
  display: block;
  margin: 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.3;
}

.nav-link:hover { text-decoration: underline; }

/* Sous-menus toujours déployés (plus de toggle) */
.sub-nav {
  margin-top: 2px;
}

/* Sous-items : pas de majuscules, précédés du glyphe └─, interlignage
   resserré par rapport au 1.9 hérité de .site-nav */
.sub-nav li a {
  display: block;
  padding-left: 2px;
  text-transform: none;
  line-height: 1.3;
}

.tree-glyph {
  display: inline-block;
  width: 18px;
}

/* ---------- Content grid ---------- */
.content {
  padding: 12px 40px 60px 0;
}

/* Grille en positionnement absolu, fidèle au node Figma 2:13 :
   chaque bloc a ses x/y/w/h calculés en % (voir --grid-design-w/h et
   script.js) à l'intérieur de ce conteneur, dont la hauteur suit la
   largeur grâce à aspect-ratio pour rester responsive. */
.content-grid {
  position: relative;
  width: 100%;
  aspect-ratio: var(--grid-design-w) / var(--grid-design-h);
}

.grid-block {
  position: absolute;
  background: var(--grey-block);
  overflow: hidden;
}

.grid-block video,
.grid-block img,
.grid-block svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* lottie-web injecte un <svg> directement dans le bloc */
.grid-block svg {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.grid-block[data-loaded="true"] video,
.grid-block[data-loaded="true"] img,
.grid-block[data-loaded="true"] svg {
  opacity: 1;
}

/* Loader affiché tant que la vidéo/image/lottie n'est pas prête
   (voir addLoader() dans script.js) */
.block-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.35);
  animation: loader-pulse 1.1s ease-in-out infinite;
}

@keyframes loader-pulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.8; }
}

@media (prefers-reduced-motion: reduce) {
  .block-loader { animation: none; }
}

/* ---------- Ticker ---------- */
.ticker {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--ticker-height);
  background: var(--green);
  overflow: hidden;
  z-index: 10;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  animation: scroll-left 28s linear infinite;
}

/* Chaque groupe est rempli en JS (buildTicker(), script.js) avec assez
   de répétitions pour dépasser la largeur d'écran ; les deux groupes
   ont donc la même largeur, ce qui rend la boucle -50% seamless. */
.ticker-group {
  display: flex;
  flex-shrink: 0;
}

.ticker-item {
  font-family: var(--font-display);
  font-size: 10px;
  padding-right: 4px;
  white-space: nowrap;
}

@keyframes scroll-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ---------- Bandeau "Coming soon" (mobile uniquement) ---------- */
.mobile-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  display: none; /* réactivé en dessous de 900px */
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: translateY(-100%);
  transition: transform 0.5s ease;
  pointer-events: none;
}

.mobile-banner.is-open {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .mobile-banner { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .mobile-banner {
    display: flex;
  }

  .page {
    grid-template-columns: 1fr;
  }

  /* Logo + nav repassent en flux normal au-dessus de la grille (au lieu
     de la sidebar collée à gauche) : mêmes marges gauche/droite que le
     contenu en dessous, pour que tout s'aligne (voir node Figma
     5:341 — logo, nav, un grand blanc, puis les blocs empilés). */
  .sidebar {
    position: relative;
    height: auto;
    padding: 20px 20px 0 20px;
    overflow: visible;
  }

  .content {
    padding: 0 20px 60px 20px;
  }

  /* Sous 900px, la grille pixel-perfect n'a plus de sens : on repasse
     les blocs en flux normal, empilés dans l'ordre du DOM, avec un
     grand espace blanc au-dessus (cf. Figma) pour séparer la nav des
     médias. */
  .content-grid {
    position: static;
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-top: 56px;
  }
  .grid-block {
    /* relative, pas static : le bloc doit rester le repère de
       positionnement pour son média (video/img/svg) et son loader,
       qui sont eux-mêmes en position: absolute; inset: 0 — en
       "static" ils s'échappaient et se plaquaient par rapport à
       toute la page au lieu de rester dans leur cadre. */
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 337 / 449;
  }
}
