/* ==================================================================
   Andreu Sureda | Portfolio
   Sistema visual: negros calidos, piedra y hierro + un unico acento brasa.
   Esquinas rectas en todo el sitio (sin border-radius).

   Escala de z-index:
     0   escena 3D / fondos
     1   contenido
     40  indice sticky del breakdown (movil)
     50  navegacion
     60  grano (pointer-events: none)
     el visor usa <dialog> (top layer), no necesita z-index
   ================================================================== */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("../fonts/big-shoulders-display-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0d0b0a;
  --bg-raised: #151210;
  --bg-sunk: #080706;
  --iron: #221d1a;
  --line: rgb(236 226 212 / 0.1);
  --line-strong: rgb(236 226 212 / 0.22);

  --text: #ece5db;
  --text-2: #b9b0a5;
  --text-3: #8d857b;

  --ember: #ef7d33;
  --ember-hi: #ffa25a;
  --ember-ink: #140d08;

  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1440px;
  --nav-h: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: inherit; line-height: 1.05; }
::selection { background: var(--ember); color: var(--ember-ink); }

/* Foco visible y consistente en todo el sitio */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ember-hi);
  outline-offset: 3px;
}

.icon { width: 1.15em; height: 1.15em; flex: none; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 70;
  padding: 0.75rem 1rem;
  background: var(--ember);
  color: var(--ember-ink);
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Grano de pelicula: fijo y sin eventos, nunca en contenedores con scroll */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Mientras se aplica el ingles guardado, evitamos el parpadeo del espanol */
html[data-lang-pending] main,
html[data-lang-pending] .nav__links,
html[data-lang-pending] footer { visibility: hidden; }

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: clamp(5rem, 10vw, 9rem); }

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ember);
}

.h-display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 0.88;
}
.h-section { font-size: clamp(3rem, 1.6rem + 6vw, 7.5rem); }

.lead {
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.375rem);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 62ch;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0 1.35rem;
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn .icon { transition: transform 0.35s var(--ease); }
.btn:hover .icon--nudge { transform: translateX(3px); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary { background: var(--ember); border-color: var(--ember); color: var(--ember-ink); }
.btn--primary:hover { background: var(--ember-hi); border-color: var(--ember-hi); }
.btn--ghost {
  background: rgb(13 11 10 / 0.55);
  border-color: var(--line-strong);
  color: var(--text);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.btn--ghost:hover { border-color: var(--ember); color: var(--ember-hi); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-2);
  transition: color 0.2s var(--ease);
}
.text-link:hover { color: var(--ember-hi); }

/* ---------- Navegacion ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-solid {
  background: rgb(13 11 10 / 0.86);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav__links {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
  font-size: 0.9375rem;
  color: var(--text-2);
}
.nav__links a { position: relative; padding-block: 0.5rem; transition: color 0.2s var(--ease); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.15rem;
  height: 1px;
  background: var(--ember);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { transform: scaleX(1); }

.nav__tools { display: flex; align-items: center; gap: 0.25rem; }
.icon-link {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  color: var(--text-2);
  transition: color 0.2s var(--ease);
}
.icon-link:hover { color: var(--ember-hi); }
.icon-link .icon { width: 20px; height: 20px; }
@media (max-width: 1099px) { .icon-link--extra { display: none; } }

.lang {
  display: inline-flex;
  margin-left: 0.5rem;
  border: 1px solid var(--line-strong);
}
.lang button {
  min-width: 40px;
  height: 32px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.nav__toggle {
  display: none;
  height: 40px;
  padding: 0 0.75rem;
  margin-left: 0.25rem;
  border: 1px solid var(--line-strong);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 899px) {
  .nav__inner { gap: 0.5rem; }
  .nav__tools { margin-left: auto; }
  .nav__toggle { display: inline-flex; align-items: center; }
  .nav__links {
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem var(--gutter) 1.25rem;
    background: rgb(13 11 10 / 0.97);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s linear 0.3s;
  }
  .nav__links a { padding-block: 0.6rem; }
  .nav__links a::after { display: none; }
  .nav.is-open { background: rgb(13 11 10 / 0.97); }
  .nav.is-open .nav__links {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }
}
@media (max-width: 420px) {
  .nav__brand { font-size: 1.125rem; }
  .icon-link { width: 36px; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  /* El contenido se ancla abajo: la mitad superior es de la escena (campana) */
  align-items: end;
  padding-top: calc(var(--nav-h) + clamp(1.5rem, 4vw, 3rem));
  padding-bottom: clamp(2rem, 5vw, 4rem);
  overflow: hidden;
}
.hero__scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}
/* Fallback estatico: visible siempre debajo; el canvas aparece encima al cargar */
.hero__fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 62% 18%, rgb(239 125 51 / 0.18), transparent 70%),
    radial-gradient(40% 40% at 15% 100%, rgb(239 125 51 / 0.1), transparent 70%),
    linear-gradient(180deg, rgb(13 11 10 / 0.55), var(--bg) 92%),
    url("../media/web/demons-bell/blocking/Belfry/Belfry_06-800.jpg") center 40% / cover no-repeat;
  filter: grayscale(0.6) brightness(0.55) sepia(0.25);
}
.hero__scene canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 1.6s var(--ease);
}
.hero__scene.is-ready canvas { opacity: 1; }
/* Velo para asegurar contraste del texto sobre la escena */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(13 11 10 / 0.72) 0%, rgb(13 11 10 / 0.35) 40%, transparent 65%),
    linear-gradient(0deg, var(--bg) 0%, transparent 22%);
}

