/* ════════════════════════════════════════════════════════════════
   DESIGN TOKENS  — aligned with intro.css
════════════════════════════════════════════════════════════════ */
:root {
  --of-red:     #e2001a;
  --bg:         #111111;
  --bg-glass:   rgba(17,17,17,.96);
  --text:       rgba(255,255,255,.92);
  --text-muted: rgba(255,255,255,.52);
  --text-dim:   rgba(255,255,255,.35);
  --border:     rgba(255,255,255,.13);
  --border-dim: rgba(255,255,255,.08);
}

/* ════════════════════════════════════════════════════════════════
   BASE
════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0f0f10;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  color: var(--text);
}

canvas { display: block; cursor: grab; }
canvas:active { cursor: grabbing; }

/* ════════════════════════════════════════════════════════════════
   LOADING OVERLAY  (#ov)
════════════════════════════════════════════════════════════════ */
#ov {
  position: fixed; inset: 0;
  display: flex; justify-content: center; align-items: stretch;
  background: #0f0f10;
  z-index: 9999;
  transition: opacity .5s ease;
}
#ov.done { opacity: 0; pointer-events: none; }

#ov-card {
  width: 100%; max-width: 480px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(18px, 5vw, 28px);
  padding: 40px clamp(24px, 8vw, 36px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

#ov-label {
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

#ov-title {
  font-size: clamp(18px, 5.5vw, 24px);
  font-weight: 900; line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--text);
  text-align: center;
}

#ov-bar-track {
  width: 100%; max-width: 280px; height: 3px;
  background: var(--border);
  border-radius: 2px; overflow: hidden;
}

#ov-bar {
  height: 100%; width: 0%;
  background: var(--of-red);
  border-radius: 2px;
  transition: width .25s ease;
}

#ov-sub {
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
}

/* ════════════════════════════════════════════════════════════════
   HUD
════════════════════════════════════════════════════════════════ */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 20px 28px;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  pointer-events: none; z-index: 10;
  display: flex; align-items: center; gap: 14px;
}
#hud h1 {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}

#btn-scene-back,
#btn-credits {
  background: none; border: none;
  color: #fff;
  line-height: 1;
  cursor: pointer; pointer-events: auto;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity .15s;
  flex-shrink: 0;
}
#btn-scene-back { font-size: 22px; }
#btn-credits    { font-size: 20px; }

#btn-scene-back:hover,
#btn-credits:hover  { opacity: .7; }
#btn-scene-back:active,
#btn-credits:active { opacity: .5; }

#hint {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  pointer-events: none; z-index: 10;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   HOTSPOT LABELS
════════════════════════════════════════════════════════════════ */
.hotspot-label {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: opacity 0.2s ease;
}
.hotspot-label .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--of-red);
  box-shadow: 0 0 0 3px rgba(226,0,26,.25);
  animation: pulse 2.4s ease-in-out infinite;
}
.hotspot-label .tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text);
  background: var(--bg-glass); backdrop-filter: blur(8px);
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border-dim);
  white-space: nowrap;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(226,0,26,.25); }
  50%       { box-shadow: 0 0 0 8px rgba(226,0,26,0);  }
}

/* ════════════════════════════════════════════════════════════════
   POPUP PANEL (bottom drawer)
════════════════════════════════════════════════════════════════ */
#popup-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
#popup-backdrop.visible { opacity: 1; pointer-events: auto; }

#popup-panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 501;
  background: transparent;
  border-radius: 16px 16px 0 0;
  max-height: 92vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#popup-panel.open { transform: translateY(0); }

#popup-header-above,
#popup-object-img-wrap,
#popup-content {
  background: var(--bg);
}

#popup-topbar {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  flex-shrink: 0;
  height: 52px;
  position: relative;
  border-radius: 16px 16px 0 0;
  background: transparent;
}
#popup-topbar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 22%;
  height: 100%;
  background: var(--bg);
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 16px 0 0;
}

#popup-close {
  background: none; border: none;
  color: #fff;
  font-size: 26px; line-height: 1;
  cursor: pointer;
  padding: 0 22px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
#popup-close:hover { opacity: .6; }

#popup-object-img-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  flex-shrink: 0;
  height: clamp(160px, 44vw, 220px);
  background: #1a1a1a;
}

/* blurred background layer */
#popup-blur-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.6);
  transform: scale(1.1);
  z-index: 0;
}

#popup-object-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

#popup-content {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 20px 20px calc(28px + env(safe-area-inset-bottom, 0px));
}
#popup-content::-webkit-scrollbar { display: none; }

#popup-header-above {
  padding: 14px 20px 14px;
  flex-shrink: 0;
}

#popup-tag {
  display: none;
}

#popup-title {
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 900; line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--of-red);
  margin-bottom: 0;
}

#popup-description {
  font-size: clamp(13px, 3.8vw, 15px);
  font-weight: 400; line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 24px;
}

#popup-article-btn {
  display: block;
  margin-top: 20px;
  padding: 14px 16px;
  background: #e2001a;
  border: 2px solid var(--of-red);
  border-radius: 4px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  text-decoration: none;
  transition: background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
#popup-article-btn:hover  { background: #ff021f; }
#popup-article-btn:active { background: #ff021f; }

/* ════════════════════════════════════════════════════════════════
   CREDITS BOTTOM SHEET
════════════════════════════════════════════════════════════════ */
#credits-backdrop {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
#credits-backdrop.visible { opacity: 1; pointer-events: auto; }

#credits-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 801;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  max-height: 88vh;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
#credits-sheet.open { transform: translateY(0); }

