/* Tokens: paleta dark de shadcn/ui (zinc), la misma base que usa el componente de 21st.dev */
:root {
  --background: hsl(240 10% 3.9%);
  --foreground: hsl(0 0% 98%);
  --card: hsl(240 10% 5.5%);
  --muted: hsl(240 3.7% 15.9%);
  --muted-foreground: hsl(240 5% 64.9%);
  --secondary: hsl(240 3.7% 15.9%);
  --secondary-foreground: hsl(0 0% 98%);
  --primary: hsl(0 0% 98%);
  --primary-foreground: hsl(240 5.9% 10%);
  --border: hsl(240 3.7% 15.9%);
  --ring: hsl(240 4.9% 83.9%);
  --radius: 0.75rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4rem; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.025em; }
p { margin: 0; }

.container { width: 100%; max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

/* Iconos (trazos estilo lucide) */
.icon { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon--xs { width: 0.75rem; height: 0.75rem; }
.icon--lg { width: 2rem; height: 2rem; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.625rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.badge--secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge--outline { border-color: var(--border); color: var(--foreground); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1.25rem; border-radius: calc(var(--radius) - 4px);
  font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; background: none; color: inherit;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.btn:focus-visible, .card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:active { transform: scale(0.97); }
.btn--sm { height: 2.25rem; padding: 0 0.875rem; }
.btn--default { background: var(--primary); color: var(--primary-foreground); }
.btn--default:hover { background: hsl(0 0% 85%); }
.btn--outline { border-color: var(--border); background: var(--background); }
.btn--outline:hover { background: var(--secondary); }
.btn--ghost:hover { background: hsl(0 0% 100% / 0.1); }
.btn--icon { width: 2.5rem; padding: 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* Animación de entrada al hacer scroll (equivalente a motion initial/animate) */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal--delay { transition-delay: .15s; }
.reveal.is-visible { opacity: 1; transform: none; }

/* Navegación */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 40;
  background: hsl(240 10% 3.9% / 0.6); backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(240 3.7% 15.9% / 0.6);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.nav__logo { font-weight: 800; letter-spacing: 0.2em; font-size: 0.95rem; }
.nav__links { display: flex; align-items: center; gap: 1.5rem; font-size: 0.875rem; }
.nav__links a:not(.btn) { color: var(--muted-foreground); transition: color .2s; }
.nav__links a:not(.btn):hover { color: var(--foreground); }
@media (max-width: 520px) { .nav__links a:not(.btn) { display: none; } }

/* Portada */
.hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; }
.hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: heroZoom 14s var(--ease-out) both; }
@keyframes heroZoom { from { transform: scale(1.12); } to { transform: scale(1); } }
.hero__shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--background) 0%, hsl(240 10% 3.9% / 0.75) 35%, hsl(240 10% 3.9% / 0.1) 75%),
    linear-gradient(to right, hsl(240 10% 3.9% / 0.7), transparent 60%);
}
.hero__content { position: relative; padding-top: 7rem; padding-bottom: 4rem; }
.hero__title { margin: 1rem 0; font-size: clamp(2.25rem, 6vw, 4.5rem); font-weight: 800; max-width: 16ch; }
.hero__text { color: var(--muted-foreground); font-size: 1.125rem; max-width: 34rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero__stats { display: flex; gap: 2.5rem; margin: 3rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--border); max-width: 30rem; }
.hero__stats dt { font-size: 1.75rem; font-weight: 700; }
.hero__stats dd { margin: 0; color: var(--muted-foreground); font-size: 0.8rem; }

/* Secciones */
.section { padding: 6rem 0; }
.section--alt { background: hsl(240 10% 5%); border-block: 1px solid var(--border); }
.section__head { text-align: center; margin-bottom: 3rem; }
.section__title { margin: 1rem 0; font-size: clamp(2rem, 4vw, 2.5rem); font-weight: 700; }
.section__text { color: var(--muted-foreground); max-width: 42rem; margin: 0 auto; }

/* Galería a pantalla completa: el encabezado va en .container, el índice y el mosaico de borde a borde */
.section--gallery { padding-bottom: 4rem; }
.bleed { padding-inline: clamp(0.5rem, 1.5vw, 1.5rem); }
[hidden] { display: none !important; }