.hero__inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(1rem, 2.5vw, 2.5rem);
  row-gap: 2.5rem;
  align-items: end;
}
.hero__copy { grid-column: 1 / span 5; }
.hero__media { grid-column: 7 / -1; }
@media (min-width: 900px) and (max-width: 1199px) {
  .hero__copy { grid-column: 1 / span 6; }
  .hero__media { grid-column: 7 / -1; }
}

.hero__title {
  margin-top: 1.1rem;
  font-size: clamp(4rem, 1.2rem + 7.6vw, 9rem);
}
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero__title .line > span { display: block; }
.hero__lede {
  margin-top: 1.5rem;
  max-width: 40ch;
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.55;
  color: var(--text-2);
}
.hero__ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero__social { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 1.75rem; font-size: 0.9375rem; }

/* Imagen destacada enmarcada: escuadras de laton en las esquinas */
.plate {
  position: relative;
  transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s var(--ease);
}
.plate::before {
  content: "";
  position: absolute;
  inset: -10px;
  pointer-events: none;
  --c: var(--ember);
  background:
    linear-gradient(var(--c), var(--c)) top left / 26px 1px,
    linear-gradient(var(--c), var(--c)) top left / 1px 26px,
    linear-gradient(var(--c), var(--c)) top right / 26px 1px,
    linear-gradient(var(--c), var(--c)) top right / 1px 26px,
    linear-gradient(var(--c), var(--c)) bottom left / 26px 1px,
    linear-gradient(var(--c), var(--c)) bottom left / 1px 26px,
    linear-gradient(var(--c), var(--c)) bottom right / 26px 1px,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 26px;
  background-repeat: no-repeat;
  opacity: 0.85;
}
.plate__link {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--bg-sunk);
  box-shadow: 0 40px 80px -30px rgb(0 0 0 / 0.7), 0 0 0 1px var(--line);
  cursor: zoom-in;
}
.plate__link img {
  width: 100%;
  aspect-ratio: 2560 / 1360;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}
.plate__link:hover img { transform: scale(1.025); }
/* Luz calida que "cae" desde la campana sobre la imagen */
.plate__link::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(70% 55% at 20% 0%, rgb(255 140 60 / 0.16), transparent 70%);
  mix-blend-mode: screen;
}
.plate__cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  font-size: 0.875rem;
  color: var(--text-3);
}
.plate__cap strong { color: var(--text-2); font-weight: 500; }

@media (max-width: 899px) {
  .hero { align-items: start; }
  .hero__copy, .hero__media { grid-column: 1 / -1; }
  .hero::after {
    background:
      linear-gradient(180deg, rgb(13 11 10 / 0.6) 0%, rgb(13 11 10 / 0.35) 55%, var(--bg) 100%);
  }
  .hero__title { font-size: clamp(3.5rem, 17vw, 6rem); }
  .hero__lede { margin-top: 1rem; }
  .hero__ctas { margin-top: 1.5rem; }
  .hero__ctas .btn { flex: 1 1 auto; }
  .hero__social { margin-top: 1.25rem; gap: 0.6rem 1rem; }
  .plate::before { inset: -6px; }
  .plate__cap .plate__more { display: none; }
}

