/* =====================================================================
   JAVIER MERY — Chile Indómito
   Paleta: carbón cálido + hueso + un solo acento cobre (el metal de Chile).
   Tipografía: Instrument Serif (títulos) · Geist (texto) · Geist Mono (datos de campo).
   ===================================================================== */

:root {
  color-scheme: dark;
  --ink: #0b0b0a;
  --ink-2: #141311;
  --ink-3: #1d1b18;
  --bone: #ece5d8;
  --bone-dim: rgba(236, 229, 216, 0.62);
  --bone-faint: rgba(236, 229, 216, 0.38);
  --line: rgba(236, 229, 216, 0.14);
  --copper: #c7875a;

  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Geist", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 64px);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
em { font-style: italic; }
::selection { background: var(--copper); color: var(--ink); }
:focus-visible { outline: 1px solid var(--copper); outline-offset: 4px; }

.wrap { padding-inline: var(--gutter); max-width: 1680px; margin-inline: auto; }

/* ---------- Tipos base ---------- */
.eyebrow {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
  margin: 0;
}
.dash { display: inline-block; width: 28px; height: 1px; background: currentColor; vertical-align: middle; margin-right: 12px; opacity: .7; }
.display {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.display em, .section-title em { color: var(--copper); }
.section-kicker { margin-bottom: clamp(24px, 3vw, 40px); }
.section-title { font-size: clamp(56px, 9vw, 150px); }
.section-lead { max-width: 44ch; color: var(--bone-dim); font-size: clamp(16px, 1.25vw, 19px); margin: 0; }
.section-head { display: grid; gap: clamp(24px, 3vw, 40px); margin-bottom: clamp(64px, 9vw, 140px); }

/* Palabras divididas para las revelaciones */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.06em 0.06em 0.12em 0; margin: -0.06em -0.06em -0.12em 0; }
.w__i { display: inline-block; will-change: transform; }

/* ---------- Loader ---------- */
.loader { display: none; }
.js .loader {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: var(--ink);
  animation: loader-failsafe .6s ease 4.5s forwards;
}
@keyframes loader-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.loader__inner { text-align: center; }
.loader__mark { font-family: var(--serif); font-size: clamp(44px, 7vw, 96px); margin: 0 0 12px; line-height: 1; letter-spacing: -0.01em; }
.loader__foot {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 20px;
}
.loader__bar { flex: 1; height: 1px; background: var(--line); position: relative; overflow: hidden; }
.loader__bar span { position: absolute; inset: 0; background: var(--bone); transform-origin: left; transform: scaleX(0); }
.loader__count { position: absolute; top: calc(28px + var(--top)); right: var(--gutter); margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--bone-dim); font-variant-numeric: tabular-nums; }

