@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --fondo: #d8cdbb;        /* arena: suelo de la hoja de montaje */
  --fondo-hondo: #c9bca7;
  --tinta: #1f1d1a;        /* línea y texto sobre arena */
  --tinta-suave: #5a5247;  /* texto secundario sobre arena */
  --senal: #2338c4;        /* azul cobalto: números de pieza y pieza activa */
  --senal-tinta: #f2f0ea;  /* texto sobre cobalto */
  --hueso: #f2f0ea;        /* suelo bajo las fotografías */
  --grafito: #16171a;
  --grafito-suave: #4b4d55;
  --gut: clamp(1.25rem, 3.4vw, 3.25rem);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--senal) var(--fondo-hondo); }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1rem, 0.94rem + 0.28vw, 1.1875rem);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--senal); color: var(--senal-tinta); }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--senal); outline-offset: 4px; }
.sobre-hueso :focus-visible { outline-color: var(--senal); }

.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.saltar { position: absolute; left: var(--gut); top: -4rem; z-index: 20; background: var(--senal); color: var(--senal-tinta); padding: 0.6rem 1rem; }
.saltar:focus { top: 1rem; }

/* Rótulos */
.rotulo {
  font-stretch: 70%;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.012em;
  font-size: clamp(2.25rem, 1.2rem + 4.4vw, 5rem);
  text-wrap: balance;
}

/* Cabecera */
.cabecera {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.5rem var(--gut);
}
.marca { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-size: 1.3rem; line-height: 1; }
.marca svg { width: 1.9rem; height: 1.9rem; flex: none; }
.logotipo { font-stretch: 70%; font-weight: 700; letter-spacing: -0.01em; }
.logotipo span { font-weight: 300; }
.menu { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.25rem); font-size: 1rem; font-stretch: 104%; }
.menu a { text-decoration: none; padding: 0.5rem 0; }
.menu a[lang] { border: 1px solid currentColor; padding: 0.3rem 0.7rem; }
@media (hover: hover) and (pointer: fine) {
  .menu a:hover, .pie a:hover { text-decoration: underline; }
  .menu a[lang]:hover { background: var(--tinta); color: var(--fondo); text-decoration: none; }
}
@media (max-width: 640px) { .menu a:not([lang]):not(.clave) { display: none; } }

