
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000;
  --bg-rgb: 0, 0, 0;
  --fg: #f4f4f2;
  --muted: #8a8a88;
  --line: #2a2a2a;
  --soft: #c9c9c6;   /* texto secundario */
  --tile: #111;      /* fondo de las fotos mientras cargan */
  --pad: clamp(16px, 2vw, 28px);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html { background: var(--bg); color: var(--fg); }
body {
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  text-transform: uppercase;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.small { font-size: 11px; letter-spacing: 0.02em; font-weight: 400; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--pad);
  padding-bottom: calc(var(--pad) * 1.6);
}
/* Fondo negro que se difumina hacia abajo, con un ligero desenfoque de lo que pasa por detrás */
.site-header::before {
  content: ""; position: absolute; inset: 0 0 -26px 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(var(--bg-rgb),.96) 0%, rgba(var(--bg-rgb),.88) 45%, rgba(var(--bg-rgb),.5) 72%, transparent 100%);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}
.site-header nav { display: flex; gap: clamp(16px, 2.4vw, 36px); }
.site-header a { position: relative; }
.site-header a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform .35s ease;
}
.site-header a:hover::after,
.site-header a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */
.hero {
  /* La foto ocupa todo el alto y se sale un poco por los lados (los bordes se funden en negro) */
  --sw: min(calc(100vw * 1.12), calc((100svh - 20px) * 16 / 9));
  /* El texto nunca más ancho que la pantalla */
  --tw: min(var(--sw), calc(100vw - 2 * var(--pad)));
  --sh: calc(var(--sw) * 9 / 16);
  --p: 0;
  position: relative;
  height: 210svh; /* la portada se queda fija mientras se anima, luego sigue la página */
}
.hero-pin {
  position: sticky; top: 0; height: 100svh; min-height: 560px;
  display: grid; place-items: center; overflow: hidden;
}
.stack {
  position: absolute; left: 50%; top: 50%;
  width: var(--sw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
}
.stack img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .9s cubic-bezier(.2,.7,.1,1), opacity .9s;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.stack img:nth-last-child(1) { transform: rotate(0deg); z-index: 3; }
.stack img:nth-last-child(2) { transform: translate(14%, -6%) rotate(7deg); z-index: 2; }
.stack img:nth-last-child(3) { transform: translate(24%, -9%) rotate(12deg); z-index: 1; }
.stack img:nth-last-child(n+4) { opacity: 0; transform: translate(30%, -10%) rotate(16deg); }
.stack-front { z-index: 6; pointer-events: none; }
.stack-front img { box-shadow: none; }

.hero h1 {
  position: absolute; z-index: 5; left: 50%;
  top: max(64px, calc(50% - var(--sh) / 2 + var(--sh) * 0.035));
  transform: translateX(-50%);
  font-weight: 500;
  display: flex; flex-direction: column; align-items: flex-start;
  pointer-events: none;
}
.hero h1 span { display: block; white-space: nowrap; }
.hero h1 .hi {
  font-size: calc(var(--tw) * 0.034); letter-spacing: -0.01em;
  padding-left: calc(var(--tw) * 0.0093); /* compensa el margen interno de la P */
}
.hero h1 .name {
  font-size: calc(var(--tw) * 0.155); letter-spacing: -0.045em; line-height: .8;
  margin-top: calc(var(--tw) * 0.004);
}

.hero-foot {
  position: absolute; inset: auto 0 0 0; padding: var(--pad);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
}
.hero-foot p:nth-child(2) { text-align: center; }
.hero-foot p:nth-child(3) { text-align: right; }

/* ---------- Galería (carrusel de temáticas) ---------- */
.gallery { padding-top: calc(var(--pad) * 4); }
.rail {
  display: flex; gap: clamp(12px, 1.4vw, 20px);
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 var(--pad); scroll-padding-inline: var(--pad); scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 clamp(220px, 21vw, 340px); scroll-snap-align: start;
  text-align: center;
}
.card figure { aspect-ratio: 3 / 4; overflow: hidden; background: var(--tile); }
.card img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.1s cubic-bezier(.2,.7,.1,1), filter .6s;
}
.card:hover img { transform: scale(1.05); }
.card h3 { margin-top: 14px; font-size: 12px; font-weight: 500; }
.card p { margin-top: 3px; font-size: 9px; color: var(--fg); }

