/* Espiral · estilos. La interfaz es la de webnou.com (src/index.css y sus componentes): mismos colores, Outfit,
   contenedor .shell, cabecera de 64 px, botones en píldora, etiquetas en mayúsculas, tarjetas con filete y la misma
   curva de animación. El único color lo ponen las capturas de los proyectos. */

@font-face {
  font-family: 'Outfit';
  src: url('/fonts/outfit-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --background: 0 0% 98%;
  --foreground: 0 0% 8%;
  --card: 0 0% 100%;
  --muted: 0 0% 94%;
  --muted-foreground: 0 0% 45%;
  --border: 0 0% 88%;

  /* Los mismos márgenes que webnou.com: 1,5rem, 3rem desde 768 px y 6rem desde 1024 px */
  --gutter: 1.5rem;
  /* Dónde empieza el contenido de .shell, para lo que va fijo en pantalla y tiene que alinearse con él */
  --edge: max(var(--gutter), calc((100vw - 80rem) / 2));
  --bar: 4rem;

  --ease-ui: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Grises «en diferencia» (ver «cabecera»): dan el gris apagado y el del filete al mezclarse con el fondo */
  --d-muted: #878787;
  --d-border: #1f1f1f;
}

@media (min-width: 768px) {
  :root {
    --gutter: 3rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --gutter: 6rem;
  }
}

/* Un muelle de verdad donde el navegador sabe dibujarlo (la estrella y las miniaturas) */
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(
      0, 0.073, 0.245, 0.46, 0.674, 0.857, 0.996, 1.087, 1.135, 1.148, 1.136, 1.11, 1.078, 1.047, 1.02, 1, 0.987,
      0.98, 0.978, 0.98, 0.984, 0.989, 0.993, 0.997, 1, 1.002, 1.003, 1.003, 1
    );
  }
}

.dark {
  --background: 0 0% 11%;
  --foreground: 0 0% 90%;
  --card: 0 0% 13%;
  --muted: 0 0% 22%;
  --muted-foreground: 0 0% 68%;
  --border: 0 0% 25%;
  --d-muted: #c9c9c9;
  --d-border: #5c5c5c;
}

/* Pieza maciza, con los colores cambiados: la entrada y el banner de contacto */
.invert {
  --background: 0 0% 8%;
  --foreground: 0 0% 98%;
  --card: 0 0% 11%;
  --muted: 0 0% 16%;
  --muted-foreground: 0 0% 64%;
  --border: 0 0% 24%;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.dark .invert {
  --background: 0 0% 90%;
  --foreground: 0 0% 11%;
  --card: 0 0% 94%;
  --muted: 0 0% 82%;
  --muted-foreground: 0 0% 36%;
  --border: 0 0% 74%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow-x: clip;
}

body[data-route='home'] {
  overflow: hidden;
  height: 100dvh;
}

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

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

ul,
ol,
dl,
dd {
  list-style: none;
  margin: 0;
  padding: 0;
}

img,
video,
svg {
  display: block;
}

:focus-visible {
  outline: 2px solid hsl(var(--foreground));
  outline-offset: 3px;
  border-radius: 4px;
}

/* Lo que diga display en estas reglas no puede ganar al atributo hidden */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* El cambio de tema se abre como un círculo desde su botón (js/ui.js) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* ---------- piezas de webnou.com ---------- */

/* Contenedor: los mismos bordes que las secciones y el pie de webnou.com */
.shell {
  width: 100%;
  max-width: calc(80rem + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Etiqueta: pequeña, en mayúsculas y espaciada */
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
}

/* Iconos de trazo */
svg[class^='i-'],
.round svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Botón principal: píldora maciza */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.3s var(--ease-ui), border-color 0.3s var(--ease-ui);
}

.btn:hover {
  background: hsl(var(--foreground) / 0.9);
}

.btn svg {
  transition: transform 0.35s var(--ease-ui);
}

.btn:hover .i-right {
  transform: translateX(4px);
}

.btn:hover .i-up-right {
  transform: translate(2px, -2px);
}

/* Botón secundario: solo el filete */
.btn-line {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground) / 0.25);
}

