@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,600;1,9..144,500&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #100e0c;
  --surface: #1a1613;
  --surface-2: #241f1a;
  --line: #3a332c;
  --text: #f0e9dd;
  --muted: #a89c8b;
  --accent: #b3271c;
  --gold: #c9a24b;
  --font-display: 'Fraunces';
  --font-body: 'Inter';
  --weight-display: 600;
  --weight-body: 400;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  position: relative;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body), sans-serif;
  font-weight: var(--weight-body);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Fond ornemental : deux pièces fixes (toujours visibles à l'écran, quelle que soit
   la position de scroll), une par coin opposé (haut-droite / bas-gauche), derrière
   tout le contenu. translateZ(0)/will-change forcent un rendu accéléré GPU : c'est
   ce qui évite le décrochage/saut des éléments en fixed pendant le scroll sur
   iPhone/Safari (notamment quand la barre d'interface apparaît/disparaît). */
.site-ornament-corner {
  position: fixed;
  width: 320px;
  height: 320px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  animation: ornement-respire 7s ease-in-out infinite;
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.site-ornament-corner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-ornament-corner.top-right { top: 0; right: 0; }
.site-ornament-corner.bottom-left { bottom: 0; left: 0; transform: rotate(180deg) translateZ(0); }

@media (max-width: 640px) {
  .site-ornament-corner { width: 190px; height: 190px; }
}

/* Deux fichiers SVG bien distincts (deux dessins différents, pas juste deux styles
   du même tracé) superposés dans chacun des deux coins : la statique — un trait fin
   en premier plan — est déclarée en second dans le HTML donc au-dessus ; l'animée —
   des taches d'encre organiques qui changent de couleur — est derrière. Chacune des
   deux est remplaçable indépendamment par un visuel envoyé depuis l'admin. */
.ornement-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.ornement-stack svg,
.ornement-stack img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ornement-anime-layer {
  filter: brightness(0.7);
  transform: scale(1.05);
  transform-origin: center;
}

.ornement-blob-anime {
  fill: var(--text);
  animation: ornement-teinte-fill 10s ease-in-out infinite;
}

/* Pièce statique : couleur de texte du thème (blanc en sombre, noir en clair), fixe. */
.ornement-trait-statique {
  fill: none;
  stroke: var(--text);
  stroke-width: 9;
  stroke-linecap: round;
}

.ornement-gemme-statique circle {
  fill: var(--text);
}

/* Motif animé personnalisé (image envoyée depuis l'admin) : impossible de piloter
   ses couleurs internes comme sur le SVG par défaut, donc on fait "vivre" la couleur
   avec un hue-rotate en plus de l'assombrissement/agrandissement communs aux deux. */
.ornement-anime-layer-custom {
  animation: ornement-hue-rotate 10s ease-in-out infinite;
}

@keyframes ornement-respire {
  0%, 100% { opacity: 0.14; }
  50% { opacity: 0.26; }
}

@keyframes ornement-teinte-fill {
  0%, 100% { fill: var(--text); }
  50% { fill: var(--accent); }
}

@keyframes ornement-hue-rotate {
  0%, 100% { filter: brightness(0.7) hue-rotate(0deg); }
  50% { filter: brightness(0.7) hue-rotate(70deg); }
}

@media (prefers-reduced-motion: reduce) {
  .site-ornament-corner,
  .ornement-blob-anime,
  .ornement-anime-layer-custom {
    animation: none;
  }
}

h1, h2, h3, .display {
  font-family: var(--font-display), serif;
  font-weight: var(--weight-display);
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header / Hero --- */

.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 100px 0 60px;
}

@media (max-width: 640px) {
  .hero { padding: 84px 0 48px; min-height: auto; }
}

.hero-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero-inner.no-image {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-inner.has-image {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  grid-template-areas:
    "copy image"
    "cta  image";
  column-gap: 56px;
  row-gap: 28px;
  align-items: center;
  text-align: left;
}

.hero-inner.has-image .hero-copy { grid-area: copy; }
.hero-inner.has-image .hero-image-wrap { grid-area: image; }
.hero-inner.has-image .hero-cta { grid-area: cta; margin-top: 0; }

/* Sur mobile : texte, puis image, puis boutons en dessous */
@media (max-width: 860px) {
  .hero-inner.has-image {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "image"
      "cta";
    text-align: center;
    row-gap: 28px;
  }
  .hero-inner.has-image .hero-cta { justify-content: center; }
}

.hero-image-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--gold);
  outline: 1px solid rgba(201, 162, 75, 0.25);
  outline-offset: 6px;
}

.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-eyebrow {
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.72rem;
  color: var(--gold);
  margin-bottom: 22px;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(3.2rem, 10vw, 7rem);
  z-index: 1;
  color: var(--text);
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero p {
  z-index: 1;
  color: var(--muted);
  max-width: 480px;
  margin-top: 18px;
  font-size: 1.05rem;
}

.hero-cta {
  z-index: 1;
  margin-top: 40px;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-inner.no-image .hero-cta { justify-content: center; }

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 14px 28px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  display: inline-block;
}

.btn:hover { border-color: var(--gold); color: var(--gold); }

.btn-fill {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-fill:hover { background: #932017; border-color: #932017; color: #fff; }

.hero-instagram-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Modèle 3D vedette et carte sont deux <section> à part entière, indépendantes l'une
   de l'autre — sur mobile elles s'empilent donc normalement (chacune avec son propre
   rythme de section, aucune fusion visuelle). Sur PC uniquement, ce wrapper les
   place côte à côte dans une grille à deux colonnes ; ses propres .container
   internes sont neutralisés pour ne pas dupliquer la largeur max/le padding. */
@media (min-width: 900px) {
  .vedette-carte-wrap.has-both {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    column-gap: 48px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
  }

  .vedette-carte-wrap.has-both .section {
    padding: 5vh 0;
  }

  .vedette-carte-wrap.has-both .container {
    max-width: none;
    padding: 0;
  }

  /* Même format que la box 3D (largeurs de colonnes égales + même ratio) pour une taille identique */
  .vedette-carte-wrap.has-both .map-embed {
    aspect-ratio: 3 / 4;
  }
}

/* La carte existe en double dans le HTML (voir partials/_carte) : une instance à
   côté du modèle vedette (PC), une autre en toute dernière section avant le pied
   de page (mobile). Chaque taille d'écran n'en affiche qu'une seule à la fois. */
@media (max-width: 899px) {
  .carte-desktop-only { display: none; }
}
@media (min-width: 900px) {
  .carte-mobile-only { display: none; }
}

.featured-3d-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #0a0908;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}

.featured-3d-wrap:active { cursor: grabbing; }

.featured-3d-wrap canvas { display: block; touch-action: none; }

/* Plein large sur mobile : le modèle vedette gagne en présence en sortant des marges du conteneur */
@media (max-width: 640px) {
  .featured-3d-wrap {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    aspect-ratio: auto;
    height: 100vw;
    height: 100svw;
    border-left: none;
    border-right: none;
  }
}

/* --- Section labels --- */

.section { padding: 5vh 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  gap: 24px;
  flex-wrap: wrap;
}

.section-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  color: var(--gold);
  margin-bottom: 10px;
  display: block;
}

.section-head h2 { font-size: 2.2rem; }

.section-head p { color: var(--muted); max-width: 340px; margin: 0; font-size: 0.92rem; }

/* --- Gallery / Flash sheet cards --- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}

/* Deux colonnes sur téléphone plutôt qu'une seule (minmax(240px,1fr) ne laisse
   passer qu'une colonne sur un écran mobile) */
@media (max-width: 640px) {
  .gallery-grid-2col {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .gallery-grid-2col .flash-meta h3 { font-size: 0.95rem; }
  .gallery-grid-2col .flash-desc { font-size: 0.8rem; }
}

.voir-tout-wrap {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

.flash-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 14px;
}

.flash-frame {
  position: relative;
  border: 1px solid var(--gold);
  outline: 1px solid rgba(201, 162, 75, 0.25);
  outline-offset: 4px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #0a0908;
}

.flash-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(15%) contrast(1.05);
  transition: transform 0.5s ease, filter 0.5s ease;
}

.flash-card:hover .flash-frame img {
  transform: scale(1.06);
  filter: grayscale(0%) contrast(1.05);
}

/* Cadre des projets connexes : contain (pas de recadrage) pour accueillir logos,
   affiches et bannières SVG dessinées à la main dans n'importe quel format. */
.projet-frame {
  position: relative;
  border: 1px solid var(--gold);
  outline: 1px solid rgba(201, 162, 75, 0.25);
  outline-offset: 4px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.projet-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.flash-meta {
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.flash-meta h3 { font-size: 1.1rem; }

.flash-cat {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  white-space: nowrap;
}

.flash-desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.flash-frame.has-3d {
  cursor: pointer;
}

.flash-frame.has-3d:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.frame-3d-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(10, 9, 8, 0.75);
  color: var(--gold);
  border: 1px solid var(--gold);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  pointer-events: none;
}

/* Pièce de flash déjà tatouée : plus disponible à la réservation, on l'indique
   clairement plutôt que de la retirer (elle reste utile comme référence de style). */
.flash-badge-done {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  pointer-events: none;
}

.flash-card.is-deja-tatoue .flash-frame img {
  filter: grayscale(60%);
  opacity: 0.75;
}

.frame-video-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(10, 9, 8, 0.75);
  color: var(--gold);
  border: 1px solid var(--gold);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  pointer-events: none;
}

.realisation-frame {
  cursor: pointer;
}

.realisation-frame:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Description de réalisation rendue depuis du markdown : espacement entre
   paragraphes/listes, liens dans la couleur d'accent. */
.realisation-desc { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.realisation-desc p { margin: 0 0 8px; }
.realisation-desc p:last-child { margin-bottom: 0; }
.realisation-desc ul, .realisation-desc ol { margin: 0 0 8px; padding-left: 20px; }
.realisation-desc a { color: var(--accent); text-decoration: underline; }

.empty-state {
  border: 1px dashed var(--line);
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong { color: var(--text); display: block; margin-bottom: 8px; font-family: 'Fraunces', serif; font-size: 1.3rem; }

/* --- Footer --- */

footer {
  border-top: 1px solid var(--line);
  padding: 40px 0;
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

footer a.admin-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}

footer a.admin-link:hover { color: var(--gold); }

.view-3d-btn {
  margin-top: 14px;
  width: 100%;
  font-size: 0.75rem;
  padding: 10px 20px;
}

.field-help {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.4;
}

.rotation-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.rotation-inputs label {
  text-align: center;
  margin-bottom: 4px;
}

.rotation-inputs input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px;
  text-align: center;
  border-radius: 2px;
  font-family: var(--font-body), sans-serif;
  font-size: 1rem;
}

.rotation-inputs input:focus {
  outline: none;
  border-color: var(--gold);
}

.current-file-preview {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--line);
  margin-top: 10px;
}

.photo-manage-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.photo-manage-row:last-child { border-bottom: none; }

.photo-manage-row.is-dragging {
  opacity: 0.4;
}

.photo-manage-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}

.photo-manage-handle:active { cursor: grabbing; }

.photo-manage-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.photo-manage-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.82rem;
}

.photo-manage-badges label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.photo-manage-delete { color: var(--accent); }

.preview-3d-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0a0908;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}

