
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  /* On n'écrase pas vos styles globaux :
     Si votre feuille de style principale définit déjà le fond/typo,
     vous pouvez supprimer ces 2 lignes. */

  font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}

/* Conteneur de page (n'affecte pas header/footer existants) */
.page { 
  max-width: 1100px; 
  margin: 40px auto; 
  padding: 0 20px; 
  background: #ffffff00; 
}

/* Carte de fiche */
.fiche { 
  --accent: var(--accent); 
  background: var(--surface); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  overflow: hidden; 
}
.fiche__bar { 
  height: 12px; 
  background: linear-gradient(90deg, var(--accent)); 
}
.fiche__inner { 
  padding: 28px; 
  display: grid; 
  gap: 22px; 
}

.page,
.fiche,
.fiche__inner,
.fiche__top,
.fiche__content,
.fiche__side,
.fiche__side-main,
.fiche__ad-panel,
.fiche__ad-box,
.nearby-monuments,
.nearby-monuments__inner,
.nearby-monuments__grid,
.nearby-monuments__item {
  min-width: 0;
  max-width: 100%;
}

.fiche__ad-panel {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.fiche__ad-box {
  width: 100%;
}

/* Annonce de fin de fiche : même largeur que les lieux à proximité. */
.record-end-ad {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 28px;
  padding: clamp(12px, 3vw, 22px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.record-end-ad__label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.record-end-ad > ins {
  min-height: 250px;
}

/* En‑tête */
.fiche__header { 
  display: grid; 
  grid-template-columns: 72px 1fr; 
  gap: 16px; 
  align-items: center; 
}
.fiche__logo { 
  width: 72px; 
  height: 72px; 
  border-radius: 16px; 
  object-fit: contain; 
  background: #ffffff; 
  border: 1px solid var(--ring); 
  padding: 8px; 
}
.fiche__title { 
  color: var(--text); 
  margin: 0; 
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); 
}
.fiche__chip { 
  display: inline-flex; 
  align-items: center; 
  gap: .5ch; 
  padding: 6px 10px; 
  border-radius: 999px; font-size: .85rem; 
  background: color-mix(in oklab, var(--accent) 20%, var(--surface) 80%); 
  border: 1px solid color-mix(in oklab, var(--accent) 35%, var(--text) 65%); 
  color: color-mix(in oklab, var(--accent) 85%, var(--text) 15%); 
}

/* Corps */
.fiche__content { 
  display: grid; 
  gap: 16px; 
}
.fiche__desc { 
  color: var(--text); 
  font-size: 1rem; 
}

/* Bouton lien externe */
.fiche__btn { 
  display: inline-flex; 
  align-items: center; 
  gap: .6ch; padding: 12px 16px; 
  border-radius: 12px; text-decoration: none; 
  font-weight: 600; background: var(--accent); color: #ffffff; 
  box-shadow: 0 4px 16px color-mix(in oklab, var(--accent) 30%, transparent 70%); 
}
.fiche__btn:hover { 
  filter: saturate(1.1) brightness(1.02); 
  transform: translateY(-1px); 
  transition: .15s ease; }

/* Pied de fiche */
.fiche__meta { 
  margin-top: 2px; 
  padding-top: 16px; 
  border-top: 1px dashed var(--ring); color: var(--muted); display: flex; 
  flex-wrap: wrap; 
  gap: 10px 18px; 
  align-items: baseline; 
  justify-content: space-between; 
  font-size: .95rem; 
}
.fiche__source { 
  color: var(--muted); 
}
.fiche__source strong { 
  color: var(--text); 
}
.fiche__date { 
  color: var(--muted); 
}
.fiche__date strong { 
  color: var(--text); 
}
.fiche time {
   white-space: nowrap; 
}

/* Disposition large */
@media (min-width: 860px) {
  .fiche__inner { grid-template-columns: 3fr 2fr; align-items: start; }
  .fiche__content { order: 1; }
  .fiche__side { order: 2; }
}

/* Thèmes/couleurs par catégorie (à compléter selon vos besoins) */
.fiche[data-category="monuments-historiques"] { --accent: #ff6600; }
.fiche[data-category="parcs-et-jardins"] { --accent: #24a600d0; }
.fiche[data-category="architecture-contemporaine"] { --accent: #757575d0; }
.fiche[data-category="maison-illustre"] { --accent: #d2a967d0; }
.fiche[data-category="patrimoine-europe"] { --accent: #1F369F; }
.fiche[data-category="musees"] { --accent: #8f488ad0; }
.fiche[data-category="frac"] { --accent: #497256d0; }
.fiche[data-category="velo"] { --accent: #3156A1; }
.fiche[data-category="unesco"] { --accent: #4376ce; }

@media (max-width: 720px) {
  .page {
    margin-block: 20px;
    padding-inline: clamp(8px, 2vw, 14px);
  }

  .fiche {
    --fiche-top-padding: 4px 0;
    --fiche-header-gap: 10px;
  }

  .fiche__inner {
    padding: clamp(12px, 3vw, 20px);
    gap: 16px;
  }

  .fiche__logo {
    width: clamp(40px, 10vw, 56px);
    height: clamp(40px, 10vw, 56px);
    flex-shrink: 0;
    padding: 5px;
    border-radius: 10px;
  }

  .fiche__top .fiche__title {
    font-size: clamp(1.125rem, 0.95rem + 0.8vw, 1.375rem);
    line-height: 1.2;
  }

  .fiche__top .fiche__title-row {
    gap: 2px 6px;
  }

  .fiche__top :is(.frac-locality, .acr-locality, .monument-locality) {
    font-size: 0.95rem;
    line-height: 1.35;
  }

  .fiche__top :is(.frac-locality, .acr-locality, .monument-locality)::before {
    margin: 0 4px 0 0;
  }

  .fiche__chip {
    padding: 3px 8px;
  }

  .nearby-monuments .nearby-monuments__inner {
    padding: clamp(12px, 3vw, 18px);
  }
}

/* Les images indisponibles laissent place au message de la galerie. */
.gallery-main img[hidden] { display: none; }

/* Une photo unique garde la hauteur existante, sur un fond tiré de l'image. */
.single-photo-backdrop { display: none; pointer-events: none; }
.fiche .fiche__gallery.fiche__gallery--single .gallery-main { isolation: isolate; }
.fiche .fiche__gallery.fiche__gallery--single .single-photo-backdrop {
  display: block;
  position: absolute;
  inset: -26px;
  z-index: 0;
  background-position: center;
  background-size: cover;
  filter: blur(24px) brightness(0.48) saturate(0.85);
  transform: scale(1.06);
}
.single-photo-backdrop[hidden] { display: none !important; }
.fiche .fiche__gallery.fiche__gallery--single .gallery-main .gallery-main-img {
  width: var(--single-photo-width, 100%);
  max-width: 100%;
  height: var(--single-photo-height, 100%);
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  object-position: center;
  z-index: 1;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.25);
}
.fiche .fiche__gallery.fiche__gallery--single .gallery-main-placeholder { z-index: 2; }
.fiche .fiche__gallery.fiche__gallery--single .gallery-main.is-loading::after { z-index: 3; }