.btn-line:hover {
  background: transparent;
  border-color: hsl(var(--foreground) / 0.5);
}

/* Botón redondo de icono */
.round {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid hsl(var(--border));
  /* Sin desenfoque de fondo: tendría que recalcularse en cada fotograma de la espiral */
  background: hsl(var(--background) / 0.88);
  transition: border-color 0.3s var(--ease-ui);
}

.round:hover {
  border-color: hsl(var(--foreground) / 0.3);
}

/* ---------- entrada ---------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  text-align: center;
}

.intro-veil {
  position: absolute;
  inset: 0;
  display: none;
}

.intro-veil-fill {
  fill: hsl(var(--background));
}

.intro-content {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2rem;
  padding: 0 var(--gutter);
  margin-top: -4vh;
}

/* La estrella gira despacio mientras carga */
.intro-star {
  display: block;
  width: clamp(48px, 5vw, 64px);
  height: clamp(48px, 5vw, 64px);
  animation: turn 14s linear infinite;
}

.intro-star svg {
  width: 100%;
  height: 100%;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

.intro-title {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.5rem, 5.2vw, 4.5rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
  opacity: 0;
}

.intro.is-live .intro-title {
  opacity: 1;
}

/* Carga y botones comparten sitio: una sale cuando los otros entran */
.intro-gate {
  display: grid;
  place-items: center;
  min-height: 2.875rem;
}

.intro-gate > * {
  grid-area: 1 / 1;
}

.intro-loading {
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s var(--ease-ui), transform 0.45s var(--ease-ui);
}

.intro.is-ready .intro-loading {
  opacity: 0;
  transform: translateY(-10px);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.45s var(--ease-ui), transform 0.45s var(--ease-ui);
}

.intro.is-ready .intro-actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition-delay: 0.15s;
}

/* Sin proyectos: en lugar de la carga y los botones, el aviso */
.intro.is-failed .intro-gate {
  display: none;
}

.intro.is-failed .intro-star {
  animation-play-state: paused;
}

.intro-error {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
}

.intro-error p {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

.intro-error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* Al entrar: el fondo pasa a ser el velo con el hueco de la estrella, y el texto se va */
.intro.is-opening {
  background: transparent;
  pointer-events: none;
}

.intro.is-opening .intro-veil {
  display: block;
}

.intro.is-opening .intro-star {
  visibility: hidden;
}

.intro.is-opening .intro-title,
.intro.is-opening .intro-gate {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* ---------- lienzo ---------- */

#gallery {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

body:not([data-route='home']) #gallery,
body[data-view='lista'] #gallery {
  pointer-events: none;
}

/* ---------- cabecera ---------- */

/* Es la barra de webnou.com: 64 px, transparente arriba y con fondo y filete al bajar.
   Va en piezas sueltas (fondo, logo, enlaces y acciones) por una razón: el logo y los enlaces flotan sobre la
   espiral, y por debajo les pasan tarjetas claras y oscuras. Van en blanco y con mezcla «diferencia», así que
   salen siempre con el color contrario al de lo que tapan; y esa mezcla solo alcanza a lo que hay detrás si el
   elemento no está metido en otro fijo. */

.bar-bg,
.logo,
.bar-links,
.bar-actions,
.home-foot {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease-ui), visibility 0.6s;
}

body.is-entered .bar-bg,
body.is-entered .logo,
body.is-entered .bar-links,
body.is-entered .bar-actions,
body.is-entered[data-route='home'] .home-foot {
  opacity: 1;
  visibility: visible;
}

.bar-bg {
  position: fixed;
  z-index: 49;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar);
  border-bottom: 1px solid transparent;
  transition: opacity 0.6s var(--ease-ui), visibility 0.6s, background-color 0.3s var(--ease-ui), border-color 0.3s var(--ease-ui);
}

.bar-bg.is-solid,
body.menu-is-open .bar-bg {
  background: hsl(var(--background));
  border-color: hsl(var(--border));
}

.logo {
  position: fixed;
  z-index: 50;
  top: 0;
  left: var(--edge);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--bar);
  color: #fff;
  mix-blend-mode: difference;
}