/* ---------- Grano de película + cursor ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 150; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .js .cursor {
    display: grid; place-items: center;
    position: fixed; top: 0; left: 0; z-index: 180; pointer-events: none;
    width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
    background: var(--bone); mix-blend-mode: difference;
    transition: width .5s var(--ease), height .5s var(--ease), margin .5s var(--ease), background .3s;
  }
  .cursor.is-view { width: 96px; height: 96px; margin: -48px 0 0 -48px; mix-blend-mode: normal; background: rgba(236, 229, 216, .92); }
  .cursor__label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); opacity: 0; transition: opacity .3s; white-space: nowrap; }
  .cursor.is-view .cursor__label { opacity: 1; }
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: calc(22px + var(--top)) var(--gutter) 22px;
  mix-blend-mode: difference; color: #fff;
  transition: transform .8s var(--ease);
}
.site-header.is-hidden { transform: translateY(-110%); }
.brand { display: flex; align-items: baseline; gap: 14px; }
.brand__name { font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: -0.01em; }
.brand__tag { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; opacity: .7; }
.nav { display: flex; gap: clamp(18px, 2.4vw, 40px); }
.nav a, .menu__nav a { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; position: relative; padding-block: 4px; }
.nav a i { font-style: normal; opacity: .5; margin-right: 8px; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease); }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); transform-origin: left; }
.menu-btn { display: none; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.menu-btn__lines { display: grid; gap: 6px; width: 22px; }
.menu-btn__lines i { display: block; height: 1px; background: currentColor; transition: transform .5s var(--ease); }
.menu-btn[aria-expanded="true"] .menu-btn__lines i:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__lines i:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.menu {
  position: fixed; inset: 0; z-index: 90; background: var(--ink-2);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(120px + var(--top)) var(--gutter) calc(40px + env(safe-area-inset-bottom, 0px));
  clip-path: inset(0 0 100% 0); transition: clip-path .9s var(--ease); visibility: hidden;
}
.menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; }
.menu__nav { display: grid; gap: 8px; margin-bottom: 48px; }
.menu__nav a { font-family: var(--serif); font-size: clamp(48px, 13vw, 88px); letter-spacing: -0.01em; text-transform: none; line-height: 1.05; }
.menu__nav a i { font-family: var(--mono); font-style: normal; font-size: 11px; letter-spacing: .16em; vertical-align: top; margin-right: 14px; color: var(--copper); }

/* ---------- Hero ---------- */
.hero { position: relative; height: 100svh; min-height: 620px; overflow: hidden; background: #000; isolation: isolate; }
.hero__media { position: absolute; inset: 0; z-index: -2; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; transform: scale(1.08); transform-origin: 50% 60%; }
.hero__shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 11, 10, .55) 0%, rgba(11, 11, 10, 0) 26%, rgba(11, 11, 10, 0) 48%, rgba(11, 11, 10, .88) 100%),
    radial-gradient(120% 80% at 50% 40%, transparent 50%, rgba(0, 0, 0, .45) 100%);
}
.hero__bar { position: absolute; left: 0; right: 0; height: 0; background: var(--ink); z-index: 3; }
.hero__bar--top { top: 0; }
.hero__bar--bottom { bottom: 0; }
.hero__top {
  position: absolute; left: var(--gutter); right: var(--gutter); top: calc(96px + var(--top));
  display: flex; justify-content: space-between; gap: 24px;
}
.hero__content {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: clamp(96px, 13vh, 150px);
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px;
}
.hero__title {
  font-family: var(--serif); font-weight: 400; margin: 0;
  font-size: clamp(88px, 17.5vw, 330px); line-height: .8; letter-spacing: -0.035em;
  display: grid;
}
.hero__line--in { padding-left: 0.62em; }
.hero__title em { color: var(--bone); }
.hero__lead { max-width: 34ch; margin: 0 0 1.2em; font-size: clamp(15px, 1.15vw, 18px); color: var(--bone-dim); }
.hero__bottom {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 32px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  border-top: 1px solid var(--line); padding-top: 18px;
}
.hero__coords { text-align: right; font-variant-numeric: tabular-nums; }
.hero__scroll { display: flex; align-items: center; gap: 12px; color: var(--bone); }
.hero__scroll-line { width: 1px; height: 28px; background: var(--line); position: relative; overflow: hidden; }
.hero__scroll-line::after { content: ""; position: absolute; left: 0; top: -100%; width: 1px; height: 100%; background: var(--bone); animation: drip 2.2s var(--ease) infinite; }
@keyframes drip { 0% { top: -100%; } 60%, 100% { top: 100%; } }

/* ---------- Manifiesto ---------- */
.manifesto { padding-block: clamp(120px, 22vh, 260px); }
.manifesto__text {
  font-family: var(--serif); font-size: clamp(34px, 4.7vw, 82px); line-height: 1.06; letter-spacing: -0.015em;
  margin: 0; max-width: 21ch; text-wrap: pretty;
}
.manifesto__text em { color: var(--copper); }
.manifesto__text .sw { opacity: .2; }
.manifesto__sign { display: flex; align-items: baseline; gap: 20px; margin-top: clamp(40px, 6vw, 80px); }
.manifesto__signature { font-family: var(--serif); font-style: italic; font-size: 32px; }

