@font-face {
  font-family: "Hanken Grotesk";
  src: url("../vendor/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../vendor/fonts/hanken-grotesk-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../vendor/fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../vendor/fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --gz-noir: #181818;
  --gz-or1: #D0A05E;
  --gz-or2: #FBAE40;
  --gz-or3: #917146;
  --gz-orange: #F26B43;
  --gz-blanc: #FFFFFF;
  --gz-gris-card: #3A3A3A;
  --gz-gris-mid: #7A7A7A;

  /* One sans-serif family throughout; titles are set apart by weight, not
     by a second typeface. */
  --font-body: "Hanken Grotesk", "HK Grotesk", Calibri, "Segoe UI", Arial, sans-serif;
  --font-title: var(--font-body);

  /* ---- Thème (par défaut : sombre) ---- */
  --ui-bg-image: url("../assets/brand/background-dark.jpg");
  --ui-text: var(--gz-blanc);
  --ui-text-dim: rgba(255,255,255,0.55);
  --ui-surface: rgba(24,24,24,0.55);
  --ui-surface-strong: rgba(24,24,24,0.75);
  --ui-border: rgba(145,113,70,0.4);
  --ui-topbar-fade: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
}

:root[data-theme="light"] {
  --ui-bg-image: url("../assets/brand/background-light.jpg");
  --ui-text: var(--gz-noir);
  --ui-text-dim: rgba(24,24,24,0.55);
  --ui-surface: rgba(255,255,255,0.6);
  --ui-surface-strong: rgba(255,255,255,0.85);
  --ui-border: rgba(145,113,70,0.5);
  --ui-topbar-fade: linear-gradient(to bottom, rgba(255,255,255,0.65), transparent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--gz-noir);
  color: var(--ui-text);
  font-family: var(--font-body);
}

button {
  font-family: inherit;
  cursor: pointer;
}

.hidden { display: none !important; }

/* ---------- Fond de page ---------- */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: var(--ui-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.3s ease;
}

/* ---------- Écran de chargement (toujours en thème sombre, logo dark) ---------- */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--gz-noir);
  transition: opacity 0.7s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: min(320px, 60vw);
  height: auto;
}

.loading-text {
  font-size: 13px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gz-gris-mid);
  /* Both messages share one grid cell so they cross-fade in place and the
     block is as wide as the longer of the two. */
  display: grid;
}

/* Driven entirely by CSS rather than timers: decoding a large .glb blocks the
   main thread for seconds, which freezes setInterval — exactly when the user
   most needs to see that something is happening. Opacity animations keep
   running on the compositor regardless. */
.loading-msg {
  grid-area: 1 / 1;
  justify-self: center;
  white-space: nowrap;
  animation: loading-msg-1 8s steps(1, end) infinite;
}

.loading-msg--2 { animation-name: loading-msg-2; }

@keyframes loading-msg-1 {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@keyframes loading-msg-2 {
  0%, 50% { opacity: 0; }
  50.01%, 100% { opacity: 1; }
}

/* Dots appear one after another (. .. ...) then reset, 0.5s apart. */
.loading-dots > span {
  opacity: 0;
  animation: loading-dot 1.5s steps(1, end) infinite;
}

.loading-dots > span:nth-child(1) { animation-name: loading-dot-1; }
.loading-dots > span:nth-child(2) { animation-name: loading-dot-2; }
.loading-dots > span:nth-child(3) { animation-name: loading-dot-3; }

@keyframes loading-dot-1 { 0%, 100% { opacity: 1; } }
@keyframes loading-dot-2 { 0%, 33.32% { opacity: 0; } 33.33%, 100% { opacity: 1; } }
@keyframes loading-dot-3 { 0%, 66.65% { opacity: 0; } 66.66%, 100% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .loading-msg,
  .loading-dots > span { animation: none; }
  .loading-msg--2 { display: none; }
  .loading-dots > span { opacity: 1; }
}

.loading-copyright {
  position: absolute;
  bottom: 24px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gz-gris-mid);
}