/* Despiece (portada) */
.escena { position: relative; }
.tablero { padding: 6rem var(--gut) 3rem; }
.dibujo { width: 100%; height: auto; max-height: 120vw; display: block; }
.dibujo .ln { fill: none; stroke: var(--tinta); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.dibujo .fina { stroke-width: 0.8; opacity: 0.55; }
.dibujo .cara { fill: var(--fondo); stroke: var(--tinta); stroke-width: 1.5; stroke-linejoin: round; }
.dibujo .clave { fill: var(--senal); stroke: var(--tinta); stroke-width: 1.5; stroke-linejoin: round; transition: fill 0.3s ease, stroke 0.3s ease; }
.dibujo .guia { stroke: var(--tinta); stroke-width: 1; stroke-dasharray: 2 7; fill: none; }
.dibujo .num { font: 700 58px "Archivo"; font-stretch: 66%; fill: var(--senal); }
.dibujo .nom { font: 500 22px "Archivo"; fill: var(--tinta); }
.capa { transition: opacity 0.4s ease; }

.lema { font-size: clamp(1.5rem, 1rem + 1.9vw, 2.25rem); line-height: 1.3; font-weight: 500; font-stretch: 88%; max-width: 17em; text-wrap: balance; }
.sello { font-stretch: 66%; font-weight: 700; line-height: 0.8; letter-spacing: -0.02em; font-size: clamp(4.25rem, 21vw, 14rem); white-space: nowrap; margin-top: 2.5rem; }
.sello span { font-weight: 300; }
.panel { margin-top: 4.5rem; }
.panel h2 { font-stretch: 68%; font-weight: 700; font-size: clamp(2.5rem, 1.5rem + 4vw, 4.75rem); line-height: 0.92; }
.panel h2 b { color: var(--senal); font-weight: 700; margin-right: 0.18em; font-variant-numeric: tabular-nums; }
.panel p { margin-top: 1rem; max-width: 34em; color: var(--tinta-suave); }
.panel figure { margin-top: 1.5rem; }
.panel img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.panel .nota-img { font-size: 0.8125rem; margin-top: 0.5rem; }
.rail { display: none; }

/* Modo recorrido: solo escritorio con movimiento permitido (lo activa main.js) */
.escena.recorrido { height: 440vh; }
.recorrido .tablero {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: minmax(0, 1fr); gap: 2rem;
  padding: 6.25rem calc(var(--gut) + 4.5rem) 2.25rem var(--gut);
}
.recorrido .lienzo { grid-column: 2; grid-row: 1; min-height: 0; display: flex; }
.recorrido .dibujo { height: 100%; max-height: none; }
.recorrido .textos { grid-column: 1; grid-row: 1; position: relative; min-height: 0; z-index: 2; }
.recorrido .panel {
  position: absolute; inset: 0; margin: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}
.recorrido .panel.intro { justify-content: space-between; }
.recorrido .sello { font-size: clamp(5rem, 13.6vw, 15rem); margin: 0 0 -0.04em; }
.recorrido .tablero[data-ch="0"] .panel[data-p="0"],
.recorrido .tablero[data-ch="1"] .panel[data-p="1"],
.recorrido .tablero[data-ch="2"] .panel[data-p="2"],
.recorrido .tablero[data-ch="3"] .panel[data-p="3"] {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.45s ease 0.1s, transform 0.6s var(--ease-out) 0.1s, visibility 0s;
}
.recorrido .panel figure { order: -1; margin: 0 0 1.75rem; }
.recorrido .panel img { max-height: 44vh; clip-path: inset(0 0 100% 0); transition: clip-path 0.3s ease; }
.recorrido .tablero[data-ch="1"] .panel[data-p="1"] img,
.recorrido .tablero[data-ch="2"] .panel[data-p="2"] img,
.recorrido .tablero[data-ch="3"] .panel[data-p="3"] img { clip-path: inset(0); transition: clip-path 0.9s var(--ease-out) 0.15s; }
.recorrido .capa .clave { fill: var(--fondo); stroke: var(--tinta); }
.recorrido .tablero[data-ch="0"] .capa[data-l="3"] .clave,
.recorrido .tablero[data-ch="1"] .capa[data-l="1"] .clave,
.recorrido .tablero[data-ch="2"] .capa[data-l="2"] .clave,
.recorrido .tablero[data-ch="3"] .capa[data-l="3"] .clave { fill: var(--senal); stroke: var(--tinta); }
.recorrido .tablero[data-ch="1"] .capa:not([data-l="1"]),
.recorrido .tablero[data-ch="2"] .capa:not([data-l="2"]),
.recorrido .tablero[data-ch="3"] .capa:not([data-l="3"]) { opacity: 0.32; }

.recorrido .rail {
  display: flex; flex-direction: column; gap: 0.35rem;
  position: absolute; right: var(--gut); top: 50%; transform: translateY(-50%); z-index: 3;
}
.rail button {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem;
  min-height: 44px; font-stretch: 70%; font-weight: 700; font-size: 1.25rem;
  color: var(--tinta-suave); transition: color 0.2s ease, transform 0.16s ease-out;
}
.rail button::after { content: ""; width: 1.5rem; height: 2px; background: currentColor; transform-origin: right; transition: transform 0.4s var(--ease-out); transform: scaleX(0.45); }
.rail button[data-abierta] { color: var(--senal); }
.rail button[data-abierta]::after { transform: scaleX(1); }
.rail button[aria-current="true"] { color: var(--tinta); }
.rail button:active { transform: scale(0.97); }

/* Secciones */
.seccion { padding: clamp(5rem, 11vw, 10.5rem) var(--gut); }
.sobre-hueso { background: var(--hueso); color: var(--grafito); }
.sobre-hueso ::selection { background: var(--senal); color: var(--hueso); }

.manifiesto { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(2rem, 6vw, 6rem); align-items: end; }
.manifiesto .rotulo { font-size: clamp(2.25rem, 1rem + 5vw, 5.5rem); }
.manifiesto p { color: var(--grafito-suave); max-width: 30em; }
.manifiesto p + p { margin-top: 1em; }
@media (max-width: 820px) { .manifiesto { grid-template-columns: 1fr; } }

/* Estudios de estilo */
.seccion.estudios { padding-top: 0; }
.estudios-cab { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem 3rem; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.filtros { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filtros button {
  min-height: 44px; padding: 0 1.1rem; border: 1px solid var(--grafito);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.16s ease-out;
}
.filtros button[aria-pressed="true"] { background: var(--grafito); color: var(--hueso); }
.filtros button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .filtros button:not([aria-pressed="true"]):hover { background: var(--senal); border-color: var(--senal); color: var(--hueso); } }
.reticula { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(0.75rem, 1.6vw, 1.5rem); row-gap: clamp(2rem, 4vw, 3.5rem); }
.pieza { display: flex; flex-direction: column; grid-column: span 6; }
.pieza[hidden] { display: none; }
.pieza .marco { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #d9d4c8; }
.pieza img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 2; }
.pieza figcaption { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.75rem; font-size: 1rem; }
.pieza figcaption span { color: var(--grafito-suave); }
.reticula[data-filtro="todos"] .pieza:nth-child(1) { grid-column: span 8; }
.reticula[data-filtro="todos"] .pieza:nth-child(2) { grid-column: span 4; }
.reticula[data-filtro="todos"] .pieza:nth-child(3) { grid-column: span 5; }
.reticula[data-filtro="todos"] .pieza:nth-child(4) { grid-column: span 7; }
.reticula[data-filtro="todos"] .pieza:nth-child(5) { grid-column: span 4; }
.reticula[data-filtro="todos"] .pieza:nth-child(6) { grid-column: span 8; }
.reticula[data-filtro="todos"] .pieza:nth-child(2) img,
.reticula[data-filtro="todos"] .pieza:nth-child(3) img,
.reticula[data-filtro="todos"] .pieza:nth-child(5) img { aspect-ratio: auto; position: absolute; inset: 0; }
.aviso { margin-top: clamp(2rem, 4vw, 3rem); max-width: 44em; color: var(--grafito-suave); font-size: 1rem; }
@media (max-width: 720px) {
  .reticula .pieza, .reticula[data-filtro="todos"] .pieza:nth-child(n) { grid-column: 1 / -1; }
  .reticula[data-filtro="todos"] .pieza:nth-child(n) img { position: static; aspect-ratio: 3 / 2; }
  .reticula[data-filtro="todos"] .pieza:nth-child(2) img, .reticula[data-filtro="todos"] .pieza:nth-child(5) img { aspect-ratio: 4 / 5; }
}

/* Proceso */
.proceso .rotulo { max-width: 14em; }
.pasos { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 2rem); margin-top: clamp(3rem, 6vw, 5.5rem); padding-top: 2.25rem; }
.pasos::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--senal); transform-origin: left; }
.pasos li { position: relative; }
.pasos li::before { content: ""; position: absolute; left: 0; top: -2.25rem; width: 3px; height: 1.1rem; background: var(--senal); }
.pasos h3 { font-stretch: 70%; font-weight: 700; font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.125rem); line-height: 1; }
.pasos h3 b { color: var(--senal); margin-right: 0.3em; font-variant-numeric: tabular-nums; }
.pasos p { margin-top: 0.7rem; color: var(--tinta-suave); font-size: 1rem; }
.js .pasos::before { transform: scaleX(0); transition: transform 1.6s var(--ease-in-out); }
.js .pasos.vista::before { transform: scaleX(1); }
@media (max-width: 1000px) {
  .pasos { grid-template-columns: 1fr; padding: 0 0 0 1.75rem; gap: 2.25rem; }
  .pasos::before { right: auto; bottom: 0; width: 3px; height: auto; transform-origin: top; }
  .js .pasos::before { transform: scaleY(0); }
  .js .pasos.vista::before { transform: scaleY(1); }
  .pasos li::before { left: -1.75rem; top: 0.65rem; width: 1.1rem; height: 3px; }
  .pasos p { max-width: 34em; }
}

