/* =========================================================
   Mercarte Studio — "Obsidiana: de la tinta a la obra"
   La imagen es la protagonista. El texto es pequeño, preciso y caro.
   ========================================================= */

@font-face { font-family: "Zodiak"; src: url("../fonts/zodiak-light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Zodiak"; src: url("../fonts/zodiak-light-italic.woff2") format("woff2"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/switzer-light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/switzer-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Switzer"; src: url("../fonts/switzer-medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --paper: #F4F0E8;     /* papel de algodón, hueso */
  --ink: #0E0E0E;       /* tinta negra profunda */
  --text: #3F3F3C;      /* gris carbón del logo */
  --text-soft: #6B6761;   /* contraste ≥ 4.5:1 sobre el papel */
  --logo-iso: #686766;  /* tonos originales del logotipo */
  --logo-txt: #454442;

  --serif: "Zodiak", "Times New Roman", serif;
  --sans: "Switzer", "Helvetica Neue", Arial, sans-serif;
  --m: clamp(20px, 3.4vw, 56px);   /* margen de joyería */
  --lockup-w: 132px;
}

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

body {
  margin: 0;
  background: var(--paper);   /* color de respaldo mientras carga el papel */
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Una sola hoja de papel de algodón detrás de todo el sitio (mosaico periódico, sin costuras) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--paper) url("../img/papel.jpg") 0 0 / 512px 512px repeat;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p, h1, h2, h3, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 5px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: var(--m); top: 12px; z-index: 100;
  padding: 10px 14px; background: var(--ink); color: var(--paper);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  transform: translateY(-160%); transition: transform .4s ease;
}
.skip:focus { transform: none; }

/* ---------------------------------------------------------
   Navegación
   --------------------------------------------------------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: flex-start; gap: 2.6rem;
  padding: calc(env(safe-area-inset-top, 0px) + 30px) var(--m) 0;
  pointer-events: none;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.nav > * { pointer-events: auto; }
.nav.is-away { transform: translateY(-120%); }
/* Fuera de la portada, al reaparecer, el menú va sobre una banda de papel con un ligero desenfoque
   (en un pseudoelemento: así el menú de celular, fijo, sigue cubriendo toda la pantalla) */
.nav::before {
  content: ""; position: absolute; inset: 0 0 -18px 0; z-index: -1; pointer-events: none;
  background: rgba(244, 240, 232, .84); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  -webkit-mask: linear-gradient(#000 calc(100% - 22px), transparent); mask: linear-gradient(#000 calc(100% - 22px), transparent);
  opacity: 0; transition: opacity .6s ease;
}
.nav.is-solid::before { opacity: 1; }
.nav__brand { margin-right: auto; display: block; }
.nav__menu { display: none; }
.lockup { display: block; width: var(--lockup-w); height: auto; }   /* píxeles del PNG original */

.nav__links, .lang {
  font-size: 12px; font-weight: 400; letter-spacing: .2em; text-transform: uppercase;
}
.nav__links { display: flex; gap: 2.4rem; padding-top: 8px; }
.nav__links a { position: relative; padding-bottom: 4px; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .7s cubic-bezier(.2, .7, .2, 1);
}
.nav__links a:hover::after, .nav__links a:focus-visible::after { transform: scaleX(1); }
.lang { display: flex; gap: .7em; align-items: center; padding-top: 2px; color: var(--text-soft); }
.lang { gap: 0; margin-top: -10px; }
.lang button { letter-spacing: inherit; text-transform: inherit; min-width: 40px; min-height: 44px; padding: 0 6px; }
.lang button[aria-pressed="true"] { color: var(--text); }

/* ---------------------------------------------------------
   Portada — la obra
   --------------------------------------------------------- */
.portada { position: relative; }
.portada__pin { position: relative; height: 100vh; height: 100svh; overflow: hidden; }

.stage { position: absolute; inset: 0; }
/* Fundido hacia el papel de la página: la portada no deja costura al terminar */
.stage__gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage__still, .stage__still img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* El render estático se ve por defecto (sin JS, sin WebGL, contexto perdido) y se retira tras el primer cuadro WebGL */
html.webgl-ready .stage__still { display: none; }
/* Con movimiento: mientras se prepara la escena solo hay papel (la obra no se anticipa) */
html.js.motion:not(.gl-failed):not(.intro-done) .stage__still { display: none; }
/* Contexto WebGL perdido (iOS al volver de segundo plano): el respaldo se ve en el acto, también a mitad de la entrada */
html.gl-perdido .stage__still { display: block !important; }   /* gana a la regla de la entrada (más específica) */
.stage__gl { opacity: 0; }
html.webgl-ready .stage__gl { opacity: 1; }
/* Celular: mientras se descarga y compila la escena, papel y un pulso de tinta discreto (aparece solo si tarda más de 0.6 s) */
@media (max-width: 760px), (pointer: coarse) {
  html.js.motion:not(.webgl-ready):not(.gl-failed):not(.intro-done) .portada__pin::after {
    content: ""; position: absolute; left: 50%; top: 46%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
    border-radius: 50%; background: var(--ink); opacity: 0; pointer-events: none;
    animation: mc-pulso 1.8s cubic-bezier(.45, 0, .55, 1) .6s infinite;
  }
}
@keyframes mc-pulso { 0%, 100% { opacity: 0; transform: scale(.8); } 50% { opacity: .55; transform: scale(1.12); } }

/* Texto mínimo, en la esquina, con precisión de joyería */
.corner {
  position: absolute; left: var(--m); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--m));
  z-index: 3; max-width: 320px;
}
.corner__name {
  font-family: var(--sans); font-weight: 500; font-size: 12px; letter-spacing: .04em; color: var(--text);
}
.corner__line {
  margin-top: 4px; font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 27px; line-height: 1.15; letter-spacing: -.005em; color: var(--ink);
}
.corner__link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 16px;
  font-size: 13px; letter-spacing: .04em; color: var(--text);
  padding-bottom: 5px; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  transition: background-size .7s cubic-bezier(.2, .7, .2, 1);
}
.corner__link:hover, .corner__link:focus-visible { background-size: 0% 1px; background-position: 100% 100%; }
.corner__link svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.hint {
  position: absolute; right: var(--m); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--m));
  z-index: 3; display: flex; align-items: center; gap: 12px;
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-soft);
}
.hint i { display: block; width: 36px; height: 1px; background: currentColor; opacity: .6; }