/* Entrada del hero (solo si el usuario acepta movimiento) */
@media (prefers-reduced-motion: no-preference) {
  .js .hero__title .line > span { animation: rise 1.1s var(--ease) both; }
  .js .hero__title .line:nth-child(2) > span { animation-delay: 0.08s; }
  .js .hero .eyebrow,
  .js .hero__lede,
  .js .hero__ctas,
  .js .hero__social { animation: fade-up 1s var(--ease) both; }
  .js .hero__lede { animation-delay: 0.18s; }
  .js .hero__ctas { animation-delay: 0.26s; }
  .js .hero__social { animation-delay: 0.32s; }
  .js .hero__media { animation: settle 1.4s var(--ease) both 0.1s; }
}
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
/* "translate" (no "transform") para no pisar el tilt 3D de .plate */
@keyframes settle { from { translate: 0 24px; } to { translate: 0 0; } }

/* ---------- Reveal on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms);
  }
  .js .reveal.is-in { opacity: 1; transform: none; }
}

/* ---------- Demon's Bell ---------- */
.db { padding-top: clamp(4rem, 8vw, 7rem); }
.db__head { display: grid; gap: 1.25rem; }
.db__title { font-size: clamp(3.75rem, 1rem + 10vw, 11rem); margin-top: 0.25rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags li {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line-strong);
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.3;
}

.db__cover {
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.db__cover a {
  display: block;
  overflow: hidden;
  background: var(--bg-sunk);
  cursor: zoom-in;
}
.db__cover img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  object-position: center 40%;
  transition: transform 1.4s var(--ease);
}
.db__cover a:hover img { transform: scale(1.02); }
.db__cover figcaption { margin-top: 0.75rem; font-size: 0.875rem; color: var(--text-3); }
@media (max-width: 699px) { .db__cover img { aspect-ratio: 2560 / 1360; } }

/* Ficha tecnica */
.spec {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line-strong);
}
.spec > div { padding: 1.25rem 1.25rem 0 0; }
.spec > div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.spec dt {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.spec dd {
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 1.1rem + 0.8vw, 1.875rem);
  font-weight: 700;
  line-height: 1.05;
  text-transform: uppercase;
}
@media (max-width: 899px) {
  .spec { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1.25rem; }
  .spec > div, .spec > div + div { padding: 1rem 1rem 0 0; border-left: 0; }
  .spec > div:last-child { grid-column: 1 / -1; }
}