/* ---------- I. Territorio ---------- */
.territory { position: relative; background: var(--ink); border-top: 1px solid var(--line); }
.territory__pin { position: relative; height: 100svh; overflow: hidden; }
.territory__track { display: flex; align-items: center; height: 100%; gap: clamp(80px, 9vw, 180px); padding-inline: var(--gutter) 12vw; width: max-content; will-change: transform; }
.territory__intro { width: min(560px, 80vw); flex: none; }
.territory__heading { font-size: clamp(72px, 10vw, 180px); margin-bottom: 36px; }
.territory__lead { color: var(--bone-dim); max-width: 38ch; margin: 0 0 40px; }
.territory__hint .arrow { display: inline-block; margin-right: 10px; color: var(--copper); animation: nudge 2s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateX(8px); } }

.chapter { flex: none; display: grid; grid-template-columns: auto 340px; gap: clamp(32px, 4vw, 64px); align-items: end; }
.chapter__media { margin: 0; height: min(68svh, 720px); aspect-ratio: 4 / 5; max-width: 100%; overflow: hidden; background: var(--ink-3); }
.chapter:nth-of-type(even) .chapter__media { aspect-ratio: 5 / 4; height: min(58svh, 620px); }
.chapter__media img { width: 118%; max-width: none; height: 100%; object-fit: cover; margin-left: -9%; transition: transform 1.4s var(--ease), filter 1.4s var(--ease); filter: saturate(.92); }
.chapter__media:hover img { transform: scale(1.04); filter: saturate(1.05); }
.chapter__body { padding-bottom: 8px; }
.chapter__num { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--copper); }
.chapter__num i { font-style: normal; color: var(--bone-faint); }
.chapter__title { font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 6vw, 104px); line-height: .92; letter-spacing: -0.025em; margin: 18px 0 14px; }
.chapter__text { color: var(--bone-dim); margin: 24px 0 28px; max-width: 36ch; }
.chapter__text em { color: var(--bone); }
.chapter__data, .notes dl, .lightbox__meta { margin: 0; display: grid; }
.chapter__data div, .notes dl div, .lightbox__meta div {
  display: flex; justify-content: space-between; gap: 16px; padding-block: 10px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums;
}
.chapter__data dt, .notes dt, .lightbox__meta dt { color: var(--bone-faint); }
.chapter__data dd, .notes dd, .lightbox__meta dd { margin: 0; text-align: right; }
.territory__outro { flex: none; display: grid; gap: 40px; }
.territory__outro .display { font-size: clamp(64px, 8vw, 150px); }
.link-arrow { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; display: inline-flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 8px; width: max-content; transition: border-color .4s, gap .6s var(--ease); }
.link-arrow:hover { border-color: var(--bone); gap: 20px; }
.link-arrow span { color: var(--copper); }

.hud {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 28px;
  display: grid; grid-template-columns: 200px 1fr auto; align-items: end; gap: 40px;
  pointer-events: none;
}
.hud__lat { display: grid; gap: 4px; }
.hud__value { font-family: var(--mono); font-size: 22px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.hud__track { position: relative; height: 1px; background: var(--line); margin-bottom: 8px; }
.hud__fill { position: absolute; inset: 0; background: var(--copper); transform-origin: left; transform: scaleX(0); }
.hud__tick { position: absolute; bottom: 10px; left: calc(var(--i) * 20%); transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--bone-faint); letter-spacing: .1em; transition: color .4s; }
.hud__tick::after { content: ""; position: absolute; left: 50%; top: calc(100% + 5px); width: 1px; height: 7px; background: currentColor; }
.hud__tick.is-on { color: var(--bone); }