/* ---------------------------------------------------------
   Elementos comunes de sección
   --------------------------------------------------------- */
.label {
  display: flex; gap: .9em; font-weight: 400; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--text-soft);
}
.label span:first-child { color: var(--text); }

/* ---------------------------------------------------------
   2 · El estudio — el manifiesto se escribe con tinta
   --------------------------------------------------------- */
.estudio { padding: 18vh var(--m) 16vh; }
.manifiesto {
  margin: 7vh 0 0 calc(100% / 12);
  max-width: 21em;
  font-family: var(--serif); font-weight: 300; font-size: clamp(26px, 3.1vw, 46px);
  line-height: 1.22; letter-spacing: -.01em; color: var(--ink);
}
.manifiesto .w { display: inline-block; will-change: opacity, filter; }
.manifiesto__tinta { display: block; }

.proceso {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(24px, 4vw, 72px);
  margin: 13vh 0 0 calc(100% / 12); max-width: 1080px;
}
.paso { position: relative; }
/* gota → trazo → piedra: ilustraciones vectoriales (formas rellenas de grosor variable, sin filtros ni texturas)
   en un lienzo de 200×140 con la misma línea base; main.js las dibuja al aparecer y las mantiene vivas */
.paso__ilus { display: block; height: clamp(112px, 9.4vw, 136px); width: auto; aspect-ratio: 200 / 140; overflow: visible; margin: 0 0 22px -6px; }
.gota__onda, .gota__cuerpo, .enso, .piedra__cara { fill: var(--ink); }
.gota__brillo { fill: var(--paper); opacity: .9; }
/* el trazo vivo lo pinta un canvas encima del SVG (que queda como estado quieto y respaldo) */
.enso__lienzo { position: absolute; pointer-events: none; }
.paso__ilus--trazo.es-lienzo .enso { opacity: 0; }
.piedra__arista { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; }
.piedra__arista--borde { stroke-width: 2.6; }
.piedra__luz { fill: url(#piedra-luz); }
.paso__num { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--text-soft); }
.paso__titulo {
  margin: 6px 0 10px; font-family: var(--serif); font-weight: 300; font-size: 26px; letter-spacing: -.005em; color: var(--ink);
}
.paso p { max-width: 30ch; font-size: 13.5px; line-height: 1.65; }

/* ---------------------------------------------------------
   3 · Servicios — un trazo de tinta bajo el nombre
   --------------------------------------------------------- */
.servicios { padding: 10vh var(--m) 12vh; }
.svc { margin: 9vh 0 0 calc(100% / 12); max-width: 980px; border-top: 1px solid rgba(63, 63, 60, .18); }
.svc__item { border-bottom: 1px solid rgba(63, 63, 60, .18); }
.svc__row {
  position: relative; display: flex; align-items: baseline; gap: clamp(18px, 3vw, 44px);
  width: 100%; padding: 26px 0 24px; text-align: left; isolation: isolate;
}
.svc__num { width: 2.6em; flex: none; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--text-soft); }
.svc__name {
  font-family: var(--serif); font-weight: 300; font-size: clamp(24px, 2.6vw, 38px); line-height: 1.15;
  letter-spacing: -.01em; color: var(--ink);
}
.svc__titulo { position: relative; display: inline-block; }
/* Trazo de tinta vivo bajo el nombre. Con movimiento lo anima main.js: la punta del pincel avanza (1 s, expo-out),
   la tinta se absorbe detrás de ella y respira muy lento; al salir se seca y se desvanece.
   Sin movimiento, el trazo simplemente aparece completo. */
