/* Galería de fotos Trocha 66 · mobile-first. Paleta y tipografías del sitio de eventos (tinta, hueso, óxido). */
:root {
  --tinta: #11130f;
  --tinta-2: #1a1d17;
  --tinta-3: #252921;
  --hueso: #e8dbca;
  --crema: #f1e9dc;
  --oxido: #ce6842;
  --rojo: #d4402a;
  --apagado: #9d9b8f;
  --borde: rgb(232 219 202 / 0.16);
  --titulo: 'Barlow Condensed', Impact, sans-serif;
  --cuerpo: 'DM Sans', system-ui, sans-serif;
  --radio: 10px;
  --lado: 16px;
  --alto-fila: 130px;
  --mov: 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  --abajo: max(12px, env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  :root { --lado: clamp(20px, 4vw, 40px); --alto-fila: clamp(170px, 20vw, 260px); }
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-block-size: 100dvh; background: var(--tinta); color: var(--crema); font: 400 1rem/1.5 var(--cuerpo); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
img { display: block; max-inline-size: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--oxido); outline-offset: 3px; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.vh { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.saltar { position: absolute; inset-inline-start: 8px; inset-block-start: -60px; z-index: 100; padding: 10px 16px; background: var(--crema); color: var(--tinta); border-radius: var(--radio); font-weight: 700; }
.saltar:focus { inset-block-start: 8px; }

/* ── Barra superior ───────────────────────────── */
.barra { position: absolute; inset-inline: 0; inset-block-start: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) var(--lado) 12px; }
.barra__marca { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 800 1.3rem/1 var(--titulo); letter-spacing: 0.06em; text-transform: uppercase; }
.barra__marca img { border-radius: 50%; }
.barra__enlace { font-size: 0.85rem; color: var(--hueso); text-underline-offset: 4px; min-block-size: 44px; display: inline-flex; align-items: center; }

/* ── Botones ──────────────────────────────────── */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-block-size: 52px; padding: 0 26px; border: 2px solid transparent; border-radius: 999px; font: 700 1.1rem/1 var(--titulo); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; transition: transform var(--mov), background-color var(--mov), border-color var(--mov); }
.boton:active { transform: scale(0.97); }
.boton--rojo { background: var(--rojo); color: #fff; }
.boton--borde { border-color: var(--borde); background: rgb(17 19 15 / 0.45); backdrop-filter: blur(6px); }
@media (hover: hover) { .boton:hover { transform: translateY(-2px); } .boton--rojo:hover { background: #e24c35; } .boton--borde:hover { border-color: var(--hueso); } }

/* ── Hero: pantalla completa en el celular ────── */
.hero { position: relative; display: grid; align-items: end; min-block-size: 100svh; padding: 96px var(--lado) calc(var(--abajo) + 56px); isolation: isolate; overflow: hidden; background: var(--tinta-2); }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -2; background: var(--portada, none) center / cover no-repeat; transform: scale(1.04); animation: respira 18s ease-in-out infinite alternate; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, var(--tinta) 6%, rgb(17 19 15 / 0.6) 48%, rgb(17 19 15 / 0.3)), radial-gradient(120% 80% at 0% 100%, rgb(212 64 42 / 0.3), transparent 60%); }
@keyframes respira { to { transform: scale(1.12) translate(-1.5%, -1%); } }
.hero__contenido { max-inline-size: 900px; }
.hero__kicker { margin: 0 0 6px; font: 700 1rem/1.25 var(--titulo); letter-spacing: 0.2em; text-transform: uppercase; color: var(--oxido); }
.hero__titulo { margin: 0; font: 800 clamp(4.4rem, 24vw, 11rem)/0.85 var(--titulo); letter-spacing: -0.01em; text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere; }
.hero__lema { margin: 14px 0 4px; font: 600 clamp(1.5rem, 6vw, 2.2rem)/1.1 var(--titulo); letter-spacing: 0.03em; text-transform: uppercase; color: var(--hueso); }
.hero__lugar { margin: 0 0 16px; color: var(--apagado); font-size: 0.95rem; }
.hero__contador { margin: 0 0 18px; font: 600 1.1rem/1 var(--titulo); letter-spacing: 0.12em; text-transform: uppercase; color: var(--hueso); }
.hero__contador b { color: var(--oxido); font-size: 1.5em; }
.hero__acciones { display: grid; gap: 10px; }
@media (min-width: 520px) { .hero__acciones { display: flex; flex-wrap: wrap; } }
.hero__pista { position: absolute; inset-inline: 0; inset-block-end: calc(var(--abajo) + 4px); display: grid; place-items: center; color: var(--hueso); animation: rebota 1.8s ease-in-out infinite; }
.hero__pista svg { inline-size: 28px; block-size: 28px; }
@keyframes rebota { 50% { transform: translateY(6px); opacity: 0.6; } }

/* ── Rejilla justificada: cada foto crece según su proporción, sin saltos de diseño ── */
.fotos { padding: 4px 3px 140px; outline: none; scroll-margin-block-start: 0; }
@media (min-width: 700px) { .fotos { padding: 18px var(--lado) 140px; } }
.rejilla { display: flex; flex-wrap: wrap; gap: 3px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 700px) { .rejilla { gap: 6px; } }
.rejilla::after { content: ''; flex-grow: 1000000; }
.foto { position: relative; flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--alto-fila)); min-inline-size: 0; max-inline-size: calc(var(--ar) * 420px); aspect-ratio: var(--ar); overflow: hidden; border-radius: 4px; background: var(--tinta-3) var(--borroso, none) center / cover; animation: aparece 0.5s var(--mov) both; animation-delay: calc(min(var(--i, 0), 10) * 40ms); }
@keyframes aparece { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.foto[hidden] { display: none; }
.foto__abrir { position: absolute; inset: 0; display: block; inline-size: 100%; block-size: 100%; padding: 0; border: 0; background: none; }
.foto__abrir img { inline-size: 100%; block-size: 100%; object-fit: cover; opacity: 0; transition: opacity 0.45s; }
.foto__abrir img.lista { opacity: 1; }
.foto__abrir:active img { transform: scale(0.98); }
.foto__fav { position: absolute; inset-block-start: 0; inset-inline-end: 0; z-index: 2; display: grid; place-items: center; inline-size: 48px; block-size: 48px; padding: 0; border: 0; background: transparent; }
.foto__fav svg { inline-size: 22px; block-size: 22px; color: #fff; filter: drop-shadow(0 1px 3px rgb(0 0 0 / 0.8)); opacity: 0.75; transition: transform var(--mov); }
.foto__fav[aria-pressed='true'] svg { fill: var(--rojo); stroke: var(--rojo); opacity: 1; }
.foto__fav:active svg { transform: scale(1.35); }
@media (hover: hover) {
  .foto__abrir img { transition: opacity 0.45s, transform 0.6s var(--mov); }
  .foto__abrir:hover img { transform: scale(1.05); }
  .foto__fav svg { opacity: 0; }
  .foto:hover .foto__fav svg, .foto__fav:focus-visible svg { opacity: 0.9; }
  .foto__fav[aria-pressed='true'] svg { opacity: 1; }
}

.mensaje { margin: 40px var(--lado); text-align: center; color: var(--apagado); font-size: 1.05rem; }
.mensaje:empty { display: none; }

/* ── Dock inferior ────────────────────────────── */
.dock { position: fixed; inset-inline: 0; inset-block-end: var(--abajo); z-index: 20; display: flex; justify-content: center; padding-inline: 12px; pointer-events: none; }
.dock[hidden] { display: none; }
.dock--fuera .dock__grupo { opacity: 0; transform: translateY(30px); pointer-events: none; }
.dock__grupo { transition: opacity var(--mov), transform var(--mov); }
.dock__grupo { display: flex; gap: 4px; padding: 5px; pointer-events: auto; border: 1px solid var(--borde); border-radius: 999px; background: rgb(26 29 23 / 0.9); backdrop-filter: blur(16px) saturate(1.3); box-shadow: 0 14px 40px rgb(0 0 0 / 0.55); animation: sube 0.45s var(--mov); }
@keyframes sube { from { opacity: 0; transform: translateY(26px); } }
.dock__zip { display: contents; }
.dock__zip[hidden] { display: none; }
.dock__btn { display: inline-flex; align-items: center; gap: 8px; min-block-size: 50px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; font: 700 1.05rem/1 var(--titulo); letter-spacing: 0.08em; text-transform: uppercase; transition: background-color var(--mov), transform var(--mov); }
.dock__btn:active { transform: scale(0.95); }
.dock__btn svg { inline-size: 22px; block-size: 22px; flex: none; }
.dock__btn span:first-of-type { max-inline-size: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock__n { font: 500 0.8rem/1 var(--cuerpo); letter-spacing: 0; opacity: 0.65; }
.dock__btn--fav[aria-pressed='true'] { background: var(--crema); color: var(--tinta); }
.dock__btn--fav[aria-pressed='true'] svg, .dock__btn--fav.tiene svg { fill: var(--rojo); stroke: var(--rojo); }
.dock__btn--fav.tiene:not([aria-pressed='true']) svg { fill: var(--rojo); }
.dock__btn--zip { background: var(--rojo); color: #fff; }
.dock__btn--zip svg { fill: none; }

/* ── Hoja inferior (filtros y favoritas) ──────── */
.hoja { inset: auto 0 0; margin: auto auto 0; inline-size: 100%; max-inline-size: 560px; max-block-size: 85dvh; padding: 0 var(--lado) max(18px, env(safe-area-inset-bottom)); border: 0; border-radius: 26px 26px 0 0; background: var(--tinta-2); color: var(--crema); overflow: auto; overscroll-behavior: contain; }
.hoja[open] { animation: hoja-sube 0.36s var(--mov); }
.hoja::backdrop { background: rgb(0 0 0 / 0.62); animation: abre 0.3s; }
@keyframes hoja-sube { from { transform: translateY(100%); } }
.hoja__asa { display: grid; place-items: center; padding: 12px 0 6px; touch-action: none; cursor: grab; }
.hoja__asa span { inline-size: 44px; block-size: 5px; border-radius: 3px; background: var(--borde); background: rgb(232 219 202 / 0.3); }
.hoja__titulo { margin: 4px 0 14px; font: 800 1.9rem/1 var(--titulo); letter-spacing: 0.04em; text-transform: uppercase; }
.buscador { margin-block-end: 14px; }
.buscador__campo { inline-size: 100%; min-block-size: 54px; padding: 0 18px 0 48px; border: 1px solid var(--borde); border-radius: 16px; background: var(--tinta-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239d9b8f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 16px center / 22px no-repeat; color: var(--crema); font: 400 16px/1.2 var(--cuerpo); }
.buscador__campo::placeholder { color: var(--apagado); }
.sugerencias { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 10px; }
.sugerencias:empty { display: none; }
.sugerencia { min-block-size: 40px; padding: 0 14px; border: 1px solid var(--borde); border-radius: 999px; background: transparent; font: 600 0.95rem/1 var(--cuerpo); text-transform: capitalize; }
.hoja__chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-block-size: 54px; padding: 0 16px; border: 1px solid var(--borde); border-radius: 16px; background: var(--tinta-3); text-align: start; font: 700 1.1rem/1.1 var(--titulo); letter-spacing: 0.06em; text-transform: uppercase; }
.chip__n { font: 500 0.85rem/1 var(--cuerpo); letter-spacing: 0; opacity: 0.65; }
.chip[aria-pressed='true'] { background: var(--crema); color: var(--tinta); border-color: var(--crema); }
.hoja__favs { margin-block-start: 18px; padding-block-start: 16px; border-block-start: 1px solid var(--borde); }
.hoja__texto { margin: 0 0 12px; color: var(--apagado); font-size: 0.92rem; }
.hoja__acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hoja__cerrar { display: block; inline-size: 100%; min-block-size: 52px; margin-block-start: 14px; border: 0; border-radius: 16px; background: transparent; color: var(--apagado); font: 700 1.05rem/1 var(--titulo); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── Visor (dialog nativo: foco atrapado, Esc cierra y devuelve el foco) ── */
.visor { inset: 0; inline-size: 100%; max-inline-size: none; block-size: 100dvh; max-block-size: none; margin: 0; padding: 0; border: 0; background: #060705; color: var(--crema); overflow: hidden; }
.visor[open] { display: grid; grid-template: 'tope' auto 'fig' 1fr 'pista' auto 'acc' auto / 1fr; }
.visor::backdrop { background: #000; }
@keyframes abre { from { opacity: 0; } }
.visor__tope { grid-area: tope; display: flex; align-items: center; justify-content: space-between; padding: max(6px, env(safe-area-inset-top)) 8px 0 20px; position: relative; z-index: 3; }
.visor__cuenta { margin: 0; font: 700 1.1rem/1 var(--titulo); letter-spacing: 0.14em; color: var(--apagado); }
.visor__icono, .visor__flecha { display: grid; place-items: center; inline-size: 48px; block-size: 48px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.visor__icono svg, .visor__flecha svg { inline-size: 28px; block-size: 28px; stroke-width: 2.2; }
.visor__flecha { display: none; }
.visor__figura { grid-area: fig; position: relative; display: grid; place-items: center; min-block-size: 0; min-inline-size: 0; margin: 0; overflow: hidden; touch-action: none; }
.visor__img { max-inline-size: 100%; max-block-size: 100%; inline-size: auto; block-size: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; transform-origin: center; will-change: transform; }
.visor__img.sale-sig { animation: entra-sig 0.3s var(--mov); }
.visor__img.sale-ant { animation: entra-ant 0.3s var(--mov); }
@keyframes entra-sig { from { opacity: 0; transform: translateX(40px); } }
@keyframes entra-ant { from { opacity: 0; transform: translateX(-40px); } }
.corazon { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.corazon svg { inline-size: 110px; block-size: 110px; fill: var(--rojo); stroke: #fff; stroke-width: 1.2; filter: drop-shadow(0 6px 24px rgb(0 0 0 / 0.6)); }
.corazon.late { animation: late 0.8s var(--mov); }
@keyframes late { 0% { opacity: 0; transform: scale(0.4); } 25% { opacity: 1; transform: scale(1.15); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25) translateY(-20px); } }
.visor__pista { grid-area: pista; margin: 0; padding: 6px 12px 0; text-align: center; font-size: 0.78rem; color: var(--apagado); transition: opacity 0.6s; }
.visor__pista.oculta { opacity: 0; }
.visor__acciones { grid-area: acc; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px 10px max(12px, env(safe-area-inset-bottom)); }
.accion { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-block-size: 64px; padding: 6px 4px; border: 0; border-radius: 16px; background: var(--tinta-2); font: 700 0.9rem/1 var(--titulo); letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; text-align: center; transition: background-color var(--mov), transform var(--mov); }
.accion:active { transform: scale(0.94); }
.accion svg { inline-size: 24px; block-size: 24px; }
.accion--principal { background: var(--rojo); color: #fff; }
.accion[aria-pressed='true'] svg { fill: var(--rojo); stroke: var(--rojo); }
.accion[aria-busy='true'] { opacity: 0.6; pointer-events: none; }
.visor.arrastrando .visor__tope, .visor.arrastrando .visor__acciones, .visor.arrastrando .visor__pista { opacity: 0.25; }

@media (min-width: 700px) {
  .visor[open] { grid-template: 'tope tope tope' auto 'ant fig sig' 1fr 'acc acc acc' auto / 72px 1fr 72px; }
  .visor__pista { display: none; }
  .visor__acciones { grid-template-columns: none; display: flex; justify-content: center; gap: 10px; }
  .accion { flex-direction: row; gap: 10px; min-block-size: 52px; padding: 0 22px; border-radius: 999px; font-size: 1rem; }
}
@media (hover: hover) and (pointer: fine) {
  .visor__flecha { display: grid; align-self: center; justify-self: center; }
  .visor__flecha--ant { grid-area: ant; }
  .visor__flecha--sig { grid-area: sig; }
  .visor__flecha:hover, .visor__icono:hover { background: rgb(232 219 202 / 0.12); }
  .accion:hover { background: var(--tinta-3); }
  .accion--principal:hover { background: #e24c35; }
}
@media (hover: hover) and (pointer: fine) and (max-width: 699px) {
  .visor[open] { grid-template-columns: 1fr; }
  .visor__flecha { position: absolute; inset-block-start: 50%; translate: 0 -50%; z-index: 3; }
  .visor__flecha--ant { inset-inline-start: 8px; }
  .visor__flecha--sig { inset-inline-end: 8px; }
}

/* Transición de la miniatura al visor (Chrome, Safari 18+) */
::view-transition-group(foto) { animation-duration: 0.38s; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }
::view-transition-old(foto), ::view-transition-new(foto) { block-size: 100%; inline-size: 100%; object-fit: contain; }

/* ── Índice de eventos ────────────────────────── */
.indice { padding: 110px var(--lado) 80px; max-inline-size: 1200px; margin-inline: auto; }
.indice .hero__titulo { font-size: clamp(3rem, 14vw, 7rem); }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; margin-block-start: 32px; }
.tarjeta { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-block-size: 380px; padding: 24px; border-radius: 20px; overflow: hidden; isolation: isolate; text-decoration: none; background: var(--tinta-2); transition: transform var(--mov); }
.tarjeta::before { content: ''; position: absolute; inset: 0; z-index: -2; background: var(--portada, none) center / cover; transition: transform 0.8s var(--mov); }
.tarjeta::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgb(17 19 15 / 0.95), rgb(17 19 15 / 0.1) 70%); }
.tarjeta:active { transform: scale(0.98); }
.tarjeta__kicker { font: 700 1rem/1 var(--titulo); letter-spacing: 0.22em; color: var(--oxido); }
.tarjeta__nombre { font: 800 3.6rem/0.9 var(--titulo); text-transform: uppercase; }
.tarjeta__meta { color: var(--hueso); font-size: 0.9rem; }
.tarjeta__cta { margin-block-start: 8px; font: 700 1.05rem/1 var(--titulo); letter-spacing: 0.1em; text-transform: uppercase; color: var(--rojo); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