/* Breakdown: indice sticky + contenido */
.breakdown {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  margin-top: clamp(3rem, 7vw, 6rem);
}
.bd-index { position: relative; }
.bd-index ol {
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
  display: grid;
  gap: 0.15rem;
  border-left: 1px solid var(--line);
}
.bd-index a {
  display: block;
  padding: 0.45rem 0 0.45rem 1rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 0.9375rem;
  color: var(--text-3);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.bd-index a:hover { color: var(--text); }
.bd-index a[aria-current="true"] { color: var(--text); border-left-color: var(--ember); }
.bd-index .is-sub a { padding-left: 1.85rem; font-size: 0.875rem; }

.bd-sec { padding-bottom: clamp(4rem, 8vw, 7rem); scroll-margin-top: calc(var(--nav-h) + 24px); }
.bd-sec:last-child { padding-bottom: 0; }
.bd-sec__title { font-size: clamp(2.25rem, 1.4rem + 3vw, 4rem); }
.bd-sec__text { margin-top: 1rem; max-width: 62ch; color: var(--text-2); }
.bd-sec .gallery { margin-top: 2rem; }
.bd-overview p {
  font-size: clamp(1.1875rem, 1rem + 0.7vw, 1.625rem);
  line-height: 1.5;
  color: var(--text);
  max-width: 34em;
}
.bd-overview p + p { margin-top: 1.25rem; color: var(--text-2); font-size: 1.0625rem; }

@media (max-width: 899px) {
  .breakdown { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .bd-index {
    position: sticky;
    top: var(--nav-h);
    z-index: 40;
    margin-inline: calc(var(--gutter) * -1);
    background: rgb(13 11 10 / 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .bd-index ol {
    position: static;
    display: flex;
    gap: 0.25rem;
    padding: 0.6rem var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    border-left: 0;
  }
  .bd-index ol::-webkit-scrollbar { display: none; }
  .bd-index li { scroll-snap-align: start; flex: none; }
  .bd-index a {
    padding: 0.4rem 0.8rem;
    margin: 0;
    border: 1px solid transparent;
    font-size: 0.875rem;
    white-space: nowrap;
  }
  .bd-index a[aria-current="true"] { border-color: var(--ember); }
  .bd-index .is-sub a { padding-left: 0.8rem; }
  .bd-sec { padding-top: 3rem; padding-bottom: 1rem; scroll-margin-top: calc(var(--nav-h) + 56px); }
}

/* ---------- Galerias ---------- */
.gallery { display: grid; gap: clamp(8px, 1vw, 14px); }
.g-fig { min-width: 0; }
.g-item {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--bg-sunk);
  cursor: zoom-in;
}
.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), opacity 0.4s var(--ease);
}
.g-item:hover img { transform: scale(1.035); }
.g-fig figcaption { margin-top: 0.6rem; font-size: 0.875rem; color: var(--text-3); line-height: 1.4; }
.g-fig figcaption b { color: var(--text-2); font-weight: 500; }

/* Imagen que no se encuentra en local: placeholder legible en vez de icono roto */
.img-missing { position: relative; }
.img-missing img { opacity: 0; }
.img-missing::after {
  content: attr(data-missing);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-3);
  background: repeating-linear-gradient(135deg, var(--bg-sunk) 0 10px, var(--bg-raised) 10px 20px);
}