.rail-controls {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 24px var(--pad) 40px;
}
.circle {
  width: 40px; height: 40px; border: 1px solid var(--fg); border-radius: 50%;
  display: grid; place-items: center; font-size: 16px; text-transform: none;
  transition: background .25s, color .25s;
}
.circle:hover { background: var(--fg); color: var(--bg); }

.section-title {
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 12px var(--pad) calc(var(--pad) * .6);
  font-size: clamp(56px, 9vw, 150px); font-weight: 300;
  letter-spacing: -0.04em; line-height: .9;
}
.section-title .num { font-weight: 300; }

/* ---------- Contacto ---------- */
.contact {
  min-height: 80svh; padding: calc(var(--pad) * 5) var(--pad) var(--pad);
  display: flex; flex-direction: column; justify-content: space-between; gap: 60px;
}
.contact .big {
  font-size: clamp(44px, 8vw, 140px); font-weight: 400; letter-spacing: -0.04em; line-height: .9;
}
.contact .big a { display: inline-block; border-bottom: 2px solid transparent; transition: border-color .3s; }
.contact .big a:hover { border-color: var(--fg); }
.contact .row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------- Página de temática ---------- */
.topic-head {
  padding: 84px var(--pad) 24px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
}
.topic-head h1 {
  font-size: clamp(56px, 9vw, 170px); font-weight: 400;
  letter-spacing: -0.045em; line-height: .84;
}
.topic-head .meta { text-align: right; padding-bottom: .6em; }

.strip {
  display: flex; gap: clamp(10px, 1.2vw, 18px);
  height: clamp(320px, calc(100svh - 300px), 760px);
  overflow-x: auto; overflow-y: hidden;
  padding: 0 var(--pad); scrollbar-width: none; cursor: grab;
}
.strip::-webkit-scrollbar { display: none; }
.strip.dragging { cursor: grabbing; }
.shot { flex: 0 0 auto; height: 100%; display: flex; flex-direction: column; }
.shot button { height: calc(100% - 26px); display: block; overflow: hidden; background: var(--tile); }
.shot img {
  height: 100%; width: auto; object-fit: cover;
  opacity: 0; transition: opacity .8s, transform 1.1s cubic-bezier(.2,.7,.1,1);
  user-select: none; -webkit-user-drag: none;
}
.shot img.loaded { opacity: 1; }
.shot button:hover img { transform: scale(1.03); }
.shot .cap { margin-top: 10px; font-size: 10px; color: var(--muted); display: flex; justify-content: space-between; }

.progress { margin: 28px var(--pad) 0; height: 1px; background: var(--line); position: relative; }
.progress i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--fg); width: 0; }