.preview-3d-wrap:active { cursor: grabbing; }

.preview-3d-wrap canvas { display: block; touch-action: none; }

.texture-order-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.tex-arrow {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 2px;
}

.tex-arrow:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }

.tex-arrow:disabled { opacity: 0.35; cursor: default; }

.tex-order-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.tex-order-preview img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 1px solid var(--line);
}

/* --- Liste réordonnable (ordre des sections, admin) --- */

.sections-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sections-order-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--line);
}

.sections-order-arrows {
  display: flex;
  gap: 6px;
}

/* --- Field divider (admin form) --- */

.field-divider {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-bottom: 18px;
}

.field-divider span {
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
}

/* --- 3D Viewer modal --- */

.viewer-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 6, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.viewer-modal[hidden] {
  display: none;
}

.viewer-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
}

.viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.viewer-head h3 {
  font-size: 1.1rem;
}

.viewer-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.viewer-close:hover { color: var(--gold); }

.viewer-canvas-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-canvas-wrap canvas { display: block; }

.viewer-status {
  color: var(--muted);
  font-size: 0.85rem;
}

.viewer-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 12px 0 18px;
}

/* --- Visionneuse photo/vidéo (réalisations) --- */

/* Pas de ratio fixe : le cadre s'ajuste au ratio réel de chaque photo (une haute
   photo verticale de bras/jambe ne doit pas être écrasée dans une boîte 4:3). */
