/* =========================================================
   REDEFINE · Galería de resultados
   Sala oscura: las fotos clínicas se ven mejor sobre fondo profundo
   ========================================================= */
.page-galeria { background: var(--teal-950); color: var(--white); }

/* ---------- Portada ---------- */
.page-hero { padding: 12px; }
.page-hero__card {
  position: relative; overflow: hidden; border-radius: var(--radius);
  min-height: clamp(460px, 62vh, 620px); display: flex; align-items: flex-end;
}
.page-hero__photo { position: absolute; inset: 0; background: var(--hero-img) center 35% / cover no-repeat; }
.page-hero__photo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10, 33, 40, .92), rgba(10, 33, 40, .4) 60%, rgba(10, 33, 40, .2)), linear-gradient(0deg, rgba(10, 33, 40, .8), transparent 50%);
}
.page-hero__content { position: relative; z-index: 1; padding: 140px clamp(24px, 4vw, 64px) clamp(32px, 4vw, 56px); max-width: 860px; }
.page-hero__title {
  margin: 18px 0 18px; font-family: var(--f-display); font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: clamp(64px, 12vw, 180px); line-height: .85; letter-spacing: -.02em;
}
.page-hero__content p { margin: 0; max-width: 46ch; font-size: clamp(16px, 1.4vw, 19px); color: rgba(255, 255, 255, .75); }


/* ---------- Índice (como el de una revista) ---------- */
.indice { position: relative; padding: clamp(56px, 7vw, 96px) 0 clamp(40px, 5vw, 64px); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.indice__intro { display: flex; align-items: center; gap: 18px; margin: 0 0 clamp(28px, 4vw, 48px); font-family: var(--f-display); font-weight: 900; text-transform: uppercase; font-size: clamp(14px, 1.2vw, 16px); letter-spacing: .14em; color: rgba(255, 255, 255, .5); }
.indice__zonas { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: clamp(28px, 4vw, 64px); }
.indice__titulo { margin: 0 0 10px; font-family: var(--f-display); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: clamp(30px, 3.2vw, 44px); line-height: 1; }
.indice__titulo small { margin-left: 8px; font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: .22em; color: var(--cyan); vertical-align: middle; }
.indice__lista { list-style: none; margin: 0; padding: 0; }
.indice__item { display: grid; grid-template-columns: 34px 1fr; align-items: baseline; column-gap: 10px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); transition: color .25s var(--ease), padding .35s var(--ease); }
.indice__n { font-family: var(--f-display); font-weight: 700; font-size: 12px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.indice__nombre { font-family: var(--f-display); font-weight: 800; font-size: clamp(19px, 1.7vw, 24px); line-height: 1.15; }
.indice__18 { margin-left: 6px; font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--orange); vertical-align: super; }
.indice__dato { grid-column: 2; margin-top: 4px; font-size: 13px; color: rgba(255, 255, 255, .5); }
.indice__item.is-soon .indice__nombre { color: rgba(255, 255, 255, .45); }
@media (hover: hover) {
  .indice__item:hover { padding-left: 10px; color: var(--orange); }
  .indice__item:hover .indice__dato { color: rgba(255, 255, 255, .8); }
}
.indice__preview {
  position: fixed; left: 0; top: 0; z-index: 40; width: 190px; aspect-ratio: 4 / 5; border-radius: 14px; pointer-events: none;
  background: #0c2c34 center / cover no-repeat; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); border: 4px solid var(--cream);
  opacity: 0; transition: opacity .25s var(--ease);
}
.indice__preview.is-on { opacity: 1; }
.indice__preview.is-mayores { filter: blur(14px); }