/* ---------- II. Historias ---------- */
.stories { padding-block: clamp(120px, 18vh, 220px) clamp(60px, 8vh, 120px); background: var(--ink); }
.story { margin-bottom: clamp(120px, 16vw, 240px); }
.story__media {
  position: relative; overflow: hidden; background: var(--ink-3);
  margin-inline: var(--gutter); aspect-ratio: 2.39 / 1; max-width: calc(100% - 2 * var(--gutter));
}
.story__media img { width: 100%; height: 120%; object-fit: cover; margin-top: -10%; }
.story--alt .story__media img { object-position: 50% 40%; }
.story__cap { position: absolute; left: 24px; bottom: 20px; color: var(--bone); text-shadow: 0 1px 12px rgba(0, 0, 0, .6); }
.story__grid {
  display: grid; grid-template-columns: 1fr 1.1fr 1.3fr 1fr; gap: clamp(24px, 3vw, 56px);
  margin-top: clamp(40px, 5vw, 72px); align-items: start;
}
.story__index { font-family: var(--serif); font-size: clamp(80px, 9vw, 160px); line-height: .8; color: var(--copper); letter-spacing: -0.04em; }
.story__title { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 3.6vw, 60px); line-height: .98; letter-spacing: -0.015em; margin: 0 0 18px; text-wrap: balance; }
.story__title em { color: var(--bone-dim); }
.story__text p { margin: 0 0 1.1em; color: var(--bone-dim); max-width: 46ch; }
.story__text .story__first { color: var(--bone); font-size: 1.12em; }
.story__text .story__first::first-letter { font-family: var(--serif); float: left; font-size: 4.1em; line-height: .78; margin: .08em .1em 0 0; color: var(--copper); }
.notes { border: 1px solid var(--line); padding: 20px 20px 10px; background: var(--ink-2); }
.notes__title { margin-bottom: 14px; color: var(--copper); }

/* ---------- III. Recorrido ---------- */
.journey { padding-block: clamp(120px, 16vh, 220px); background: var(--ink-2); border-block: 1px solid var(--line); }
.journey__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 7vw, 140px); align-items: start; }
.journey__portrait { position: sticky; top: calc(110px + var(--top)); }
.journey__portrait figure { margin: 0; aspect-ratio: 4 / 5; overflow: hidden; background: var(--ink-3); max-width: 100%; }
.journey__portrait img { width: 100%; height: 115%; object-fit: cover; object-position: 60% 50%; filter: grayscale(.15) contrast(1.05); }
.journey__cap { margin-top: 16px; }
.journey__lead { font-family: var(--serif); font-size: clamp(26px, 2.4vw, 40px); line-height: 1.15; letter-spacing: -0.01em; margin: clamp(32px, 4vw, 56px) 0 24px; max-width: 26ch; text-wrap: pretty; }
.journey__lead em { color: var(--copper); }
.journey__text { color: var(--bone-dim); max-width: 52ch; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-block: clamp(56px, 7vw, 96px); border-top: 1px solid var(--line); }
.stat { padding: 24px 16px 0 0; display: grid; gap: 8px; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.stat__num { font-family: var(--serif); font-size: clamp(48px, 4.6vw, 80px); line-height: .9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--bone-faint); }
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline__item { display: grid; grid-template-columns: 120px 1fr; gap: 24px; padding-block: 28px; border-bottom: 1px solid var(--line); transition: padding .6s var(--ease); }
.timeline__item:hover { padding-left: 12px; }
.timeline__year { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; color: var(--copper); padding-top: 6px; font-variant-numeric: tabular-nums; }
.timeline h4 { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 2vw, 32px); line-height: 1.1; margin: 0 0 6px; }
.timeline p { margin: 0; color: var(--bone-dim); max-width: 50ch; }

/* ---------- IV. Archivo ---------- */
.archive { padding-block: clamp(120px, 18vh, 220px); }
.archive__head { grid-template-columns: 1fr auto; align-items: end; }
.archive__controls {
  position: sticky; top: calc(76px + var(--top)); z-index: 20;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  padding-block: 14px; margin-bottom: clamp(32px, 4vw, 56px);
  background: rgba(11, 11, 10, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-block: 1px solid var(--line);
}
.toggle { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.toggle button { position: relative; z-index: 1; padding: 9px 20px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--bone-dim); transition: color .4s; border-radius: 999px; }
.toggle button[aria-selected="true"] { color: var(--ink); }
.toggle__pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--bone); transition: transform .6s var(--ease); }
.toggle[data-view="cronologia"] .toggle__pill { transform: translateX(100%); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { padding: 8px 14px; border: 1px solid transparent; border-radius: 999px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--bone-dim); transition: border-color .3s, color .3s; }
.filter sup { font-size: 9px; margin-left: 4px; color: var(--bone-faint); }
.filter:hover { color: var(--bone); }
.filter[aria-pressed="true"] { border-color: var(--bone); color: var(--bone); }

