/* ==========================================================================
   Noel Cegarra · Portfolio
   Dirección: portada azul con palabras en 3D (homenaje a vanholtz.co),
   interiores blancos con titulares en azul y texto en negro.
   ========================================================================== */

/* ---------- Tipografías (OFL, autoalojadas) ---------- */
@font-face { font-family: 'Anybody'; font-style: normal; font-weight: 100 900; font-stretch: 50% 150%; font-display: swap;
  src: url('/assets/fonts/anybody-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Anybody'; font-style: normal; font-weight: 100 900; font-stretch: 50% 150%; font-display: swap;
  src: url('/assets/fonts/anybody-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url('/assets/fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url('/assets/fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Tokens ---------- */
:root {
  /* Azul eléctrico: 6,9:1 con blanco y 3:1 con negro (AA para texto grande en ambos) */
  --blue: #5520ff;
  --blue-ink: #3d0fd6;
  --ink: #0a0a0c;
  --ink-2: #3c3c46;
  --paper: #ffffff;
  --mist: #f3f2f8;
  --line: rgba(10, 10, 12, .12);
  --white: #ffffff;

  --display: 'Anybody', 'Arial Black', Impact, sans-serif;
  --text: 'Archivo', 'Helvetica Neue', Arial, system-ui, sans-serif;

  --pad: clamp(20px, 4.17vw, 60px);
  --gap: clamp(16px, 2vw, 28px);
  --header: clamp(64px, 9vh, 96px);

  --out: cubic-bezier(.075, .82, .165, 1);     /* easeOutCirc: lo que usa vanholtz */
  --in: cubic-bezier(.55, .055, .675, .19);    /* easeInCubic */
  --expo: cubic-bezier(.16, 1, .3, 1);
  --back: cubic-bezier(.175, .885, .32, 1.275);

  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
html.is-blue { background: var(--blue); }
body {
  margin: 0; min-height: 100svh;
  font-family: var(--text); font-size: 16px; line-height: 1.55; font-stretch: 100%;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .7s var(--out);
}
body.is-blue { background: var(--blue); }
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-weight: inherit; }
ul, ol { margin: 0; padding: 0; }
dl, dd { margin: 0; }
strong { font-weight: 650; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.is-blue :focus-visible { outline-color: #fff; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: 12px; z-index: 100; padding: 10px 16px; background: var(--ink); color: #fff; text-decoration: none; transform: translateY(-160%); transition: transform .2s; }
.skip:focus { transform: none; }
.display { font-family: var(--display); font-stretch: 150%; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; line-height: .9; }

/* Fundido simple (cambio de idioma) */
main[data-swap] { transition: opacity .38s ease; }
main[data-swap].is-fading { opacity: 0; }

/* ---------- Logo persistente (NOEL / CEGARRA) ---------- */
.logo {
  position: absolute; z-index: 60; left: var(--pad); top: 0;
  display: block; text-decoration: none;
  font-family: var(--display); font-stretch: 150%; font-weight: 700;
  font-size: clamp(30px, 3.1vw, 46px); line-height: .86; letter-spacing: .01em; text-transform: uppercase;
  color: var(--blue); -webkit-text-stroke: 1px var(--blue);
  transform-origin: 0 0;
  transform: translate3d(0, var(--logo-y, 26px), 0) scale(var(--logo-s, .5));
  transition: transform 1.35s var(--out), color .3s, -webkit-text-stroke-color .6s;
}
.logo span { display: block; overflow: hidden; padding-bottom: 2px; }
.logo span i { display: block; font-style: normal; transition: transform 1s var(--out); }
.logo:hover, .logo:focus-visible { color: transparent; }
/* Portada: abajo a la izquierda, en blanco */
body[data-view="home"] .logo { --logo-y: calc(92.5svh - 67px - 1.72em); --logo-s: 1; color: #fff; -webkit-text-stroke-color: #fff; }
body[data-view="home"] .logo:hover, body[data-view="home"] .logo:focus-visible { color: transparent; }
html.is-curtain .logo { color: #fff; -webkit-text-stroke-color: #fff; }
/* Intro de la portada: cada línea del logo sube */
.home-intro .logo span i { transform: translate3d(0, 120%, 0); }
.home-intro.is-playing .logo span i { transform: none; transition-delay: 1.15s; }
.home-intro.is-playing .logo span + span i { transition-delay: 1.3s; }

/* ---------- Cortinilla entre páginas ---------- */
.curtain {
  position: fixed; inset: 0; z-index: 55; pointer-events: none;
  background: var(--blue);
  transform: translate3d(0, 100%, 0);
  visibility: hidden; /* en reposo no existe: evita que asome con la barra dinámica del móvil */
}
.curtain.is-in, .curtain.is-out { visibility: visible; }
.curtain.is-in { transform: none; transition: transform .62s cubic-bezier(.7, 0, .25, 1); }
.curtain.is-out { transform: translate3d(0, -100%, 0); transition: transform .8s cubic-bezier(.7, 0, .25, 1); }
.curtain.is-reset { transition: none; }

/* ==========================================================================
   PORTADA
   ========================================================================== */
body[data-view="home"] { overflow: hidden; }
.home { position: relative; height: 100svh; overflow: hidden; color: #fff; }
.home-stage {
  position: absolute; inset: 0;
  perspective: 160vw; perspective-origin: var(--po-x, 50%) var(--po-y, 46%);
  transition: transform .5s var(--in), opacity .4s;
}
.home-stage nav { position: absolute; inset: 0; transform-style: preserve-3d; pointer-events: none; }
.home-list {
  list-style: none; position: absolute; right: var(--pad); top: 50%;
  transform: translateY(-56%); transform-style: preserve-3d;
  text-align: right;
  --item: min(13.4vw, 25vh);
}
.home-item { display: block; transform-style: preserve-3d; }
.home-item + .home-item { margin-top: -.02em; }
.home-wrap {
  display: block;
  transform: rotateY(-45deg) translateZ(0);
  transform-origin: right center; transform-style: preserve-3d; will-change: transform;
  transition: transform 1.5s var(--out), opacity 1.5s var(--out);
}
.home-link {
  position: relative; display: inline-block;
  font-family: var(--display); font-stretch: 150%; font-weight: 900;
  font-size: var(--item); line-height: .9; letter-spacing: .02em; text-transform: uppercase;
  color: var(--ink); -webkit-text-stroke: 3px var(--ink); text-decoration: none;
  transition: color .3s, -webkit-text-stroke-width .3s;
  -webkit-tap-highlight-color: transparent; pointer-events: auto;
}
/* etiqueta pequeña y barra diagonal a la izquierda de cada palabra (data-info) */
.home-link::before {
  content: attr(data-info);
  position: absolute; right: calc(100% + var(--item) * .3); top: .04em;
  font-family: var(--text); font-stretch: 100%; font-weight: 600; font-size: max(11px, calc(var(--item) * .1));
  letter-spacing: .02em; line-height: 1.2; white-space: nowrap; text-transform: none;
  color: var(--ink); -webkit-text-stroke: 0;
  transition: opacity .2s;
}
.home-link::after {
  content: ''; position: absolute; left: -.3em; top: .02em;
  width: 2px; height: .85em; background: var(--ink);
  transform: rotate(25deg); transform-origin: center;
  transition: opacity .2s;
}
@media (hover: hover) {
  .home:not(.is-intro):not(.is-outro) .home-item:hover .home-wrap { transform: rotateY(-35deg) translateZ(0); transition-duration: 1s; }
  .home:not(.is-intro):not(.is-outro) .home-item:hover .home-link { color: transparent; -webkit-text-stroke-color: #151515; }
}
.home:not(.is-intro):not(.is-outro) .home-link:focus-visible { color: transparent; outline: 3px solid #fff; outline-offset: 10px; }
.home:not(.is-intro):not(.is-outro) .home-item:focus-within .home-wrap { transform: rotateY(-35deg) translateZ(0); }

/* Clic: la palabra elegida se endereza; las demás giran y desaparecen */
.home .home-item.is-selected .home-wrap { transform: rotateY(0deg) translateZ(0) scale(1); }
.home .home-item.is-selected .home-link { color: transparent; -webkit-text-stroke: 3px #151515; }
.home.is-outro .home-item:not(.is-selected) .home-wrap {
  transform: rotateY(-114deg) translateZ(0); opacity: 0;
  transition: transform .25s var(--in) .1s, opacity .25s var(--in) .1s;
}
.home.is-outro .home-item.is-selected .home-link::before,
.home.is-outro .home-item.is-selected .home-link::after { opacity: 0; transition: opacity .2s ease-out .15s; }
.home.is-outro2 .home-item.is-selected .home-wrap { transform: rotateY(0deg) translateZ(0) scale(.7); opacity: 0; transition: transform .5s var(--in), opacity .5s var(--in); }
.home.is-outro2 .home-stage { transform: translate3d(0, -25vh, 0); }
.home.is-outro .home-ui > * { opacity: 0; transition: opacity .35s; }

/* Intro */
.home.is-intro .home-stage { transform: translate3d(0, -110%, 0); }
.home.is-intro.is-playing .home-stage { transform: none; transition: transform 1.9s var(--out); }
.home.is-intro .home-wrap { transform: rotateY(-100deg) translateZ(0); opacity: 0; transition: none; }
.home.is-intro.is-playing .home-wrap { transform: rotateY(-45deg) translateZ(0); opacity: 1; transition: transform 1.9s var(--out), opacity 1.9s var(--out); }
.home.is-intro.is-playing .home-item:nth-child(1) .home-wrap { transition-delay: .55s; }
.home.is-intro.is-playing .home-item:nth-child(2) .home-wrap { transition-delay: .35s; }
.home.is-intro .home-ui > * { opacity: 0; transform: translate3d(0, 12px, 0); }
.home.is-intro.is-playing .home-ui > * { opacity: 1; transform: none; transition: opacity .8s var(--out), transform .8s var(--out); }
.home.is-intro.is-playing .home-ui > :nth-child(1) { transition-delay: 1.5s; }
.home.is-intro.is-playing .home-ui > :nth-child(2) { transition-delay: 1.6s; }
.home.is-intro.is-playing .home-ui > :nth-child(3) { transition-delay: 1.7s; }
.home.is-intro.is-playing .home-ui > :nth-child(4) { transition-delay: 1.8s; }
.home.is-intro.is-playing .home-ui > :nth-child(5) { transition-delay: 1.9s; }
/* Intro corta (al volver a la portada desde otra página) */
.home.is-intro.is-quick.is-playing .home-stage { transition-duration: 1.2s; }
.home.is-intro.is-quick .home-stage { transform: translate3d(0, -30%, 0); }

/* Pie de la portada (textos de Noel) */
.home-ui {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 7.5svh;
  display: flex; align-items: flex-end; gap: clamp(20px, 3vw, 44px);
  font-size: 15px; line-height: 1.4; color: #fff;
}
.home-ui p { margin: 0; }
.home-ui a { text-decoration: none; font-weight: 650; }
.home-ui .col { min-width: 0; }
.home-ui .spacer { flex: 1; }
.u-link { position: relative; display: inline-block; text-decoration: none; transform-origin: left center; perspective: 250px; }
.u-link > span { display: inline-block; transition: transform .25s var(--back); transform-origin: left center; }
.u-link:hover > span, .u-link:focus-visible > span { transform: rotateY(15deg); }
.u-num { display: inline-block; width: 26px; font-size: 10px; font-weight: 500; vertical-align: 1px; opacity: .9; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #7dffb0; vertical-align: 1px; box-shadow: 0 0 0 0 rgba(125, 255, 176, .7); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(125, 255, 176, .55); } 70% { box-shadow: 0 0 0 8px rgba(125, 255, 176, 0); } 100% { box-shadow: 0 0 0 0 rgba(125, 255, 176, 0); } }
.lang {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 12px;
  border: 1.5px solid currentColor; border-radius: 999px;
  font-weight: 700; font-size: 13px; letter-spacing: .06em; text-decoration: none;
  transition: background-color .25s, color .25s;
}
.lang:hover, .lang:focus-visible { background: #fff; color: var(--blue); }
.page .lang:hover, .page .lang:focus-visible { background: var(--blue); color: #fff; }

/* ==========================================================================
   PÁGINAS INTERIORES
   ========================================================================== */
.page { position: relative; min-height: 100svh; }
.topbar {
  position: absolute; z-index: 20; top: 0; left: 0; right: 0;
  height: var(--header); padding: 0 var(--pad);
  display: flex; align-items: center; justify-content: flex-end; gap: clamp(14px, 2vw, 28px);
  font-size: 15px;
}
.topbar nav { display: flex; gap: clamp(14px, 2vw, 28px); }
.topbar a:not(.lang) { text-decoration: none; font-weight: 600; }
.topbar a[aria-current="page"] { color: var(--blue); }
.back {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid transparent; transition: border-color .25s, transform .4s var(--out);
}
.back:hover, .back:focus-visible { border-color: currentColor; }
.back svg { width: 18px; height: 18px; }

/* Títulos con máscara (las líneas suben al entrar) */
.mask { display: block; overflow: hidden; padding-bottom: .04em; }
.mask > span { display: block; transform: translate3d(0, 105%, 0); }
.is-shown .mask > span, .no-anim .mask > span { transform: none; transition: transform 1.1s var(--expo); }
.is-shown .mask:nth-child(2) > span { transition-delay: .08s; }
.is-shown .mask:nth-child(3) > span { transition-delay: .16s; }
[data-r] { opacity: 0; transform: translate3d(0, 28px, 0); }
[data-r].is-in, .no-anim [data-r] { opacity: 1; transform: none; transition: opacity .9s var(--out), transform 1.1s var(--expo); transition-delay: var(--d, 0s); }

/* ---------- Lista de proyectos (sin scroll de página; solo la lista) ---------- */
body[data-view="projects"] { overflow: hidden; }
.works {
  height: 100svh; display: grid;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  padding: calc(var(--header) + 4px) var(--pad) var(--pad);
  gap: clamp(14px, 2.4vh, 28px);
}
.works-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.works-title { color: var(--blue); font-size: clamp(44px, min(7.7vw, 13.5vh), 124px); white-space: nowrap; }
.works-title sup { font-family: var(--text); font-stretch: 100%; font-weight: 600; font-size: .16em; letter-spacing: .02em; vertical-align: top; position: relative; top: .35em; margin-left: .25em; }
.works-sub { margin: 0 0 .4em; font-size: 15px; line-height: 1.35; color: var(--ink-2); text-align: right; white-space: nowrap; }
.works-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 72px); min-height: 0; }
.wlist-wrap { position: relative; min-height: 0; }
.wlist-wrap::before, .wlist-wrap::after { content: ''; position: absolute; left: 0; right: 0; height: 28px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .3s; }
.wlist-wrap::before { top: 0; background: linear-gradient(var(--paper), rgba(255, 255, 255, 0)); }
.wlist-wrap::after { bottom: 0; background: linear-gradient(rgba(255, 255, 255, 0), var(--paper)); }
.wlist-wrap.has-top::before, .wlist-wrap.has-bottom::after { opacity: 1; }
.wlist {
  list-style: none; height: 100%; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none; border-top: 1.5px solid var(--ink);
  perspective: 1600px;
}
.wlist::-webkit-scrollbar { display: none; }
.wrow { border-bottom: 1px solid var(--line); }
.wlink {
  position: relative; display: block;
  padding: clamp(12px, 1.9vh, 20px) 0 clamp(14px, 2.1vh, 22px); text-decoration: none;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .9s var(--out), opacity .5s;
}
.wtop { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; font-size: 12px; line-height: 1; }
.wnum { font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.wname {
  position: relative; display: block; min-width: 0;
  font-family: var(--display); font-stretch: 150%; font-weight: 900; text-transform: uppercase;
  font-size: clamp(22px, min(3vw, 5.2vh), 46px); line-height: .95; letter-spacing: .02em;
  /* grosor proporcional al tamaño: a 24 px un trazo fijo de 1,5 px cerraba los huecos de E, S y G */
  color: var(--ink); -webkit-text-stroke: max(1px, .033em) var(--ink);
  transition: color .3s, -webkit-text-stroke-color .3s;
}
.wname b { display: block; font-weight: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform .6s var(--out); }
.warrow { position: absolute; left: 0; top: 50%; width: .72em; height: .72em; margin-top: -.36em; color: var(--blue); opacity: 0; transform: translateX(-60%); transition: transform .5s var(--out), opacity .3s; }
.wtype { color: var(--ink-2); white-space: nowrap; }
.wtype .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 0; background: currentColor; }
.dot--prod, .dot--internal { color: #12a150; }
.dot--dev { color: #e08a00; }
.dot--concept { color: #9a9aa6; }
.wrow.is-active .wname, .wlink:focus-visible .wname { color: transparent; -webkit-text-stroke-color: var(--blue); }
.wrow.is-active .warrow, .wlink:focus-visible .warrow { opacity: 1; transform: none; }
.wrow.is-active .wname b, .wlink:focus-visible .wname b { transform: translateX(1em); }
@media (hover: hover) {
  .wrow:hover .wlink { transform: rotateY(-9deg) translateX(6px); }
}
.wrow--more .wname { color: var(--blue); -webkit-text-stroke-color: var(--blue); }
.wrow--more .wnum { color: var(--ink); }
/* Salida: la fila elegida se queda y el resto gira hacia atrás */
.works.is-leaving .wrow:not(.is-selected) .wlink { transform: rotateY(-90deg); opacity: 0; transition: transform .35s var(--in), opacity .3s var(--in); transition-delay: calc(var(--i, 0) * 35ms); }
.works.is-leaving .wrow.is-selected .wlink { transform: translateX(18px); }
.works.is-leaving .wrow.is-selected .wname { color: var(--blue); -webkit-text-stroke-color: var(--blue); }
.works.is-leaving .wpanel { transform: scale(.96); opacity: 0; transition: transform .6s var(--in) .15s, opacity .5s var(--in) .2s; }
.works.is-leaving .works-title { opacity: .15; transition: opacity .4s; }
/* Entrada */
.works .wrow .wlink { opacity: 0; transform: rotateY(-70deg); }
.works.is-shown .wrow .wlink { opacity: 1; transform: none; transition: transform 1.1s var(--out), opacity .8s var(--out); transition-delay: calc(.15s + var(--i, 0) * 60ms); }
.works.is-shown .wrow .wlink:hover { transition-delay: 0s; }
.no-anim .works .wrow .wlink { opacity: 1; transform: none; }

/* Panel de imagen */
.wpanel { position: relative; min-height: 0; display: flex; flex-direction: column; gap: 18px; }
.wframe {
  position: relative; overflow: hidden; background: var(--mist); aspect-ratio: 16 / 10; flex: none; max-height: calc(100% - 120px);
  box-shadow: 0 0 0 1px rgba(10, 10, 12, .06), 0 40px 80px -48px rgba(32, 10, 120, .55);
  border-radius: 48px 0 0 0;
  clip-path: inset(100% 0 0 0 round 48px 0 0 0);
}
.works.is-shown .wframe, .no-anim .wframe { clip-path: inset(0 0 0 0 round 48px 0 0 0); transition: clip-path 1.2s var(--expo) .2s; }
.wimg { position: absolute; inset: 0; opacity: 0; transform: scale(1.06); transition: opacity .55s ease, transform 1.1s var(--expo); }
.wimg.is-active { opacity: 1; transform: none; z-index: 1; }
.wimg picture, .wimg img { width: 100%; height: 100%; }
.wimg img { object-fit: cover; object-position: top center; }
.wcap { display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; align-items: baseline; font-size: 14px; color: var(--ink-2); min-height: 4.4em; }
.wcap strong { font-family: var(--display); font-stretch: 150%; font-weight: 900; text-transform: uppercase; font-size: 18px; letter-spacing: .02em; color: var(--blue); }
.wcap .wmeta { text-align: right; }
.wcap .wtag { grid-column: 1 / -1; max-width: 56ch; font-size: 15px; line-height: 1.45; color: var(--ink); }
.wimg--grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 6px; background: var(--mist); }
.wimg--grid picture { min-height: 0; }
.wimg--grid img { border-radius: 4px; }
.whint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 14px; }

/* ---------- Ficha de proyecto ---------- */
.case { padding-top: calc(var(--header) + clamp(28px, 6vh, 80px)); }
.wrap { padding-left: var(--pad); padding-right: var(--pad); }
.case-kicker { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 14px; color: var(--ink-2); margin-bottom: clamp(14px, 2vh, 24px); }
.case-kicker a { color: var(--blue); font-weight: 650; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.case-kicker a svg { width: 14px; height: 14px; transform: rotate(180deg); }
.case-title { color: var(--blue); font-size: var(--fs, 12vw); overflow-wrap: anywhere; }
.fit-5 { --fs: min(15vw, 230px); } .fit-6 { --fs: min(14vw, 210px); } .fit-7 { --fs: min(12.6vw, 190px); }
.fit-8 { --fs: min(11vw, 170px); } .fit-9 { --fs: min(9.8vw, 150px); } .fit-10 { --fs: min(8.9vw, 136px); }
.case-lead { max-width: 34ch; margin: clamp(20px, 3vh, 36px) 0 0; font-size: clamp(20px, 1.9vw, 28px); line-height: 1.3; font-weight: 450; letter-spacing: -.005em; }
.case-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 22px 28px;
  margin-top: clamp(28px, 5vh, 56px); padding-top: 20px; border-top: 1.5px solid var(--ink);
  font-size: 15px;
}
.case-meta dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); margin-bottom: 6px; }
.case-meta dd a { font-weight: 650; text-underline-offset: 3px; }
.case-meta .muted { color: var(--ink-2); }
.visit { display: inline; overflow-wrap: anywhere; }
.visit svg { display: inline-block; width: 13px; height: 13px; margin-left: 4px; vertical-align: .05em; }
.note { margin-top: 18px; padding: 12px 16px; border-left: 3px solid var(--blue); background: var(--mist); font-size: 14px; color: var(--ink-2); max-width: 72ch; }

.case-hero { margin-top: clamp(36px, 6vh, 72px); }
.browser { position: relative; overflow: hidden; border-radius: 14px; background: #101015; box-shadow: 0 40px 80px -40px rgba(32, 10, 120, .45), 0 0 0 1px rgba(10, 10, 12, .08); }
.browser-bar { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; background: #ececf1; }
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: #c9c9d2; }
.browser-bar span { flex: 1; margin-left: 10px; height: 20px; border-radius: 6px; background: #fff; font-size: 11px; line-height: 20px; padding: 0 10px; color: #6a6a75; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 360px; }
.browser video, .browser picture, .browser img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; background: #e9e8ef; }
.clip-btn { position: absolute; right: 14px; bottom: 14px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(10, 10, 12, .72); color: #fff; backdrop-filter: blur(6px); }
.clip-btn svg { width: 16px; height: 16px; }
.clip-btn .i-play { display: none; }
.clip-btn.is-paused .i-play { display: block; }
.clip-btn.is-paused .i-pause { display: none; }

.case-body { margin-top: clamp(56px, 10vh, 120px); }
.sec { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gap) clamp(24px, 4vw, 64px); padding: clamp(40px, 7vh, 80px) 0; border-top: 1px solid var(--line); }
.sec:first-child { border-top: 0; padding-top: 0; }
.sec-title { font-family: var(--display); font-stretch: 150%; font-weight: 800; text-transform: uppercase; color: var(--blue); font-size: clamp(22px, 2.2vw, 34px); line-height: 1; letter-spacing: .01em; }
.sec-body { font-size: clamp(17px, 1.25vw, 19px); line-height: 1.6; max-width: 68ch; }
.sec-body em { font-style: italic; }
.sec--full { grid-template-columns: 1fr; }
.sec--full .sec-body { max-width: none; }
.sec-sub { font-size: 18px; margin-top: 28px; }
.sec-intro { font-size: 15px; color: var(--ink-2); margin-top: 12px; max-width: 46ch; }
.bul { list-style: none; display: grid; gap: 14px; }
.bul li { position: relative; padding-left: 28px; }
.bul li::before { content: ''; position: absolute; left: 0; top: .62em; width: 14px; height: 2px; background: var(--blue); }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border-top: 1.5px solid var(--ink); }
.stat { padding: 22px 16px 22px 0; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--line); }
.stat b { display: block; font-family: var(--display); font-stretch: 150%; font-weight: 900; color: var(--blue); font-size: clamp(30px, 3.4vw, 54px); line-height: 1; letter-spacing: .01em; }
.stat span { display: block; margin-top: 8px; font-size: 14px; color: var(--ink-2); line-height: 1.3; }

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 36px); }
.shot { margin: 0; }
.shot--wide { grid-column: 1 / -1; }
.shot-btn { display: block; width: 100%; border-radius: 10px; overflow: hidden; background: var(--mist); box-shadow: 0 0 0 1px rgba(10, 10, 12, .08), 0 24px 48px -32px rgba(32, 10, 120, .35); cursor: zoom-in; }
.shot-btn img { width: 100%; transition: transform 1s var(--expo); }
.shot-btn:hover img { transform: scale(1.02); }
.shot figcaption, .phone figcaption { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--ink-2); max-width: 60ch; }

.phones { display: flex; flex-wrap: wrap; gap: clamp(20px, 4vw, 64px); align-items: flex-start; }
.phone { margin: 0; width: min(300px, 70vw); }
.phone--desktop { width: min(620px, 100%); }
.phone-frame { padding: 10px; border-radius: 42px; background: #0b0b10; box-shadow: 0 30px 60px -30px rgba(32, 10, 120, .5); }
.phone-frame .shot-btn { border-radius: 32px; box-shadow: none; }
.phone--desktop .phone-frame { padding: 0; border-radius: 10px; background: none; box-shadow: none; }
.phone--desktop .phone-frame .shot-btn { border-radius: 10px; box-shadow: 0 0 0 1px rgba(10, 10, 12, .08), 0 24px 48px -32px rgba(32, 10, 120, .35); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.chips li { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 500; }
.chips li.is-ai { border-color: var(--blue); color: var(--blue); }

/* Diagrama de Legalix AI */
.flow { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: flow; }
.flow li { position: relative; padding: 18px 18px 20px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--paper); counter-increment: flow; min-height: 150px; }
.flow li::before { content: counter(flow, decimal-leading-zero); display: block; font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 10px; letter-spacing: .06em; }
.flow h3 { font-family: var(--display); font-stretch: 140%; font-weight: 800; font-size: 17px; line-height: 1.1; text-transform: uppercase; margin-bottom: 8px; }
.flow p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.flow li.is-ai { background: var(--blue); border-color: var(--blue); color: #fff; }
.flow li.is-ai::before, .flow li.is-ai p { color: rgba(255, 255, 255, .82); }
.flow li:not(:nth-child(4n))::after { content: ''; position: absolute; top: 50%; right: -14px; width: 14px; height: 1.5px; background: var(--ink); }
.models { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.models span { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 9px; border-radius: 8px; background: rgba(255, 255, 255, .14); }
.models em { font-style: normal; opacity: .78; }
.risk { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.risk span { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; }
.flow-caption { margin-top: 14px; font-size: 14px; color: var(--ink-2); }

/* Siguiente proyecto */
.next { display: block; padding: clamp(56px, 12vh, 140px) var(--pad); border-top: 1.5px solid var(--ink); text-decoration: none; perspective: 1200px; }
.next small { display: block; font-size: 14px; font-weight: 600; color: var(--blue); margin-bottom: 12px; letter-spacing: .04em; text-transform: uppercase; }
.next .display { display: inline-block; font-size: clamp(34px, 7.8vw, 128px); color: transparent; -webkit-text-stroke: 2px var(--blue); transform-origin: left center; transition: color .35s, transform 1s var(--out); }
.next:hover .display, .next:focus-visible .display { color: var(--blue); transform: rotateY(-14deg); }

/* ---------- Sobre mí ---------- */
.about { padding-top: calc(var(--header) + clamp(28px, 6vh, 80px)); }
.about-title { color: var(--blue); font-size: min(10.2vw, 156px); white-space: nowrap; }
.erasmus { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: clamp(28px, 5vw, 80px); margin-top: clamp(32px, 6vh, 72px); align-items: start; }
.erasmus-kicker { display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 13px; font-weight: 650; letter-spacing: .03em; }
.erasmus-kicker .status-dot { margin: 0; }
.erasmus h2 { margin: 18px 0 22px; font-size: clamp(30px, 3.6vw, 56px); line-height: 1.04; font-weight: 600; letter-spacing: -.02em; font-stretch: 105%; }
.erasmus-text { margin-top: 28px; font-size: clamp(17px, 1.25vw, 19px); max-width: 60ch; }
.facts { display: grid; grid-template-columns: 1fr 1fr; border-top: 1.5px solid var(--ink); }
.fact { padding: 18px 0; border-bottom: 1px solid var(--line); }
.fact:nth-child(odd) { padding-right: 16px; }
.fact:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.fact dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); margin-bottom: 4px; }
.fact dd { font-size: clamp(17px, 1.4vw, 21px); font-weight: 600; line-height: 1.25; }
.portrait { margin: 0 0 32px; position: relative; overflow: hidden; border-radius: 50%; aspect-ratio: 1; width: min(240px, 60vw); background: #dfe8f5; box-shadow: 0 0 0 6px #fff, 0 0 0 7.5px var(--blue); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.erasmus aside .sec-title { font-size: clamp(20px, 1.7vw, 26px); margin-bottom: 18px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 650; font-size: 15px; text-decoration: none; transition: background-color .25s, color .25s, transform .4s var(--back); }
.btn--solid { background: var(--blue); color: #fff; }
.btn--solid:hover, .btn--solid:focus-visible { background: var(--ink); }
.btn--line { border: 1.5px solid var(--ink); }
.btn--line:hover, .btn--line:focus-visible { background: var(--ink); color: #fff; }
.btn svg { width: 15px; height: 15px; }
.courses { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.courses li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--mist); font-weight: 650; font-size: 15px; }
.courses li::before { content: ''; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: step; }
.steps li { counter-increment: step; padding: 16px; border: 1.5px solid var(--ink); border-radius: 14px; }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 8px; }
.steps b { display: block; font-family: var(--display); font-stretch: 140%; font-weight: 800; text-transform: uppercase; font-size: 16px; margin-bottom: 6px; }
.steps span { display: block; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.tl { list-style: none; display: grid; gap: 0; border-top: 1.5px solid var(--ink); }
.tl li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.tl time { font-size: 14px; font-weight: 600; color: var(--blue); }
.tl b { display: block; font-weight: 650; }
.tl span { font-size: 14px; color: var(--ink-2); }
.skills { display: grid; gap: 0; border-top: 1.5px solid var(--ink); }
.skills div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.skills dt { font-size: 14px; font-weight: 600; color: var(--blue); }

/* ---------- Pie de páginas interiores ---------- */
.foot { overflow: hidden; margin-top: clamp(40px, 8vh, 100px); padding: clamp(56px, 10vh, 120px) var(--pad) 28px; background: var(--blue); color: #fff; }
.foot-talk { display: inline-block; font-size: clamp(26px, 8.2vw, 150px); color: transparent; -webkit-text-stroke: 2px #fff; text-decoration: none; transform-origin: left center; perspective: 800px; transition: color .35s, transform 1s var(--out); }
.foot-talk:hover, .foot-talk:focus-visible { color: #fff; }
.foot-sub { max-width: 44ch; margin: 22px 0 0; font-size: clamp(17px, 1.3vw, 20px); }
.foot-mail { display: inline-block; margin-top: 10px; font-weight: 700; font-size: clamp(18px, 1.5vw, 22px); }
.foot-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px clamp(20px, 3vw, 44px); margin-top: clamp(48px, 9vh, 110px); padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .35); font-size: 15px; line-height: 1.4; }
.foot-row p { margin: 0; }
.foot-row .spacer { flex: 1; }
.foot-row a { text-decoration: none; font-weight: 650; }

.next + .foot { margin-top: 0; }

/* ---------- Visor de capturas ---------- */
.lb { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(10, 10, 14, .94); color: #fff; }
.lb::backdrop { background: transparent; }
.lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: 14px var(--pad); font-size: 14px; }
.lb-fig { margin: 0; min-height: 0; display: grid; place-items: center; padding: 0 var(--pad); overflow: auto; }
.lb-fig img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; }
.lb-fig.is-tall { place-items: start center; }
.lb-fig.is-tall img { max-height: none; max-width: min(480px, 100%); }
.lb-cap { padding: 14px var(--pad) 18px; font-size: 14px; color: rgba(255, 255, 255, .8); text-align: center; }
.lb-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .4); }
.lb-btn:hover, .lb-btn:focus-visible { border-color: #fff; }
.lb-btn svg { width: 16px; height: 16px; }
.lb-nav { display: flex; gap: 10px; }

/* ---------- 404 ---------- */
.nf { min-height: 100svh; display: grid; place-content: center; text-align: center; padding: var(--pad); }
.nf .display { font-size: min(24vw, 300px); color: transparent; -webkit-text-stroke: 3px var(--blue); }
.nf p { margin: 20px 0 28px; font-size: 18px; }
.nf .nf-cta { margin: 0; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(4) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow li::after { display: none; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-ui { flex-wrap: wrap; }
}
@media (max-width: 860px) {
  .home-stage { perspective: 200vw; perspective-origin: 50% 46%; }
  .home-list { --item: min(17.5vw, 13vh); top: 47%; }
  .home-link { -webkit-text-stroke-width: 2px; }
  .home-link::before { font-size: max(10px, calc(var(--item) * .15)); right: auto; left: .2em; top: -1.7em; }
  body[data-view="home"] .logo { --logo-y: 22px; --logo-s: .62; }
  .home-ui { bottom: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; font-size: 13px; }
  .home-ui .spacer { display: none; }
  .home-ui .col--lang { position: absolute; right: 0; bottom: 0; }
  .works { grid-template-rows: auto auto minmax(0, 1fr); }
  .works-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 14px; }
  .works-title { font-size: min(8.7vw, 7vh); }
  .wname { font-size: min(5vw, 24px); font-weight: 800; -webkit-text-stroke-width: .6px; }
  .wpanel { gap: 10px; }
  .wcap { min-height: 0; }
  .wcap strong { font-size: 15px; }
  .wcap .wtag { display: none; }
  .wpanel { order: -1; }
  .wframe { aspect-ratio: 16 / 9; max-height: 26svh; border-radius: 28px 0 0 0; clip-path: inset(100% 0 0 0 round 28px 0 0 0); }
  .works.is-shown .wframe, .no-anim .wframe { clip-path: inset(0 0 0 0 round 28px 0 0 0); }
  .wcap { font-size: 13px; }
  .works-sub { display: none; }
  .sec { grid-template-columns: 1fr; }
  .shots { grid-template-columns: 1fr; }
  .erasmus { grid-template-columns: 1fr; }
  .portrait { max-width: 420px; }
  .topbar, .topbar nav { gap: 14px; font-size: 14px; }
}
@media (max-width: 560px) {
  .topbar nav { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { padding-left: 0; border-left: 0; }
  .stat:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .flow, .steps, .courses { grid-template-columns: 1fr; }
  .flow li { min-height: 0; }
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(even) { padding-left: 0; border-left: 0; }
  .tl li, .skills div { grid-template-columns: 1fr; gap: 4px; }
  .case-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-height: 560px) and (min-width: 861px) {
  .home-ui { bottom: 20px; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .mask > span, [data-r], .works .wrow .wlink { transform: none !important; opacity: 1 !important; }
  .wframe { clip-path: none !important; }
}