/* Zonas del blocking: plano de apertura a todo el ancho + filas de 3 */
.bd-zone { scroll-margin-top: calc(var(--nav-h) + 24px); }
.bd-sec__text + .bd-zone { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.bd-zone + .bd-zone { margin-top: clamp(3.5rem, 7vw, 5.5rem); }
.bd-zone__title { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.75rem); }
.bd-zone__text { margin-top: 0.6rem; max-width: 60ch; color: var(--text-2); }
.bd-zone .gallery { margin-top: 1.5rem; }
.gallery--zone { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery--zone .g-item { aspect-ratio: 2560 / 1360; }
.gallery--zone .g-fig:first-child { grid-column: 1 / -1; }
@media (max-width: 699px) {
  .gallery--zone { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery--zone .g-fig:last-child:nth-child(even) { grid-column: 1 / -1; }
}

/* Materiales: cuadricula 3x3 (todas las capturas comparten encuadre 16:9) */
.gallery--swatch { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery--swatch .g-item { aspect-ratio: 16 / 9; }

/* Doble vista de materiales: resultado en UE5 / escultura en ZBrush */
.view-toggle {
  display: inline-flex;
  margin-top: 1.5rem;
  border: 1px solid var(--line-strong);
}
.view-toggle button {
  min-height: 40px;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.view-toggle + .gallery { margin-top: 1.25rem; }
.g-swap { position: relative; }
.g-swap .g-item + .g-item { position: absolute; inset: 0; }
.g-item[data-variant="zbrush"] {
  background: #050404;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0s linear 0.5s;
}
[data-view="zbrush"] .g-item[data-variant="zbrush"] {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s var(--ease);
}
@media (max-width: 699px) {
  .gallery--swatch {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
    scrollbar-width: thin;
  }
  .gallery--swatch .g-fig { flex: 0 0 82%; scroll-snap-align: start; }
}

/* Mesh trims: pareja amplia */
.gallery--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery--pair .g-item { aspect-ratio: 16 / 9; background: #050404; }
.gallery--pair .g-item img { object-fit: contain; }
@media (max-width: 599px) { .gallery--pair { grid-template-columns: minmax(0, 1fr); } }

/* Galeria generica de las paginas de proyecto */
.gallery--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery--grid .g-item { aspect-ratio: 16 / 9; }
.gallery--grid .g-fig:first-child:nth-last-child(odd),
.gallery--grid .g-fig.is-wide { grid-column: 1 / -1; }
@media (max-width: 599px) { .gallery--grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Video (fachada ligera de YouTube) ---------- */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-sunk);
  overflow: hidden;
  margin-top: 2rem;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__btn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  cursor: pointer;
}
.video__btn img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) saturate(0.85);
  transition: filter 0.4s var(--ease), transform 1s var(--ease);
}
.video__btn:hover img { filter: brightness(0.85) saturate(1); transform: scale(1.02); }
.video__play {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.4rem;
  background: var(--ember);
  color: var(--ember-ink);
  font-weight: 600;
  transition: background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.video__btn:hover .video__play { background: var(--ember-hi); }
.video__btn:active .video__play { transform: scale(0.98); }
.video--empty {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  color: var(--text-3);
  text-align: center;
  padding: 2rem;
}

/* ---------- Proyectos ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(2.5rem, 4vw, 3.5rem) clamp(1rem, 2.5vw, 2rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.card { grid-column: span 7; display: flex; flex-direction: column; }
.card:nth-child(4n + 2), .card:nth-child(4n + 3) { grid-column: span 5; }
.card__media {
  position: relative;
  height: clamp(240px, 30vw, 440px);
  overflow: hidden;
  background: var(--bg-sunk);
  box-shadow: 0 0 0 1px var(--line);
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.85);
}
.card__body { padding-top: 1.25rem; display: grid; gap: 0.75rem; }
.card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.875rem, 1.4rem + 1.4vw, 2.75rem);
  text-transform: uppercase;
  line-height: 0.95;
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
}
.card__title .icon { width: 0.7em; height: 0.7em; color: var(--ember); transition: transform 0.45s var(--ease); }
.card__who { font-size: 0.9375rem; color: var(--text-3); }
.card__text { color: var(--text-2); max-width: 52ch; }
.card .tags li { font-size: 0.75rem; }
.card:hover .card__media img { transform: scale(1.04); filter: saturate(1); }
.card:hover .card__title .icon { transform: translate(3px, -3px); }
.card:focus-visible { outline-offset: 6px; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform 0.6s var(--ease); }
  .card:hover { transform: translateY(-4px); }
}
@media (max-width: 899px) {
  .card, .card:nth-child(4n + 2), .card:nth-child(4n + 3) { grid-column: 1 / -1; }
  .card__media { height: auto; aspect-ratio: 16 / 10; }
}

/* Placa de codigo (tarjeta y pagina del addon) */
.code {
  margin: 0;
  height: 100%;
  overflow: auto;
  padding: 1.25rem 1.4rem;
  background: #100e0c;
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: #cfc6ba;
  tab-size: 4;
}
.code__file {
  display: block;
  margin-bottom: 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 0.75rem;
}
.tok-k { color: #ef9a5c; }      /* palabras clave */
.tok-s { color: #c9b98d; }      /* cadenas */
.tok-f { color: #ece5db; font-weight: 600; } /* funciones */
.tok-c { color: #8d857b; font-style: italic; } /* comentarios (AA sobre #100e0c) */
.tok-n { color: #d7a77c; }      /* numeros / constantes */

/* ---------- Sobre mi ---------- */
.about__top {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2.5rem clamp(1rem, 2.5vw, 2.5rem);
  align-items: end;
}
.about__intro { grid-column: 1 / span 8; }
.about__intro .lead { margin-top: 1.75rem; color: var(--text); }
.langs { grid-column: 10 / -1; }
.langs dl { display: grid; gap: 1rem; margin-top: 1rem; }
.langs div { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); }
.langs dt { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; text-transform: uppercase; line-height: 1; }
.langs dd { color: var(--text-3); font-size: 0.9375rem; }
.langs__title { font-size: 0.875rem; font-weight: 500; color: var(--text-3); }

.about__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3.5rem clamp(1rem, 2.5vw, 2.5rem);
  margin-top: clamp(4rem, 8vw, 6.5rem);
}
.about__xp { grid-column: 1 / span 7; }
.about__skills { grid-column: 9 / -1; }
.sub-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.4rem + 1vw, 2.25rem);
  text-transform: uppercase;
}

.timeline { margin-top: 2rem; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(var(--ember), var(--line) 30%, var(--line));
}
.timeline > li { position: relative; padding-left: 2.25rem; }
.timeline > li + li { margin-top: 2.75rem; }
/* Marcador del timeline: indica un punto en el tiempo, no es decorativo */
.timeline > li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.45rem;
  width: 11px; height: 11px;
  background: var(--bg);
  border: 2px solid var(--ember);
}
.timeline time { font-size: 0.875rem; color: var(--text-3); letter-spacing: 0.02em; }
.timeline h4 {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.625rem;
  text-transform: uppercase;
  line-height: 1.05;
}
.timeline .org { margin-top: 0.3rem; color: var(--ember); font-size: 0.9375rem; }
.timeline ul { margin-top: 1rem; display: grid; gap: 0.45rem; color: var(--text-2); }
.timeline ul li { padding-left: 1.1rem; position: relative; }
.timeline ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 0.5rem; height: 1px;
  background: var(--text-3);
}

.skills { margin-top: 2rem; display: grid; gap: 1.75rem; }
.skills h4 { font-size: 0.875rem; color: var(--text-3); font-weight: 500; }
.skills .tags { margin-top: 0.6rem; }
.skills .tags li { color: var(--text); font-size: 0.875rem; }

@media (max-width: 899px) {
  .about__intro, .langs, .about__xp, .about__skills { grid-column: 1 / -1; }
}

/* ---------- Contacto ---------- */
.contact { position: relative; overflow: hidden; }
.contact::before {
  content: "";
  position: absolute;
  inset: auto -10% -40% -10%;
  height: 80%;
  pointer-events: none;
  background: radial-gradient(50% 60% at 50% 100%, rgb(239 125 51 / 0.14), transparent 70%);
}
.contact__inner { position: relative; }
.contact__note { margin-top: 1.25rem; }
.contact__mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.contact__mail a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 0.8rem + 5vw, 5.5rem);
  line-height: 1;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--ember), var(--ember)) left 100% / 0 2px no-repeat;
  transition: background-size 0.5s var(--ease), color 0.3s var(--ease);
  padding-bottom: 0.1em;
}
.contact__mail a:hover { background-size: 100% 2px; color: var(--ember-hi); }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 0.85rem;
  border: 1px solid var(--line-strong);
  font-size: 0.875rem;
  color: var(--text-2);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.copy-btn:hover { border-color: var(--ember); color: var(--text); }