/* Encargos */
.encargos .rotulo { margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.encargo { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr); gap: clamp(1rem, 3vw, 3rem); align-items: center; padding: clamp(1.5rem, 3vw, 2.5rem) 0; border-top: 1px solid var(--grafito); }
.encargo:last-child { border-bottom: 1px solid var(--grafito); }
.encargo h3 { font-stretch: 70%; font-weight: 700; font-size: clamp(2rem, 1.2rem + 3.2vw, 4rem); line-height: 0.95; }
.encargo p { color: var(--grafito-suave); max-width: 30em; }
.encargo img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
@media (max-width: 820px) { .encargo { grid-template-columns: 1fr; } .encargo img { aspect-ratio: 16 / 9; } }

/* Contacto */
.contacto { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: clamp(2rem, 5vw, 5rem); align-items: end; }
.contacto .rotulo { font-size: clamp(2.75rem, 1rem + 7.4vw, 6rem); }
.contacto p { max-width: 26em; }
.boton {
  display: inline-flex; align-items: center; min-height: 3.5rem; margin-top: 1.5rem; padding: 0 1.75rem;
  background: var(--grafito); color: var(--hueso); text-decoration: none; font-weight: 600; font-size: 1.125rem;
  transition: background-color 0.2s ease, transform 0.16s ease-out;
}
.boton:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .boton:hover { background: var(--senal); } }
@media (max-width: 820px) { .contacto { grid-template-columns: 1fr; } }

