/* ==========================================================================
   Villa Planes · page Photos
   Téléphone : chaque photo en pleine largeur, entière (jamais recadrée).
   Ordinateur : colonnes « maçonnerie ». Visionneuse plein écran au toucher.
   ========================================================================== */

/* Transition douce entre l'accueil et la page Photos (navigateurs récents) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-sortie .35s ease both; }
::view-transition-new(root) { animation: vt-entree .55s cubic-bezier(.22,.8,.22,1) both; }
@keyframes vt-sortie { to { opacity: 0; } }
@keyframes vt-entree { from { opacity: 0; transform: translateY(18px); } }
.ph-nav .logo { view-transition-name: logo; }

.page-photos { background: var(--nuit); color: var(--chaux); }

/* --- En-tête --- */
.ph-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 12px var(--gutter); padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(16,32,42,.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(247,242,234,.08);
  transition: transform .5s var(--ease);
}
.ph-nav.is-cache { transform: translateY(-100%); }
.ph-retour { justify-self: start; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(247,242,234,.22); transition: background .3s, color .3s; }
.ph-retour:hover { background: var(--chaux); color: var(--nuit); }
.ph-retour svg { width: 18px; height: 18px; }
.ph-nav .logo { justify-self: center; font-size: 26px; }
.ph-resa { justify-self: end; padding: 11px 20px !important; font-size: 12px !important; }

/* --- Introduction --- */
.ph-intro { padding: calc(130px + env(safe-area-inset-top)) var(--gutter) 34px; text-align: center; max-width: 760px; margin: 0 auto; }
.ph-intro .kicker { color: var(--eau-clair); justify-content: center; }
.ph-intro h1 { font-size: clamp(56px, 11vw, 120px); margin: 14px 0 16px; }
.ph-intro h1 em { font-style: italic; color: var(--or); }
.ph-intro p { color: rgba(247,242,234,.72); margin: 0 auto; max-width: 30em; }
.ph-apparait { opacity: 0; transform: translateY(22px); animation: ph-monte 1s var(--ease) forwards; }
.ph-apparait.d1 { animation-delay: .1s; } .ph-apparait.d2 { animation-delay: .22s; }
@keyframes ph-monte { to { opacity: 1; transform: none; } }

