:root {
  --bg: #07070a;
  --fg: #ecebe4;
  --mute: #8a8980;
  --acid: #c6ff3d;
  --line: rgba(236, 235, 228, .14);
  --display: "Big Shoulders", "Arial Narrow", sans-serif;
  --mono: "Martian Mono", ui-monospace, monospace;
  --serif: "Bodoni Moda", Georgia, serif;
  --gutter: clamp(16px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--display);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
body.is-loading { overflow: hidden; }
a { color: inherit; text-decoration: none; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--acid); }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.label { color: var(--mute); margin-bottom: 3rem; }
.big { font-size: clamp(56px, 11vw, 176px); line-height: .85; font-weight: 900; letter-spacing: -.01em; text-transform: uppercase; }
::selection { background: var(--acid); color: var(--bg); }

@media (hover: hover) and (pointer: fine) {
  body, a, button { cursor: none; }
}

/* ---------- loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  pointer-events: none;
}
.loader__bars { position: absolute; inset: 0; display: flex; }
.loader__bars i { flex: 1; background: var(--acid); }
.loader__bars i:nth-child(even) { background: #0f0f14; }
.loader__count {
  position: relative; mix-blend-mode: difference; color: var(--fg);
  font-size: clamp(80px, 22vw, 320px); font-weight: 900; letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.loader__count sup { font-size: .25em; vertical-align: top; }
.loader__label {
  position: absolute; bottom: 32px; left: var(--gutter);
  font-family: var(--mono); font-size: 12px; mix-blend-mode: difference; color: var(--fg);
}

/* ---------- cursor ---------- */
.cursor, .cursor-dot {
  position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none;
  border-radius: 50%; mix-blend-mode: difference;
}
.cursor {
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border: 1px solid var(--fg);
  display: grid; place-items: center;
  transition: background .25s, border-color .25s;
}
.cursor.is-big { background: var(--fg); border-color: transparent; }
.cursor__label {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: #000;
  opacity: 0; transition: opacity .2s;
}
.cursor.is-big .cursor__label { opacity: 1; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--fg); }
@media not ((hover: hover) and (pointer: fine)) { .cursor, .cursor-dot { display: none; } }