/* Pie */
.pie { background: var(--grafito); color: var(--hueso); padding: 3rem var(--gut); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 3rem; font-size: 1rem; }
.pie p { color: #b9bbc4; }
.pie nav { display: flex; gap: 1.5rem; }
.pie a { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .js .pasos::before { transform: none; }
}

/* Rótulos del dibujo legibles cuando el dibujo se ve pequeño */
@media (max-width: 959px) { .dibujo .nom { font-size: 32px; } .dibujo .num { font-size: 66px; } }

/* ---- Ajustes tras la revisión final ---- */

/* Voz de etiqueta: Archivo ancha, versales pequeñas */
.menu, .filtros button, .pieza figcaption span, .nota-img, .panel .nota-img {
  font-stretch: 116%; text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.8125rem; font-weight: 500;
}
.dibujo .nom { font-stretch: 116%; text-transform: uppercase; letter-spacing: 0.07em; font-size: 17px; }
@media (max-width: 959px) { .dibujo .nom { font-size: 26px; } }
@media (max-width: 480px) { .filtros button { padding: 0 0.7rem; font-size: 0.75rem; } }

/* Frase de portada: en hueso y una oración por línea */
.panel .lema { color: var(--tinta); max-width: none; }
.lema span { display: block; }

/* Fotografía de cada capa: a sangre por la izquierda, misma posición en las tres */
.recorrido .dibujo { overflow: visible; }
.recorrido .panel figure {
  order: 0; position: absolute; top: 0; left: calc(-1 * var(--gut)); right: 0; bottom: 14.5rem;
  margin: 0; display: flex; flex-direction: column;
}
.recorrido .panel figure img { flex: 1; min-height: 0; height: 100%; max-height: none; aspect-ratio: auto; }
.recorrido .panel .nota-img { padding-left: var(--gut); }

/* Un solo sistema de números: el raíl sigue el orden de la pila (03 arriba) */
.recorrido .rail { flex-direction: column-reverse; }
.capa { transition: none; }
.capa > * { transition: opacity 0.4s ease, fill 0.3s ease, stroke 0.3s ease; }
.recorrido .tablero[data-ch="1"] .capa:not([data-l="1"]),
.recorrido .tablero[data-ch="2"] .capa:not([data-l="2"]),
.recorrido .tablero[data-ch="3"] .capa:not([data-l="3"]) { opacity: 1; }
.recorrido .tablero[data-ch="1"] .capa:not([data-l="1"]) > :not(text),
.recorrido .tablero[data-ch="2"] .capa:not([data-l="2"]) > :not(text),
.recorrido .tablero[data-ch="3"] .capa:not([data-l="3"]) > :not(text) { opacity: 0.3; }
.sin-transicion .panel, .sin-transicion .panel img { transition: none !important; }

/* Aviso de imágenes generadas, antes de la galería */
.estudios-cab .aviso { margin-top: 1rem; }

/* Contacto sobre azul; el lima queda solo en el botón */
.contacto p { color: var(--tinta-suave); }
.contacto .boton { background: var(--senal); color: var(--senal-tinta); }
@media (hover: hover) and (pointer: fine) { .contacto .boton:hover { background: var(--tinta); } }

/* Los rótulos del dibujo son el índice de capas (sustituyen al raíl lateral) */
.recorrido .tablero { padding-right: var(--gut); }
.recorrido .tablero[data-ch="1"] .capa:not([data-l="1"]) > .etq,
.recorrido .tablero[data-ch="2"] .capa:not([data-l="2"]) > .etq,
.recorrido .tablero[data-ch="3"] .capa:not([data-l="3"]) > .etq { opacity: 1; }
.recorrido .etq { cursor: pointer; }
.recorrido .etq .num, .recorrido .etq .nom { fill: var(--tinta-suave); transition: fill 0.2s ease; }
.recorrido .etq[data-abierta] .num { fill: var(--senal); }
.recorrido .etq[aria-current="true"] .num { fill: var(--senal); }
.recorrido .etq[aria-current="true"] .nom { fill: var(--tinta); }
.etq:focus-visible { outline: 2px solid var(--senal); outline-offset: 2px; }
@media (max-width: 959px) { .dibujo .nom { font-size: 19px; } .dibujo .num { font-size: 56px; } }
@media (max-width: 480px) {
  .filtros { flex-wrap: nowrap; width: 100%; gap: 0.35rem; }
  .filtros button { flex: 1; padding: 0 0.25rem; font-size: 0.6875rem; letter-spacing: 0.04em; }
}

/* Proceso en tres pasos */
@media (min-width: 1001px) { .pasos { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pasos p { max-width: 24em; } }
.pie p a { color: var(--hueso); text-decoration: underline; }

/* Paleta arena: el símbolo del pie va entero en hueso */
.pie .marca svg path { stroke: currentColor; }
