/* ==========================================================================
   MORLA — Proyectos Técnicos
   Sistema: papel de plano + tinta. Grotesk (Archivo) para voz,
   mono (IBM Plex Mono) para el cajetín técnico.
   ========================================================================== */

:root {
  --paper: #f7f6f3;
  --ink: #101010;
  --muted: #75756f;
  --line: rgba(16, 16, 16, 0.16);
  --accent: #2438c8;
  --white: #fdfdfc;

  --font-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --pad-x: clamp(1.25rem, 4vw, 4rem);
  --gap: clamp(1rem, 2vw, 2rem);

  /* entradas y cortinas: arranque rápido, frenada larga */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* hover de texto: reacción inmediata y recorrido corto, para que el cursor
     no arrastre el texto detrás */
  --ease-text: cubic-bezier(0.3, 0, 0.25, 1);
  /* hover de imagen: mismo ease-out de entrada, recorrido corto y frenada
     limpia. El zoom acompaña al cursor en vez de arrastrarse detrás. */
  --ease-media: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.7s;
  --dur-hover: 0.28s;   /* color y subrayados */
  --dur-move: 0.38s;    /* desplazamientos cortos de texto */
  --dur-media: 0.9s;    /* zoom y viraje de imágenes */
  /* entrada de las imágenes al aparecer en pantalla (clip-path). Está en una
     variable porque se declara en dos sitios: `.reveal-media img` y, por la
     colisión de `transition` explicada allí, `.work .work__media img`. */
  --dur-reveal: 1.1s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Lenis toma el control del scroll cuando está activo (añade estas clases a
   <html> por su cuenta); el scroll nativo suave debe apagarse o pelean. */
html.lenis,
html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--white); }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ tipos */

.t-mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.t-display {
  font-weight: 640;
  font-size: clamp(3.4rem, 10.5vw, 9.5rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

/* titulares con palabras muy largas ("renderizamos"): el mínimo de .t-display
   no deja sitio a la palabra entera en pantallas estrechas y acabaría partida.
   Aquí se baja ese mínimo para que el ancho siga mandando sobre el tamaño. */
.t-display--long { font-size: clamp(2.1rem, 10.5vw, 9.5rem); }

.t-statement {
  font-weight: 520;
  font-size: clamp(1.65rem, 3.4vw, 3.1rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.t-body-lg {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  line-height: 1.5;
}

/* ------------------------------------------------------------- utilidades */

.wrap { padding-inline: var(--pad-x); }

.section { padding-block: clamp(4.5rem, 10vw, 9rem); }

.section-label {
  display: block;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  color: var(--ink);
}
.section-label::before { content: "("; }
.section-label::after { content: ")"; }

.hairline { border: 0; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.05rem 1.7rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color var(--dur-hover) var(--ease-text), color var(--dur-hover) var(--ease-text), box-shadow var(--dur-hover) var(--ease-text), transform var(--dur-hover) var(--ease-text);
}

.pill::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  transition: background-color var(--dur-hover) var(--ease-text);
}

.pill:hover { background: var(--accent); }
.pill:hover::after { background: currentColor; }

.pill--light {
  background: var(--paper);
  color: var(--ink);
}
.pill--light:hover { background: var(--accent); color: var(--white); }

/* ----------------------------------------------------------------- header */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.1rem, 2.5vw, 2rem) var(--pad-x);
}

.site-header--solid { position: relative; }

.brand { line-height: 1; }

.brand__logo {
  display: block;
  height: clamp(2.2rem, 3.9vw, 3.4rem);
  width: auto;
}

.brand__tag {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

/* el logo es un trazo negro sobre transparente: sobre el header oscuro
   de la home (imagen de fondo) se invierte a blanco para mantener contraste */
.header--on-image .brand__logo { filter: invert(1); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding-top: 0.55rem;
}

.site-nav__link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
}

.site-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-move) var(--ease-text);
}