.logo-star {
  width: 1.25rem;
  height: 1.25rem;
}

.logo-star svg {
  width: 100%;
  height: 100%;
  transform: rotate(var(--turn, 0deg));
  transition: transform 0.9s var(--spring);
}

.logo-name {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 300;
  letter-spacing: -0.025em;
  transition: opacity 0.3s var(--ease-ui);
}

.logo-name:hover {
  opacity: 0.7;
}

/* Enlaces: apagados, y con un filete que crece desde la izquierda */
.bar-links {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 2rem;
  height: var(--bar);
  color: var(--d-muted);
  mix-blend-mode: difference;
}

.bar-links a {
  position: relative;
  transition: color 0.3s var(--ease-ui);
}

.bar-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: 0;
  height: 1px;
  background: #fff;
  transition: width 0.3s var(--ease-ui);
}

.bar-links a:hover,
.bar-links a[aria-current] {
  color: #fff;
}

.bar-links a:hover::after,
.bar-links a[aria-current]::after {
  width: 100%;
}

.bar-actions {
  position: fixed;
  z-index: 50;
  top: 0;
  right: var(--edge);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--bar);
}

.bar-cta {
  display: none;
  margin-left: 0.25rem;
}

/* Sol en claro, luna en oscuro */
.i-moon,
.dark .i-sun {
  display: none;
}

.dark .i-moon {
  display: block;
}

#sound[aria-pressed='true'] .sound-cross,
#sound[aria-pressed='false'] .sound-waves {
  display: none;
}

/* Tres rayas que se cruzan en aspa */
.burger {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
}

.burger span {
  position: absolute;
  left: 0.625rem;
  width: 1.25rem;
  height: 2px;
  background: hsl(var(--foreground));
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, top 0.3s ease-in-out;
}

.burger span:nth-child(1) {
  top: 0.625rem;
}

.burger span:nth-child(2) {
  top: 1.125rem;
}

.burger span:nth-child(3) {
  top: 1.625rem;
}

.burger[aria-expanded='true'] span:nth-child(1) {
  top: 1.125rem;
  transform: rotate(45deg);
}

.burger[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}

.burger[aria-expanded='true'] span:nth-child(3) {
  top: 1.125rem;
  transform: rotate(-45deg);
}

@media (min-width: 1024px) {
  .bar-links {
    display: flex;
  }

  .bar-cta {
    display: inline-flex;
  }

  .burger {
    display: none;
  }
}

/* ---------- menú de pantallas estrechas ---------- */

/* Enlaces grandes alineados a la izquierda, numerados y con filete; abajo, la propuesta y el correo */
.menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: hsl(var(--background));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s var(--ease-ui), visibility 0.45s var(--ease-ui);
}

.menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.menu-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-top: 5rem;
  padding-bottom: 2rem;
}

/* Entrada escalonada: 0,45 s con la curva de interfaz, 40 ms entre cada elemento */
.menu-links li,
.menu-foot {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s var(--ease-ui), transform 0.45s var(--ease-ui);
}

.menu.is-open .menu-links li,
.menu.is-open .menu-foot {
  opacity: 1;
  transform: none;
}

.menu.is-open .menu-links li:nth-child(2) {
  transition-delay: 40ms;
}

.menu.is-open .menu-links li:nth-child(3) {
  transition-delay: 80ms;
}

.menu.is-open .menu-foot {
  transition-delay: 120ms;
}

.menu-links li {
  border-bottom: 1px solid hsl(var(--border));
}

.menu-links li:last-child {
  border-bottom: 0;
}

.menu-links a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0;
  color: hsl(var(--foreground) / 0.6);
}

.menu-links a[aria-current],
.menu-links a:active {
  color: hsl(var(--foreground));
}