/* Índice de sesiones: una portada 3:2 por modelo */
.sessions { display: grid; gap: 6px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .sessions { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1800px) { .sessions { grid-template-columns: repeat(3, 1fr); } }
.sessions__item { animation: popIn .5s var(--ease-out) both; }
.cover { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 2px; background: var(--muted); }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease-out), filter .4s; }
.cover:hover img, .cover:focus-visible img { transform: scale(1.04); filter: brightness(1.08); }
.cover:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.cover__caption {
  position: absolute; inset: auto 0 0; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 4rem clamp(1rem, 2vw, 1.75rem) clamp(0.9rem, 1.6vw, 1.5rem);
  background: linear-gradient(to top, rgb(0 0 0 / .75), rgb(0 0 0 / .35) 55%, transparent);
}
.cover__name { font-size: clamp(1.15rem, 1.8vw, 1.6rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.cover__count { flex-shrink: 0; color: hsl(0 0% 100% / .7); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; }

/* Barra de la sesión abierta */
.session__bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding-block: 0 1.25rem;
}
.session__back { display: inline-flex; align-items: center; gap: 0.25rem; justify-self: start; color: var(--muted-foreground); font-size: 0.875rem; transition: color .2s; }
.session__back .icon { width: 1.1rem; height: 1.1rem; }
.session__title { text-align: center; }
.session__title h3 { font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 700; }
.session__title span { color: var(--muted-foreground); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; }
.session__nav { display: flex; gap: 0.25rem; justify-self: end; }
.session__nav a { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted-foreground); transition: color .2s, background-color .2s; }
.session__back:hover, .session__nav a:hover { color: var(--foreground); }
.session__nav a:hover { background: var(--secondary); }
.session__nav .icon { width: 1.1rem; height: 1.1rem; }
@media (max-width: 640px) {
  .session__bar { grid-template-columns: 1fr auto; }
  .session__title { grid-column: 1 / -1; grid-row: 1; margin-bottom: 0.25rem; }
}

/* Mosaico de filas justificadas: cada foto mantiene su formato y todas las de una fila miden lo mismo de alto.
   --row-h es la altura objetivo (relativa al ancho de pantalla); main.js da a cada foto flex-grow y
   flex-basis proporcionales a ancho/alto. Resultado: 1 apaisada por fila en móvil, 2 en tablet y
   escritorio, 3 a partir de 1800 px. */
.grid { --row-h: 50vw; display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ""; flex: 1e6 0 0; } /* la última fila no se estira */
@media (min-width: 640px) { .grid { --row-h: 26vw; } }
@media (min-width: 1024px) { .grid { --row-h: 24vw; } }
@media (min-width: 1800px) { .grid { --row-h: 17vw; } }

.grid__item { animation: popIn .35s var(--ease-out) both; }
@keyframes popIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.tile {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden; cursor: zoom-in;
  border: 0; border-radius: 2px; background: var(--muted);
}
.tile:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out), filter .3s; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.03); filter: brightness(1.08); }

/* Sobre mí */
.about { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 900px) { .about { grid-template-columns: 1fr 1fr; gap: 4rem; } }
.about__img { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4 / 5; }
.about__img img { width: 100%; height: 100%; object-fit: cover; }
.about__body p { color: var(--muted-foreground); margin-bottom: 1rem; }
.services { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Contacto */
.contact { display: grid; gap: 1rem; max-width: 56rem; margin: 0 auto; }
@media (min-width: 720px) { .contact { grid-template-columns: repeat(3, 1fr); } }
.contact__item { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2rem 1rem; text-align: center; transition: border-color .3s, transform .3s var(--ease-out); }
.contact__item:hover { border-color: var(--ring); transform: translateY(-4px); }
.contact__label { color: var(--muted-foreground); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.contact__value { font-weight: 600; word-break: break-word; }

/* Datos pendientes de rellenar: se ven a simple vista mientras no estén los reales */
.todo { outline: 1px dashed hsl(45 90% 55% / 0.7); outline-offset: 3px; border-radius: 2px; }

.footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--muted-foreground); font-size: 0.875rem; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgb(0 0 0 / .96);
  animation: fadeIn .2s ease both;
}
.lightbox[hidden] { display: none; }
.lightbox.is-closing { animation: fadeOut .2s ease both; }
.lightbox.is-closing .lightbox__panel { animation: panelOut .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.lightbox__panel { margin: 0; max-width: 96vw; display: flex; flex-direction: column; align-items: center; animation: panelIn .45s var(--spring) both; }
@keyframes panelIn { from { opacity: 0; transform: scale(0.85); } }
@keyframes panelOut { to { opacity: 0; transform: scale(0.85); } }
.lightbox__panel img { max-width: 100%; max-height: 86vh; max-height: 86svh; width: auto; border-radius: 0.5rem; user-select: none; }
.lightbox__panel img.is-swapping { animation: fadeIn .25s ease both; }
.lightbox__info { margin-top: 0.75rem; text-align: center; color: var(--muted-foreground); display: flex; align-items: center; gap: 0.75rem; animation: infoIn .4s .1s var(--ease-out) both; }
@keyframes infoIn { from { opacity: 0; transform: translateY(20px); } }
.lightbox__info h3 { font-size: 1rem; font-weight: 600; color: var(--foreground); }
.lightbox .btn--ghost { color: var(--muted-foreground); position: absolute; z-index: 1; }
.lightbox .btn--ghost:hover { color: var(--foreground); }
.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; }
.lightbox__nav:active { transform: translateY(-50%) scale(0.95); }
.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--next { right: 1rem; }
@media (min-width: 641px) { .lightbox__panel { max-width: calc(100vw - 9rem); } } /* las flechas no tapan la foto */
@media (max-width: 640px) { .lightbox__nav { top: auto; bottom: 1rem; transform: none; } .lightbox__nav:active { transform: scale(0.95); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