/* ---------- Login ---------- */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--gz-noir);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.login-logo { width: min(260px, 55vw); }

/* Same treatment as the login screen: an empty or unreachable project should
   still look like the product, not like a broken page. */
#message-screen {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--gz-noir);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

.message-text {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gz-gris-mid);
  max-width: 34ch;
  line-height: 1.7;
}

.message-link {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gz-or1);
  text-decoration: none;
  border-bottom: 1px solid var(--gz-or3);
  padding-bottom: 3px;
}

.message-link:hover { color: var(--gz-or2); border-color: var(--gz-or2); }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(320px, 85vw);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--gz-gris-mid);
}

.login-field input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--gz-or3);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--gz-blanc);
  font-size: 14px;
  font-family: inherit;
}

.login-field input:focus { outline: none; border-color: var(--gz-or1); }

.login-error { color: #F26B43; font-size: 12.5px; margin: 0; }

.login-submit {
  background: var(--gz-or1);
  color: var(--gz-noir);
  border: none;
  border-radius: 6px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.login-submit:hover { background: var(--gz-or2); }

.logout-link {
  position: fixed;
  bottom: 42px;
  left: 24px;
  z-index: 5;
  background: none;
  border: none;
  color: var(--ui-text-dim);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Header ----------
   Proportions mesurées sur la maquette de référence (canvas 2560x1212) :
   logo height 11.55vh, marge gauche 4.96vw, marge haute 4.29vh,
   écart logo->méta 4.65vw, bloc méta 6.11vh. Le header est ancré en
   haut (pas centré) : FR|EN s'aligne sur le haut du logo, pas son centre. */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  gap: clamp(16px, 4.65vw, 56px);
  padding: clamp(14px, 4.29vh, 50px) clamp(20px, 4.96vw, 60px) 24px;
  background: var(--ui-topbar-fade);
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}

.logo {
  --logo-h: clamp(52px, 11.55vh, 116px);
  height: var(--logo-h);
  width: auto;
  display: block;
  /* Dans le fichier logo, le texte "GROUPE ZEBRA" démarre à 17.66% de la
     hauteur du visuel (la tête du zèbre dépasse au-dessus) : on remonte
     l'image de cette valeur pour que le TEXTE s'aligne avec le bloc
     métadonnées, pas le zèbre. */
  margin-top: calc(var(--logo-h) * -0.1766);
}

.meta {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding-left: clamp(16px, 2vw, 24px);
  margin-left: 4px;
  border-left: 1px solid var(--gz-or3);
  font-size: clamp(11px, 1.7vh, 15px);
  color: var(--ui-text-dim);
  letter-spacing: 0.02em;
  min-width: 0;
}

.meta-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-filename { color: var(--ui-text); font-weight: 600; }

.lang-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.lang-sep { color: var(--ui-text-dim); }

.lang-btn {
  background: none;
  border: none;
  color: var(--ui-text-dim);
  padding: 4px 2px;
}

.lang-btn.active {
  color: var(--gz-or2);
  font-weight: 700;
}

.topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.topbar-btn:hover {
  color: var(--gz-noir);
  background: var(--gz-or1);
}

/* ---------- Theme switch (jour/nuit) ----------
   Maquette : quasi flush au bord droit (0.04vw), centré verticalement
   (51.4% ~ 50%), largeur 1.6vw, hauteur 8.75vh (ratio ~2.67 = viewBox natif). */
.theme-switch {
  position: fixed;
  top: 50%;
  right: clamp(4px, 0.6vw, 10px);
  transform: translateY(-50%);
  z-index: 5;
  --switch-w: clamp(24px, 1.6vw, 40px);
  width: var(--switch-w);
  height: calc(var(--switch-w) * 80 / 30);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--ui-border);
}

.theme-switch-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.theme-switch-zone {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  border: none;
  background: transparent;
  padding: 0;
}

.theme-switch-zone--top { top: 0; }
.theme-switch-zone--bottom { bottom: 0; }

#switchTopBg,
#switchBottomBg,
#switchMoon,
#switchSunCircle,
#switchSunRays {
  transition: fill 0.25s ease, stroke 0.25s ease;
}