.archive__grid { transition: opacity .35s ease; }
.archive__grid.is-swapping { opacity: 0; }

.shot { margin: 0; cursor: zoom-in; }
.shot__frame { position: relative; overflow: hidden; background: var(--ink-3); max-width: 100%; }
.shot__frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), filter .8s; filter: saturate(.9); }
.shot:hover .shot__frame img, .shot:focus-visible .shot__frame img { transform: scale(1.045); filter: saturate(1.05); }
.shot figcaption { display: flex; justify-content: space-between; gap: 16px; padding-top: 12px; }
.shot__title { font-family: var(--serif); font-size: 20px; line-height: 1.2; }
.shot__title span { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--copper); margin-right: 10px; vertical-align: 3px; }
.shot__meta { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--bone-faint); white-space: nowrap; padding-top: 5px; }

/* Selección: composición editorial */
.sel { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2vw, 32px); row-gap: clamp(48px, 6vw, 96px); align-items: start; }
.sel .shot:nth-child(10n+1) { grid-column: 1 / span 8; } .sel .shot:nth-child(10n+1) .shot__frame { aspect-ratio: 3 / 2; }
.sel .shot:nth-child(10n+2) { grid-column: 9 / span 4; margin-top: 22%; } .sel .shot:nth-child(10n+2) .shot__frame { aspect-ratio: 4 / 5; }
.sel .shot:nth-child(10n+3) { grid-column: 2 / span 4; } .sel .shot:nth-child(10n+3) .shot__frame { aspect-ratio: 4 / 5; }
.sel .shot:nth-child(10n+4) { grid-column: 7 / span 6; margin-top: 12%; } .sel .shot:nth-child(10n+4) .shot__frame { aspect-ratio: 4 / 3; }
.sel .shot:nth-child(10n+5) { grid-column: 1 / -1; } .sel .shot:nth-child(10n+5) .shot__frame { aspect-ratio: 2.39 / 1; }
.sel .shot:nth-child(10n+6) { grid-column: 1 / span 4; } .sel .shot:nth-child(10n+6) .shot__frame { aspect-ratio: 3 / 4; }
.sel .shot:nth-child(10n+7) { grid-column: 5 / span 4; margin-top: 18%; } .sel .shot:nth-child(10n+7) .shot__frame { aspect-ratio: 3 / 4; }
.sel .shot:nth-child(10n+8) { grid-column: 9 / span 4; } .sel .shot:nth-child(10n+8) .shot__frame { aspect-ratio: 3 / 4; }
.sel .shot:nth-child(10n+9) { grid-column: 1 / span 6; } .sel .shot:nth-child(10n+9) .shot__frame { aspect-ratio: 3 / 2; }
.sel .shot:nth-child(10n+10) { grid-column: 7 / span 6; margin-top: 10%; } .sel .shot:nth-child(10n+10) .shot__frame { aspect-ratio: 3 / 2; }

/* Cronología: año a año */
.year { display: grid; grid-template-columns: minmax(120px, 2fr) 10fr; gap: clamp(24px, 3vw, 48px); padding-block: clamp(40px, 5vw, 72px); border-top: 1px solid var(--line); }
.year__label { position: sticky; top: calc(170px + var(--top)); align-self: start; margin: 0; }
.year__num { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 6vw, 104px); line-height: .85; letter-spacing: -0.03em; }
.year__count { display: block; margin-top: 12px; }
.year__grid { columns: 3 260px; column-gap: clamp(16px, 2vw, 28px); }
.year__grid .shot { break-inside: avoid; margin-bottom: clamp(24px, 3vw, 40px); display: block; }
.year__grid .shot__frame img { height: auto; }
.archive__empty { padding: 80px 0; text-align: center; color: var(--bone-dim); }
.archive__empty button { color: var(--bone); border-bottom: 1px solid var(--bone); }