.photo-viewer-canvas {
  width: 100%;
  max-height: 75vh;
  min-height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0908;
  overflow: hidden;
}

/* Épouse exactement les bords rendus de la photo/vidéo (et non ceux du canvas, qui
   peut être plus large/haut qu'elle en cas de letterboxing) : c'est ce conteneur,
   pas le canvas, qui sert de repère pour ancrer le badge sur la photo elle-même. */
.photo-viewer-media {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 75vh;
  line-height: 0;
  overflow: hidden;
}

#photo-viewer-img, #photo-viewer-video {
  max-width: 100%;
  max-height: 75vh;
  display: block;
}

#photo-viewer-img {
  cursor: zoom-in;
  touch-action: none;
  transition: opacity 0.15s ease;
}

#photo-viewer-img.is-zoomed {
  cursor: grab;
}

#photo-viewer-img.is-panning {
  cursor: grabbing;
}

/* Sans ça, "display: block" ci-dessus l'emporte sur le display:none implicite de
   l'attribut hidden (spécificité par ID) : la photo ET la vidéo pouvaient se
   retrouver visibles/tentées en même temps au lieu de basculer proprement de l'une
   à l'autre selon la diapositive affichée. */
#photo-viewer-img[hidden], #photo-viewer-video[hidden] {
  display: none;
}