.menu-num {
  width: 1.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.menu-label {
  flex: 1;
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.025em;
}

.menu-links svg {
  width: 1.25rem;
  height: 1.25rem;
  opacity: 0.4;
}

.menu-links a[aria-current] svg {
  opacity: 1;
}

.menu-foot {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: auto;
  padding-top: 2.5rem;
}

.btn-wide {
  justify-content: space-between;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  line-height: 1.5rem;
}

.btn-wide svg {
  width: 1.25rem;
  height: 1.25rem;
}

.menu-email {
  align-self: flex-start;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: hsl(var(--border));
}

/* ---------- pie del inicio: etiqueta, vistas y pista ---------- */

/* Como el logo, va sobre la espiral: todo él en «diferencia» */
.home-foot {
  position: fixed;
  z-index: 24;
  left: var(--edge);
  right: var(--edge);
  bottom: 1.75rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  pointer-events: none;
  mix-blend-mode: difference;
}

.home-foot .eyebrow {
  color: var(--d-muted);
}

.home-foot-left {
  display: grid;
  gap: 0.875rem;
}

/* Las dos vistas, como los filtros de /proyectos: píldoras con filete; la activa, maciza */
.filters {
  display: flex;
  gap: 0.625rem;
  pointer-events: auto;
}

.filters button {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--d-border);
  color: var(--d-muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: background-color 0.3s var(--ease-ui), border-color 0.3s var(--ease-ui), color 0.3s var(--ease-ui);
}

.filters button:hover {
  border-color: var(--d-muted);
}

.filters button[aria-pressed='true'] {
  background: #fff;
  border-color: #fff;
  color: #000;
}

.hint {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s var(--ease-ui), transform 0.45s var(--ease-ui);
}

.hint.is-on {
  opacity: 1;
  transform: none;
}

body[data-view='lista'] .hint {
  opacity: 0;
}

/* ---------- chip de la tarjeta ---------- */

/* Una tarjeta pequeña: miniatura, nombre y subtítulo, como el pie de las tarjetas de proyecto */
.chip {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.5rem 1.125rem 0.5rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  box-shadow: 0 20px 50px -24px hsl(0 0% 0% / 0.35);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s var(--ease-ui), transform 0.45s var(--ease-ui);
}

.chip.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chip-thumb {
  width: 4.5rem;
  aspect-ratio: 16 / 10;
  border-radius: 0.5rem;
  overflow: hidden;
  background: hsl(var(--muted));
}

.chip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chip-text {
  display: grid;
}

.chip-title {
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 300;
  letter-spacing: -0.025em;
}

.chip-tagline {
  font-size: 0.8125rem;
  line-height: 1.125rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- etiqueta del cursor ---------- */

/* Como la flecha de las tarjetas de proyecto: oscura, translúcida y con filete claro */
.cursor-tag {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  pointer-events: none;
}

.cursor-tag span {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.2);
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.25rem;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -140%) scale(0.85);
  transition: transform 0.35s var(--ease-ui), opacity 0.2s ease;
}

.cursor-tag b {
  font-weight: 500;
}

.cursor-tag.is-on span {
  opacity: 1;
  transform: translate(-50%, -140%) scale(1);
}

/* ---------- lista de proyectos ---------- */

.list {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  padding: 6rem 0 9rem;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s 0.5s;
}

.list.is-on {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

body:not([data-route='home']) .list {
  pointer-events: none;
}

.list li {
  position: relative;
  z-index: 1;
}

/* Al irse: rápido, la fila de arriba primero */
.list-row {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.22s ease, transform 0.3s ease;
  transition-delay: calc(var(--i) * 18ms);
}

/* Al llegar: en cascada, 40 ms entre fila y fila */
.list.is-on .list-row {
  opacity: 1;
  transform: none;
  transition: opacity 0.45s var(--ease-ui), transform 0.7s var(--ease-ui);
  transition-delay: calc(0.12s + var(--i) * 40ms);
}

/* Los filetes llevan el mismo compás: se dibujan desde la izquierda al llegar y se recogen hacia la derecha */
.list-rule {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: hsl(var(--border));
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.3s ease;
  transition-delay: calc(var(--i) * 18ms);
}

.list-rule-end {
  top: auto;
  bottom: 0;
  transition-delay: calc((var(--i) + 1) * 18ms);
}

.list.is-on .list-rule {
  transform: none;
  transform-origin: left center;
  transition: transform 1s var(--ease-ui);
  transition-delay: calc(0.08s + var(--i) * 40ms);
}

.list.is-on .list-rule-end {
  transition-delay: calc(0.08s + (var(--i) + 1) * 40ms);
}

/* Al pasar por una fila se entintan los dos filetes que la enmarcan */
.list-rule::after {
  content: '';
  position: absolute;
  inset: 0;
  background: hsl(var(--foreground));
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.45s var(--ease-ui);
}

.list li:hover > .list-rule::after,
.list li:focus-within > .list-rule::after,
.list li:hover + li > .list-rule:not(.list-rule-end)::after,
.list li:focus-within + li > .list-rule:not(.list-rule-end)::after {
  transform: none;
  transform-origin: left center;
  transition-duration: 0.6s;
}

/* El título bajo el cursor queda por encima de la miniatura; los demás, por debajo */
.list li:hover {
  z-index: 3;
}

/* Fila: número, nombre fino, categoría y flecha, como los enlaces del menú de webnou.com */
.list a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0;
  transition: opacity 0.3s var(--ease-ui);
}