/* --- Barre des thèmes (collante) --- */
.ph-themes {
  position: sticky; top: 0; z-index: 50;
  background: rgba(16,32,42,.9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(247,242,234,.08);
  transition: top .5s var(--ease);
}
.ph-themes.sous-nav { top: calc(69px + env(safe-area-inset-top)); }
.ph-themes-in {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px var(--gutter);
  max-width: 1400px; margin: 0 auto; scroll-behavior: smooth;
}
.ph-themes-in::-webkit-scrollbar { display: none; }
.ph-themes a {
  flex: 0 0 auto; padding: 9px 16px; border-radius: 99px; border: 1px solid rgba(247,242,234,.2);
  font-size: 13px; letter-spacing: .04em; white-space: nowrap; color: rgba(247,242,234,.8);
  transition: background .35s, color .35s, border-color .35s;
}
.ph-themes a.is-on { background: var(--or); border-color: var(--or); color: #fff; }

/* --- Sections et photos --- */
.ph-section { max-width: 1400px; margin: 0 auto; padding: 56px var(--gutter) 10px; scroll-margin-top: 70px; }
.ph-titre { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.ph-titre h2 { font-size: clamp(38px, 6vw, 64px); }
.ph-titre p { margin: 0; font-size: 14px; letter-spacing: .06em; color: rgba(247,242,234,.6); }
.ph-grille { columns: 3 320px; column-gap: 14px; }
.ph-photo {
  position: relative; margin: 0 0 14px; break-inside: avoid; border-radius: 4px; overflow: hidden;
  cursor: zoom-in; background: rgba(247,242,234,.05);
  opacity: 0; transform: translateY(36px) scale(.98);
  transition: opacity .9s var(--ease), transform 1.1s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.ph-photo.is-in { opacity: 1; transform: none; }
.ph-photo img { width: 100%; height: auto; display: block; transition: transform 1.2s var(--ease), filter .6s; }
.ph-photo:hover img { transform: scale(1.03); }
.ph-photo:active img { filter: brightness(.85); }
/* petite loupe en coin, discrète */
.ph-photo::after {
  content: ""; position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(16,32,42,.5) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 15px no-repeat;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: .9;
}

/* --- Fin de page --- */
.ph-fin { text-align: center; padding: 80px var(--gutter) 110px; }
.ph-fin-titre { font-family: var(--serif); font-size: clamp(34px, 5vw, 56px); margin: 0 0 26px; }
.ph-fin-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* --- Bouton haut de page --- */
.ph-haut {
  position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 55;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--chaux); color: var(--nuit); box-shadow: 0 10px 30px -8px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity .4s, transform .5s var(--ease);
}
.ph-haut.is-on { opacity: 1; transform: none; pointer-events: auto; }
.ph-haut svg { width: 18px; height: 18px; }

/* ==========================================================================
   Visionneuse : photo entière sur fond noir, glisser pour changer,
   glisser vers le bas pour fermer, ouverture depuis la photo touchée.
   ========================================================================== */
.vz { position: fixed; inset: 0; z-index: 200; visibility: hidden; touch-action: none; }
.vz.is-open { visibility: visible; }
.vz-fond { position: absolute; inset: 0; background: #070d11; opacity: 0; transition: opacity .4s ease; }
.vz.is-open .vz-fond { opacity: 1; }
.vz-piste { position: absolute; inset: 0; display: flex; will-change: transform; }
.vz-cell { flex: 0 0 100%; height: 100%; display: grid; place-items: center; padding: 64px 0 64px; }
.vz-cell { min-width: 0; min-height: 0; }
.vz-cell img { max-width: 100vw; max-height: calc(100vh - 128px); max-height: calc(100svh - 128px); width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.vz-haut {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); color: #fff;
  background: linear-gradient(rgba(7,13,17,.7), transparent); opacity: 0; transition: opacity .4s .1s;
}
.vz.is-open .vz-haut, .vz.is-open .vz-aide { opacity: 1; }
.vz-theme { font-family: var(--serif); font-size: 20px; }
.vz-cpt { margin-left: auto; font-size: 12px; letter-spacing: .2em; opacity: .75; font-variant-numeric: tabular-nums; }
.vz-fermer { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; }
.vz-fermer svg { width: 18px; height: 18px; }
.vz-prec, .vz-suiv { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; transition: background .3s; }
.vz-prec:hover, .vz-suiv:hover { background: rgba(255,255,255,.25); }
.vz-prec { left: 18px; } .vz-suiv { right: 18px; }
.vz-prec svg, .vz-suiv svg { width: 20px; height: 20px; }
.vz-aide { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); left: 0; right: 0; margin: 0; text-align: center; font-size: 12px; letter-spacing: .08em; color: rgba(255,255,255,.55); opacity: 0; transition: opacity .4s .2s; }
.vz-aide.vu { display: none; }
/* image « volante » : part de la photo touchée et s'agrandit en plein écran */
.vz-vol { position: fixed; z-index: 210; object-fit: cover; border-radius: 4px; pointer-events: none; transition: all .45s cubic-bezier(.22,.8,.22,1); }

/* --- Téléphone --- */
@media (max-width: 900px) {
  .ph-nav .logo { font-size: 23px; }
  .ph-resa { padding: 10px 14px !important; font-size: 11px !important; letter-spacing: .1em !important; }
  .ph-intro { padding-top: calc(110px + env(safe-area-inset-top)); padding-bottom: 26px; }
  .ph-section { padding: 40px 0 0; }
  .ph-titre { padding: 0 var(--gutter); margin-bottom: 16px; }
  /* photos en pleine largeur, l'une sous l'autre, entières */
  .ph-grille { columns: 1; column-gap: 0; }
  .ph-photo { margin: 0 0 6px; border-radius: 0; }
  .ph-photo:hover img { transform: none; }
  .vz-prec, .vz-suiv { display: none; }
  .vz-cell { padding: 0; }
  .vz-cell img { max-height: 100vh; max-height: 100svh; }
  .ph-fin-cta .btn { flex: 1 1 100%; justify-content: center; }
}
/* ==========================================================================
   Téléphone : carrousel une photo à la fois (le reste de la page est masqué).
   Défilement natif avec aimantation : fluide, inertie du téléphone.
   ========================================================================== */
.cr { display: none; }
@media (max-width: 900px) {
  html:has(.page-photos), .page-photos { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .ph-intro, .ph-themes, .ph-section, .ph-fin, .ph-haut { display: none !important; }
  .ph-nav, .ph-nav.is-cache { transform: none; }

  .cr {
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    padding-top: calc(69px + env(safe-area-inset-top));
  }
  .cr-filtres { flex: 0 0 auto; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 16px; scroll-behavior: smooth; }
  .cr-filtres::-webkit-scrollbar { display: none; }
  .cr-filtres button {
    flex: 0 0 auto; padding: 9px 15px; border-radius: 99px; border: 1px solid rgba(247,242,234,.22);
    font-size: 13px; color: rgba(247,242,234,.85); white-space: nowrap; transition: background .3s, color .3s, border-color .3s;
  }
  .cr-filtres button small { font-size: 11px; opacity: .6; margin-left: 3px; }
  .cr-filtres button.is-on { background: var(--or); border-color: var(--or); color: #fff; }
  .cr-filtres button.is-on small { opacity: .85; }

  .cr-piste {
    flex: 1 1 auto; min-height: 0; display: flex;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    transition: opacity .3s ease;
  }
  .cr-piste::-webkit-scrollbar { display: none; }
  .cr-piste.change { opacity: 0; }
  .cr-slide {
    flex: 0 0 100%; width: 100%; height: 100%; margin: 0;
    scroll-snap-align: center; scroll-snap-stop: always;
    display: flex; align-items: center; justify-content: center; padding: 6px 0;
  }
  .cr-slide[hidden] { display: none; }
  /* la photo entière, jamais recadrée */
  .cr-slide img { width: 100%; height: 100%; object-fit: contain; will-change: transform, opacity; user-select: none; -webkit-user-drag: none; }

  .cr-legende { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 4px; }
  .cr-info { text-align: center; min-width: 0; }
  .cr-info b { display: block; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.15; }
  .cr-info span { display: block; margin-top: 3px; font-size: 12px; letter-spacing: .18em; color: rgba(247,242,234,.6); font-variant-numeric: tabular-nums; }
  .cr-nav { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(247,242,234,.25); display: grid; place-items: center; transition: background .3s, opacity .3s; }
  .cr-nav:active { background: rgba(247,242,234,.15); }
  .cr-nav:disabled { opacity: .25; }
  .cr-nav svg { width: 18px; height: 18px; }
  .cr-barre { flex: 0 0 auto; height: 2px; margin: 10px 16px 0; background: rgba(247,242,234,.14); border-radius: 2px; overflow: hidden; }
  .cr-barre i { display: block; height: 100%; background: var(--or); transform-origin: left; transform: scaleX(0); transition: transform .35s var(--ease); }
  .cr-aide {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
    font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: rgba(247,242,234,.55);
    transition: opacity .5s;
  }
  .cr-aide i { position: relative; width: 30px; height: 1px; background: currentColor; animation: cr-glisse 1.8s var(--ease) infinite; }
  .cr-aide i::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-top: 1px solid currentColor; border-right: 1px solid currentColor; transform: rotate(45deg); }
  .cr-aide.vu { opacity: 0; }
}
@keyframes cr-glisse { 0%, 100% { transform: translateX(-5px); opacity: .5; } 50% { transform: translateX(5px); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .ph-photo { opacity: 1; transform: none; }
  .ph-apparait { animation: none; opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}