.site-nav__link:hover::after,
.site-nav__link[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.header--on-image { color: var(--white); }

/* pills flotantes (aparecen al hacer scroll) */

.float-ui {
  position: fixed;
  top: clamp(1rem, 2vw, 1.5rem);
  right: var(--pad-x);
  z-index: 60;
  display: flex;
  gap: 0.6rem;
  opacity: 0;
  transform: translateY(-0.75rem);
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.float-ui.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.float-ui .pill { box-shadow: 0 10px 30px rgba(16, 16, 16, 0.18); }

/* el par flotante va sin el círculo del final: son dos rótulos de la misma
   barra ("Contacto" y "Menú") y el punto sólo desequilibraba al primero */
.float-ui .pill::after { display: none; }

.pill--menu {
  background: var(--white);
  color: var(--ink);
}
.pill--menu::after { display: none; }
.pill--menu:hover { background: var(--accent); color: var(--white); }

/* --------------------------------------------------------------- overlay */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) var(--pad-x);
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path 0.7s var(--ease-out), visibility 0s 0.7s;
}

.menu-overlay.is-open {
  clip-path: inset(0 0 0% 0);
  visibility: visible;
  transition: clip-path 0.7s var(--ease-out);
}

.menu-overlay__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-overlay__links {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2em;
}

.menu-overlay__link {
  font-weight: 620;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  width: fit-content;
  transition: color var(--dur-hover) var(--ease-text), transform var(--dur-move) var(--ease-text);
}

.menu-overlay__link:hover { color: #97a4ff; transform: translateX(0.4rem); }

/* aparición del texto al desplegarse el menú: cada línea sube y aparece
   escalonada mientras la cortina termina de abrirse. Se hace con @keyframes
   (sin `forwards`) para no bloquear el `transform` del hover al terminar. */
@keyframes menu-line-in {
  from { opacity: 0; transform: translateY(1.1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

.menu-overlay.is-open .menu-overlay__link,
.menu-overlay.is-open .menu-overlay__top,
.menu-overlay.is-open .menu-overlay__bottom {
  animation: menu-line-in 0.85s var(--ease-out) backwards;
}

.menu-overlay.is-open .menu-overlay__top { animation-delay: 0.1s; }
.menu-overlay.is-open .menu-overlay__link:nth-child(1) { animation-delay: 0.2s; }
.menu-overlay.is-open .menu-overlay__link:nth-child(2) { animation-delay: 0.27s; }
.menu-overlay.is-open .menu-overlay__link:nth-child(3) { animation-delay: 0.34s; }
.menu-overlay.is-open .menu-overlay__link:nth-child(4) { animation-delay: 0.41s; }
.menu-overlay.is-open .menu-overlay__bottom { animation-delay: 0.5s; }

/* tres casillas de igual peso a los lados: así el correo queda centrado
   respecto a la página, no respecto a lo que ocupan sus vecinos */
.menu-overlay__bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.6rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 246, 243, 0.66);
}

.menu-overlay__bottom > :nth-child(2) { justify-self: center; text-align: center; }
.menu-overlay__bottom > :nth-child(3) { justify-self: end; }

.menu-overlay__bottom a { transition: color var(--dur-hover) var(--ease-text); }
.menu-overlay__bottom a:hover { color: var(--paper); }

/* ------------------------------------------------------------------- hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--white);
  isolation: isolate;
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.hero__media picture {
  display: block;
  width: 100%;
  height: 100%;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  animation: hero-settle 2.2s var(--ease-out) forwards;
}

@keyframes hero-settle { to { transform: scale(1); } }

.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(10, 10, 10, 0.42) 0%, rgba(10, 10, 10, 0.05) 32%, rgba(10, 10, 10, 0.08) 62%, rgba(10, 10, 10, 0.55) 100%);
}

/* cajetín de proyecto destacado, distribuido en línea */
.hero__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0 var(--pad-x);
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
}

.hero__meta .view-link {
  position: relative;
  padding-bottom: 0.3rem;
}
.hero__meta .view-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  transition: transform var(--dur-move) var(--ease-text);
}
.hero__meta .view-link:hover::after { transform: scaleX(0.4); }

.hero__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 0 var(--pad-x) clamp(1.75rem, 4vh, 3rem);
}

