/* Tokens ------------------------------------------------------------ */
:root {
  --bg: #0d0d0f;
  --bg-2: #141417;
  --ink: #f2efe9;
  --ink-dim: #a7a49d;
  --line: rgba(242, 239, 233, .14);
  --accent: #c97a52; /* se sobrescribe con data.json */
  --on-accent: #16130c;
  --display: "Antonio", "Arial Narrow", sans-serif;
  --body: "Hanken Grotesk", system-ui, sans-serif;
  --pad: clamp(20px, 5vw, 72px);
  --top: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* los estilos de cada elemento no deben pisar "hidden" */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--body); overflow-x: hidden; }
img { display: block; max-width: 100%; pointer-events: none; -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Barra superior ------------------------------------------------------ */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--pad);
  background: linear-gradient(to bottom, rgba(13,13,15,.85), rgba(13,13,15,0));
  transition: background .3s, backdrop-filter .3s;
}
.scrolled .topbar { background: rgba(13,13,15,.72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--line); }
.topbar__name { font: 500 22px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.topbar__nav { display: flex; gap: clamp(14px, 2.4vw, 36px); margin-left: auto; margin-right: clamp(16px, 2.4vw, 32px); }
.topbar__nav a { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: var(--ink-dim); transition: color .2s; padding: 10px 0; }
.topbar__nav a:hover, .topbar__nav a[aria-current="true"] { color: var(--ink); }
.topbar__tools { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; width: 44px; height: 44px; padding: 0; background: none; border: 0; cursor: pointer; position: relative; }
.menu-btn span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--ink); transition: transform .3s, top .3s; }
.menu-btn span:first-child { top: 18px; } .menu-btn span:last-child { top: 25px; }
.menu-open .menu-btn span:first-child { top: 21.5px; transform: rotate(45deg); }
.menu-open .menu-btn span:last-child { top: 21.5px; transform: rotate(-45deg); }
.drawer { position: fixed; inset: 0; z-index: 29; padding: calc(var(--top) + 32px) var(--pad) 40px; background: rgba(13,13,15,.97); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.drawer[hidden] { display: none; }
.drawer a { font: 300 clamp(40px, 12vw, 64px)/1.15 var(--display); text-transform: uppercase; text-decoration: none; padding: 6px 0; color: var(--ink); }
.drawer a[aria-current="true"] { color: var(--accent); }
.menu-open { overflow: hidden; }
.lang { font: 500 12px/1 var(--body); letter-spacing: .14em; color: var(--ink); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; cursor: pointer; min-height: 36px; }
.lang:hover { border-color: var(--accent); }

/* Redes fijas --------------------------------------------------------- */
.social { position: fixed; right: clamp(10px, 2vw, 28px); top: 50%; transform: translateY(-50%); z-index: 25; list-style: none; display: grid; gap: 8px; }
.social a { width: 52px; height: 52px; display: grid; place-items: center; color: var(--accent); transition: color .2s, transform .2s; }
.social a:hover { color: var(--ink); transform: scale(1.12); }
.social svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 6px rgba(0,0,0,.6)); }

/* Foto fija: Home + About -------------------------------------------- */
.stage { position: relative; }
.stage__media { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; z-index: 0; }
.stage__media img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 30%; }
.stage__shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(13,13,15,.78) 0%, rgba(13,13,15,.25) 55%, rgba(13,13,15,0) 100%); }
.stage__content { position: relative; z-index: 1; margin-top: -100vh; margin-top: -100svh; }