#switchTopBg { fill: var(--gz-noir); }
#switchBottomBg { fill: var(--gz-or1); }
#switchMoon { fill: #fff; }
#switchSunCircle { fill: #000; }
#switchSunRays { stroke: #000; }

.theme-switch[data-active="night"] #switchTopBg { fill: var(--gz-or1); }
.theme-switch[data-active="night"] #switchBottomBg { fill: var(--gz-noir); }
.theme-switch[data-active="night"] #switchMoon { fill: #000; }
.theme-switch[data-active="night"] #switchSunCircle { fill: #fff; }
.theme-switch[data-active="night"] #switchSunRays { stroke: #fff; }

/* ---------- Viewer ---------- */
.viewer-wrap {
  position: fixed;
  inset: 0;
  z-index: 2;
}

model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background-color: transparent;
}

.progress-bar {
  display: block;
  width: 40%;
  height: 3px;
  max-width: 200px;
  border-radius: 2px;
  background: rgba(255,255,255,0.15);
  position: absolute;
  left: 30%;
  bottom: 10%;
}

.progress-bar.hide { visibility: hidden; }

.update-bar {
  height: 100%;
  width: 0%;
  background: var(--gz-or2);
  border-radius: 2px;
}

.ar-button {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--gz-or3);
  background: var(--ui-surface-strong);
  color: var(--ui-text);
  font-size: 13px;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
}

.ar-button:hover { background: var(--gz-or1); color: var(--gz-noir); }

#ar-prompt {
  position: absolute;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  display: none;
}

#ar-prompt img { width: 40px; opacity: 0.85; }

/* ---------- Hotspots ---------- */
.Hotspot {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gz-blanc);
  background: var(--gz-or2);
  box-shadow: 0 0 0 4px rgba(251,174,64,0.25);
  cursor: pointer;
  padding: 0;
}

.Hotspot:not([data-visible]) {
  pointer-events: none;
  opacity: 0;
}

.HotspotAnnotation {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: var(--ui-surface-strong);
  border: 1px solid var(--gz-or3);
  color: var(--ui-text);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 5px;
  pointer-events: none;
  /* Visible without hovering: these are annotations meant to be read, not
     tooltips to be discovered. Hover only strengthens them. */
  opacity: 0.82;
  transition: opacity 0.15s ease;
}

.Hotspot:hover .HotspotAnnotation,
.Hotspot:focus .HotspotAnnotation {
  opacity: 1;
}

/* ---------- Hint / footer ---------- */
.hint {
  position: fixed;
  bottom: 18px;
  left: 24px;
  z-index: 5;
  color: var(--ui-text-dim);
  font-size: 12px;
  pointer-events: none;
}

.copyright {
  position: fixed;
  bottom: clamp(12px, 4.13vh, 40px);
  right: clamp(16px, 2.34vw, 50px);
  z-index: 5;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ui-text-dim);
  pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 12px 14px 20px; }
  .logo { --logo-h: clamp(40px, 11.55vh, 60px); }
  .meta { display: none; }
  .lang-switch { font-size: 12px; }
  .theme-switch { right: 8px; --switch-w: 26px; }
  .topbar-btn { width: 30px; height: 30px; }
  .hint { display: none; }
  .copyright { left: 14px; right: auto; bottom: 10px; font-size: 9px; }
}

@media (max-height: 420px) and (orientation: landscape) {
  .topbar { padding-top: 10px; }
  .logo { --logo-h: clamp(36px, 11.55vh, 48px); }
  .theme-switch { --switch-w: 24px; }
}