/* ---------- grain & progress ---------- */
.noise {
  position: fixed; inset: -50%; z-index: 80; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-5%, 3%); }
  40% { transform: translate(4%, -6%); } 60% { transform: translate(-3%, 8%); }
  80% { transform: translate(7%, 2%); } 100% { transform: translate(0, 0); }
}
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70;
  background: var(--acid); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter);
  mix-blend-mode: difference; color: var(--fg);
}
.nav__logo { font-weight: 800; font-size: 22px; letter-spacing: .01em; display: inline-block; }
.nav__logo span { color: var(--mute); }
.nav__links { display: flex; gap: 28px; font-family: var(--mono); font-size: 12px; }
.nav__links a { display: inline-block; padding: 6px 0; }
.nav__clock { font-family: var(--mono); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.nav__clock small { color: var(--mute); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 12px var(--acid); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- hero ---------- */
.hero {
  position: relative; height: 100svh; min-height: 560px;
  display: flex; align-items: flex-end;
  padding: 0 var(--gutter) 9vh;
  overflow: hidden;
}
#gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero__inner { position: relative; z-index: 2; width: 100%; pointer-events: none; }

.hero__kicker { margin-bottom: 2vh; }
.blink { color: var(--acid); animation: pulse 1s infinite; }
.hero__title {
  font-weight: 900; font-size: min(20vw, 29svh); white-space: nowrap;
  line-height: .84; letter-spacing: -.01em; text-transform: uppercase;
}
.hero__title .line { display: block; overflow: hidden; padding-bottom: .04em; }
.line--outline { filter: url(#outline); }
.char { display: inline-block; will-change: transform; }
.hero__meta {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  margin-top: 4vh; flex-wrap: wrap;
}
.hero__role { font-size: clamp(22px, 2.6vw, 36px); line-height: 1.1; font-weight: 600; max-width: 26ch; }
.hero__coords { color: var(--mute); text-align: right; line-height: 1.7; }
@keyframes bob { 50% { transform: translateY(8px); } }

/* ---------- marquee ---------- */
.marquee { padding: 6vh 0; overflow: hidden; border-block: 1px solid var(--line); }
.marquee__track {
  display: flex; white-space: nowrap; width: max-content;
  font-size: clamp(56px, 11vw, 170px); font-weight: 900; letter-spacing: 0;
}
.marquee__track--alt {
  font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--acid);
  font-size: clamp(32px, 5.5vw, 84px); letter-spacing: 0;
}

/* ---------- manifesto ---------- */
.manifesto { padding: 22vh var(--gutter); }
.manifesto__text {
  font-size: clamp(34px, 6vw, 96px); line-height: 1; font-weight: 800; letter-spacing: 0;
  max-width: 24ch;
}
.manifesto__text .word { display: inline-block; opacity: .12; }

/* ---------- work (horizontal) ---------- */
.work { position: relative; overflow: hidden; }
.work__head { flex: 0 0 auto; align-self: center; padding-right: 4vw; }
.work__track {
  display: flex; align-items: center; gap: 3vw; padding: 0 var(--gutter);
  width: max-content; height: 100svh;
}
.card {
  --c: var(--acid);
  position: relative; flex: 0 0 auto;
  width: min(78vw, 500px); height: min(84svh, 680px);
  padding: 28px; border: 1px solid var(--line); border-radius: 28px;
  background: linear-gradient(160deg, rgba(255,255,255,.04), rgba(255,255,255,0) 60%);
  display: flex; flex-direction: column; gap: 18px;
  transform-style: preserve-3d; will-change: transform;
  transition: border-color .4s;
}
.card:hover { border-color: var(--c); }
.card__link { position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.card__num { font-family: var(--mono); font-size: 13px; color: var(--c); }
.card h3 { font-size: clamp(40px, 4.4vw, 68px); font-weight: 900; letter-spacing: 0; line-height: .95; text-transform: uppercase; }
.card p { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: #c8c7bf; }
.card p em { color: var(--c); font-size: 1.15em; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.tags li {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px;
}
.card:hover .tags li { border-color: var(--c); color: var(--c); }
.card--end {
  border: none; background: none; justify-content: center; align-items: flex-start; gap: 40px;
}

.card__visual {
  position: relative; height: clamp(120px, 26svh, 240px); flex-shrink: 0; border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--c) 25%, transparent), transparent 65%), #0e0e13;
  display: grid; place-items: center;
}
.orb {
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--c) 35%, #000 80%);
  filter: blur(.5px); box-shadow: 0 0 80px var(--c);
}
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: radial-gradient(circle, #000 20%, transparent 75%);
}
.phone {
  width: 110px; height: 200px; border: 2px solid var(--c); border-radius: 22px; padding: 22px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.phone i { height: 22px; border-radius: 8px; background: color-mix(in srgb, var(--c) 40%, transparent); }
.phone i:nth-child(2) { width: 70%; } .phone i:nth-child(4) { width: 45%; }
.rack { display: flex; flex-direction: column; gap: 8px; width: 200px; }
.rack i {
  height: 22px; border: 1px solid var(--c); border-radius: 4px; position: relative;
}
.rack i::after {
  content: ""; position: absolute; right: 8px; top: 7px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 8px var(--c); animation: pulse 1s infinite;
}
.rack i:nth-child(2)::after { animation-delay: .3s; } .rack i:nth-child(4)::after { animation-delay: .6s; }
.wave { display: flex; align-items: center; gap: 10px; height: 140px; }
.wave i { width: 12px; height: 30%; background: var(--c); border-radius: 6px; animation: eq 1s ease-in-out infinite alternate; }
.wave i:nth-child(2n) { animation-delay: -.3s; } .wave i:nth-child(3n) { animation-delay: -.6s; }
.wave i:nth-child(4n) { animation-duration: .7s; }
@keyframes eq { to { height: 100%; } }



/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: 18px 34px; border-radius: 99px; overflow: hidden; isolation: isolate;
  border: 1px solid var(--fg); font-family: var(--mono); text-transform: uppercase; font-size: 14px;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--acid);
  transform: translateY(101%); border-radius: 50% 50% 0 0; transition: transform .5s cubic-bezier(.7,0,.2,1), border-radius .5s;
}
.btn:hover { color: var(--bg); border-color: var(--acid); }
.btn:hover::before { transform: translateY(0); border-radius: 0; }
.btn--big { padding: 28px 56px; font-size: 18px; }

/* ---------- stack ---------- */
.stack { padding: 18vh var(--gutter); }
.stack__list { list-style: none; border-top: 1px solid var(--line); }
.stack__list li {
  display: flex; justify-content: space-between; align-items: center; gap: .35em;
  padding: 2.2vh 0; border-bottom: 1px solid var(--line);
  font-size: clamp(34px, 7.5vw, 124px); font-weight: 900; letter-spacing: 0; line-height: 1; text-transform: uppercase;
  transition: color .3s, padding-left .4s cubic-bezier(.7,0,.2,1);
}
.stack__list li > .scramble-h {
  flex: 1;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stack__logos { display: flex; gap: .25em; flex-shrink: 0; }
.stack__logos i { display: block; width: .7em; height: .7em; transition: transform .5s cubic-bezier(.7,0,.2,1); }
.stack__logos svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.stack__list li:hover { padding-left: 2vw; }
.stack__list li:hover .stack__logos i { transform: rotate(-12deg) scale(1.15); }
.stack__list small { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- infra ---------- */
.infra__pin {
  min-height: 100svh; display: grid; grid-template-columns: 1fr 1.1fr; gap: 5vw;
  padding: 12vh var(--gutter); align-items: center;
}
.infra__svg { width: 100%; max-width: 380px; margin-top: 4vh; overflow: visible; }
.infra__svg path { stroke: var(--acid); stroke-width: 2; }
.infra__svg .draw--2 { stroke: #7d5cff; }
.infra__svg circle { fill: var(--bg); stroke: var(--fg); stroke-width: 2; }
.infra__svg text { fill: var(--fg); font-family: var(--mono); font-size: 13px; }
.term {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #0c0c11;
  box-shadow: 0 40px 120px -40px rgba(198, 255, 61, .25);
}
.term__bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.term__bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term__bar i:nth-child(2) { background: #febc2e; } .term__bar i:nth-child(3) { background: #28c840; }
.term__bar span { margin-left: 10px; font-family: var(--mono); font-size: 12px; color: var(--mute); }
.term__body {
  font-family: var(--mono); font-size: clamp(11px, 1vw, 13px); line-height: 1.7; padding: 18px;
  min-height: 330px; white-space: pre-wrap; word-break: break-word; color: #c8c7bf;
}
.term__body .p { color: var(--acid); }
.term__body .ok { color: #28c840; }
.term__body .caret { display: inline-block; width: .6em; background: var(--acid); animation: pulse .8s steps(1) infinite; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 4vh; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.stat { background: var(--bg); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.stat b { font-size: clamp(32px, 3.4vw, 52px); font-weight: 900; color: var(--acid); letter-spacing: -.03em; }
.stat span { font-family: var(--mono); font-size: 12px; color: var(--mute); text-transform: uppercase; line-height: 1.5; }

/* ---------- contact ---------- */
.contact { position: relative; }
.contact__pin {
  height: 100svh; display: grid; place-items: center; overflow: hidden; position: relative;
}
.contact__giant span { display: inline-block; }
.contact__giant {
  position: absolute; font-size: 36vw; font-weight: 900; letter-spacing: -.01em; white-space: nowrap;
  color: var(--acid); line-height: 1;
}
.contact__body {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 40px;
  text-align: center; padding: 0 var(--gutter);
}
.contact__links { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; justify-content: center; }
.link { font-family: var(--mono); text-transform: uppercase; font-size: 14px; display: inline-block; }

/* ---------- footer ---------- */
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px var(--gutter); border-top: 1px solid var(--line); color: var(--mute);
}

/* ---------- modo fumada (konami) ---------- */
body.fumada { animation: hue 2s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }
.glyph {
  position: fixed; z-index: 95; pointer-events: none; font-weight: 900; color: var(--acid);
  font-size: 28px; top: 0; left: 0;
}

@media (prefers-reduced-motion: reduce) {
  .noise, .blink, .dot, .wave i, .rack i::after { animation: none !important; }
}
.stack__logos i.logo-wide { width: 1.7em; }
.stack__logos .logo-multi svg { fill: initial; }
.stack__logos i.logo-multi { width: .85em; height: .85em; margin: -.075em 0; }
/* la itálica de Bodoni luce mejor (y cabe en móvil) en minúscula */
.big em { text-transform: none; letter-spacing: -.02em; }
.line--outline { letter-spacing: .02em; }
.hero__role em { white-space: nowrap; }
.hero__place { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; display: inline-block; margin-top: .7em; }
.m-br { display: none; }
.hero__place { display: inline-flex; align-items: center; gap: .6em; }
.cross { width: 14px; height: 18px; fill: none; stroke: var(--acid); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.cross path { vector-effect: non-scaling-stroke; }
.card__visual--3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* =====================================================================
   RESPONSIVE
   El layout base es escritorio horizontal. Los modos:
   - "apilado"  → proyectos en columna/rejilla en vez de scroll horizontal
                  (móviles, tablets en vertical y pantallas bajas). El JS
                  usa la misma condición (STACKED en main.js).
   - tablets/móviles en vertical → nombre abajo.
   ===================================================================== */

/* ---- portátiles con poca altura ---- */
@media (min-width: 821px) and (max-height: 760px) {
  .card p { font-size: 12px; line-height: 1.5; }
  .card { gap: 12px; padding: 22px; }
}

/* ---- tablets horizontales y portátiles pequeños (≤ 1199px) ---- */
@media (max-width: 1199px) {
  .nav__links { gap: 20px; }
  .infra__pin { gap: 4vw; }
}

/* ---- modo apilado de proyectos ---- */
@media (max-width: 820px), (max-height: 560px), (orientation: portrait) and (max-width: 1199px) {
  .work__track { flex-direction: column; align-items: stretch; width: auto; height: auto; gap: 24px; padding: 12vh var(--gutter); }
  .work__head { align-self: flex-start; padding-right: 0; }
  .card { width: 100%; height: auto; }
  .card--end { padding: 40px 0; }
}
/* tablets en vertical: rejilla de 2 columnas */
@media (min-width: 600px) and (max-width: 1199px) and (orientation: portrait) {
  .work__track { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .work__head { grid-column: 1 / -1; }
  .card--end { align-items: center; justify-content: center; text-align: center; }
}

/* ---- tablets y móviles en vertical: nombre abajo ---- */
@media (orientation: portrait) and (max-width: 1199px) {
  .hero { padding-bottom: 7svh; }
  /* "ESPINOSA" mide ~3.75em: que siempre quepa en el ancho útil */
  .hero__title { font-size: min(calc((100vw - 2 * var(--gutter)) / 3.85), 22svh); }
  .hero__role { font-size: clamp(20px, 3.6vw, 34px); }
  .hero__place { font-size: clamp(11px, 1.6vw, 14px); }
  .infra__pin { grid-template-columns: 1fr; min-height: 0; }
  .infra__svg { max-width: 420px; margin-inline: auto; display: block; }
}

/* ---- tablets en vertical (iPad, iPad Air, iPad Pro) ---- */
@media (min-width: 600px) and (max-width: 1199px) and (orientation: portrait) {
  .manifesto__text { max-width: 20ch; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .infra__left { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 4vw; }
  .infra__left .big { grid-column: 1; }
  .infra__svg { grid-column: 2; grid-row: 1; margin-top: 0; }
}

/* ---- móviles ---- */
@media (max-width: 720px) {
  .nav__links { display: none; }
  .stack__list small { display: none; }
  .contact__links { gap: 20px 28px; }
  .btn--big { padding: 22px 44px; font-size: 16px; }
  .term__body { min-height: 260px; }
  .footer { justify-content: center; }
}
@media (max-width: 600px) {
  .hero__role em { white-space: normal; }
  .hero__role { font-size: 20px; }
  .m-br { display: inline; }
  .card { padding: 22px; border-radius: 22px; }
  .stat { padding: 18px; }
}
/* móviles pequeños (iPhone SE, 320–380px) */
@media (max-width: 380px) {
  :root { --gutter: 16px; }
  .nav { padding-block: 16px; }
  .nav__logo { font-size: 19px; }
  .nav__clock small { display: none; }
  .hero__kicker { font-size: 10px; }
  .hero__coords { display: none; }
  .stats { grid-template-columns: 1fr; }
  .card p { font-size: 12px; }
}
/* móviles bajitos (SE en vertical) */
@media (orientation: portrait) and (max-height: 700px) and (max-width: 720px) {
  .hero__title { font-size: min(calc((100vw - 2 * var(--gutter)) / 3.85), 19svh); }
}

/* ---- móviles en horizontal (poca altura) ---- */
@media (orientation: landscape) and (max-height: 560px) {
  .hero { height: auto; min-height: 100svh; padding-top: 84px; padding-bottom: 28px; }
  .hero__title { font-size: min(14vw, 26svh); }
  .hero__meta { margin-top: 14px; }
  .hero__role { font-size: 18px; }
  .manifesto, .stack { padding-block: 14vh; }
  .infra__pin { min-height: 0; }
  .contact__body { gap: 22px; }
}