.copy-btn[data-copied] { border-color: var(--ember); color: var(--ember-hi); }

.contact__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 1.5rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line-strong);
}
.contact__item {
  display: grid;
  gap: 0.35rem;
  padding: 1.5rem 1rem 1.5rem 0;
  border-bottom: 1px solid var(--line);
  transition: color 0.2s var(--ease);
}
.contact__item span { font-size: 0.8125rem; color: var(--text-3); }
.contact__item strong {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 1.0625rem;
  white-space: nowrap;
}
a.contact__item:hover strong { color: var(--ember-hi); }
@media (max-width: 420px) { .contact__item strong { font-size: 0.9375rem; gap: 0.4rem; } }
.contact__cv { display: flex; align-items: center; padding-block: 1.5rem; border-bottom: 1px solid var(--line); }
@media (max-width: 899px) {
  .contact__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
  .contact__cv { grid-column: 1 / -1; border-bottom: 0; }
  .contact__cv .btn { width: 100%; }
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 1.75rem;
  font-size: 0.875rem;
  color: var(--text-3);
}
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }
.footer__social { display: flex; gap: 0.25rem; margin-inline: auto; }
.footer__social .icon-link { color: var(--text-3); }
.footer__social .icon-link:hover { color: var(--ember-hi); }
@media (max-width: 599px) {
  .footer .wrap { flex-direction: column; text-align: center; }
  .footer__social { order: -1; }
}

/* ---------- Pagina de proyecto ---------- */
.p-hero { padding-top: calc(var(--nav-h) + clamp(2rem, 5vw, 4rem)); }
.p-back { font-size: 0.9375rem; }
.p-back .icon { transform: rotate(180deg); }
.p-title { margin-top: 1.5rem; font-size: clamp(3.25rem, 1rem + 8vw, 8.5rem); }
.p-who { margin-top: 0.9rem; font-size: 1.0625rem; color: var(--ember); }
.p-hero .tags { margin-top: 1.5rem; }
.p-hero .lead { margin-top: 1.75rem; }
.p-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.p-cover { margin-top: clamp(2.5rem, 5vw, 4rem); }
.p-cover .g-item { aspect-ratio: 16 / 9; }
.p-cover .code { max-height: none; font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.9375rem); }