.home { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--top) + 24px) var(--pad) 96px; max-width: 1200px; }
.home__place { font-size: 13px; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
.home__name { font: 300 clamp(64px, 14vw, 210px)/.88 var(--display); text-transform: uppercase; letter-spacing: -.005em; color: var(--ink); max-width: 9ch; }
.home__name em { font-style: normal; font-weight: 700; color: var(--accent); }
.home__quote { margin-top: 28px; max-width: 34ch; font-size: clamp(16px, 1.6vw, 20px); font-weight: 300; color: var(--ink); }
.scrollcue { position: absolute; left: var(--pad); bottom: 32px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; text-decoration: none; color: var(--ink-dim); display: inline-flex; align-items: center; gap: 12px; padding: 8px 0; }
.scrollcue::after { content: ""; width: 1px; height: 36px; background: linear-gradient(var(--accent), transparent); }

.about { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 96px var(--pad); }
.about__panel { max-width: 460px; padding: clamp(20px, 3vw, 36px); background: rgba(13,13,15,.62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-left: 2px solid var(--accent); }
.eyebrow { font: 500 12px/1 var(--body); letter-spacing: .3em; text-transform: uppercase; color: var(--accent); }
/* Títulos de sección más grandes: Comp card, Book y Portafolio */
#ccTitle, #bookTitle, #portTitle { font: 200 clamp(26px, 2.6vw, 38px)/1 var(--display); letter-spacing: .14em; }
#ccTitle { margin-bottom: 6px; }
.about__text { margin-top: 20px; font-size: 17px; font-weight: 300; }
.counters { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 20px 16px; }
.counters:empty { display: none; }
.counters dt { font: 300 clamp(38px, 5vw, 56px)/1 var(--display); color: var(--ink); }
.counters dd { margin-top: 4px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); }

/* Comp card ----------------------------------------------------------- */
.compcard { position: relative; z-index: 2; background: var(--bg-2); clip-path: inset(0); } /* clip-path: la foto fija solo se ve dentro de esta sección */
.cc-photo { position: fixed; top: 50%; left: calc(var(--cc-left) + var(--textw) + var(--gap)); right: auto; transform: translateY(-50%); height: var(--ph); aspect-ratio: 3 / 4; width: auto; border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.5); z-index: 0; }
.compcard { --ph: min(74vh, 820px); --ph: min(74svh, 820px); --textw: min(560px, 44vw); --gap: clamp(32px, 5vw, 96px); --photow: calc(var(--ph) * .75);
  --cc-left: max(var(--pad), calc((100vw - var(--textw) - var(--gap) - var(--photow)) / 2)); } /* el texto y la foto forman un solo bloque centrado */