.hero__claim {
  max-width: 34ch;
  font-weight: 520;
  font-size: clamp(1.7rem, 3.4vw, 3rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero__scroll { flex-shrink: 0; }

/* --------------------------------------------------------------- estudio */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: start;
}

.studio__media {
  position: sticky;
  top: clamp(4rem, 12vh, 7rem);
}

.studio__media img { width: 100%; }

.studio__text .t-statement { margin-bottom: 2.2rem; text-wrap: balance; }

.studio__text p + p { margin-top: 1.4rem; }

.studio__text .pill { margin-top: 2.6rem; }

.studio__cols {
  color: #3c3c38;
  max-width: 56ch;
}

/* cifras del estudio, en fila de cajetín */
.studio__facts {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.studio__fact {
  padding: 1.2rem 1rem 0 0;
}
.studio__fact + .studio__fact { border-left: 1px solid var(--line); padding-left: 1.2rem; }

.studio__fact strong {
  display: block;
  font-weight: 620;
  font-size: clamp(1.7rem, 2.6vw, 2.4rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.studio__fact span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------- titular gigante */

.giant {
  padding-top: clamp(4rem, 9vw, 8rem);
  overflow: hidden;
}

/* dos palabras largas: se deja partir en dos líneas en vez de forzar
   una sola línea que se saldría del ancho de la página */
.giant h2 {
  max-width: 15ch;
  text-wrap: balance;
}

/* ------------------------------------------------------------ obra / grid */

.works {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gap);
  row-gap: clamp(3.5rem, 8vw, 7rem);
}

.work {
  position: relative;
  display: block;
}

.work__media {
  overflow: hidden;
  background: #e8e6e0;
}

/* CUIDADO al tocar esta regla: la tarjeta es `<a class="work reveal-media">`,
   así que a esta misma <img> le llegan DOS reglas con `transition` — ésta (el
   zoom del hover) y `.reveal-media img` (el clip-path de entrada, más abajo).
   `transition` es una sola propiedad: la que gana la cascada borra a la otra,
   no se suman. Con el selector `.work__media img` empataban en especificidad
   (0,1,1) y ganaba la de abajo por orden, así que el zoom se quedaba SIN
   transición y el hover saltaba de golpe. De ahí el `.work` delante, que sube
   a (0,2,1), y de ahí que las dos transiciones se declaren juntas aquí. */
.work .work__media img {
  width: 100%;
  aspect-ratio: var(--ratio, 3 / 2);
  object-fit: cover;
  /* escala explícita en reposo: el navegador interpola desde un valor real
     y no desde `none`, que es donde aparecían los saltos al iniciar el hover */
  transform: scale(1);
  transition: transform var(--dur-media) var(--ease-media),
              clip-path var(--dur-reveal) var(--ease-out);
}

.work:hover .work__media img { transform: scale(1.04); }

/* Sólo donde hay cursor: se avisa al navegador de que la imagen va a moverse
   para que la mantenga en su propia capa. Sin esto vuelve a rasterizarla a
   cada paso y el zoom avanza a saltos, que es lo que se leía como brusco.
   En táctil no se declara: son capas de memoria que allí no se usan. */
@media (hover: hover) and (pointer: fine) {
  .work__media img,
  .dept__media img { will-change: transform; }
}

/* cajetín bajo cada obra */
.work__caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-top: 0.85rem;
  margin-top: 0.1rem;
}

.work__title {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  font-weight: 560;
  font-size: 1rem;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.work__title .idx {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--dur-hover) var(--ease-text);
}

.work:hover .work__title .idx { color: var(--accent); }

.work__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* colocación escalonada en portada */
.works--featured .work:nth-child(odd)  { grid-column: 1 / span 7; }
.works--featured .work:nth-child(even) { grid-column: 6 / span 7; margin-top: clamp(2rem, 8vw, 8rem); }
.works--featured .work:nth-child(4n+3) { grid-column: 1 / span 5; }
.works--featured .work:nth-child(4n)   { grid-column: 7 / span 6; }

.works-cta {
  display: flex;
  justify-content: center;
  padding-top: clamp(3.5rem, 8vw, 6rem);
}

/* --------------------------------------------------------- departamentos */

.depts { border-top: 1px solid var(--line); }

.dept {
  display: grid;
  grid-template-columns: clamp(7rem, 14vw, 14rem) minmax(0, 1fr) minmax(0, 30ch);
  grid-template-areas: "media name desc";
  gap: var(--gap);
  align-items: center;
  padding-block: clamp(1.8rem, 4vw, 2.6rem);
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: padding-left var(--dur-move) var(--ease-text);
}

.dept:hover { padding-left: 1.2rem; }

/* miniatura de cada departamento: en gris hasta que se pasa por encima */
.dept__media {
  grid-area: media;
  overflow: hidden;
  background: #e8e6e0;
}

.dept__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) contrast(1.03);
  transform: scale(1);
  transition: transform var(--dur-media) var(--ease-media), filter 1.4s var(--ease-media);
}