/* Superposés en haut à droite de la photo elle-même (ancré sur .photo-viewer-media,
   pas sur le canvas), comme le badge "3D" sur les cartes modèles. */
.photo-viewer-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  /* .photo-viewer-media (parent) est en line-height:0 pour supprimer l'espace
     fantôme sous l'image ; sans ce reset, les badges héritaient de ce line-height:0
     et leur texte s'affichait écrasé. */
  line-height: normal;
}

.photo-badge {
  background: var(--gold);
  color: #100e0c;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
}

.photo-badge-cica {
  background: var(--accent);
  color: #fff;
}

/* Navigation précédent/suivant intégrée directement sur la photo (superposée aux
   bords du canvas), plutôt qu'une barre séparée façon .texture-order-bar en dessous :
   plus proche des usages habituels d'une visionneuse (type carrousel/lightbox). */
.photo-viewer-nav-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.photo-viewer-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 9, 8, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.photo-viewer-arrow:hover:not(:disabled) {
  background: rgba(10, 9, 8, 0.8);
  border-color: var(--gold);
  color: var(--gold);
}

.photo-viewer-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.photo-viewer-arrow-prev { left: 12px; }
.photo-viewer-arrow-next { right: 12px; }

.photo-viewer-counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 9, 8, 0.6);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 20px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .photo-viewer-arrow {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
}

/* Même empilement de badges (haut-droite de la photo) directement sur la carte de
   la page d'accueil, avant même d'ouvrir la visionneuse. */
.frame-badges-tr {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.photo-badge-count {
  background: rgba(10, 9, 8, 0.75);
  color: var(--gold);
  border: 1px solid var(--gold);
}

@media (max-width: 640px) {
  .viewer-modal {
    padding: 0;
  }

  .viewer-panel {
    max-width: none;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border: none;
  }

  .viewer-canvas-wrap {
    flex: 1;
    aspect-ratio: auto;
    width: 100%;
    height: auto;
  }

  .viewer-head {
    padding: 16px;
  }

  .viewer-hint {
    padding: 10px 16px 16px;
  }
}

/* --- Topbar (site public) --- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
}

@media (max-width: 480px) {
  .topbar { padding: 16px; }
  .topbar-logo { height: 28px; }
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display), serif;
  font-size: 1.05rem;
}

.topbar-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.topbar-icon:hover { border-color: var(--gold); color: var(--gold); }

.icon-sun, .icon-moon { display: block; }

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

/* --- Guest shop map embed --- */

.map-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: var(--surface);
}