.cc-flow { position: relative; z-index: 1; width: var(--textw); margin-left: var(--cc-left); padding: 0; }
.compcard__info { padding: 38vh 0 62vh; padding: 38svh 0 62svh; }
.cc-after { position: relative; z-index: 3; background: var(--bg-2); padding: 72px var(--pad) 112px; display: grid; gap: 40px; justify-items: center; }
.compcard__name { margin-top: 18px; font: 300 clamp(44px, 6.5vw, 96px)/.92 var(--display); text-transform: uppercase; }
.measures { margin: 36px 0 0; display: grid; gap: 0; max-width: 340px; }
.compcard__cta { display: flex; justify-content: center; }
.measures div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.measures dt { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim); }
.measures dd { font-weight: 500; text-align: right; }
.cc-photo { background: #16161a; overflow: hidden; }
.cc-photo::before { content: ""; position: absolute; inset: -6%; background: var(--bgimg) center / cover no-repeat; filter: blur(34px) brightness(.55) saturate(1.1); transform: scale(1.08); transition: background-image .3s; }
.cc-photo img { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; } /* la foto se ve completa, sin recortes */
.arrow { z-index: 2; position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(13,13,15,.45); color: #fff; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s, border-color .2s; }
.arrow:hover { background: rgba(13,13,15,.75); border-color: var(--accent); }
.arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.arrow--prev { left: 14px; } .arrow--next { right: 14px; }
.dots { z-index: 2; position: absolute; left: 0; right: 0; bottom: 16px; display: flex; justify-content: center; gap: 4px; }
.dots button { width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.dots button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.5); transition: background .2s, transform .2s; }
.dots button[aria-current="true"]::before { background: var(--accent); transform: scale(1.35); }
.compcard__strip button { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #1b1b1f; cursor: pointer; transition: transform .5s ease, opacity .5s ease, filter .5s ease, outline-color .2s; outline: 2px solid transparent; outline-offset: -2px; }
.compcard__strip button:focus-visible { outline-color: var(--accent); }
/* Al pasar el cursor por la franja, la foto señalada crece y las demás se apagan y se desenfocan */
@media (hover: hover) and (pointer: fine) {
  .compcard__strip:hover button { transform: scale(.97); opacity: .55; filter: blur(2px); }
  .compcard__strip:hover button:hover, .compcard__strip:hover button:focus-visible { transform: scale(1.06); opacity: 1; filter: none; z-index: 2; }
}
.compcard__strip button[aria-current="true"] { outline-color: var(--accent); }

/* Aparición al llegar (solo si hay JS) */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }
.compcard__strip { width: 100%; max-width: 980px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.6vw, 20px); }
.compcard__strip img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 28px; background: var(--accent); color: var(--on-accent); font: 600 12px/1 var(--body); letter-spacing: .2em; text-transform: uppercase; text-decoration: none; border: 1px solid var(--accent); cursor: pointer; transition: background .2s, color .2s; }
.btn:hover { background: transparent; color: var(--accent); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Galerías ------------------------------------------------------------ */
.gallery { position: relative; z-index: 2; background: var(--bg); padding: 112px var(--pad) 40px; }
.gallery + .gallery { padding-top: 72px; }
.gallery__head { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.grid { display: grid; gap: clamp(8px, 1.4vw, 18px); }
.tile { position: relative; padding: 0; border: 0; background: #1b1b1f; cursor: zoom-in; overflow: hidden; aspect-ratio: 2 / 3; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.tile:hover img { transform: scale(1.04); }
.tile[hidden] { display: none; }

/* Book: fila horizontal que se desliza (arrastrar con el mouse o con el dedo) */
.rail { --card-h: clamp(320px, 54vh, 500px); --card-h: clamp(320px, 54svh, 500px);
  position: relative; display: flex; gap: clamp(12px, 1.6vw, 22px); overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  margin-inline: calc(var(--pad) * -1); padding: 14px var(--pad) 18px; scroll-padding-inline: var(--pad);
  scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; cursor: grab; }
.rail::-webkit-scrollbar { display: none; }
.rail.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; -webkit-user-select: none; }
.rail .tile { flex: 0 0 auto; height: var(--card-h); aspect-ratio: 3 / 4; border-radius: 14px; scroll-snap-align: start; cursor: inherit; transition: transform .3s ease; }
.rail.dragging .tile { pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .rail .tile:hover { transform: scale(1.02); } .rail .tile:hover img { transform: none; } }
.rail-ctl { display: flex; gap: 8px; }
.rail-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; transition: border-color .2s, opacity .2s; }
.rail-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.rail-btn:disabled { opacity: .3; cursor: default; }
.rail-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: none) { .rail-ctl { display: none; } } /* en pantallas táctiles se desliza con el dedo, sin botones */

/* Contacto ------------------------------------------------------------ */
.contact { position: relative; z-index: 2; background: var(--bg); text-align: center; padding: 120px var(--pad) 72px; display: grid; justify-items: center; gap: 28px; }
.contact__title { font: 300 clamp(40px, 8vw, 110px)/.95 var(--display); text-transform: uppercase; max-width: 14ch; }
.contact__credit { margin-top: 56px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }

