/* Adaptations pour la version autonome, sans dépendance à un hébergeur. */
[hidden], dialog:not([open]) { display: none !important; }
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(8, 20, 16, .72); }
dialog.gallery-dialog, dialog.mobile-menu { position: fixed; inset: 0; margin: auto; transform: none; max-height: 100svh; box-sizing: border-box; }
dialog.gallery-dialog { overflow: hidden; }
.gallery-image img { min-height: 0; }
.gallery-footer { flex-shrink: 0; }
.inquiry-form input[type="date"] { min-width: 0; width: 100%; }
.form-feedback { overflow-wrap: anywhere; }
.email-draft { white-space: pre-wrap; font: inherit; margin: 14px 0 0; }
body.modal-open { overflow: hidden; }

/* Galerie immersive : la place est réservée aux photos, sur tous les écrans. */
dialog.gallery-dialog {
  color: #f7f6f2;
  background: #101714 !important;
  border: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  width: min(1180px, 96vw) !important;
  max-width: none !important;
  height: min(940px, 96vh) !important;
  height: min(940px, 96dvh) !important;
  max-height: 100dvh;
}
.gallery-dialog::backdrop { background: rgba(3, 10, 7, .88); }
.gallery-dialog .gallery-header {
  flex: 0 0 auto; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.gallery-dialog .gallery-header .gallery-heading { gap: 12px; min-width: 0; }
.gallery-dialog .gallery-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; white-space: nowrap; }
.gallery-counter { color: #b7c3bb; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gallery-dialog .gallery-header .gallery-header-actions { gap: 8px; flex-shrink: 0; }
.gallery-dialog button { min-height: 44px; cursor: pointer; }
.gallery-dialog button:focus-visible { outline: 2px solid #e4e7d5; outline-offset: -4px; }
.gallery-dialog button:disabled { opacity: .45; cursor: wait; }
.gallery-dialog .gallery-close, .gallery-controls > button:not(.gallery-zoom) {
  width: 44px; height: 44px; padding: 10px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0;
}
.gallery-dialog .gallery-view { font: 12px Arial, sans-serif; text-underline-offset: 5px; padding: 8px; }
.gallery-dialog .gallery-close:hover, .gallery-controls > button:hover { background: rgba(255,255,255,.1); }
.gallery-dialog .gallery-image {
  background: #101714; width: 100%; flex: 1 1 0%; min-height: 0;
  position: relative; display: block; overflow: hidden;
  overscroll-behavior: contain; touch-action: pan-y pinch-zoom;
}
.gallery-image-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.gallery-dialog .gallery-image img {
  display: block; width: 100%; height: 100%; max-width: none;
  object-fit: contain; object-position: center; user-select: none; -webkit-user-select: none;
}
.gallery-dialog .gallery-image.is-zoomed { overflow: auto; touch-action: pan-x pan-y pinch-zoom; }
.gallery-image.is-zoomed .gallery-image-stage { flex: none; }
.gallery-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 20px; text-align: center; color: #dce4dd; font-size: 14px;
}
.gallery-status button { border: 1px solid #73877a; padding: 8px 18px; border-radius: 24px; }
.gallery-dialog .gallery-footer {
  flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 16px; align-items: center; padding: 12px 18px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.gallery-caption { font-size: 14px; line-height: 1.4; min-height: 20px; margin: 0; }
.gallery-dialog .gallery-footer .gallery-controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.gallery-dialog .gallery-zoom { border: 1px solid #667a6c; border-radius: 24px; padding: 8px 16px; font-size: 13px; white-space: nowrap; }
.gallery-hint { font-size: 11px; color: #adbdb2; margin: 4px 0 0; line-height: 1.4; }
@media (max-width: 700px), (max-height: 550px) {
  dialog.gallery-dialog {
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    max-height: 100dvh; max-width: 100vw !important; border-radius: 0 !important;
  }
  .gallery-dialog .gallery-header {
    padding: max(7px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 7px max(14px, env(safe-area-inset-left));
    gap: 8px;
  }
  .gallery-dialog .gallery-header .gallery-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
  .gallery-dialog .gallery-heading h2 { font-size: 18px; }
  .gallery-counter { font-size: 10px; }
  .gallery-dialog .gallery-header .gallery-header-actions { gap: 2px; }
  .gallery-dialog .gallery-view { font-size: 11px; padding: 6px; }
  .gallery-dialog .gallery-footer {
    padding: 9px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    grid-template-columns: 1fr; gap: 3px; text-align: center;
  }
  .gallery-caption { font-size: 13px; min-height: 18px; }
  .gallery-hint { font-size: 10px; margin: 0; }
  .gallery-dialog .gallery-footer .gallery-controls { gap: 25px; }
}
@media (orientation: landscape) and (max-height: 550px) {
  .gallery-dialog .gallery-header { padding-top: 3px; padding-bottom: 3px; }
  .gallery-dialog .gallery-header .gallery-heading { flex-direction: row; align-items: center; gap: 12px; }
  .gallery-dialog .gallery-footer { grid-template-columns: minmax(0, 1fr) auto; padding-top: 3px; padding-bottom: max(3px, env(safe-area-inset-bottom)); }
  .gallery-caption { text-align: left; }
  .gallery-hint { display: none; }
}
@media (max-width: 360px) {
  .site-header, .site-header.solid { padding-left: 12px; padding-right: 12px; }
  .wordmark .brand-main { font-size: 22px; }
  .brand-sub { font-size: 6px; }
  .reserve { font-size: 11px; padding: 10px 8px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Album : seul le conteneur défile. Les cartes gardent leur hauteur naturelle,
   sans lignes de grille contraintes par la hauteur de la fenêtre. */
.gallery-collection {
  flex: 1 1 0%; min-height: 0; width: 100%; overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #57685c #101714;
  padding: 0 max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  box-sizing: border-box; scroll-padding-top: 130px;
}
.gallery-collection-toolbar {
  position: sticky; top: 0; z-index: 2; background: #101714;
  padding: 18px 0 14px; border-bottom: 1px solid #2a3830; margin-bottom: 20px;
}
.gallery-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-dialog .gallery-filters button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 8px 14px; border: 1px solid #405247;
  border-radius: 999px; font: 13px Arial, sans-serif; color: #e3e9e3;
  background: #18221d; transition: background .15s ease, color .15s ease;
}
.gallery-filters button span { color: #b5c6b9; font-size: 11px; font-variant-numeric: tabular-nums; }
.gallery-dialog .gallery-filters button[aria-pressed="true"] { background: #e7eddc; color: #17251b; border-color: #e7eddc; }
.gallery-filters button[aria-pressed="true"] span { color: #4c6049; }
.gallery-collection-summary { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: #b5c6b9; }
.gallery-dialog .photo-grid {
  display: block; flex: none; width: 100%; height: auto; max-height: none;
  min-height: 0; overflow: visible; margin: 0; padding: 0;
  column-count: 3; column-gap: 20px; column-fill: balance;
}
.gallery-dialog .photo-grid .photo-card {
  display: inline-block; vertical-align: top; break-inside: avoid; page-break-inside: avoid;
  width: 100%; height: auto; min-height: 0; max-height: none; margin: 0 0 20px;
  padding: 0; overflow: hidden; text-align: left; border: 1px solid #304236;
  border-radius: 12px; background: #1a251e; color: #edf1e7;
  box-sizing: border-box; cursor: zoom-in; touch-action: manipulation;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.gallery-dialog .photo-grid span { display: block; margin: 0; color: inherit; }
.gallery-dialog .photo-grid .photo-card-media { position: relative; width: 100%; overflow: hidden; line-height: 0; }
.gallery-dialog .photo-grid img {
  display: block; position: static; width: 100%; height: auto; max-height: none;
  aspect-ratio: auto; object-fit: contain; margin: 0;
  transition: transform .25s ease; background: #233329;
}
.gallery-dialog .photo-grid .photo-card-open {
  position: absolute; right: 10px; bottom: 10px; display: flex;
  align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 1px solid rgba(255,255,255,.45); border-radius: 50%;
  background: rgba(16,23,20,.72); color: #fff;
}
.gallery-dialog .photo-grid .photo-card-caption {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 13px 14px; line-height: 1.5;
}
.gallery-dialog .photo-grid .photo-card-label { font-size: 13px; line-height: 1.5; }
.gallery-dialog .photo-grid .photo-card-number { flex: none; font-size: 11px; color: #afbfac; font-variant-numeric: tabular-nums; }
.gallery-dialog .photo-grid .photo-card[aria-current="true"] { border-color: #b1c399; }
.gallery-dialog .photo-grid .photo-card:focus-visible { outline: 3px solid #e7eddc; outline-offset: -3px; }
.gallery-collection-end { margin: 8px 0 12px; color: #9cad9b; font-size: 12px; text-align: center; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .gallery-dialog .photo-grid .photo-card:hover { border-color: #b1c399; box-shadow: 0 8px 24px rgba(0,0,0,.22); }
  .gallery-dialog .photo-grid .photo-card:hover img { transform: scale(1.025); }
  .gallery-dialog .gallery-filters button:hover { border-color: #b1c399; }
}
@media (max-width: 949px) {
  .gallery-dialog .photo-grid { column-count: 2; column-gap: 16px; }
  .gallery-dialog .photo-grid .photo-card { margin-bottom: 16px; }
}
@media (max-width: 599px) {
  .gallery-collection { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .gallery-collection-toolbar { padding-top: 12px; padding-bottom: 12px; margin-bottom: 16px; }
  .gallery-filters { gap: 6px; }
  .gallery-dialog .gallery-filters button { font-size: 12px; padding: 7px 11px; }
  .gallery-dialog .photo-grid { column-count: 1; }
  .gallery-dialog .photo-grid .photo-card-label { font-size: 14px; }
  .gallery-dialog .photo-grid .photo-card-caption { padding: 13px 14px; }
  .gallery-collection-summary { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-dialog .photo-grid img, .gallery-dialog .photo-grid .photo-card, .gallery-dialog .gallery-filters button { transition: none; }
}

.form-grid .form-field-full { grid-column: 1 / -1; }
.form-feedback { margin-top: 16px; line-height: 1.6; }
.form-feedback[data-state="error"] { color: #843b26; }
.form-feedback a { text-decoration: underline; text-underline-offset: 3px; }