.list-num {
  width: 1.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.list-title {
  flex: 1;
  font-size: clamp(2.25rem, 5vw, 4.5rem);
  line-height: 1.05;
  font-weight: 300;
  letter-spacing: -0.025em;
}

.list-meta {
  display: none;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.list a svg {
  width: 1.25rem;
  height: 1.25rem;
  opacity: 0.4;
  transition: opacity 0.3s var(--ease-ui), transform 0.35s var(--ease-ui);
}

.list ol:hover a {
  opacity: 0.4;
}

.list ol a:hover,
.list ol a:focus-visible {
  opacity: 1;
}

.list a:hover svg {
  opacity: 1;
  transform: translate(2px, -2px);
}

@media (min-width: 768px) {
  .list-meta {
    display: block;
  }
}

.preview {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  width: min(340px, 30vw);
  aspect-ratio: 16 / 10;
  pointer-events: none;
  /* Al salir de los títulos: el montón se encoge y se desvanece */
  opacity: 0;
  scale: 0.66;
  transition: opacity 0.3s var(--ease-ui), scale 0.3s var(--ease-ui);
}

.preview.is-on {
  opacity: 1;
  scale: 1;
}

/* Cada miniatura crece desde cero, encima de la anterior */
.preview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  box-shadow: 0 24px 60px -20px hsl(0 0% 0% / 0.45);
  animation: preview-zoom 0.5s var(--ease-out-expo) both;
}

@keyframes preview-zoom {
  from {
    opacity: 0;
    transform: scale(0);
  }
}

@media (hover: none) {
  .preview,
  .cursor-tag,
  .chip,
  .hint {
    display: none;
  }
}

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

#view {
  position: relative;
  z-index: 10;
  outline: none;
}

.page {
  background: hsl(var(--background));
  transition: opacity 0.38s ease;
}

.page.is-leaving {
  opacity: 0;
}

/* Lo que entra al llegar a pantalla: sube un poco y aparece, en cascada */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-ui), transform 0.9s var(--ease-ui);
}

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

/* palabras que suben desde detrás de una máscara, una línea tras otra */

.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}

.split-word > span {
  display: inline-block;
  transform: translateY(118%);
  transition: transform 1s var(--ease-out-expo);
  transition-delay: calc(0.1s + var(--line, 0) * 90ms);
}

.is-in .split-word > span,
.is-live .split-word > span {
  transform: none;
}

/* ---------- proyecto ---------- */

/* La misma estructura que la ficha de webnou.com: vuelta atrás, etiqueta, título, resumen y botón; portada;
   datos en cuatro columnas y galería a dos. */
.project {
  padding-top: 6rem;
}

/* La ficha entera entra con zoom: empieza algo pequeña y transparente, y crece hasta su sitio */
.project-body {
  opacity: 0;
  transform: translateY(4vh) scale(0.94);
  transform-origin: 50% 40vh;
  transition: transform 1s var(--ease-out-expo), opacity 0.5s ease;
}

.project.is-in .project-body {
  opacity: 1;
  transform: none;
}