/* ---------- Patrimonio ---------- */
.heritage { position: relative; overflow: hidden; padding-block: clamp(140px, 22vh, 280px); isolation: isolate; }
.heritage__bg { position: absolute; inset: -12% 0; z-index: -2; }
.heritage__bg img { width: 100%; height: 100%; object-fit: cover; }
.heritage::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--ink) 0%, rgba(11, 11, 10, .72) 22%, rgba(11, 11, 10, .72) 78%, var(--ink) 100%); }
.heritage__title { font-size: clamp(72px, 12vw, 220px); }
.heritage__lead { font-family: var(--serif); font-size: clamp(24px, 2.3vw, 38px); line-height: 1.2; max-width: 32ch; margin: clamp(40px, 5vw, 72px) 0 clamp(72px, 9vw, 140px); text-wrap: pretty; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.fact { padding: 28px 24px 0 0; }
.fact + .fact { padding-left: 24px; border-left: 1px solid var(--line); }
.fact__num { display: block; font-family: var(--serif); font-size: clamp(52px, 5vw, 88px); line-height: .9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.fact__num small { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-left: 8px; color: var(--copper); vertical-align: 0.4em; }
.fact p { margin: 14px 0 0; color: var(--bone-dim); max-width: 24ch; font-size: 15px; }

/* ---------- Contacto ---------- */
.contact { padding-block: clamp(120px, 18vh, 220px) clamp(80px, 10vh, 140px); }
.contact__title { font-size: clamp(72px, 13vw, 240px); }
.contact__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(48px, 6vw, 120px); margin-top: clamp(64px, 8vw, 120px); align-items: end; }
.services { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.services li { display: flex; gap: 24px; align-items: baseline; padding-block: 20px; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: clamp(22px, 2vw, 30px); line-height: 1.2; }
.services span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--copper); }
.contact__cta { display: grid; gap: 20px; }
.contact__mailrow { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.contact__mail { font-family: var(--serif); font-style: italic; font-size: clamp(34px, 4.2vw, 72px); line-height: 1; letter-spacing: -0.02em; border-bottom: 1px solid var(--line); padding-bottom: 8px; transition: border-color .4s, color .4s; overflow-wrap: anywhere; user-select: all; }
.contact__mail:hover { border-color: var(--copper); color: var(--copper); }
.copy-btn { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; color: var(--bone-dim); transition: border-color .3s, color .3s; }
.copy-btn:hover { border-color: var(--bone); color: var(--bone); }
.socials { display: flex; flex-wrap: wrap; gap: 28px; }
.socials a { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--bone-dim); transition: color .3s; }
.socials a:hover { color: var(--bone); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
.footer__mark { font-family: var(--serif); font-size: 21.5vw; line-height: .8; letter-spacing: -0.045em; margin: 0; padding: 4vw 0 3vw; text-align: center; white-space: nowrap; color: var(--bone); }
.footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.footer__top:hover { color: var(--bone); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 160; background: rgba(8, 8, 7, .97);
  display: grid; grid-template-columns: 1fr 340px;
  padding: calc(80px + var(--top)) var(--gutter) calc(72px + env(safe-area-inset-bottom, 0px));
  gap: 48px; opacity: 0; visibility: hidden; transition: opacity .5s var(--ease), visibility .5s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__stage { display: grid; place-items: center; min-height: 0; min-width: 0; }
.lightbox__img { max-width: 100%; max-height: 100%; object-fit: contain; transition: opacity .4s ease, transform .8s var(--ease); }
.lightbox__img.is-loading { opacity: 0; transform: scale(.985); }
.lightbox__info { align-self: end; }
.lightbox__num { color: var(--copper); margin-bottom: 14px; }
.lightbox__title { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 3vw, 52px); line-height: 1; letter-spacing: -0.015em; margin: 0 0 10px; }
.lightbox__place { color: var(--bone-dim); margin: 0 0 28px; }
.lightbox__note { color: var(--bone-dim); margin: 24px 0 0; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.35; }
.lightbox__close { position: absolute; top: calc(24px + var(--top)); right: var(--gutter); font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; display: flex; gap: 10px; align-items: center; }
.lightbox__nav { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; border: 1px solid var(--line); border-radius: 50%; font-size: 18px; transition: border-color .3s, background .3s; }
.lightbox__nav:hover { border-color: var(--bone); background: rgba(236, 229, 216, .06); }
.lightbox__nav--prev { left: var(--gutter); }
.lightbox__nav--next { left: calc(var(--gutter) + 64px); }
.lightbox__counter { position: absolute; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); right: var(--gutter); font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .story__grid { grid-template-columns: auto 1fr; }
  .story__text, .notes { grid-column: 2; }
  .story__index { grid-row: span 3; }
  .facts { grid-template-columns: repeat(2, 1fr); row-gap: 40px; }
  .fact:nth-child(3) { padding-left: 0; border-left: 0; }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  .brand__tag { display: none; }

  .hero__top .hero__range { display: none; }
  .hero__content { grid-template-columns: 1fr; gap: 24px; bottom: 110px; }
  .hero__bottom { grid-template-columns: 1fr auto; }
  .hero__fig { display: none; }
  .hero__coords { display: none; }

  /* Territorio en vertical */
  .territory__pin { height: auto; overflow: visible; }
  .territory__track { flex-direction: column; align-items: stretch; width: auto; height: auto; padding: clamp(96px, 16vw, 140px) var(--gutter); gap: clamp(80px, 16vw, 120px); }
  .territory__intro { width: auto; }
  .territory__hint { display: none; }
  .chapter { grid-template-columns: 1fr; gap: 28px; }
  .chapter__media, .chapter:nth-of-type(even) .chapter__media { height: auto; width: 100%; aspect-ratio: 4 / 5; }
  .chapter:nth-of-type(even) .chapter__media { aspect-ratio: 4 / 3; }
  .chapter__media img { width: 100%; margin-left: 0; }
  .hud { display: none; }

  .story__media { aspect-ratio: 4 / 3; }
  .story__grid { grid-template-columns: 1fr; }
  .story__text, .notes { grid-column: auto; }
  .story__index { grid-row: auto; font-size: 72px; }

  .journey__grid { grid-template-columns: 1fr; }
  .journey__portrait { position: relative; top: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat { padding-bottom: 24px; }
  .timeline__item { grid-template-columns: 72px 1fr; gap: 16px; }

  .archive__head { grid-template-columns: 1fr; }
  .archive__controls { top: calc(64px + var(--top)); }
  .filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter { white-space: nowrap; }
  .sel { grid-template-columns: 1fr 1fr; }
  .sel .shot[class] { grid-column: auto !important; margin-top: 0 !important; }
  .sel .shot .shot__frame[class] { aspect-ratio: 4 / 5 !important; }
  .sel .shot:nth-child(5n+1) { grid-column: 1 / -1 !important; }
  .sel .shot:nth-child(5n+1) .shot__frame[class] { aspect-ratio: 3 / 2 !important; }
  .year { grid-template-columns: 1fr; }
  .year__label { position: static; display: flex; align-items: baseline; gap: 16px; }
  .year__count { margin: 0; }

  .contact__grid { grid-template-columns: 1fr; }

  .lightbox { grid-template-columns: 1fr; grid-template-rows: 1fr auto; gap: 20px; padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .lightbox__note, .lightbox__meta { display: none; }
  .lightbox__title { font-size: 30px; }
  .lightbox__place { margin-bottom: 0; font-size: 14px; }
}

@media (max-width: 560px) {
  .hero__title { font-size: clamp(76px, 25vw, 140px); }
  .hero__line--in { padding-left: 0.3em; }
  .sel { grid-template-columns: 1fr; }
  .shot figcaption { flex-direction: column; gap: 2px; }
  .facts { grid-template-columns: 1fr; }
  .fact + .fact { padding-left: 0; border-left: 0; }
  .timeline__item { grid-template-columns: 1fr; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain, .hero__scroll-line::after, .territory__hint .arrow { animation: none; }
  .manifesto__text .sw { opacity: 1; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Sin JS o sin animación: el territorio se recorre con scroll horizontal nativo */
.no-js .territory__pin, .no-pin .territory__pin { height: auto; overflow-x: auto; }
.no-js .territory__track, .no-pin .territory__track { height: auto; padding-block: clamp(96px, 14vh, 160px); }
.no-js .hud, .no-pin .hud { display: none; }