.svc__trazo {
  position: absolute; left: -1px; right: 0; top: calc(100% + 1px); width: calc(100% + 1px); height: 13px; overflow: visible;
  pointer-events: none; opacity: 0; --trazo: 0%; transform-origin: 50% 50%;
  -webkit-mask: linear-gradient(90deg, #000 calc(var(--trazo) - 3%), transparent var(--trazo));
          mask: linear-gradient(90deg, #000 calc(var(--trazo) - 3%), transparent var(--trazo));
}
.svc__trazo path { fill: var(--ink); filter: url(#tinta-fina); }
.svc__bleed path { filter: url(#tinta-absorcion); }
.svc__item.is-on .svc__trazo { opacity: 1; --trazo: 109%; }
.svc__item.is-on .svc__bleed { opacity: .28; }
/* punta del pincel: una gota de tinta cargada al frente del trazo */
.svc__punta {
  position: absolute; left: 0; top: calc(100% + 7.5px); width: 11px; height: 8px; margin: -4px 0 0 -7px;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 58% 50%, var(--ink) 45%, rgba(14, 14, 14, .55) 62%, rgba(14, 14, 14, 0) 74%);
}
.svc__mas { position: relative; width: 11px; height: 11px; margin-left: auto; align-self: center; flex: none; }
.svc__mas::before, .svc__mas::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--text-soft); transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.svc__mas::after { transform: rotate(90deg); }
.svc__item.is-on .svc__mas::after { transform: rotate(0deg); }
.svc__more {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  padding-left: calc(2.6em * 15 / 13 + clamp(18px, 3vw, 44px));
  transition: grid-template-rows .8s cubic-bezier(.2, .7, .2, 1), opacity .6s ease;
}
.svc__inner { min-height: 0; overflow: hidden; }
.svc__tech { font-size: 13px; color: var(--text); }
.svc__line { margin-top: 1.9em; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 19px; color: var(--ink); padding-bottom: 26px; }
.svc__item.is-on .svc__more { grid-template-rows: 1fr; opacity: 1; }

/* ---------------------------------------------------------
   4 · Trabajos — una obra por pliego: la foto principal grande (nunca más alta que el 80 % de la pantalla),
   la cédula a su lado (alterna izquierda / derecha) y debajo 4 fotos de apoyo del mismo tamaño.
   Retícula de 12 columnas: la principal ocupa hasta 9 (= 3 apoyos) y la cédula 3 (= 1 apoyo).
   --------------------------------------------------------- */
.trabajos { padding: 10vh var(--m) 12vh; }
.pliego {
  --gap: clamp(16px, 2vw, 32px);
  display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: var(--gap);
  margin-top: clamp(150px, 24vh, 260px);                          /* entre obras: una pausa clara */
}
.pliego--1 { margin-top: clamp(56px, 9vh, 100px); }
.pieza { display: block; width: 100%; text-align: left; }
.pieza__marco { display: block; overflow: hidden; }
.pieza img { display: block; width: 100%; height: auto; transform: scale(1); transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
@media (hover: hover) and (pointer: fine) {
  .pieza:hover img { transform: scale(1.03); }
}
.pieza:focus-visible img { transform: scale(1.03); }
.pieza:focus-visible { outline-offset: 6px; }

/* principal: su proporción real, a lo más 9 columnas de ancho y el alto topado en 80vh (--r = ancho / alto, en el HTML);
   la cédula va pegada a su borde real (3 columnas), así el aire sobrante queda hacia afuera, no entre foto y texto */
.pliego .pieza--portada { flex: none; width: min(calc(75% - var(--gap) / 4), calc(80vh * var(--r, 1.5))); }
.pliego .cedula { flex: none; width: calc(25% - var(--gap) * 3 / 4); padding-bottom: 4px; }
.pliego:nth-of-type(even) { justify-content: flex-end; }
.pliego:nth-of-type(even) .cedula { order: -1; }

/* apoyos: 4 del mismo tamaño (4:3); cada uno mide lo que 3 columnas de la retícula de 12 */
.apoyos {
  flex: 0 0 100%; margin-top: clamp(40px, 7vh, 84px);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gap);
}
.pieza--apoyo img { aspect-ratio: 4 / 3; object-fit: cover; }

/* Cédula: el mismo lenguaje que las cédulas del sitio */
.cedula__num { font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 15px; color: var(--text-soft); }
.cedula__titulo { margin-top: 8px; font-weight: 500; font-size: 12.5px; line-height: 1.5; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.cedula__nombre { position: relative; display: inline-block; }
.cedula .svc__trazo { height: 8px; top: calc(100% + 3px); }
.cedula .svc__punta { top: calc(100% + 8px); width: 8px; height: 6px; margin: -3px 0 0 -5px; }
.pliego.is-on .svc__trazo { opacity: 1; --trazo: 109%; }
.pliego.is-on .svc__bleed { opacity: .28; }
.cedula__disc { margin-top: 14px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); }
.cedula__frase { margin-top: 18px; max-width: 22em; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 19px; line-height: 1.35; color: var(--ink); }

/* Vista ampliada: una sala de exposición sobre el mismo papel */
.expo {
  position: fixed; inset: 0; z-index: 70; touch-action: pinch-zoom;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: calc(env(safe-area-inset-top, 0px) + 72px) minmax(0, 1fr) auto;
  height: 100vh; height: 100dvh;
}
.expo[hidden] { display: none; }
.expo__escena { position: absolute; inset: 0; background: var(--paper) url("../img/papel.jpg") 0 0 / 512px 512px; opacity: 0; transition: opacity .6s ease; }
.expo.is-open .expo__escena { opacity: 1; }
.expo__marco { position: relative; grid-row: 2; grid-column: 1; margin-bottom: 3vh; display: grid; place-items: center; pointer-events: none; }
.expo__capa { grid-area: 1 / 1; display: block; will-change: transform, opacity; background: 0 0 / 100% 100% no-repeat; }
.expo__capa { pointer-events: auto; }
.expo__capa img { display: block; width: 100%; height: 100%; }
.expo__x { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 20px); right: clamp(14px, 2.4vw, 36px); width: 44px; height: 44px; display: grid; place-items: center; color: var(--text); }
.expo__x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.2; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.expo__x:hover svg { transform: rotate(90deg); }
.expo__flecha { position: relative; grid-row: 2; grid-column: 1; align-self: center; width: 64px; height: 44px; display: grid; place-items: center; color: var(--text); z-index: 1; }
.expo__flecha--prev { justify-self: start; margin-left: var(--m); }
.expo__flecha--next { justify-self: end; margin-right: var(--m); }
.expo__flecha svg { width: 40px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.expo__flecha--prev:hover svg { transform: translateX(-6px); }
.expo__flecha--next:hover svg { transform: translateX(6px); }
.expo__cedula {
  position: relative; grid-row: 3; grid-column: 1; padding: 0 var(--m) calc(env(safe-area-inset-bottom, 0px) + 5vh);
  display: flex; align-items: baseline; gap: 1.1em; flex-wrap: wrap;
}
.expo__num { font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 15px; color: var(--text-soft); }
.expo__titulo { font-weight: 500; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.expo__disc { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); }
.expo__cuenta { margin-left: auto; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.expo__cedula, .expo__x, .expo__flecha { opacity: 0; transition: opacity .6s ease .25s; }
.expo.is-open .expo__cedula, .expo.is-open .expo__x, .expo.is-open .expo__flecha { opacity: 1; }
html.expo-open, html.expo-open body { overflow: hidden; }

/* ---------------------------------------------------------
   5 · Contacto — la tinta se reúne en una pequeña obsidiana
   --------------------------------------------------------- */
.contacto { position: relative; min-height: 100vh; min-height: 100svh; padding: 12vh var(--m) calc(env(safe-area-inset-bottom, 0px) + 36px); display: flex; flex-direction: column; }
.stage--cierre { position: relative; height: 42vh; margin: 0 calc(var(--m) * -1) 2vh; }
.stage--cierre .stage__gl { position: absolute; inset: 0; }
.stage__still--cierre { position: absolute; left: 50%; top: 50%; width: min(360px, 60vw); height: auto; transform: translate(-50%, -50%); display: block; }
html.webgl-on-cierre .stage__still--cierre { display: none; }
.contacto .label { justify-content: center; }
.contacto__titulo {
  margin-top: 4vh; text-align: center; font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(30px, 3.6vw, 54px); line-height: 1.1; letter-spacing: -.01em; color: var(--ink);
}
.contacto__sub { margin-top: 14px; text-align: center; font-size: 13.5px; }
.contacto__accion { display: flex; justify-content: center; margin-top: 5vh; }

/* Botón de tinta: píldora con borde carbón; al pasar el cursor la tinta la llena como una pincelada */
.tinta-btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 34px;
  border: 1px solid var(--text); border-radius: 999px;
  font-size: 11px; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--text);
  transition: color .5s ease .05s;
}
.tinta-btn > span { position: relative; z-index: 1; padding-left: .26em; }   /* compensa el espaciado final */
.tinta-btn::before {
  content: ""; position: absolute; z-index: 0; top: -30%; bottom: -30%; left: -10%; width: 150%;   /* lleno: el borde húmedo queda fuera de la píldora */
  background: var(--ink); filter: url(#tinta);
  -webkit-mask: linear-gradient(90deg, #000 76%, rgba(0,0,0,.55) 87%, transparent 96%) 0 0 / 100% 100% no-repeat;
          mask: linear-gradient(90deg, #000 76%, rgba(0,0,0,.55) 87%, transparent 96%) 0 0 / 100% 100% no-repeat;
  transform: translateX(-100%) skewX(-12deg);
  transition: transform .6s cubic-bezier(.6, 0, .4, 1);
}
.tinta-btn:hover, .tinta-btn:focus-visible { color: var(--paper); }
.tinta-btn:hover::before, .tinta-btn:focus-visible::before { transform: translateX(0) skewX(-12deg); transition-duration: .9s; transition-timing-function: cubic-bezier(.16, 1, .3, 1); }
.tinta-btn:focus-visible { outline-offset: 4px; }

/* Panel de contacto */
.panel { position: fixed; inset: 0; z-index: 60; }
.panel[hidden] { display: none; }
.panel__fondo { position: absolute; inset: 0; background: rgba(14, 14, 14, .32); opacity: 0; transition: opacity .6s ease; }
.panel__hoja {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0px) + 34px) clamp(24px, 3.6vw, 56px) calc(env(safe-area-inset-bottom, 0px) + 40px);
  background: var(--paper) url("../img/papel.jpg") 0 0 / 512px 512px;
  box-shadow: -30px 0 60px -40px rgba(40, 34, 26, .45);
  transform: translateX(100%); transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.panel.is-open .panel__fondo { opacity: 1; }
.panel.is-open .panel__hoja { transform: none; }
html.panel-open, html.panel-open body { overflow: hidden; }
.panel__x { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 20px); right: clamp(14px, 2.4vw, 36px); width: 44px; height: 44px; display: grid; place-items: center; color: var(--text); }
.panel__x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.2; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.panel__x:hover svg { transform: rotate(90deg); }
.panel__titulo { margin: 9vh 0 5vh; font-family: var(--serif); font-weight: 300; font-style: italic; font-size: clamp(30px, 3vw, 42px); line-height: 1.1; letter-spacing: -.01em; color: var(--ink); }

.forma { display: flex; flex-direction: column; gap: 26px; }
.forma[hidden], .gracias[hidden] { display: none; }
.forma__trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.campo { display: flex; flex-direction: column; }
.campo label { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--text); }
.campo input, .campo select, .campo textarea {
  width: 100%; margin-top: 6px; padding: 8px 0 10px; border: 0; border-bottom: 1px solid rgba(63, 63, 60, .4); border-radius: 0;
  background: transparent; font-family: var(--serif); font-weight: 300; font-size: 21px; line-height: 1.35; color: var(--ink);
  transition: border-color .4s ease;
}
.campo textarea { resize: vertical; min-height: 7.5em; font-size: 19px; }
.campo select { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%233F3F3C' stroke-width='1.1'/%3E%3C/svg%3E") right 4px center / 12px 8px no-repeat; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-bottom-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.campo input:focus-visible, .campo select:focus-visible, .campo textarea:focus-visible { outline: none; }
.campo [aria-invalid="true"] { border-bottom-color: #8A2B1E; box-shadow: 0 1px 0 #8A2B1E; }
.campo__error { min-height: 1.5em; margin-top: 6px; font-size: 12px; color: #8A2B1E; }   /* contraste 7:1 sobre el papel */
.campo__error:empty { min-height: 0; margin-top: 0; }
.forma__aviso { font-size: 12.5px; color: #8A2B1E; }
.forma__aviso:empty { display: none; }
.forma .tinta-btn { align-self: flex-start; margin-top: 8px; }
.forma .tinta-btn[disabled] { cursor: progress; opacity: .6; }
/* Aceptación del aviso: casilla de tinta, cuadrada, con la misma línea fina que los campos */
.campo--casilla { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: start; }
.campo--casilla input {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin: 0; padding: 0;
  border: 1px solid rgba(63, 63, 60, .55); border-radius: 0; background: transparent; cursor: pointer;
  display: grid; place-content: center;
}
.campo--casilla input::before { content: ""; width: 11px; height: 11px; background: var(--ink); transform: scale(0); transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
.campo--casilla input:checked::before { transform: scale(1); }
.campo--casilla input:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.campo--casilla input[aria-invalid="true"] { border-color: #8A2B1E; box-shadow: none; }
.campo--casilla label { font-size: 13px; letter-spacing: .01em; text-transform: none; color: var(--text); line-height: 1.55; cursor: pointer; }
.campo--casilla label a, .pie__aviso { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px; }
.campo--casilla .campo__error { grid-column: 2; }
.forma__verificacion:empty { display: none; }
.campo__nota { margin-top: 8px; font-size: 12px; color: var(--text-soft); }
.forma__privacidad { font-size: 12px; line-height: 1.6; color: var(--text-soft); }
/* la casilla se dibuja con el fondo: en colores forzados (alto contraste) se usan los del sistema */
@media (forced-colors: active) {
  .campo--casilla input { border-color: CanvasText; }
  .campo--casilla input::before { background: CanvasText; }
}

.gracias { padding-top: 2vh; outline: none; }
.gracias__trazo { display: block; width: 160px; height: auto; overflow: visible; }
.gracias__trazo path { fill: none; stroke: var(--ink); stroke-width: 4.4; stroke-linecap: round; filter: url(#tinta); stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.gracias.is-on .gracias__trazo path { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s cubic-bezier(.16, 1, .3, 1) .15s; }
.gracias__titulo { margin-top: 22px; font-family: var(--serif); font-weight: 300; font-style: italic; font-size: 34px; color: var(--ink); }
.gracias__texto { margin-top: 10px; max-width: 34ch; font-size: 13.5px; }
.pie {
  display: flex; justify-content: space-between; gap: 20px; margin-top: auto; padding-top: 10vh;
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-soft);
}
.pie__aviso { color: var(--text); transition: background-size .7s cubic-bezier(.2, .7, .2, 1); }
.pie__aviso:hover, .pie__aviso:focus-visible { background-size: 0% 1px; background-position: 100% 100%; }

/* ---------------------------------------------------------
   Páginas sencillas: aviso de privacidad y 404 (sin escena ni JS)
   --------------------------------------------------------- */
.sencilla .nav { position: absolute; }
.sencilla .nav__otro { padding-top: 8px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-soft); }
.sencilla .nav__otro:hover, .sencilla .nav__otro:focus-visible { color: var(--text); }
.legal { max-width: 46rem; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 200px) var(--m) 0; }
.legal__titulo, .perdida__titulo {
  margin-top: 22px; font-family: var(--serif); font-weight: 300; font-style: italic;
  font-size: clamp(34px, 4.2vw, 56px); line-height: 1.08; letter-spacing: -.01em; color: var(--ink);
}
.legal__fecha { margin-top: 16px; font-size: 12px; color: var(--text-soft); }
.legal__intro { margin-top: 6vh; font-size: 15px; line-height: 1.7; color: var(--text); }
.legal h2 { margin-top: 7vh; font-family: var(--serif); font-weight: 300; font-size: 25px; line-height: 1.2; color: var(--ink); }
.legal p, .legal li { font-size: 14px; line-height: 1.75; }
.legal h2 + p, .legal p + p, .legal p + ul, .legal ul + p { margin-top: 14px; }
.legal ul { margin-top: 12px; display: grid; gap: 8px; }
.legal li { position: relative; padding-left: 22px; }
.legal li::before { content: ""; position: absolute; left: 0; top: .85em; width: 10px; height: 1px; background: var(--text); }
.legal a { color: var(--ink); background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 1px; }
.legal strong { font-weight: 500; color: var(--ink); }
.legal .pendiente { background: #EAD9B8; padding: 0 4px; }
.sencilla .pie { max-width: 46rem; margin: 0 auto; padding: 14vh var(--m) calc(env(safe-area-inset-bottom, 0px) + 36px); }
.perdida { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 120px var(--m) 60px; }
.perdida__gota { width: 54px; height: auto; }
.perdida__gota path { fill: var(--ink); }
.perdida__texto { margin-top: 14px; font-size: 13.5px; }
.perdida__en { margin-top: 26px; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 19px; color: var(--text-soft); }
.perdida .tinta-btn { margin-top: 6vh; }

/* Mientras corre la entrada, solo existen el papel y la tinta */
html.js.motion:not(.intro-done) .nav,
html.js.motion:not(.intro-done) .corner,
html.js.motion:not(.intro-done) .hint { opacity: 0; visibility: hidden; }   /* ocultos también para el foco */

/* ---------------------------------------------------------
   Celular
   --------------------------------------------------------- */
@media (max-width: 760px) {
  :root { --lockup-w: 100px; }
  .nav { gap: .6rem; }
  .lang button { min-width: 34px; padding: 0 4px; }
  .nav { padding-top: calc(env(safe-area-inset-top, 0px) + 20px); }
  .nav__links { display: none; }
  .nav__menu {
    display: block; min-height: 44px; padding: 0 4px; margin-top: -4px;
    font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--text);
  }
  html.menu-open, html.menu-open body { overflow: hidden; }   /* también sin Lenis (reducir movimiento) */
  html.menu-open .nav__links {
    display: flex; flex-direction: column; gap: 6vh; position: fixed; inset: 0; z-index: -1;
    padding: 30vh var(--m) 0; background: var(--paper) url("../img/papel.jpg") 0 0 / 512px 512px;
    font-family: var(--serif); font-size: 30px; letter-spacing: 0; text-transform: none; color: var(--ink);
  }
  .corner__line { font-size: 22px; }
  .hint { display: none; }

  .estudio { padding-top: 22vh; }
  .manifiesto { margin-left: 0; font-size: 25px; }
  .proceso { grid-template-columns: 1fr; row-gap: 9vh; margin: 14vh 0 0; }
  .svc { margin-left: 0; }
  .panel__hoja { width: 100%; box-shadow: none; }
  .panel__titulo { margin-top: 10vh; }
  .svc__more { padding-left: 0; }
  .svc__row { gap: 14px; }
  .svc__num { width: 2em; }
  /* una columna: la principal primero, la cédula y los apoyos en una cuadrícula de 2 */
  .pliego { display: flex; flex-direction: column; margin-top: clamp(96px, 15vh, 150px); }
  .pliego--1 { margin-top: clamp(40px, 7vh, 64px); }
  .pliego .pieza--portada { width: min(100%, calc(80vh * var(--r, 1.5))); align-self: center; }
  .pliego .cedula { width: auto; margin: 22px 0 0; padding: 0; order: 0; }
  .apoyos { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
  .cedula__frase { font-size: 18px; }
  .expo { grid-template-rows: calc(env(safe-area-inset-top, 0px) + 72px) minmax(0, 1fr) auto auto; }
  .expo__flecha { grid-row: 3; align-self: start; margin-bottom: 14px; }
  .expo__flecha--prev { margin-left: calc(var(--m) - 12px); }
  .expo__flecha--next { margin-right: calc(var(--m) - 12px); }
  .expo__cedula { grid-row: 4; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 4vh); row-gap: 4px; }
  .stage--cierre { height: 34vh; }
  .pie { flex-direction: column; gap: 6px; }
  .legal { padding-top: calc(env(safe-area-inset-top, 0px) + 150px); }
}

/* Pantallas muy angostas (≤ 340 px): todo cabe en la cabecera */
@media (max-width: 340px) {
  :root { --lockup-w: 86px; }
  .nav { gap: .25rem; }
  .nav__menu, .lang { letter-spacing: .12em; }
  .lang button { min-width: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
  .pieza:hover img, .pieza:focus-visible img { transform: none; }
}