.map-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Plein large sur mobile, comme le modèle 3D vedette juste au-dessus : sans ça la
   carte reste étriquée (16:9) à côté de la box 3D qui prend elle toute la largeur.
   Hauteur basée sur la hauteur d'écran réelle (dvh, avec repli vh) plutôt que sur
   la largeur : sinon la carte est mal proportionnée selon le format du téléphone,
   et dvh s'ajuste correctement quand la barre Safari apparaît/disparaît. */
@media (max-width: 640px) {
  .map-embed {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    aspect-ratio: auto;
    height: 50vh;
    height: 50dvh;
    border-left: none;
    border-right: none;
  }
}

/* Google Maps ne propose pas de thème nuit pour ce type d'iframe : on simule un
   rendu sombre en inversant les couleurs de la carte en thème sombre. */
:root[data-theme="dark"] .map-embed iframe {
  filter: invert(90%) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}

.range-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.range-field label {
  width: 70px;
  flex-shrink: 0;
  margin-bottom: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
}

.range-field input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
}

.range-value {
  width: 44px;
  flex-shrink: 0;
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
}

.contrast-status {
  margin-top: 14px;
  font-size: 0.78rem;
  color: #7fae7a;
  line-height: 1.5;
}

.contrast-status.is-warning {
  color: var(--accent);
}

/* --- Site settings page --- */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 760px;
}

.settings-form .form-panel h2 {
  font-size: 1.2rem;
  margin-bottom: 22px;
}

.select-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--font-body), sans-serif;
  font-size: 1rem;
  border-radius: 2px;
}

.select-input:focus { outline: none; border-color: var(--gold); }

.field-help code {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1px 6px;
  font-size: 0.78rem;
}

.color-theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

@media (max-width: 560px) {
  .color-theme-grid { grid-template-columns: 1fr; }
}

.color-theme-title {
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.color-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.color-field label {
  font-size: 0.85rem;
  color: var(--text);
}

.color-field input[type="color"] {
  width: 44px;
  height: 32px;
  border: 1px solid var(--line);
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 2px;
}

/* --- Login page --- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-panel h1 {
  font-size: 1.8rem;
  margin: 10px 0 26px;
}

/* --- Admin page --- */

.admin-shell { padding: 60px 0 100px; }

.admin-head {
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display), serif;
  font-size: 1.1rem;
}

.admin-nav-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.admin-nav-links {
  display: flex;
  gap: 4px;
}

.admin-nav-links a {
  padding: 9px 16px;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 2px;
}

.admin-nav-links a:hover { color: var(--text); }

.admin-nav-links a.is-active {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface);
}

.admin-head h1 { font-size: 2.4rem; }

.admin-head span { color: var(--gold); text-transform: uppercase; letter-spacing: 0.3em; font-size: 0.7rem; display: block; margin-bottom: 10px; }

.admin-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 28px;
}

.form-panel h2 { font-size: 1.2rem; margin-bottom: 22px; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}

.field input[type="text"],
.field input[type="url"],
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--font-body), sans-serif;
  font-size: 1rem;
  border-radius: 2px;
}

.field textarea { resize: vertical; min-height: 80px; }

.field input[type="file"] {
  width: 100%;
  color: var(--muted);
  font-size: 0.85rem;
}

.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.form-msg { font-size: 0.85rem; margin-top: 14px; min-height: 1.2em; }
.form-msg.error { color: var(--accent); }
.form-msg.success { color: #7fae7a; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  vertical-align: middle;
}

.admin-table th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}

.admin-table img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.del-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 14px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
}

.del-btn:hover { border-color: var(--accent); color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
