/* Habillage de visite Matterport — les couleurs viennent de visite.json (variables CSS). */
:root {
  --accent: #f1885f;      /* corail */
  --ink: #1d1b1b;         /* textes forts */
  --text: #7b7979;        /* gris chaud */
  --cream: #f4f2ed;       /* fond crème */
  --line: rgba(29, 27, 27, .12);
  --bar-h: 64px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; font-family: var(--font-body, Montserrat, Arial, sans-serif); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
.script { font-family: var(--font-script, "Oooh Baby", cursive); color: var(--accent); text-transform: var(--script-transform, none); letter-spacing: var(--script-spacing, normal); }

/* ---------- barre supérieure ---------- */
.topbar {
  position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: env(safe-area-inset-top, 0px) max(clamp(14px, 4vw, 56px), env(safe-area-inset-right, 0px)) 0 max(clamp(14px, 4vw, 56px), env(safe-area-inset-left, 0px));
  background: rgba(244, 242, 237, .96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button { -webkit-tap-highlight-color: transparent; color: inherit; }
.menu-btn { justify-self: start; display: flex; align-items: center; gap: 14px; background: none; border: 0; padding: 8px 0; color: var(--ink); }
.burger { display: grid; gap: 6px; width: 30px; }
.burger i { display: block; height: 1px; background: var(--ink); transition: transform .35s var(--ease), width .35s var(--ease); }
.burger i:nth-child(2) { width: 70%; justify-self: end; }
.menu-btn:hover .burger i:nth-child(2) { width: 100%; }
.menu-label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
/* option menuButton : mot « MENU » à la place du pictogramme (toutes tailles d'écran) */
.menu-btn--text .burger { display: none; }
.menu-btn--text .menu-label { display: inline !important; font-size: 13px; letter-spacing: .22em; padding: 4px 0; border-bottom: 1px solid currentColor; transition: color .25s; }
@media (hover: hover) { .menu-btn--text:hover { color: var(--accent); } }
@media (max-width: 360px) { .menu-btn--text .menu-label { font-size: 11px; letter-spacing: .16em; } }
.brand { display: block; line-height: 0; }
.brand img { height: 40px; width: auto; }
.top-links { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.top-links a { color: var(--ink); text-decoration: none; font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid currentColor; padding-bottom: 1px; transition: color .25s; }
.top-links a:hover { color: var(--accent); }

/* ---------- visite ---------- */
.stage { position: fixed; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0; bottom: 0; }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.veil {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--cream); opacity: 0; pointer-events: none; transition: opacity .6s var(--ease);
}
.veil.on { opacity: 1; pointer-events: auto; }
.veil-mark { width: min(260px, 60vw); filter: brightness(0); opacity: .55; }
.veil .script { font-size: calc(34px * var(--script-scale, 1)); }

/* étiquette « Visite guidée » posée au-dessus du bouton lecture de Matterport (non cliquable :
   le bouton est dans l'iframe ; la pointe vise son centre : 67 px sur ordinateur, 28 px sur mobile) */
.tour-label {
  --x: 67px;
  position: absolute; z-index: 1; left: calc(var(--x) - 22px); bottom: 66px; pointer-events: none;
  opacity: 0; transform: translateY(6px); transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.tour-label.on { opacity: 1; transform: none; animation: nudge 2.6s var(--ease) 1s infinite; }
.tour-label span {
  display: block; background: var(--accent); color: #fff; padding: 6px 12px 6px 12px; white-space: nowrap;
  font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.tour-label::after { /* pointe vers le bouton */
  content: ""; position: absolute; left: 16px; bottom: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--accent);
}
@keyframes nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-4px); } 90% { transform: translateY(1px); } }
/* Matterport passe en barre compacte (bouton lecture à 28 px, sans flèches) sous 768 px de large */
@media (max-width: 767px) { .tour-label { --x: 28px; } }

/* ---------- bandeau lieu précédent / suivant (sous la visite) ---------- */
body.has-nav { --nav-h: 52px; }
body.has-nav .stage { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
.tour-nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h, 52px) + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 max(clamp(10px, 4vw, 56px), env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(clamp(10px, 4vw, 56px), env(safe-area-inset-left, 0px));
  background: rgba(244, 242, 237, .97); border-top: 1px solid var(--line);
}
.tour-nav[hidden] { display: none; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 10px 4px; color: var(--ink);
  font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; transition: color .25s, gap .35s var(--ease);
}
.nav-btn.prev { justify-self: start; }
.nav-btn.next { justify-self: end; }
.nav-arrow { color: var(--accent); font-size: 26px; font-weight: 300; line-height: 0; position: relative; top: -2px; letter-spacing: 0; }
@media (hover: hover) { .nav-btn:hover { color: var(--accent); gap: 14px; } }
.nav-btn:active { color: var(--accent); }
.nav-pos { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 0 8px; text-align: center; }
.pos-title { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.pos-num { font-size: 10px; letter-spacing: .14em; color: var(--text); }
@media (max-width: 420px) { .nav-btn { gap: 7px; letter-spacing: .14em; } .pos-title { font-size: 10px; max-width: 40vw; } }

/* ---------- écran d'accueil ---------- */
.intro { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; transition: opacity .9s var(--ease), visibility .9s; }
.intro.gone { opacity: 0; visibility: hidden; }
.intro-bg { position: absolute; inset: 0; background: #222 center/cover no-repeat; transform: scale(1.04); animation: drift 18s var(--ease) forwards; }
.intro-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,.25) 70%), linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.1) 40%, rgba(0,0,0,.5)); }
@keyframes drift { to { transform: scale(1); } }
.intro-inner { position: relative; padding: 24px; max-width: 720px; animation: rise 1.2s var(--ease) both .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.intro-mark { width: min(300px, 64vw); display: block; margin: 0 auto 6px; }
.intro-mark[hidden] { display: none; }
.intro-logo { width: min(420px, 80vw); display: block; margin: 0 auto; filter: var(--logo-light-filter, none); }
.intro-script { font-size: calc(clamp(34px, 6vw, 52px) * var(--script-scale, 1)); margin: 18px 0 4px; }
.intro-text { font-size: 14px; line-height: 1.7; font-weight: 300; letter-spacing: .02em; max-width: 520px; margin: 0 auto 30px; color: rgba(255,255,255,.9); }
.enter {
  background: none; border: 1px solid rgba(255,255,255,.75); color: #fff; padding: 16px 38px;
  font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; transition: background .35s var(--ease), border-color .35s, color .35s;
}
.enter:hover { background: var(--accent); border-color: var(--accent); }
.play-icon { display: none; }
/* accueil vidéo (option intro.video) : vidéo plein écran + gros bouton lecture au centre */
.intro-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.intro--video .intro-bg { animation: none; transform: none; }
.intro--video .intro-bg::after { background: radial-gradient(ellipse at center, rgba(0,0,0,.42), rgba(0,0,0,.12) 65%), linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,0) 30%, rgba(0,0,0,.35)); }
.intro--video .intro-mark, .intro--video .intro-logo, .intro--video .intro-script, .intro--video .intro-text { display: none; }
.intro--video .enter {
  display: flex; flex-direction: column; align-items: center; gap: 18px; border: 0; padding: 0; background: none;
  font-size: clamp(13px, 1.6vw, 17px); letter-spacing: .22em; text-shadow: 0 2px 14px rgba(0,0,0,.6);
}
.intro--video .play-icon {
  display: block; position: relative; width: clamp(96px, 13vw, 150px); aspect-ratio: 1; border-radius: 50%;
  background: var(--accent); box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 0 0 0 rgba(255,255,255,.55);
  transition: transform .35s var(--ease); animation: pulse 2.4s var(--ease) infinite;
}
.intro--video .play-icon::after { /* triangle lecture, légèrement décalé à droite pour paraître centré */
  content: ""; position: absolute; left: 54%; top: 50%; transform: translate(-50%, -50%);
  border-style: solid; border-width: calc(clamp(96px, 13vw, 150px) * .19) 0 calc(clamp(96px, 13vw, 150px) * .19) calc(clamp(96px, 13vw, 150px) * .31);
  border-color: transparent transparent transparent #fff;
}
@keyframes pulse { 0% { box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 0 0 0 rgba(255,255,255,.5); } 70%, 100% { box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 0 0 26px rgba(255,255,255,0); } }
.intro--video #enter-label { background: rgba(0,0,0,.42); padding: 9px 18px 9px 20px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.intro--video .enter:hover { background: none; }
@media (hover: hover) { .intro--video .enter:hover .play-icon { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .intro--video .play-icon { animation: none; } }
.intro-credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.made-by { margin: 22px 0 6px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.made-by a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
@media (hover: hover) { .made-by a:hover { color: var(--accent); } }
a.tag-item { display: block; text-decoration: none; }
.intro-credits { position: absolute; bottom: 14px; left: 0; right: 0; margin: 0; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }

/* ---------- menu d'accès rapide ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(20,18,18,.35); opacity: 0; visibility: hidden; transition: opacity .45s var(--ease), visibility .45s; }
.scrim.on { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(420px, 100vw);
  background: var(--cream); display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .55s var(--ease); box-shadow: 20px 0 60px rgba(0,0,0,.18);
}
.drawer.on { transform: none; }
.drawer-head { position: relative; padding: calc(34px + env(safe-area-inset-top, 0px)) 34px 18px; border-bottom: 1px solid var(--line); }
.drawer-foot { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)) !important; }
.drawer-script { font-size: calc(34px * var(--script-scale, 1)); line-height: 1; }
.drawer-title { margin: 6px 0 0; font-weight: 400; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.close { position: absolute; top: calc(18px + env(safe-area-inset-top, 0px)); right: 20px; width: 40px; height: 40px; border: 0; background: none; font-size: 30px; font-weight: 300; color: var(--ink); transition: transform .35s var(--ease), color .25s; }
.close:hover { transform: rotate(90deg); color: var(--accent); }
.tag-list { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 8px 34px 24px; scrollbar-width: thin; }
.cat { margin-top: 22px; }
.cat-name { font-size: 10px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }
.tag-item {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 13px 0 13px; color: var(--ink); position: relative; transition: padding .35s var(--ease);
  opacity: 0; transform: translateX(-10px);
}
.drawer.on .tag-item { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .5s var(--ease), padding .35s var(--ease); transition-delay: calc(var(--i) * 30ms + 150ms), calc(var(--i) * 30ms + 150ms), 0s; }
.tag-item::before { content: ""; position: absolute; left: 0; top: 50%; width: 0; height: 1px; background: var(--accent); transition: width .35s var(--ease); }
.tag-item:hover, .tag-item:focus-visible { padding-left: 26px; outline: none; }
.tag-item:hover::before, .tag-item:focus-visible::before { width: 16px; }
.tag-item.active { padding-left: 26px; }
.tag-item.active::before { width: 16px; }
.tag-title { display: block; font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.tag-sub { display: block; margin-top: 3px; font-size: 12px; font-weight: 300; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-foot { padding: 16px 34px 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid currentColor; }
.link-btn:hover { color: var(--accent); }

@media (max-width: 720px) {
  :root { --bar-h: 56px; }
  .menu-label { display: none; }
  .brand img { height: 30px; max-width: 44vw; object-fit: contain; } /* logos très larges (ex. CEM 6,5:1) : ne touchent pas les liens */
  .topbar { column-gap: 10px; }
  .top-links a:not(:first-child) { display: none; }
  /* smartphone : le menu occupe la moitié de l'écran, la visite reste visible à droite */
  .drawer { width: 50vw; min-width: 170px; }
  .drawer-head, .tag-list, .drawer-foot { padding-left: 14px; padding-right: 12px; }
  .drawer-head { padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-bottom: 12px; }
  .drawer-script { font-size: calc(25px * var(--script-scale, 1)); }
  .drawer-title { font-size: 12px; letter-spacing: .06em; }
  .close { top: calc(6px + env(safe-area-inset-top, 0px)); right: 2px; width: 34px; height: 34px; font-size: 24px; }
  .cat { margin-top: 16px; }
  .cat-name { font-size: 9px; letter-spacing: .14em; }
  .tag-item { padding: 9px 0; }
  .tag-item:hover, .tag-item:focus-visible, .tag-item.active { padding-left: 14px; }
  .tag-item:hover::before, .tag-item:focus-visible::before, .tag-item.active::before { width: 9px; }
  .tag-title { font-size: 11px; letter-spacing: .04em; line-height: 1.35; }
  .tag-sub { font-size: 10px; margin-top: 2px; }
  .drawer-foot { flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 12px; }
  .link-btn { font-size: 10px; }
}

/* ---------- consentement cookies (mesure d'audience, mesure.js) ---------- */
.consent {
  position: fixed; z-index: 80; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(560px, calc(100% - 24px));
  transform: translate(-50%, 16px); opacity: 0; visibility: hidden; transition: opacity .45s var(--ease), transform .45s var(--ease), visibility .45s;
  background: var(--cream); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0,0,0,.28);
  padding: 18px 20px; display: flex; align-items: center; gap: 18px;
}
.consent.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.consent p { margin: 0; font-size: 12px; line-height: 1.55; color: var(--text); }
.consent a { color: var(--ink); }
.consent-btns { display: flex; gap: 8px; flex-shrink: 0; }
.consent button {
  padding: 10px 16px; font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  border: 1px solid var(--ink); background: transparent; color: var(--ink); transition: background .25s, color .25s, border-color .25s;
}
.consent .consent-accept { background: var(--ink); color: #fff; }
@media (hover: hover) { .consent button:hover { background: var(--accent); border-color: var(--accent); color: #fff; } }
@media (max-width: 600px) {
  .consent { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .consent-btns button { flex: 1; }
}
.drawer-foot .cookies-btn { opacity: .7; }

@media (max-height: 500px) { /* téléphone à l'horizontale */
  .intro { overflow-y: auto; }
  .intro-inner { padding: 12px 24px; }
  .intro-mark { display: none !important; }
  .intro-logo { width: min(230px, 34vw); }
  .intro-script { font-size: calc(28px * var(--script-scale, 1)); margin: 4px 0 2px; }
  .intro-text { font-size: 12px; line-height: 1.5; margin-bottom: 12px; }
  .enter { padding: 11px 28px; }
  .intro-credits { bottom: 6px; font-size: 9px; }
  body.has-nav { --nav-h: 40px; }
  .nav-btn { padding: 6px 4px; }
  .nav-pos { flex-direction: row; gap: 10px; align-items: baseline; }
}
@media (max-width: 360px) { /* très petits écrans : logo réduit pour ne pas toucher le menu */
  .brand img { height: 22px; max-width: 40vw; }
  .burger { width: 24px; }
  .top-links a { font-size: 10px; letter-spacing: .03em; }
  .topbar { column-gap: 8px; }
}