/* ---------- Cada servicio ---------- */
.gal { padding: clamp(64px, 8vw, 112px) 0 clamp(48px, 6vw, 80px); scroll-margin-top: 70px; border-bottom: 1px solid rgba(255, 255, 255, .08); overflow: hidden; }
.gal__head { display: grid; grid-template-columns: auto auto 1fr; align-items: end; gap: 12px clamp(20px, 3vw, 44px); margin-bottom: clamp(28px, 4vw, 48px); }
.gal__num { font-family: var(--f-display); font-weight: 900; font-size: clamp(56px, 6vw, 92px); line-height: .8; color: transparent; -webkit-text-stroke: 1.5px var(--cyan); }
.gal__zona { margin: 0 0 8px; font-family: var(--f-display); font-weight: 700; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--cyan); }
.gal__title { margin: 0; font-family: var(--f-display); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: clamp(30px, 4vw, 56px); line-height: .95; }
.gal__texto { justify-self: end; max-width: 40ch; }
.gal__texto p { margin: 0; color: rgba(255, 255, 255, .7); font-size: 16px; }
.gal__texto .gal__nota { margin-top: 6px; font-size: 14px; color: rgba(255, 255, 255, .5); }
.gal__stage { position: relative; }

/* Carrusel en perspectiva */
.flow { --w: clamp(230px, 30vw, 400px); position: relative; height: calc(var(--w) * 1.25 + 64px); outline: none; }
.flow__pista { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0 0 64px; perspective: 1400px; touch-action: pan-y; user-select: none; }
.flow__item {
  position: absolute; left: 50%; top: 0; width: var(--w); aspect-ratio: 4 / 5; margin-left: calc(var(--w) / -2);
  border-radius: 16px; overflow: hidden; background: #0c2c34;
  transform: translateX(calc(var(--d) * var(--w) * .42 + var(--d) / max(var(--ad), 1) * var(--w) * .34)) translateZ(calc(var(--ad) * -150px)) rotateY(calc(var(--d) / max(var(--ad), 1) * -38deg));
  filter: brightness(calc(1 - var(--ad) * .22));
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .8);
  transition: transform .6s var(--ease), filter .6s var(--ease), opacity .4s var(--ease);
}
.flow__item.is-activo { transform: none; filter: none; }
.flow__item.is-oculto { opacity: 0; pointer-events: none; }
/* reflejo suave bajo cada tarjeta, como una vitrina */
.flow__item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); pointer-events: none; }
.flow__foto { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.flow__item:not(.is-activo) .flow__foto { cursor: pointer; }
.flow__item.is-activo .flow__foto { cursor: zoom-in; }
.flow__foto picture, .flow__foto img { display: block; width: 100%; height: 100%; }
.flow__foto img { object-fit: cover; -webkit-user-drag: none; }
.flow__item--video video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.flow__tapa { position: absolute; inset: 0; display: grid; place-items: center; border: 0; background: linear-gradient(0deg, rgba(10, 33, 40, .5), transparent 50%); cursor: pointer; }
.flow__tapa svg { width: 64px; height: 64px; padding: 20px; border-radius: 50%; background: var(--orange); fill: var(--ink); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .6); transition: transform .25s var(--ease); }
.flow__tapa:hover svg { transform: scale(1.08); }
.flow__item.is-playing .flow__tapa { display: none; }
.flow__flecha {
  position: absolute; top: calc((var(--w) * 1.25) / 2 - 26px); z-index: 120; width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(10, 33, 40, .7); backdrop-filter: blur(8px); color: var(--white);
  display: grid; place-items: center; transition: background .2s, color .2s, opacity .2s, transform .15s;
}
.flow__flecha svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.flow__flecha:hover:not(:disabled) { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.flow__flecha:active:not(:disabled) { transform: scale(.94); }
.flow__flecha:disabled { opacity: .25; cursor: default; }
.flow__flecha--prev { left: max(0px, calc(50% - var(--w) * 1.45)); }
.flow__flecha--next { right: max(0px, calc(50% - var(--w) * 1.45)); }
.flow__leyenda { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; text-align: center; font-size: 14px; color: rgba(255, 255, 255, .6); }
.flow__leyenda em { font-family: 'Caveat', cursive; font-style: normal; font-size: 26px; color: var(--white); }
.flow__leyenda span { margin-left: 10px; font-variant-numeric: tabular-nums; color: var(--cyan); font-weight: 600; }
.flow__esqueleto { display: block; position: absolute; left: 50%; top: 0; width: var(--w); margin-left: calc(var(--w) / -2); aspect-ratio: 4 / 5; border-radius: 16px; }
.is-loading { background: linear-gradient(100deg, #0c2c34 30%, #12404a 50%, #0c2c34 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.gal__pie { display: flex; justify-content: center; align-items: center; gap: 28px; margin-top: 18px; flex-wrap: wrap; }
.gal__link { font-family: var(--f-display); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); padding-bottom: 4px; border-bottom: 1.5px solid currentColor; }
.gal__link:hover { color: var(--white); }
.gal__volver { font-size: 13px; color: rgba(255, 255, 255, .5); }
.gal__volver:hover { color: var(--white); }

/* Sin fotos todavía */
.gal__vacio { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding: 28px 32px; border: 1.5px dashed rgba(255, 255, 255, .18); border-radius: var(--radius-sm); }
.gal__vacio p { margin: 0; max-width: 52ch; color: rgba(255, 255, 255, .65); }
.gal__vacio strong { color: var(--white); }

/* Velo +18 */
.flow, .gal__compare { transition: filter .8s var(--ease); }
.gal.is-veiled .flow, .gal.is-veiled .gal__compare { filter: blur(28px); pointer-events: none; }
.gal__veil { position: absolute; inset: 0; z-index: 130; display: grid; place-items: center; padding: 20px; text-align: center; transition: opacity .5s var(--ease), visibility .5s; }
.gal:not(.is-veiled) .gal__veil { opacity: 0; visibility: hidden; }
.gal__veil-card { max-width: 380px; padding: 28px; border-radius: var(--radius-sm); background: rgba(10, 33, 40, .88); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(10px); }
.gal__veil-badge { display: inline-block; padding: 4px 10px; border-radius: 8px; background: var(--orange); color: var(--ink); font-family: var(--f-display); font-weight: 900; font-size: 13px; }
.gal__veil-card strong { display: block; margin: 14px 0 8px; font-family: var(--f-display); font-weight: 900; text-transform: uppercase; font-size: 18px; }
.gal__veil-card p { margin: 0 0 20px; font-size: 14px; color: rgba(255, 255, 255, .7); }

/* Antes / después (si se agregan pares) */
.gal__compare { margin: 40px auto 0; max-width: 460px; }
.gal__compare h3 { margin: 0 0 16px; font-family: var(--f-display); font-weight: 900; text-transform: uppercase; font-size: 18px; }
.ba { position: relative; max-width: 460px; aspect-ratio: 4 / 5; border-radius: var(--radius-sm); overflow: hidden; user-select: none; }
.ba + .ba { margin-top: 32px; }
.ba__layer { position: absolute; inset: 0; }
.ba__layer img { width: 100%; height: 100%; object-fit: cover; }
.ba__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba__label { position: absolute; top: 14px; padding: 5px 10px; border-radius: 8px; font-family: var(--f-display); font-weight: 800; font-size: 11px; letter-spacing: .14em; background: rgba(10, 33, 40, .8); color: var(--white); }
.ba__label--before { left: 14px; }
.ba__label--after { right: 14px; background: var(--orange); color: var(--ink); }
.ba__handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--white); pointer-events: none; }
.ba__knob { position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--white); color: var(--ink); display: grid; place-items: center; }
.ba__knob svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.ba__range { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: ew-resize; }