/* Celular ------------------------------------------------------------- */
@media (max-width: 900px) {
  /* Celular: la foto entra con la sección (sin hueco) y se queda pegada arriba; el texto sube por detrás de ella */
  .cc-photo { position: sticky; top: var(--top); left: auto; right: auto; transform: none; aspect-ratio: auto; width: 100%; height: 44vh; height: 44svh; border-radius: 0; box-shadow: none; z-index: 2; }
  .cc-flow { width: 100%; margin-left: 0; padding: 0 var(--pad); z-index: 1; }
  .compcard__info { margin-top: 0; padding: 36px 0 10vh; padding: 36px 0 10svh; }
}
@media (max-width: 700px) {
  :root { --top: 56px; }
  .topbar__nav { display: none; }
  .menu-btn { display: block; }
  .stage__media img { object-position: 50% 20%; }
  .stage__shade { background: linear-gradient(to top, rgba(13,13,15,.92) 0%, rgba(13,13,15,.35) 50%, rgba(13,13,15,0) 80%); }
  .home { justify-content: flex-end; padding-bottom: 120px; }
  .home__name { font-size: clamp(64px, 22vw, 120px); }
  .about { align-items: flex-end; padding: 96px var(--pad) 72px; }
  .about__panel { max-width: none; }
  .social { top: auto; bottom: 16px; right: 12px; transform: none; grid-auto-flow: column; gap: 0; padding: 2px 8px; background: rgba(13,13,15,.72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; }
  .social a { width: 46px; height: 46px; }

  .rail { --card-h: clamp(280px, 42vh, 400px); --card-h: clamp(280px, 42svh, 400px); } /* en celular se asoma un pedazo de la siguiente foto */
  .compcard__strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage__media img { transform: none; filter: none; }
  .js .reveal { opacity: 1; transform: none; }
  * { transition: none !important; animation: none !important; }
}

/* Visor de fotos (book y portafolio) ---------------------------------- */
.lb { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8,8,10,.95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 0; transition: opacity .35s ease; }
.lb[hidden] { display: none; }
.lb.on { opacity: 1; }
.lb { --lb-pt: clamp(56px, 8vh, 84px); --lb-pb: clamp(56px, 8vh, 84px); --lb-px: clamp(12px, 6vw, 96px); }
.lb__stage { width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center; padding: var(--lb-pt) var(--lb-px) var(--lb-pb); touch-action: pan-y; }
.lb__img { max-width: calc(100vw - 2 * var(--lb-px)); max-height: calc(100vh - var(--lb-pt) - var(--lb-pb)); max-height: calc(100svh - var(--lb-pt) - var(--lb-pb)); width: auto; height: auto; object-fit: contain; will-change: transform, opacity; box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.lb__btn { position: absolute; z-index: 2; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.28); background: rgba(13,13,15,.5); color: #fff; cursor: pointer; transition: border-color .2s, background .2s; }
.lb__btn:hover { border-color: var(--accent); background: rgba(13,13,15,.8); }
.lb__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb__close { top: 14px; right: 14px; }
.lb__prev { left: clamp(8px, 2vw, 28px); top: 50%; transform: translateY(-50%); }
.lb__next { right: clamp(8px, 2vw, 28px); top: 50%; transform: translateY(-50%); }
.lb__meta { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 18px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-dim); }
.lb__meta b { color: var(--accent); font-weight: 500; }
.lb-open { overflow: hidden; }
@media (max-width: 700px) { .lb__prev, .lb__next { top: auto; bottom: 56px; transform: none; } .lb__prev { left: 16px; } .lb__next { right: 16px; } .lb { --lb-pb: 130px; } }
@media (prefers-reduced-motion: reduce) { .lb, .lb__img { transition: none !important; } }

/* Portafolio: collage asimétrico (columnas de alturas distintas que suben a ritmos diferentes) ---- */
.collage { --cgap: clamp(10px, 1.4vw, 20px); display: flex; align-items: flex-start; gap: var(--cgap); min-height: 60vh; padding-top: 28px; padding-bottom: clamp(40px, 9vh, 110px); }
.collage__col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--cgap); will-change: transform; }
.collage__cell { display: block; }
.collage .tile { display: block; width: 100%; aspect-ratio: auto; border-radius: 12px; background: #1b1b1f; }
.collage .tile img { display: block; width: 100%; height: auto; }
.js .collage .tile { clip-path: inset(0 0 100% 0); transition: clip-path 1.1s cubic-bezier(.2,.7,.2,1) var(--d, 0ms); }
.js .collage .tile.in { clip-path: inset(0 0 0 0); }
.js .collage .tile img { transform: scale(1.18); transition: transform 1.5s cubic-bezier(.2,.7,.2,1) var(--d, 0ms); }
.js .collage .tile.in img { transform: scale(1); }
@media (hover: hover) and (pointer: fine) { .js .collage .tile.in:hover img { transform: scale(1.05); transition: transform .8s cubic-bezier(.2,.7,.2,1); } }
@media (prefers-reduced-motion: reduce) { .js .collage .tile, .js .collage .tile img { clip-path: none; transform: none; transition: none; } }
