/* Visite 3D de la mosquée Arrahma : polices et couleurs du site. */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../assets/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap;
  src: url("../assets/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../assets/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../assets/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Amiri"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../assets/fonts/amiri-arabic-400-normal.woff2") format("woff2"); }

:root {
  --deep: #0c2218; --forest: #123425; --emerald: #1d5a3f;
  --gold: #c9a14b; --gold-2: #e6c77f; --gold-deep: #9a7730;
  --cream: #f7f2e7; --paper: #fffdf8; --sand: #efe6d3; --line: #e4d9c2;
  --ink: #14201a; --muted: #66746b;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ombre: 0 8px 26px rgba(7, 21, 14, .12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 15px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
[lang="ar"] { font-family: "Amiri", serif; letter-spacing: 0; text-transform: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  font: inherit; cursor: pointer; color: inherit; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px;
  transition: background .2s, border-color .2s, color .2s;
}
button:hover { background: var(--sand); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* En-tête et pied (visite ouverte seule, en plein écran) */
.entete { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--paper); }
.marque { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.marque > span { display: grid; gap: 5px; font: 600 1.4rem/1 var(--display); color: var(--deep); }
.marque small { font: 700 .66rem/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.marque small [lang="ar"] { font-size: .9rem; color: var(--gold-deep); }
.accroche { font-size: .85rem; color: var(--muted); }
.entete button { font-size: .8rem; font-weight: 700; }
footer { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--line); }
footer b { margin: 0 8px; color: var(--gold); }
footer button { font-size: .75rem; border: 0; font-weight: 700; color: var(--deep); }

/* La scène occupe tout l'espace ; l'étape, les étapes et les commandes
 * flottent par-dessus, en verre vert sombre. */
main { height: calc(100dvh - 76px - 56px); min-height: 520px; padding: 14px; }
.viewer { position: relative; height: 100%; overflow: hidden; border-radius: 22px; background: #d4d9d0; box-shadow: 0 30px 60px -40px rgba(7, 21, 14, .5); isolation: isolate; }
#scene { position: absolute; inset: 0; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#error { position: absolute; top: 35%; left: 10%; right: 10%; padding: 24px; background: var(--paper); border-radius: 16px; z-index: 3; }

.fiche, .view-top > *, #stops, .controls .rond {
  background: rgba(10, 30, 21, .74); color: #f3eee2; border: 1px solid rgba(230, 199, 127, .22);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .55);
}
.rond { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 1.05rem; line-height: 1; }
.rond svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.viewer button:hover { background: rgba(18, 52, 37, .9); border-color: rgba(230, 199, 127, .5); }

/* La fiche de l'étape */
.fiche { position: absolute; z-index: 2; top: 16px; left: 16px; width: min(380px, calc(100% - 32px)); max-height: calc(100% - 112px); display: flex; flex-direction: column; padding: 16px 16px 16px 20px; border-radius: 18px; }
.fiche__tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fiche__titres { min-width: 0; }
.fiche .eyebrow { color: var(--gold-2); }
.fiche h2 { margin: 6px 0 0; font: 600 1.7rem/1.08 var(--display); color: #fff; }
.fiche__plier { flex: none; width: 34px; height: 34px; background: rgba(255, 255, 255, .06); border-color: rgba(230, 199, 127, .3); }
.fiche__plier svg { transition: transform .3s; }
.fiche.is-pliee .fiche__plier svg { transform: rotate(180deg); }
.fiche__corps { margin-top: 10px; overflow: auto; scrollbar-width: thin; }
.fiche.is-pliee .fiche__corps { display: none; }
.fiche p { margin: 0 0 10px; font-size: .86rem; line-height: 1.7; color: rgba(243, 238, 226, .78); }
#photo { padding: 4px 0; border: 0; border-bottom: 1px solid var(--gold); border-radius: 0; font-size: .76rem; font-weight: 700; color: var(--gold-2); background: none; }
#photo:hover { background: none; color: #fff; }
.detail-views { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.detail-views button, .detail-views a { padding: 7px 12px; border-radius: 999px; font-size: .72rem; font-weight: 600; text-decoration: none; color: #f3eee2; background: rgba(255, 255, 255, .06); border: 1px solid rgba(230, 199, 127, .28); }
.detail-views a { border-color: transparent; background: none; text-decoration: underline; text-underline-offset: 3px; color: var(--gold-2); }

/* En haut à droite : le lieu, la vue d'ensemble, le plein écran */
.view-top { position: absolute; z-index: 2; top: 16px; right: 16px; display: flex; align-items: center; gap: 8px; }
.view-top .pill { display: inline-flex; align-items: center; gap: 9px; padding: 11px 15px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 0 4px rgba(230, 199, 127, .2); }
#overview { padding: 11px 16px; font-size: .76rem; font-weight: 700; }

/* En bas : les six étapes, puis les commandes de déplacement */
.bas { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; pointer-events: none; }
.bas > * { pointer-events: auto; }
#stops { display: flex; gap: 2px; min-width: 0; padding: 5px; border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
#stops::-webkit-scrollbar { display: none; }
#stops button { flex: none; display: inline-flex; align-items: baseline; gap: 8px; padding: 9px 14px; border: 0; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; color: rgba(243, 238, 226, .8); background: none; }
#stops button span { font: 600 .95rem/1 var(--display); color: var(--gold-2); }
#stops button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
#stops button.active { background: linear-gradient(135deg, #e9cb84, var(--gold)); color: var(--deep); }
#stops button.active span { color: var(--deep); }
.controls { flex: none; display: flex; gap: 6px; }
.controls .rond { touch-action: none; user-select: none; -webkit-user-select: none; }

dialog { border: 0; border-radius: 22px; padding: 32px; background: var(--paper); color: var(--ink); max-width: 900px; width: 90vw; max-height: 90dvh; }
dialog::backdrop { background: rgba(7, 21, 14, .66); backdrop-filter: blur(6px); }
#close { float: right; }
dialog h2 { margin: 0 50px 10px 0; font: 600 1.65rem/1.1 var(--display); color: var(--deep); }
dialog img { max-width: 100%; max-height: 65vh; object-fit: contain; display: block; margin: 18px auto; border-radius: 12px; }
dialog p { line-height: 1.75; color: var(--muted); }
dialog a { color: var(--emerald); font-weight: 700; }
.eyebrow { font-size: .66rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-deep); }

/* Intégrée dans une page du site (iframe) : la scène remplit tout le cadre. */
.integre body { background: var(--deep); }
.integre .entete, .integre footer { display: none; }
.integre main { height: 100dvh; min-height: 0; padding: 0; }
.integre .viewer { border-radius: 0; box-shadow: none; }

@media (max-width: 1100px) { .view-top .pill { display: none; } }
@media (max-width: 850px) {
  .entete { height: 64px; padding: 0 16px; }
  .accroche { display: none; }
  footer { display: none; }
  main { height: calc(100dvh - 64px); min-height: 0; padding: 0; }
  .viewer { border-radius: 0; }
  .bas { flex-direction: column; align-items: stretch; gap: 10px; left: 10px; right: 10px; bottom: 10px; }
  .controls { order: -1; align-self: flex-end; }
  #stops { border-radius: 18px; }
  .fiche { top: 62px; left: 10px; right: 10px; width: auto; max-height: calc(100% - 200px); padding: 12px 12px 12px 16px; }
  .fiche h2 { font-size: 1.35rem; }
  .view-top { top: 10px; right: 10px; }
  #overview { padding: 10px 14px; }
}