.p-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3rem clamp(1rem, 2.5vw, 2.5rem);
  margin-top: clamp(3.5rem, 7vw, 6rem);
}
.p-body__main { grid-column: 1 / span 7; }
.p-body__side { grid-column: 9 / -1; }
.p-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.4rem + 1vw, 2.25rem);
  text-transform: uppercase;
}
.p-body h2 + * { margin-top: 1rem; }
.p-body p { color: var(--text-2); max-width: 62ch; }
.p-body p + h2, .p-body ul + h2, .p-body .compare + h2 { margin-top: 2.75rem; }
.p-list { display: grid; gap: 0.75rem; color: var(--text-2); }
.p-list li { position: relative; padding-left: 1.25rem; max-width: 62ch; }
.p-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 0.6rem; height: 1px;
  background: var(--ember);
}
.p-list b { color: var(--text); font-weight: 500; }
.p-facts { display: grid; gap: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line-strong); }
.p-facts dt { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.p-facts dd { margin-top: 0.25rem; color: var(--text); }
.p-section { margin-top: clamp(4rem, 8vw, 6rem); }
.p-section > h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 1.5vw, 3rem);
  text-transform: uppercase;
}

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.compare > div { background: var(--bg); padding: 1.25rem; }
.compare h3 { font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.compare ol { margin-top: 0.85rem; display: grid; gap: 0.4rem; color: var(--text-2); counter-reset: s; font-size: 0.9375rem; }
.compare ol li { counter-increment: s; display: flex; gap: 0.6rem; }
.compare ol li::before { content: counter(s); color: var(--text-3); min-width: 1ch; }
.compare .is-after { background: var(--bg-raised); }
.compare .is-after h3 { color: var(--ember); }

.p-next {
  display: grid;
  gap: 0.5rem;
  margin-top: clamp(5rem, 10vw, 8rem);
  padding-block: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line-strong);
}
.p-next span { font-size: 0.9375rem; color: var(--text-3); }
.p-next strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 1rem + 6vw, 6rem);
  text-transform: uppercase;
  line-height: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  transition: color 0.3s var(--ease);
}
.p-next strong .icon { width: 0.55em; height: 0.55em; color: var(--ember); transition: transform 0.45s var(--ease); }
.p-next:hover strong { color: var(--ember-hi); }
.p-next:hover strong .icon { transform: translateX(6px); }

@media (max-width: 899px) {
  .p-body__main, .p-body__side { grid-column: 1 / -1; }
  .compare { grid-template-columns: 1fr; }
}

/* ---------- Visor (lightbox) ---------- */
.lb {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: rgb(8 7 6 / 0.97);
  color: var(--text);
  overflow: hidden;
}
.lb::backdrop { background: rgb(8 7 6 / 0.9); }
.lb[open] { display: grid; grid-template-rows: 1fr auto; }
html.lb-open { overflow: hidden; }
.lb__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(56px, 6vw, 72px) clamp(8px, 6vw, 96px) 0;
  touch-action: pan-y;
}
.lb__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.25s var(--ease);
}
.lb__img.is-loading { opacity: 0.35; }
.lb__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(16px, 6vw, 96px) 1.25rem;
  font-size: 0.9375rem;
}
.lb__cap { color: var(--text-2); }
.lb__count { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  color: var(--text);
  background: rgb(13 11 10 / 0.6);
  border: 1px solid var(--line-strong);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.lb__btn:hover { border-color: var(--ember); color: var(--ember-hi); }
.lb__btn .icon { width: 22px; height: 22px; }
.lb__close { top: 12px; right: 12px; }
.lb__prev, .lb__next { top: 50%; transform: translateY(-50%); }
.lb__prev { left: 12px; }
.lb__next { right: 12px; }
.lb[data-single] .lb__prev, .lb[data-single] .lb__next, .lb[data-single] .lb__count { display: none; }
@media (max-width: 699px) {
  .lb__prev, .lb__next { top: auto; bottom: 8px; transform: none; }
  .lb__bar { padding-inline: 68px; flex-direction: column; align-items: center; text-align: center; gap: 0.25rem; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .plate { transform: none !important; }
}