.next {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: calc(var(--pad) * 3);
  border-top: 1px solid var(--line);
  padding: 12px var(--pad) var(--pad);
}
.next a { display: block; }
.next a:last-child { text-align: right; }
.next .label { font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.next .name {
  font-size: clamp(32px, 5.5vw, 96px); font-weight: 400; letter-spacing: -0.04em; line-height: .9;
  transition: opacity .3s;
}
.next a:hover .name { opacity: .55; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(var(--bg-rgb),.96);
  display: grid; grid-template-rows: auto 1fr auto; opacity: 0; pointer-events: none;
  visibility: hidden; transition: opacity .35s, visibility 0s .35s;
}
.lightbox.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity .35s; }
.lightbox .lb-top, .lightbox .lb-bottom {
  display: flex; justify-content: space-between; align-items: center; padding: var(--pad);
}
.lightbox .lb-stage { display: grid; place-items: center; min-height: 0; padding: 0 var(--pad); }
.lightbox .lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Animaciones de entrada ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1s ease, transform 1s cubic-bezier(.2,.7,.1,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Móvil ---------- */
@media (max-width: 720px) {
  .hero-foot { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .hero-foot p:nth-child(2) { grid-column: 1 / -1; grid-row: 1; text-align: left; }
  .card { flex-basis: 66vw; }

  .topic-head { flex-direction: column; align-items: flex-start; }
  .topic-head .meta { text-align: left; }
  .strip { flex-direction: column; height: auto; overflow: visible; cursor: auto; }
  .shot { height: auto; }
  .shot button { height: auto; }
  .shot img { width: 100%; height: auto; }
  .progress { display: none; }
}

/* ---------- Motion blur al desplazar ---------- */
:root { --mb-y: 0px; --sk-y: 0deg; --st-y: 1; }
.rail, .strip { --mb-x: 0px; --sk-x: 0deg; }

/* Fotos: desenfoque según la velocidad (vertical u horizontal, la que sea mayor) */
.card figure,
.shot button {
  filter: blur(max(var(--mb-y), var(--mb-x)));
  transform: skewY(var(--sk-y)) skewX(var(--sk-x)) scaleY(var(--st-y));
  will-change: filter, transform;
}
/* Titulares grandes: se estiran y desenfocan un poco al hacer scroll */
.section-title,
.topic-head h1,
.next .name {
  filter: blur(calc(var(--mb-y) * 0.6));
  transform: skewY(var(--sk-y));
  transform-origin: left center;
}
.hero .stack img,
.hero h1 { filter: blur(calc(var(--mb-y) * 0.5)); }

/* ---------- Degradado en los bordes de la foto de portada ---------- */
.hero .stack {
  --fx: calc(16% + 20% * var(--p));
  --ft: calc(9% + 16% * var(--p));
  --fbm: calc(74% - 18% * var(--p));
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 var(--fx), #000 calc(100% - var(--fx)), transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 var(--ft), #000 var(--fbm), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, #000 var(--fx), #000 calc(100% - var(--fx)), transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 var(--ft), #000 var(--fbm), transparent 100%);
  mask-composite: intersect;
}
.hero .stack img { box-shadow: none; }

/* ---------- Sobre mí ---------- */
.about { padding-top: calc(var(--pad) * 6); }
.about-grid {
  display: grid; grid-template-columns: 1fr 2fr; gap: var(--pad);
  padding: 0 var(--pad) calc(var(--pad) * 4);
}
.about-label { padding-top: .6em; }
.about-body { text-transform: none; }
.about-lead {
  font-size: clamp(28px, 3.4vw, 58px); font-weight: 500;
  letter-spacing: -0.03em; line-height: 1.02; max-width: 24ch;
}
.about-text {
  margin-top: clamp(28px, 4vw, 56px);
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px clamp(20px, 3vw, 48px);
  font-size: 15px; line-height: 1.5; color: var(--soft); max-width: 900px;
}
.about-text p:last-child { grid-column: 1 / -1; color: var(--fg); }
.about-cta {
  display: inline-block; margin-top: 36px; text-transform: uppercase;
  border: 1px solid var(--fg); border-radius: 999px; padding: 12px 22px;
  transition: background .25s, color .25s;
}
.about-cta:hover { background: var(--fg); color: var(--bg); }

/* ---------- Lista de contacto ---------- */
.contact-list { list-style: none; border-top: 1px solid var(--line); }
.contact-list li {
  display: grid; grid-template-columns: 1fr 2fr; align-items: baseline; gap: var(--pad);
  border-bottom: 1px solid var(--line); padding: 18px 0;
}
.contact-list a {
  font-size: clamp(22px, 2.6vw, 42px); letter-spacing: -0.03em; font-weight: 400;
  text-transform: none; display: flex; justify-content: space-between; align-items: baseline;
  transition: opacity .25s, padding .35s cubic-bezier(.2,.7,.1,1);
}
.contact-list a i { font-style: normal; font-size: .6em; opacity: .5; transition: opacity .25s, transform .35s; }
.contact-list a:hover { padding-left: 12px; }
.contact-list a:hover i { opacity: 1; transform: translate(3px, -3px); }

@media (max-width: 720px) {
  .site-header .nav-ig { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-text { grid-template-columns: 1fr; }
  .contact-list li { grid-template-columns: 1fr; gap: 6px; }
}

.section-title--right { justify-content: flex-end; }

/* Texto de Sobre mí justificado: recto a izquierda y derecha en las dos columnas */
.about-text p { text-align: justify; text-justify: inter-word; -webkit-hyphens: auto; hyphens: auto; }

/* ---------- Movimiento de la portada al deslizar ----------
   --p va de 0 a 1 mientras la portada está fija.
   La foto se mueve entera (fondo y gato juntos, siempre alineados):
   se acerca y se oscurece, y la galería sube por encima como un telón.
   El nombre sigue por detrás del gato y baja un poco. */
.hero .stack img {
  filter: blur(calc(var(--mb-y) * 0.5)) brightness(calc(1 - var(--p) * 0.4)) saturate(calc(1 - var(--p) * 0.2));
}
.hero .stack {
  transform: translate(-50%, -50%) translateY(calc(var(--p) * -4%)) scale(calc(1 + var(--p) * 0.12));
  transform-origin: 50% 55%;
}
.hero h1 {
  transform: translateX(-50%) translateY(calc(var(--p) * 3vh)) scale(calc(1 - var(--p) * 0.06));
  transform-origin: 50% 0%;
}
.hero-foot { opacity: calc(1 - var(--p) * 1.6); }

@media (prefers-reduced-motion: reduce) {
  .hero { height: 100svh; --p: 0 !important; }
}

html { color-scheme: dark; }
.hero-pin { isolation: isolate; }

/* Títulos de sección arriba, antes del contenido */
.gallery .section-title, .about .section-title { margin-bottom: calc(var(--pad) * 2.5); }
.contact .section-title { margin: 0 calc(-1 * var(--pad)); }
.about { padding-top: calc(var(--pad) * 4); }
.contact { padding-top: calc(var(--pad) * 4); justify-content: flex-start; }
.contact .row { margin-top: auto; }

/* ---------- Motion blur vertical al bajar y cambiar de sección ----------
   Mientras se desplaza la página, las secciones se desenfocan en vertical
   según la velocidad (filtro SVG #mby); al parar vuelven a estar nítidas. */
html.is-moving .gallery,
html.is-moving .about,
html.is-moving .contact,
html.is-moving .topic-head,
html.is-moving .next { filter: url(#mby); }
/* Dentro de las secciones, las fotos y títulos ya no suman su propio desenfoque vertical */
.card figure { filter: blur(var(--mb-x)); }
.gallery .section-title, .about .section-title, .contact .section-title { filter: none; }

/* ---------- Foto en Sobre mí: pequeña y vertical, en la columna izquierda bajo la etiqueta ---------- */
.about-side { display: flex; justify-content: center; }
.about-photo { margin: 0; width: min(100%, clamp(220px, 25vw, 380px)); }
@media (max-width: 720px) { .about-photo { width: 70%; } }
.about-photo img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; }


/* Foto y texto centrados entre sí, con más aire bajo el título */
.about-grid { align-items: center; }
.about .section-title { margin-bottom: calc(var(--pad) * 4); }
@media (max-width: 720px) { .about-side { justify-content: flex-start; } }

/* Móvil: la foto del gato de la portada llena la pantalla en vertical */
@media (max-width: 720px) {
  .hero { --sw: max(100vw, calc(100svh * 16 / 9 * 0.76)); } /* algo más alejada que a pantalla completa */
  .hero-foot p:nth-child(2) { display: none; }               /* sin "Fotógrafo" en móvil */
}

/* Portada del gato sin motion blur */
.hero .stack img { filter: brightness(calc(1 - var(--p) * 0.4)) saturate(calc(1 - var(--p) * 0.2)); }
.hero h1 { filter: none; }

/* Nombre de la temática y nº de imágenes alineados a la derecha */
.card h3, .card p { text-align: right; }

/* "Hola, soy" alineado a la derecha, encima del final de PAXLSHOTS */
.hero h1 { align-items: flex-end; }
.hero h1 .hi { padding-left: 0; padding-right: calc(var(--tw) * 0.004); }

/* Aparición suave al deslizar: más lenta, desde más abajo y saliendo de un ligero desenfoque */
.reveal {
  opacity: 0; transform: translateY(60px); filter: blur(6px);
  transition: opacity 1.4s ease, transform 1.4s cubic-bezier(.16,.8,.2,1), filter 1.4s ease;
}
.reveal.in { opacity: 1; transform: none; filter: none; }
.section-title .reveal { display: inline-block; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; filter: none; transition: none; } }