/* Al irse, se aleja alrededor de lo que haya en pantalla */
.project.is-leaving .project-body {
  opacity: 0;
  transform: scale(0.96);
  transition: transform 0.4s ease, opacity 0.3s ease;
}

.project-head {
  margin-bottom: 2.5rem;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  transition: color 0.3s var(--ease-ui);
}

.back:hover {
  color: hsl(var(--foreground));
}

.project-head-row {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-head-text {
  max-width: 48rem;
}

.project-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-bottom: 1rem;
}

.project-labels i {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background: hsl(var(--muted-foreground) / 0.6);
}

.project-title {
  margin: 0;
  font-size: 3rem;
  line-height: 1;
  font-weight: 300;
  letter-spacing: -0.025em;
}

.project-lead {
  margin: 1.25rem 0 0;
  font-size: 1.125rem;
  line-height: 1.625;
  color: hsl(var(--muted-foreground));
  text-wrap: balance;
}

.project-cta {
  align-self: flex-start;
  flex: none;
}

.hero {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out-expo);
}

.hero:hover img {
  transform: scale(1.03);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem 1.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid hsl(var(--border));
}

.facts dd {
  margin-top: 0.75rem;
}

.facts .fact-note {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.facts ul {
  display: grid;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.fact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: hsl(var(--border));
  transition: text-decoration-color 0.3s var(--ease-ui);
}

.fact-links a:hover {
  text-decoration-color: hsl(var(--foreground));
}

.fact-links svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* Galería: la primera captura a todo lo ancho y el resto a dos columnas */
.frames {
  display: grid;
  gap: 1rem;
  padding: 4rem 0;
}

.frame {
  margin: 0;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
}

.frame img {
  width: 100%;
  height: auto;
}

@media (min-width: 768px) {
  .project {
    padding-top: 8rem;
  }

  .project-head {
    margin-bottom: 3rem;
  }

  .project-head-row {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3rem;
  }

  .project-title {
    font-size: 3.75rem;
  }

  .project-lead {
    font-size: 1.25rem;
  }

  .project-cta {
    align-self: flex-end;
  }

  .hero {
    aspect-ratio: 16 / 9;
    border-radius: 1.5rem;
  }

  .facts {
    padding: 2.5rem 0;
  }

  .frames {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    padding: 6rem 0;
  }

  .frame:first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .project-title {
    font-size: 4.5rem;
  }

  .facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* proyecto siguiente: se llega con solo seguir bajando */

.next {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1.5rem;
  min-height: 100dvh;
  padding: 6rem var(--gutter);
  border-top: 1px solid hsl(var(--border));
}

.next-card {
  position: relative;
  width: min(35rem, 100%);
  aspect-ratio: 16 / 10;
  transform: scale(calc(1 + var(--pull, 0) * 0.1));
  transition: transform 0.6s var(--ease-ui);
}

.next-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
}

/* Dos etiquetas en las esquinas, con el aspecto de los filtros */
.sticker-tag {
  position: absolute;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--foreground));
  font-size: 0.875rem;
  line-height: 1.25rem;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s var(--ease-ui), transform 0.45s var(--ease-ui);
}