.btn--outline { background: transparent; color: var(--white); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .4); }
.btn--outline:hover { background: var(--white); color: var(--ink); }

.gal-disclaimer { padding-top: 48px; padding-bottom: 72px; font-size: 13px; color: rgba(255, 255, 255, .5); }
.gal-disclaimer a { color: var(--cyan); text-decoration: underline; }

/* ---------- Aviso +18 al entrar ---------- */
.gate {
  width: min(460px, calc(100% - 32px)); padding: 40px 32px 32px; border: 1px solid rgba(0, 168, 204, .3); border-radius: var(--radius);
  background: var(--teal-950); color: var(--white); text-align: center;
}
.gate::backdrop { background: rgba(5, 16, 19, .82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.gate[open] { animation: gate-in .5s var(--ease); }
@keyframes gate-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.gate__mark { height: 64px; width: auto; margin: 0 auto 16px; opacity: .9; }
.gate__badge { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 8px; background: var(--orange); color: var(--ink); font-family: var(--f-display); font-weight: 900; }
.gate__title { margin: 0 0 12px; font-family: var(--f-display); font-weight: 900; text-transform: uppercase; font-size: clamp(22px, 4vw, 28px); line-height: 1.05; }
.gate__text { margin: 0 0 26px; font-size: 15px; color: rgba(255, 255, 255, .72); }
.gate__text strong { color: var(--white); }
.gate__actions { display: grid; gap: 10px; }

/* ---------- Visor ampliado ---------- */
.lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 16, 19, .96); color: var(--white); }
.lb::backdrop { background: transparent; }
.lb[open] { animation: lb-in .32s var(--ease); }
.lb.is-closing { animation: lb-out .2s ease-in forwards; }
@keyframes lb-in { from { opacity: 0; } }
@keyframes lb-out { to { opacity: 0; } }
.lb__stage { position: absolute; inset: 84px 96px 32px; display: grid; place-items: center; touch-action: pan-y; }
.lb__stage picture { display: contents; }
.lb__img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 14px; user-select: none; -webkit-user-drag: none; }
.lb__bar { position: absolute; top: 0; left: 0; right: 0; height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.lb__caption { margin: 0; display: flex; align-items: baseline; gap: 12px; }
.lb__title { font-family: var(--f-display); font-weight: 900; text-transform: uppercase; font-size: 18px; }
.lb__count { font-size: 14px; color: rgba(255, 255, 255, .6); font-variant-numeric: tabular-nums; }
.lb__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.lb__btn { width: 50px; height: 50px; border-radius: 14px; border: 0; background: rgba(255, 255, 255, .1); color: var(--white); display: grid; place-items: center; transition: background-color .2s, transform .2s; }
.lb__btn:hover { background: var(--orange); color: var(--ink); }
.lb__btn:active { transform: scale(.94); }
.lb__nav { position: absolute; top: 50%; margin-top: -25px; }
.lb__prev { left: 24px; }
.lb__next { right: 24px; }
.lb.is-single .lb__nav, .lb.is-single .lb__count { display: none; }

/* El chat y el aviso de cookies quedan sobre el fondo oscuro */
.page-galeria .footer { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .indice__zonas { grid-template-columns: 1fr 1fr; }
  .indice__zona:first-child { grid-column: 1 / -1; }
  .gal__head { grid-template-columns: auto 1fr; }
  .gal__texto { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 720px) {
  .page-hero { padding: 8px; }
  .page-hero__content { padding-top: 120px; }
  .indice__zonas { grid-template-columns: 1fr; gap: 36px; }
  .gal__head { gap: 10px 16px; }
  .flow { --w: min(64vw, 280px); }
  .flow__item { transform: translateX(calc(var(--d) * var(--w) * .2 + var(--d) / max(var(--ad), 1) * var(--w) * .34)) translateZ(calc(var(--ad) * -160px)) rotateY(calc(var(--d) / max(var(--ad), 1) * -40deg)); }
  .flow__flecha { width: 44px; height: 44px; top: auto; bottom: 0; }
  .flow__flecha--prev { left: 0; }
  .flow__flecha--next { right: 0; }
  .flow__leyenda { bottom: 10px; padding: 0 52px; }
  .gal__pie { gap: 18px; }
  .lb__stage { inset: 68px 12px 96px; }
  .lb__bar { height: 68px; padding: 0 16px; }
  .lb__nav { top: auto; bottom: calc(22px + env(safe-area-inset-bottom)); margin: 0; }
  .lb__prev { left: calc(50% - 62px); }
  .lb__next { right: calc(50% - 62px); }
}
@media (prefers-reduced-motion: reduce) {
  .is-loading { animation: none; }
  .flow__item { transition: none; }
}
@media (max-width: 720px) {
  .gal__title { font-size: clamp(22px, 7.2vw, 34px); overflow-wrap: anywhere; }
  .gal__num { font-size: 44px; }
  .indice__intro { flex-wrap: wrap; gap: 6px 14px; }
}
/* los videos son verticales (9:16): misma altura que las fotos, pero sin recortar el video */
.flow__item--video { --vw: calc(var(--w) * 1.25 * 9 / 16); width: var(--vw); margin-left: calc(var(--vw) / -2); aspect-ratio: 9 / 16; }
.flow__item--video video { object-fit: contain; }