.dept:hover .dept__media img { filter: none; transform: scale(1.04); }

.dept__name {
  grid-area: name;
  font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw, 2.9rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.dept__desc {
  grid-area: desc;
  color: #3c3c38;
  font-size: 0.98rem;
  max-width: 34ch;
  justify-self: end;
}

/* ---------------------------------------------------------- proceso band */

.process-band { text-align: left; }

.process-band .t-statement {
  max-width: 24ch;
  text-wrap: balance;
}

.process-band__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
}

.process-band__side p { color: #3c3c38; max-width: 40ch; }
.process-band__side .pill { margin-top: 2rem; }

/* pasos numerados (el proceso sí es secuencia) */
.steps {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-top: clamp(3rem, 6vw, 5rem);
}

.step {
  counter-increment: step;
  border-top: 1px solid var(--ink);
  padding-top: 1rem;
  min-height: 9.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
}

.step::before {
  content: "(" counter(step, decimal-leading-zero) ")";
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.step h3 {
  font-weight: 580;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-transform: uppercase;
}

.step p { font-size: 0.94rem; color: #3c3c38; }

/* ------------------------------------------------------------------ claim */

.claim {
  border-top: 1px solid var(--line);
  text-align: center;
}

.claim .t-display {
  font-size: clamp(2.4rem, 6.5vw, 6rem);
  text-transform: none;
  letter-spacing: -0.03em;
  line-height: 1.02;
  max-width: 18ch;
  margin-inline: auto;
  text-wrap: balance;
}

.claim .accent { color: var(--accent); }

/* -------------------------------------------------------------------- cta */

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

.cta .t-mono { color: var(--muted); }

/* ----------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding-top: clamp(3rem, 6vw, 5rem);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 4fr) minmax(0, 4fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding-bottom: clamp(3rem, 7vw, 6rem);
}

.site-footer__media img {
  width: min(100%, 20rem);
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* datos legales: viven dentro de la primera columna del pie, como una nota
   al pie de la imagen, no como una barra aparte al final de la página */
.site-footer__colophon {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 20rem;
  margin-top: clamp(1.8rem, 3vw, 2.6rem);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-label {
  display: block;
  margin-bottom: 1.6rem;
  color: var(--muted);
}
.footer-label::before { content: "("; }
.footer-label::after { content: ")"; }

.site-footer__nav a {
  display: block;
  width: fit-content;
  font-weight: 620;
  font-size: clamp(2rem, 3.6vw, 3.2rem);
  line-height: 1.14;
  letter-spacing: -0.025em;
  transition: color var(--dur-hover) var(--ease-text), transform var(--dur-move) var(--ease-text);
}

.site-footer__nav a:hover { color: var(--accent); transform: translateX(0.4rem); }

.site-footer__info { font-size: 0.98rem; }

.site-footer__info p { margin-bottom: 0.55rem; }

.site-footer__info b {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-right: 0.4rem;
}

.site-footer__info a { transition: color var(--dur-hover) var(--ease-text); }
.site-footer__info a:hover { color: var(--accent); }

/* sólo el segundo rótulo ("Síguenos") se separa: el primero tiene que arrancar
   a la misma altura que "(Navegación)" en la columna de al lado */
.site-footer__info .footer-label:not(:first-child) { margin-top: 2.4rem; }

/* logotipo monumental: cierra la página de margen a margen, el mismo gesto
   que hacía el wordmark tipográfico al que sustituye. En SVG, para que a
   este tamaño el trazo siga siendo un trazo y no un mapa de píxeles. */
.site-footer__wordmark {
  display: block;
  width: 100%;
  padding-inline: var(--pad-x);
  padding-bottom: clamp(0.5rem, 1.5vw, 1.2rem);
}

.site-footer__wordmark img { width: 100%; }

/* firma del estudio: al margen inferior derecho, separada de los datos de
   Morla para que la marca de autoría no se lea como parte de su información */
.site-footer__credit {
  display: flex;
  justify-content: flex-end;
  padding-top: clamp(1rem, 2vw, 1.6rem);
  padding-bottom: clamp(1rem, 2.5vw, 1.8rem);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer__credit a { transition: color var(--dur-hover) var(--ease-text); }
.site-footer__credit a:hover { color: var(--ink); }

/* ------------------------------------------------------- páginas internas */

.page-head { padding-top: clamp(6rem, 14vh, 9rem); }

.page-head .t-mono { display: block; margin-bottom: 1.4rem; color: var(--muted); }

/* los titulares nunca se parten con guion: cada palabra salta entera a la
   línea siguiente. `break-word` sólo actúa si una palabra sola no cabe. */
.page-head h1 {
  overflow-wrap: break-word;
  -webkit-hyphens: manual;
  hyphens: manual;
}

.page-head__intro {
  max-width: 52ch;
  margin-top: 2.4rem;
  color: #3c3c38;
}

/* filtros de portafolio */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: clamp(2.5rem, 5vw, 4rem) 0 clamp(2rem, 4vw, 3.5rem);
}

.filter-btn {
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color var(--dur-hover) var(--ease-text), color var(--dur-hover) var(--ease-text), box-shadow var(--dur-hover) var(--ease-text);
}

.filter-btn:hover { box-shadow: inset 0 0 0 1px var(--ink); }

.filter-btn.is-active {
  background: var(--ink);
  color: var(--white);
  box-shadow: none;
}

/* grid de portafolio completo */
.works--all .work { grid-column: span 6; }
.works--all .work:nth-child(4n+1) { grid-column: 1 / span 7; }
.works--all .work:nth-child(4n+2) { grid-column: 8 / span 5; margin-top: clamp(1.5rem, 4vw, 4rem); }
.works--all .work:nth-child(4n+3) { grid-column: 1 / span 5; }
.works--all .work:nth-child(4n)   { grid-column: 6 / span 7; margin-top: clamp(1.5rem, 4vw, 4rem); }

.work.is-hidden { display: none; }

/* cuando el filtro está activo, grid regular */
.works--all.is-filtered .work,
.works--all.is-filtered .work:nth-child(n) {
  grid-column: span 6;
  margin-top: 0;
}

/* ---------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 12, 12, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  cursor: zoom-out;
}

.lightbox.is-open { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.lightbox figcaption {
  position: absolute;
  left: 50%;
  bottom: clamp(1rem, 3vw, 2rem);
  transform: translateX(-50%);
  color: rgba(253, 253, 252, 0.85);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* --------------------------------------------------------------- servicios */

.service {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 7rem);
  padding-block: clamp(3.5rem, 8vw, 7rem);
  border-top: 1px solid var(--line);
}

.service:nth-child(even) .service__media { order: 2; }

.service__head { margin-bottom: 1.8rem; }

.service__head .t-mono { color: var(--muted); display: block; margin-bottom: 1rem; }

.service__head h2 {
  font-weight: 620;
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  letter-spacing: -0.025em;
  line-height: 1;
  text-transform: uppercase;
}

.service__body p { color: #3c3c38; max-width: 52ch; }
.service__body p + p { margin-top: 1.2rem; }

.service__list {
  list-style: none;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}

.service__list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-weight: 540;
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.service__media img { width: 100%; }

.service__media figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------- proceso por fases (servicios) */

.phases__intro {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
}

.phases__intro .t-statement { max-width: 22ch; text-wrap: balance; }
.phases__intro p { color: #3c3c38; max-width: 38ch; }

.phases {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--ink);
}

.phase {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: clamp(1.2rem, 4vw, 4rem);
  padding-block: clamp(1.8rem, 3.5vw, 2.8rem);
  border-bottom: 1px solid var(--line);
}

.phase__head { align-self: start; }

.phase__head .t-mono {
  display: block;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.phase__head h3 {
  font-weight: 600;
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

/* dónde ocurre cada fase: el dato que la distingue */
.phase__where {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.phase__steps { list-style: none; }

.phase__step {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: clamp(1rem, 2.5vw, 2.4rem);
  padding-block: 0.9rem;
  align-items: baseline;
}

.phase__step + .phase__step { border-top: 1px solid var(--line); }

.phase__step h4 {
  font-weight: 560;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  line-height: 1.25;
  text-transform: uppercase;
}

.phase__step p { font-size: 0.96rem; color: #3c3c38; }

/* ------------------------------------------ anatomía de una imagen (3D) */

.anatomy__grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}

/* la imagen acompaña a la lectura de las capas, como en la sección estudio */
.anatomy__media {
  position: sticky;
  top: clamp(4rem, 12vh, 7rem);
}

.anatomy__media img { width: 100%; }

.anatomy__media figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.anatomy__lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.45;
  color: #3c3c38;
  max-width: 42ch;
  margin-bottom: clamp(1.8rem, 3vw, 2.6rem);
}

.layers { list-style: none; }

.layer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: clamp(1rem, 2vw, 1.8rem);
  row-gap: 0.35rem;
  padding-block: 1rem;
  border-top: 1px solid var(--line);
}

.layer:last-child { border-bottom: 1px solid var(--line); }

.layer__idx {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 0.2rem;
}

.layer__name {
  font-weight: 600;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.layer p {
  grid-column: 2;
  font-size: 0.95rem;
  color: #3c3c38;
  max-width: 44ch;
}

/* ficha final, en cajetín de cuatro casillas */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(3rem, 6vw, 5rem);
  border-top: 1px solid var(--ink);
}

.spec {
  padding: 1.4rem 1.4rem 0 0;
}

.spec + .spec {
  border-left: 1px solid var(--line);
  padding-left: 1.4rem;
}

.spec dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.spec dd { font-size: 0.96rem; color: #3c3c38; }

/* --------------------------------------------------------------- contacto */

.contact-methods { border-top: 1px solid var(--line); }

.contact-method {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 9fr);
  align-items: baseline;
  gap: var(--gap);
  padding-block: clamp(1.6rem, 4vw, 2.8rem);
  border-bottom: 1px solid var(--line);
}

/* el desplazamiento del hover es el mismo que el de los enlaces del pie:
   misma propiedad, misma distancia y misma duración, para que teléfono,
   móvil y email reaccionen al cursor igual que "Inicio / Servicios / …" */
.contact-method__value { transition: transform var(--dur-move) var(--ease-text); }

.contact-method__meta {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  transition: color var(--dur-hover) var(--ease-text), transform var(--dur-move) var(--ease-text);
}

.contact-method:hover .contact-method__meta,
.contact-method:hover .contact-method__value {
  transform: translateX(0.4rem);
}

.contact-method:hover .contact-method__meta { color: var(--accent); }

.contact-method__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contact-method__value {
  font-weight: 600;
  font-size: clamp(1.8rem, 5.4vw, 4.4rem);
  letter-spacing: -0.02em;
  line-height: 1.02;
}

.contact-info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(3rem, 7vw, 5rem);
}

.contact-info-item p { font-size: 1.05rem; }

.contact-info-item .footer-label { display: block; margin-bottom: 0.9rem; }

/* -------------------------------------------------------------------- 404 */

.page-404 {
  min-height: 72svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.4rem;
}

.page-404 .t-display { max-width: 12ch; }

/* ------------------------------------------------------------- animación */

.reveal {
  opacity: 0;
  transform: translateY(2.2rem);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal.is-inview {
  opacity: 1;
  transform: none;
}

.reveal-media { overflow: hidden; }

/* OJO: esta regla pisa el `transition` de cualquier imagen que además tenga
   hover propio. Si se le añade una animación a otra imagen dentro de un
   `.reveal-media`, la transición hay que declararla junta, como en
   `.work .work__media img`. */
.reveal-media img {
  clip-path: inset(0 0 100% 0);
  transition: clip-path var(--dur-reveal) var(--ease-out);
}

.reveal-media.is-inview img { clip-path: inset(0); }

/* -------------------------------------------------- transición de página */

/* La cortina vive en los pseudo-elementos de <html>: así ya está pintada
   antes de que exista el <body> y no hace falta markup en cada página.
   Sin JS la clase .is-preload no se añade nunca y esto no llega a verse.
   El movimiento es siempre ascendente: la hoja sube para tapar la página
   que se deja y sigue subiendo para descubrir la que llega. */

html::before,
html::after {
  position: fixed;
  pointer-events: none;
  visibility: hidden;
}

html::before {
  content: "";
  inset: 0;
  z-index: 200;
  background: var(--ink);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.85s var(--ease-out), visibility 0s 0.85s;
}

/* rótulo del estudio, mientras la hoja tapa la página que se deja */
html::after {
  content: "Morla — Proyectos Técnicos";
  z-index: 201;
  left: var(--pad-x);
  bottom: clamp(1.5rem, 4vh, 2.6rem);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out), visibility 0s 0.5s;
}

/* llegada: la hoja cubre y, al quitarse la clase, se retira hacia arriba */
html.is-preload::before {
  clip-path: inset(0);
  visibility: visible;
  transition: none;
}

/* salida: la hoja entra desde abajo hasta cubrir la página */
@keyframes curtain-up {
  from { clip-path: inset(100% 0 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

html.is-leaving::before {
  visibility: visible;
  animation: curtain-up 0.68s var(--ease-out) forwards;
}

html.is-leaving::after {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s var(--ease-out) 0.1s;
}

body {
  opacity: 1;
  transition: opacity 0.7s var(--ease-out) 0.12s;
}

/* en la carga inicial con secuencia (.is-intro) la página no se oculta:
   queda debajo de la portadilla, que es opaca y se retira hacia arriba */
html.is-preload:not(.is-intro) body { opacity: 0; transition: none; }

/* --------------------------------------------------- portadilla de carga */

/* Sólo en la primera carga de la sesión. Es una hoja negra a pantalla
   completa con el logo "dibujándose", un contador 000→100 y una línea de
   progreso; al terminar sube y descubre la página, en el mismo movimiento
   ascendente que la cortina de las transiciones. */

.intro {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: none;
  grid-template-rows: 1fr auto;
  gap: 2rem;
  padding: clamp(1.5rem, 4vh, 2.8rem) var(--pad-x);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  clip-path: inset(0);
  transition: clip-path 0.95s var(--ease-out);
}

html.is-intro .intro { display: grid; }

.intro__logo {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(52vw, 24rem);
}

.intro__logo img {
  width: 100%;
  filter: invert(1);
  clip-path: inset(0 100% 0 0);
  animation: intro-draw 1.15s cubic-bezier(0.66, 0.02, 0.24, 1) 0.15s forwards;
}

@keyframes intro-draw { to { clip-path: inset(0 0 0 0); } }

/* el "lápiz": una línea fina que recorre el logo al ritmo del trazo */
.intro__logo::after {
  content: "";
  position: absolute;
  top: -8%;
  bottom: -8%;
  left: 0;
  width: 1px;
  background: rgba(247, 246, 243, 0.55);
  animation: intro-pen 1.15s cubic-bezier(0.66, 0.02, 0.24, 1) 0.15s forwards;
}

@keyframes intro-pen {
  0%   { left: 0;    opacity: 0; }
  14%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

.intro__foot {
  display: grid;
  gap: clamp(0.9rem, 2vh, 1.4rem);
  animation: intro-foot-in 0.9s var(--ease-out) 0.1s backwards;
}

@keyframes intro-foot-in { from { opacity: 0; } }

/* línea de progreso: se rellena con la variable --p que escribe main.js */
.intro__bar {
  position: relative;
  height: 1px;
  background: rgba(247, 246, 243, 0.18);
}

.intro__bar i {
  position: absolute;
  inset: 0;
  background: var(--paper);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}

.intro__meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.intro__label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(247, 246, 243, 0.66);
  padding-bottom: 0.4rem;
}

.intro__count {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* salida: el contenido se adelanta hacia arriba y la hoja lo sigue */
html.is-intro-done .intro { clip-path: inset(0 0 100% 0); }

html.is-intro-done .intro__logo,
html.is-intro-done .intro__foot {
  opacity: 0;
  transform: translateY(-1.4rem);
  transition: opacity 0.45s var(--ease-out), transform 0.8s var(--ease-out);
}

/* el zoom del hero se guarda para cuando se levanta la portadilla */
html.is-intro .hero__media img { animation-play-state: paused; }
html.is-intro.is-intro-done .hero__media img { animation-play-state: running; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-media img { opacity: 1; transform: none; clip-path: none; }
  html::before, html::after { display: none !important; }
  .intro { display: none !important; }
  html.is-preload body { opacity: 1; }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .site-nav { display: none; }

  .studio { grid-template-columns: 1fr; }
  .studio__media { position: static; }

  /* sin navegación al lado, los botones de sección dejan de acompañar a un
     texto alineado a la izquierda y pasan a leerse como remate de bloque */
  .studio__text .pill,
  .process-band__side .pill {
    display: flex;
    width: fit-content;
    margin-inline: auto;
  }

  .works--featured .work:nth-child(n) {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .works--all .work:nth-child(n) {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .dept {
    grid-template-columns: clamp(5.5rem, 26vw, 8rem) minmax(0, 1fr);
    grid-template-areas:
      "media name"
      "media desc";
    align-items: start;
    column-gap: 1.2rem;
    row-gap: 0.5rem;
  }
  .dept__media { align-self: start; }
  .dept__desc { justify-self: start; max-width: none; }

  .process-band__grid { grid-template-columns: 1fr; align-items: start; }
  .steps { grid-template-columns: 1fr 1fr; }

  /* en columna, la altura mínima repartía el sobrante entre los huecos de
     cada paso: los de texto corto ("Dirección de obra") acababan con el
     doble de aire que el resto. Aquí manda el contenido y el hueco es fijo. */
  .step {
    min-height: 0;
    justify-content: flex-start;
    gap: 1.2rem;
  }

  .site-footer__grid { grid-template-columns: 1fr; padding-bottom: 0.5rem; }
  /* en móvil se cae la imagen, pero el colofón baja al final del pie */
  .site-footer__media { order: 3; }
  .site-footer__media img { display: none; }
  .site-footer__colophon { margin-top: 0; max-width: none; }

  /* la firma del estudio sube a continuación del colofón —es otra línea de
     letra pequeña, no un pie aparte— y deja el fondo del pie para el logo */
  .site-footer { display: flex; flex-direction: column; }
  .site-footer__credit {
    order: 2;
    justify-content: flex-start;
    padding-top: 0;
    padding-bottom: clamp(2.4rem, 8vw, 4rem);
  }
  .site-footer__wordmark { order: 3; }

  .service { grid-template-columns: 1fr; }
  .service:nth-child(even) .service__media { order: 0; }

  .phases__intro { grid-template-columns: 1fr; align-items: start; row-gap: 1.4rem; }
  .phase { grid-template-columns: 1fr; row-gap: 1.2rem; }
  .phase__step { grid-template-columns: minmax(0, 1fr); row-gap: 0.3rem; }

  .anatomy__grid { grid-template-columns: 1fr; }
  .anatomy__media { position: static; }
  .spec-strip { grid-template-columns: 1fr 1fr; }
  .spec:nth-child(3) {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    margin-top: 1rem;
  }

  .contact-method { grid-template-columns: 1fr; row-gap: 0.6rem; }
  .contact-info-strip { grid-template-columns: 1fr; gap: 2rem; }

  .hero__meta { flex-wrap: wrap; row-gap: 0.5rem; }
  .hero__meta .hide-m { display: none; }

  .studio__facts { grid-template-columns: 1fr 1fr; }
  .studio__fact:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); margin-top: 1rem; grid-column: 1 / -1; }
}

/* por debajo de este ancho la dirección ya no cabe en su casilla: el cajetín
   del menú se apila y se alinea todo a la izquierda */
@media (max-width: 780px) {
  .menu-overlay__bottom { grid-template-columns: minmax(0, 1fr); }
  .menu-overlay__bottom > :nth-child(2) { justify-self: start; text-align: left; }
  .menu-overlay__bottom > :nth-child(3) { justify-self: start; }
}

@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .hero__bottom { flex-direction: column; align-items: flex-start; }

  /* "seleccionados" es la palabra más larga del sitio: aquí el mínimo de
     .t-display ya no cabe entre los márgenes y la sacaba fuera de caja
     (con overflow oculto, recortada). Manda el ancho de pantalla. */
  .giant h2 { font-size: min(10vw, 3.4rem); }

  .spec-strip { grid-template-columns: 1fr; }
  .spec + .spec {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    margin-top: 1rem;
  }
}