.tag-a {
  top: -1rem;
  right: -1rem;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.tag-b {
  bottom: -1rem;
  left: -1rem;
  background: hsl(var(--background));
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.next.is-in .sticker-tag {
  opacity: 1;
  transform: none;
}

.next.is-in .tag-a {
  transition-delay: 0.3s;
}

.next.is-in .tag-b {
  transition-delay: 0.42s;
}

.next-title {
  margin: 0.5rem 0 0;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 300;
  letter-spacing: -0.025em;
}

.next-bar {
  position: absolute;
  top: 50%;
  right: var(--gutter);
  width: 2px;
  height: 34vh;
  transform: translateY(-50%);
  overflow: hidden;
  border-radius: 2px;
  background: hsl(var(--border));
}

.next-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: hsl(var(--foreground));
  transform: scaleY(0);
  transform-origin: top;
}

/* ---------- sobre mí ---------- */

.about {
  opacity: 0;
}

.about.is-in {
  opacity: 1;
  transition: opacity 0.7s ease;
}

.about.is-leaving {
  opacity: 0;
  transition: opacity 0.38s ease;
}

/* Una sección alta con una pantalla fija dentro: al recorrerla, el texto se enciende palabra a palabra */
.about-pin {
  height: calc(100dvh + 1400px);
}

.about-stick {
  position: sticky;
  top: 0;
  display: grid;
  align-items: center;
  height: 100dvh;
}

.about-inner {
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  text-align: center;
}

.about-text {
  max-width: 64rem;
  margin: 0;
  font-size: clamp(1.75rem, 3.6vw, 3.5rem);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.about-word {
  opacity: 0.2;
  transition: opacity 0.35s var(--ease-ui);
}

.about-word.is-lit {
  opacity: 1;
}

.about-star {
  display: inline-block;
  width: 0.56em;
  height: 0.56em;
  margin: 0 0.1em;
  vertical-align: -0.02em;
  transform: scale(0) rotate(-120deg);
  transition: transform 0.8s var(--spring);
}

.about-star.is-lit {
  transform: none;
}

.strip {
  overflow: clip;
  padding: 2rem 0 6rem;
}

.strip-track {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: max-content;
  will-change: transform;
}

/* Tarjetas de proyecto: esquinas de 16 px y filete, y la imagen se acerca un poco al pasar */
.strip-card {
  width: clamp(240px, 31vw, 480px);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  transition: border-color 0.3s var(--ease-ui);
}

.strip-card:nth-child(even) {
  width: clamp(180px, 21vw, 340px);
}

.strip-card:hover {
  border-color: hsl(var(--foreground) / 0.2);
}

.strip-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out-expo);
}

.strip-card:hover img {
  transform: scale(1.03);
}

/* Banner de contacto, como el que cierra las páginas de webnou.com */
.cta {
  display: grid;
  gap: 2rem;
  padding: 2rem;
  border-radius: 1rem;
}

.cta h2 {
  margin: 0;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 300;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.cta-text p {
  max-width: 36rem;
  margin: 1.25rem 0 0;
  line-height: 1.625;
  color: hsl(var(--foreground) / 0.7);
}

.cta-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.cta-note {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  color: hsl(var(--foreground) / 0.5);
  text-wrap: balance;
}

@media (min-width: 768px) {
  .cta {
    padding: 3rem;
  }

  .cta h2 {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}

@media (min-width: 1024px) {
  .cta {
    grid-template-columns: 7fr 5fr;
    align-items: end;
    gap: 3rem;
    padding: 4rem;
  }

  .cta h2 {
    font-size: 3rem;
    line-height: 1;
  }

  .cta-side {
    align-items: flex-end;
  }

  .cta-note {
    text-align: right;
  }
}

/* Pie: un filete y, debajo, el © y los enlaces en pequeño */
.foot {
  margin-top: 6rem;
  border-top: 1px solid hsl(var(--border));
}

.foot-row {
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
  padding-block: 1rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: hsl(var(--muted-foreground));
}

.foot-row p {
  margin: 0;
}

.foot-row ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.foot-row a {
  transition: color 0.3s var(--ease-ui);
}

.foot-row a:hover {
  color: hsl(var(--foreground));
}

@media (min-width: 768px) {
  .foot-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ---------- sin JavaScript y página no encontrada ---------- */

.noscript,
.lost {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: var(--gutter);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  text-align: center;
}

.noscript p {
  max-width: 32ch;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 300;
}

.noscript a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lost > svg {
  width: 3rem;
  height: 3rem;
}

.lost h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1;
}

.lost p {
  max-width: 36ch;
  margin: 0 0 0.5rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- pantallas pequeñas ---------- */

@media (max-width: 767px) {
  .home-eyebrow {
    display: none;
  }

  .about-pin {
    height: calc(100dvh + 1000px);
  }

  .tag-a {
    right: -0.5rem;
  }

  .tag-b {
    left: -0.5rem;
  }
}

/* ---------- sin movimiento ---------- */

/* Lo pide el sistema («reducir movimiento») o la dirección (?motion=none): lo decide js/theme.js */
.motion-none *,
.motion-none *::before,
.motion-none *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  transition-delay: 0s !important;
}