#credits-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 16px 0;
  flex-shrink: 0;
}
#credits-close-btn {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 24px; line-height: 1;
  cursor: pointer; padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color .15s;
}
#credits-close-btn:hover { color: var(--text); }

#credits-inner {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: clamp(20px, 5vw, 28px) clamp(20px, 5vw, 28px) calc(clamp(24px, 6vw, 36px) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  align-items: stretch;
  gap: clamp(16px, 4.5vw, 22px);
}
#credits-inner::-webkit-scrollbar { display: none; }

#credits-title {
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 900; line-height: 1.04;
  letter-spacing: -.02em;
  color: var(--of-red);
}

#credits-hyblab {
  background: #fff;
  border-radius: 10px;
  padding: clamp(14px, 4vw, 20px) clamp(20px, 6vw, 32px);
  display: flex; align-items: center; justify-content: center;
}
#credits-hyblab img {
  width: clamp(110px, 40vw, 160px);
  height: auto; display: block;
}

#credits-team {
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 400; line-height: 1.7;
  color: var(--text-muted);
  text-align: center;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: clamp(12px, 3.5vw, 16px) clamp(14px, 4vw, 20px);
}

#credits-partners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.5vw, 12px);
}
.credits-partner-cell:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 50%;
  margin: 0 auto;
  width: 100%;
}
.credits-partner-cell {
  background: #fff;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: clamp(10px, 3vw, 14px);
  display: flex; align-items: center; justify-content: center;
  min-height: clamp(52px, 14vw, 68px);
}
.credits-partner-cell img {
  max-width: 100%;
  max-height: clamp(30px, 8vw, 42px);
  height: auto; object-fit: contain; display: block;
}

#credits-bottom-logos {
  display: flex;
  align-items: center; justify-content: center;
  gap: clamp(8px, 2.5vw, 12px);
}
.credits-bottom-cell {
  background: #fff;
  border-radius: 8px;
  padding: clamp(10px, 3vw, 14px) clamp(14px, 4vw, 20px);
  display: flex; align-items: center; justify-content: center;
}
.credits-bottom-cell img {
  height: clamp(28px, 7vw, 38px);
  width: auto;
  display: block;
  object-fit: contain;
}

/* ════════════════════════════════════════════════════════════════
   PROGRESS COUNTER (in HUD)
════════════════════════════════════════════════════════════════ */
#progress-counter {
  font-size: clamp(13px, 3.8vw, 16px);
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  pointer-events: none;
  flex-shrink: 0;
  line-height: 1;
}
#progress-found {
  color: var(--of-red);
  font-size: clamp(16px, 4.5vw, 20px);
}

/* ════════════════════════════════════════════════════════════════
   COMPLETION SHEET
════════════════════════════════════════════════════════════════ */
#completion-backdrop {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
#completion-backdrop.visible { opacity: 1; pointer-events: auto; }

#completion-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 1101;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--border);
  max-height: 92vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#completion-sheet.open { transform: translateY(0); }

#completion-topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-shrink: 0;
  height: 52px;
  position: relative;
  border-radius: 16px 16px 0 0;
  background: transparent;
}
#completion-topbar::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 22%; height: 100%;
  background: var(--bg);
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 16px 0 0;
}
#completion-back,
#completion-close {
  background: none; border: none;
  color: #fff; line-height: 1;
  cursor: pointer; padding: 0 20px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
  position: relative; z-index: 1;
  display: flex; align-items: center;
}
#completion-back  { font-size: 22px; }
#completion-close { font-size: 26px; }
#completion-back:hover,
#completion-close:hover { opacity: .6; }

#completion-inner {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: clamp(20px,5vw,28px) clamp(20px,5vw,28px)
           calc(clamp(24px,6vw,36px) + env(safe-area-inset-bottom,0px));
  display: flex; flex-direction: column;
  gap: clamp(14px,4vw,20px);
}
#completion-inner::-webkit-scrollbar { display: none; }

#completion-title {
  font-size: clamp(26px,8vw,36px);
  font-weight: 900; line-height: 1.06;
  letter-spacing: -.02em;
  color: var(--of-red);
}

#completion-body,
#completion-body2 {
  font-size: clamp(13px,3.8vw,15px);
  font-weight: 400; line-height: 1.55;
  color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════════════
   COMPLETION LINK BUTTONS — branded
════════════════════════════════════════════════════════════════ */
#completion-links {
  display: flex; flex-direction: column;
  gap: clamp(10px,3vw,14px);
  margin-top: 4px;
}

.completion-link-btn {
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  padding: clamp(14px,4vw,18px) clamp(16px,5vw,24px);
  text-decoration: none;
  transition: filter .15s, transform .12s;
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: #333; /* fallback */
}
.completion-link-btn:hover  { filter: brightness(1.08); }
.completion-link-btn:active { transform: scale(.97); filter: brightness(.95); }

/* Ouest-France — rouge */
.completion-link-btn#completion-btn-of {
  background: #ff021f;
  border: none;
}
.completion-link-btn#completion-btn-of img {
  filter: brightness(0) invert(1);
}

/* Jmail — bleu nuit */
.completion-link-btn#completion-btn-jmail {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.completion-link-btn img {
  height: clamp(22px,6vw,32px);
  width: auto; display: block;
  object-fit: contain;
  max-width: 180px;
}

/* ════════════════════════════════════════════════════════════════
   POPUP IFRAME (video embed)
════════════════════════════════════════════════════════════════ */
#popup-iframe-wrap {
  display: none;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
  flex-shrink: 0;
}
#popup-iframe {
  width: 100%; height: 100%;
  border: none; display: block;
}

/* progress counter becomes tappable after completion */
#progress-counter[style*="pointer"] {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--of-red);
}