/* =========================================================
   Mario de Domingo · portfolio
   Dirección: "el nombre como monumento" — color de marca a pantalla
   completa, tres escenas de scroll (stage.js), código que fluye y temas
   ========================================================= */

/* ---------- Color: cada tema define los mismos tokens ---------- */

:root {
  /* Marca (se cambia con data-color) */
  --brand: #ff7a1f;        /* el color caliente */
  --brand-alt: #ffffff;    /* segunda tinta sobre la marca */
  --on-brand: #050f16;     /* texto sobre la marca */

  /* Superficies del modo día */
  --hot: var(--brand);
  --on-hot: var(--on-brand);
  --hot-alt: var(--brand-alt);
  --paper: #ffffff;
  --on-paper: #050f16;
  --soft: #66707a;
  --dark: #050f16;
  --dark-2: #13222c;
  --on-dark: #ffffff;
  --btn: #050f16;
  --on-btn: var(--brand);

  /* Tokens que leen las escenas */
  --ground: var(--hot);
  --ink: var(--on-hot);
  --accent: var(--brand);

  /* Tipo: tres familias */
  --font-display: 'Panchang', 'Arial Black', sans-serif;
  --font-text: 'Switzer', 'Helvetica Neue', Arial, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(1.5rem, 1rem + 1.6vw, 2.25rem);
  --step-display: clamp(1.3rem, 5.4vw, 5.75rem);
  --step-giant: clamp(3rem, 12.4vw, 14rem);

  /* Espacio */
  --margin: clamp(16px, 2.8vw, 40px);
  --section: clamp(96px, 12vw, 200px);

  /* Movimiento */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 280ms;
  --t-theme: 500ms;
}

[data-color="lima"]    { --brand: #c8f53c; --brand-alt: #1f6b34; --on-brand: #0b1a07; }
[data-color="cobalto"] { --brand: #3355ff; --brand-alt: #ffd23f; --on-brand: #ffffff; }
[data-color="rosa"]    { --brand: #ff5fa2; --brand-alt: #ffffff; --on-brand: #1a0510; }
[data-color="rojo"]    { --brand: #e62429; --brand-alt: #050f16; --on-brand: #ffffff; }

/* Modo noche: la marca pasa a ser tinta y los fondos se apagan */
[data-mode="dark"] {
  --hot: #0b1318;
  --on-hot: var(--brand);
  --hot-alt: #eef2f4;
  --paper: #10191f;
  --on-paper: #e4e9ec;
  --soft: #8d979e;
  --dark: #03080b;
  --dark-2: #15232c;
  --on-dark: #eef2f4;
  --btn: var(--brand);
  --on-btn: var(--on-brand);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; background: var(--hot); overflow-x: clip; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--hot);
  color: var(--on-hot);
  font: 400 var(--step-body)/1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

/* Al cambiar de tema sin View Transitions, los colores se funden */
html.is-theming *, html.is-theming *::before, html.is-theming *::after {
  transition: background-color var(--t-theme) ease, color var(--t-theme) ease, border-color var(--t-theme) ease !important;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, p, ul, dl, dd, figure, fieldset, pre { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
code { font-family: var(--font-code); }

:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }
::selection { background: var(--brand); color: var(--on-brand); }

.skip {
  position: absolute; left: var(--margin); top: -100px; z-index: 50;
  background: var(--btn); color: var(--on-btn); padding: 10px 16px; text-decoration: none;
}
.skip:focus { top: var(--margin); }

/* ---------- Piezas comunes ---------- */

.h-small { font: 500 var(--step-head)/1.05 var(--font-text); letter-spacing: -0.02em; }

.link {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.22em;
  transition: text-decoration-color var(--t-hover) ease, color var(--t-hover) ease;
}
.link--line { text-decoration-color: currentColor; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 0 30px;
  background: var(--btn); color: var(--on-btn);
  font: 500 var(--step-body)/1 var(--font-text);
  text-decoration: none; border: 0; border-radius: 0; cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.button:active { transform: scale(0.96); }

@media (hover: hover) and (pointer: fine) {
  .link:hover { text-decoration-color: currentColor; }
  .button:hover { background: var(--on-hot); color: var(--hot); }
}

/* ---------- Cabecera fija ---------- */

.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px var(--margin);
  color: var(--on-hot);
  font-size: var(--step-small);
  font-weight: 500;
  pointer-events: none;
  transition: color 300ms ease, transform 500ms var(--ease-expo);
}
.top.is-hidden { transform: translateY(-110%); }
.top.is-light { color: var(--on-dark); }
.top.is-paper { color: var(--on-paper); }
.top a, .top button { pointer-events: auto; }
.top a { text-decoration-color: transparent; }
.top .link--line { text-decoration-color: currentColor; }
.top__mark { font: 700 var(--step-body)/1 var(--font-display); letter-spacing: -0.04em; text-decoration: none; }
.top__nav { display: flex; align-items: center; gap: 24px; }
.top__tools { display: flex; gap: 8px; margin-left: 4px; }

/* Botones de icono: sol/luna y pincel */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px; padding: 0;
  background: transparent; border: 2px solid currentColor; border-radius: 50%;
  cursor: pointer;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn .icon { transition: transform 600ms var(--ease-expo), opacity 300ms ease; }
.icon-btn[aria-expanded="true"] { background: currentColor; }
.icon-btn[aria-expanded="true"] .icon { stroke: var(--hot); }
.top.is-light .icon-btn[aria-expanded="true"] .icon { stroke: var(--dark); }
.top.is-paper .icon-btn[aria-expanded="true"] .icon { stroke: var(--paper); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover .icon { transform: rotate(-18deg) scale(1.1); } }


/* ---------- Panel de tema ---------- */

.palette {
  position: fixed; z-index: 30; top: 76px; right: var(--margin);
  width: min(360px, calc(100vw - var(--margin) * 2));
  padding: 24px;
  background: var(--paper); color: var(--on-paper);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28); /* taste-skill-ignore: flota sobre la página */
  display: flex; flex-direction: column; gap: 24px;
  transform-origin: calc(100% - 24px) 0;
}
.palette[hidden] { display: none; }
.palette.is-open { animation: palette-in 420ms var(--ease-expo); }
@keyframes palette-in { from { opacity: 0; transform: translateY(-8px) scale(0.92); } }
.palette__group legend { font-size: var(--step-small); color: var(--soft); margin-bottom: 12px; }
.palette__group legend code::before { content: '--'; color: var(--brand); }
.palette__note { font-size: var(--step-small); color: var(--soft); }
.account__title { font: 700 var(--step-lead)/1 var(--font-display); text-transform: uppercase; letter-spacing: -0.03em; }
.account__text { color: var(--soft); }
.account__go { align-self: flex-start; border-radius: 999px; }
.account__go[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.account__estado { display: flex; align-items: center; gap: 8px; font-size: var(--step-small); color: var(--soft); }
.account__estado em { font-style: normal; }
.account__estado span { width: 8px; height: 8px; border-radius: 50%; background: var(--soft); flex: none; }
.account__estado[data-app-estado="comprobando"] span { animation: account-latido 1s ease-in-out infinite alternate; }
.account__estado[data-app-estado="en-linea"] span { background: #2bd576; box-shadow: 0 0 0 4px color-mix(in srgb, #2bd576 22%, transparent); }
.account__estado[data-app-estado="apagado"] span { background: #e5484d; }
.account__estado[data-app-estado="apagado"] + .account__go { opacity: 0.55; cursor: not-allowed; }
@keyframes account-latido { to { opacity: 0.25; } }

/* ---------- Escena 1: portada en 3D ---------- */

/* El lienzo de partículas ocupa toda la pantalla; el texto es poco y va a los bordes */
.hero__stage { position: relative; min-height: 100svh; overflow: clip; }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hero__intro {
  position: absolute; z-index: 2;
  left: var(--margin); bottom: calc(var(--margin) + 8px);
  max-width: min(560px, calc(100% - var(--margin) * 2 - 80px));
  display: flex; flex-direction: column; align-items: flex-start; gap: 28px;
}
.hero__title { display: flex; flex-direction: column; gap: 10px; font-weight: 400; }
.hero__name { font: 700 var(--step-head)/1 var(--font-display); text-transform: uppercase; letter-spacing: -0.03em; }
.hero__role { font: 500 var(--step-lead)/1.25 var(--font-text); }

.hero__cta {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 54px; padding: 0 28px;
  background: var(--btn); color: var(--on-btn);
  border-radius: 999px;
  font: 500 var(--step-body)/1 var(--font-text);
  text-decoration: none;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.hero__cta .icon { width: 18px; height: 18px; transition: transform var(--t-ui) var(--ease-out); }
.hero__cta:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .hero__cta:hover { background: var(--hot-alt); color: var(--on-hot); }
  .hero__cta:hover .icon { transform: translateX(4px); }
}

/* Lo que están formando las partículas, a la derecha */
.hero__steps {
  position: absolute; z-index: 2; right: var(--margin); top: 50%; translate: 0 -50%;
  display: flex; flex-direction: column; align-items: flex-end; gap: 14px;
  list-style: none; font-size: var(--step-small);
}
.hero__steps li { display: flex; align-items: center; gap: 12px; opacity: 0.4; transition: opacity var(--t-ui) ease; }
.hero__steps li::before {
  content: ''; width: 16px; height: 2px; background: currentColor;
  transition: width 500ms var(--ease-expo);
}
.hero__steps li.is-on { opacity: 1; }
.hero__steps li.is-on::before { width: 44px; }

.hero__hint {
  position: absolute; z-index: 2; left: 50%; bottom: calc(var(--margin) + 8px); translate: -50% 0;
  display: flex; align-items: center; gap: 8px;
  font-size: var(--step-small);
}
.hero__hint .icon { width: 16px; height: 16px; }

/* Sin escena (movimiento reducido) o sin WebGL: una portada fija y clara */
.hero:not(.is-live) .hero__steps, .hero:not(.is-live) .hero__hint { display: none; }
.hero.no-webgl .hero__canvas { display: none; }
.hero.no-webgl .hero__intro { top: 50%; bottom: auto; translate: 0 -50%; }
.hero.no-webgl .hero__name { font-size: var(--step-giant); line-height: 0.86; }

/* ---------- Sobre mí ---------- */

.about {
  background: var(--paper); color: var(--on-paper);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px;
  padding: var(--section) var(--margin);
}
.about__side { grid-column: 1 / span 4; }
.about__portrait { width: clamp(160px, 18vw, 240px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: var(--brand); display: block; margin: 32px auto 40px; }
.facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; }
.facts dt { font: 400 var(--step-small)/1.4 var(--font-code); color: var(--soft); }
.facts dt::before { content: '$ '; color: var(--brand); }
[data-color="lima"]:not([data-mode="dark"]) .facts dt::before { color: var(--brand-alt); }
.facts dd { font-weight: 500; text-align: right; }

.about__body { grid-column: 6 / span 7; }
.about__statement {
  font: 500 var(--step-head)/1.15 var(--font-text);
  letter-spacing: -0.02em;
  margin-bottom: 48px;
}
.about__body p:not(.about__statement) { max-width: 60ch; }
.about__body p + p { margin-top: 1em; }
.about__body strong { font-weight: 500; }
.about__body .button { margin-top: 40px; }
.about .button:hover { background: var(--brand); color: var(--on-brand); }

/* ---------- Código que fluye ---------- */

.code {
  background: var(--hot); color: var(--on-hot);
  padding: var(--section) 0;
  overflow: clip;
}
.code__head { padding: 0 var(--margin); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 16px 40px; margin-bottom: 64px; }
.code__title { font: 700 var(--step-display)/0.9 var(--font-display); text-transform: uppercase; letter-spacing: -0.04em; }
.code__note { font-size: var(--step-small); }

.code__rows { display: flex; flex-direction: column; gap: 18px; }
.code__row { display: flex; width: max-content; }
.code__line {
  flex: none;
  font: 400 clamp(1rem, 0.6rem + 1.6vw, 2rem)/1.3 var(--font-code);
  white-space: pre;
  padding-right: 2ch;
}
.code__line .k { color: var(--hot-alt); font-weight: 600; }
.code__line .t { font-weight: 600; }
.code__line .f { text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
.code__line .s { font-style: italic; }
.code__line .c { opacity: 0.6; }

/* Movimiento propio de cada fila; el scroll le añade empuje (main.js) */
@media (prefers-reduced-motion: no-preference) {
  .code__row { animation: flow 48s linear infinite; }
  .code__row[data-speed="-1"] { animation-direction: reverse; animation-duration: 56s; }
  .code__row[data-speed="1.4"] { animation-duration: 38s; }
  .code__rows:hover .code__row { animation-play-state: paused; }
}
@keyframes flow { to { translate: -50% 0; } }

/* ---------- Escena 2: proyectos en horizontal ---------- */

.work { background: var(--dark); color: var(--on-dark); }
.work__stage { padding: var(--section) var(--margin); }

.work__track { display: flex; flex-direction: column; gap: 24px; }

.work__title {
  font: 700 var(--step-giant)/0.86 var(--font-display);
  text-transform: uppercase; letter-spacing: -0.05em;
  color: var(--brand);
  white-space: nowrap;
  margin-bottom: 24px;
}

.panel {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 12px;
  padding: 32px;
  min-height: 360px;
  text-decoration: none;
  background: var(--dark-2);
  color: var(--on-dark);
  transition: background-color var(--t-ui) ease, color var(--t-ui) ease;
}
.panel--hot { background: var(--brand); color: var(--on-brand); }
.panel--paper { background: #ffffff; color: #050f16; }
.panel--shot { background: transparent; padding: 0; }
.panel--more { background: transparent; justify-content: center; color: var(--brand); }

.panel__media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; overflow: clip; margin-bottom: 12px; }
.panel__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; transition: scale 900ms var(--ease-expo); }
.panel__media img:only-child { grid-column: 1 / -1; }
.panel__cover { flex: 1 1 auto; min-height: 0; margin: -32px -32px 8px; overflow: clip; }
.panel__cover img { width: 100%; height: 100%; min-height: 140px; object-fit: cover; transition: scale 900ms var(--ease-expo); }

.panel__name { font: 700 var(--step-head)/0.9 var(--font-display); text-transform: uppercase; letter-spacing: -0.04em; }
.panel__meta { font: 400 var(--step-small)/1.4 var(--font-code); }
.panel__meta::before { content: '> '; }
.panel__text { max-width: 38ch; }
.panel--more .panel__name { font-size: clamp(2rem, 4vw, 4.25rem); white-space: nowrap; }
.panel__go {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
  margin-top: 12px; padding: 12px 20px;
  border: 2px solid currentColor; border-radius: 999px;
  font: 500 var(--step-body)/1 var(--font-text);
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.panel__go .icon { width: 18px; height: 18px; transition: transform var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .panel--more:hover .panel__go { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
  .panel--more:hover .panel__go .icon { transform: rotate(45deg); }
}

@media (hover: hover) and (pointer: fine) {
  .panel:hover :is(.panel__media, .panel__cover) img { scale: 1.04; }
  .panel--hot:hover { background: #ffffff; color: #050f16; }
  .panel--paper:hover { background: var(--brand); color: var(--on-brand); }
}

/* En vivo: una pista horizontal empujada por el scroll */
.work.is-live .work__stage { padding: 0; }
.work.is-live .work__track {
  flex-direction: row; align-items: stretch; gap: 2vw;
  height: 100svh; width: max-content;
  padding: 12svh 6vw 10svh var(--margin);
}
.work.is-live .work__title { align-self: center; margin: 0 4vw 0 0; }
.work.is-live .panel { width: 30vw; min-height: 0; height: 58svh; align-self: flex-start; }
.work.is-live .panel--low { align-self: flex-end; }
.work.is-live .panel--shot { width: 52vw; height: auto; }
.work.is-live .panel--shot.panel--low { width: 40vw; }
.work.is-live .panel--more { width: auto; min-width: 24vw; height: auto; align-self: center; }

/* ---------- Área privada: el proyecto de casa ---------- */

.casa { position: relative; overflow: clip; background: var(--dark); color: var(--on-dark); padding: var(--section) var(--margin); }
/* un halo del color de marca detrás del escaparate */
.casa::before {
  content: ''; position: absolute; inset: 18% -20% auto; height: 70%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 28%, transparent), transparent);
  filter: blur(40px); opacity: 0.8;
}
.casa > * { position: relative; }
.casa__head { display: grid; gap: 24px; margin-bottom: clamp(48px, 7vw, 96px); }
.casa__kicker { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 10px; font-size: var(--step-small); color: var(--brand); }
.casa__punto { width: 10px; height: 10px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6); animation: latido 2s ease-out infinite; }
@keyframes latido { 70% { box-shadow: 0 0 0 12px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }
.casa__title { font: 700 var(--step-giant)/0.84 var(--font-display); text-transform: uppercase; letter-spacing: -0.05em; color: var(--brand); }
.casa__lead { justify-self: end; font-size: var(--step-lead); line-height: 1.35; max-width: 40ch; }
.casa__lead em { font-style: normal; color: var(--brand); white-space: nowrap; }

/* escaparate: el portátil con dos móviles y el chat de Telegram delante */
.casa__escaparate { position: relative; max-width: 1400px; margin: 0 auto; padding: 0 8% 120px 0; }
.casa__portatil { margin: 0; border-radius: 16px; overflow: hidden; background: #0b1318; border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 50px 120px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.4); }
.casa__barra { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: #121c22; font: 400 12px/1 var(--font-code); color: #8d979e; }
.casa__barra i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.casa__barra i:nth-child(2) { background: #febc2e; }
.casa__barra i:nth-child(3) { background: #28c840; }
.casa__barra b { font-weight: 400; margin-left: 10px; }
.casa__portatil img { display: block; width: 100%; height: auto; }
.casa__movil { position: absolute; margin: 0; width: clamp(130px, 17vw, 250px); border-radius: 34px; overflow: hidden; border: 7px solid #10171c; background: #10171c; box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.85); }
.casa__movil img { display: block; width: 100%; height: auto; border-radius: 27px; }
.casa__movil--a { right: 0; bottom: 0; }
.casa__movil--b { right: clamp(110px, 15vw, 230px); bottom: -40px; width: clamp(110px, 14vw, 210px); }
.casa__chat {
  position: absolute; left: -2%; bottom: 10px; width: min(360px, 44%);
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 20px;
  background: rgba(16, 25, 31, 0.86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  font: 400 14px/1.4 var(--font-text);
}
.casa__chat-cab { font: 500 12px/1 var(--font-code); color: #8d979e; margin-bottom: 4px; }
.burbuja { max-width: 88%; padding: 9px 12px; border-radius: 16px 16px 16px 4px; background: #1d2a33; color: #eef2f4; }
.burbuja--yo { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: #2b5278; }
.burbuja b { font-weight: 600; }
.burbuja__botones { display: flex; gap: 6px; margin-top: -2px; }
.burbuja__botones span { flex: 1; text-align: center; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: #eef2f4; font-size: 13px; }

/* cifras */
.casa__cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: clamp(64px, 8vw, 120px) 0 clamp(40px, 5vw, 72px); padding: 0; list-style: none; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.casa__cifras li { display: flex; flex-direction: column; gap: 8px; padding-top: 24px; }
.casa__cifras b { font: 700 clamp(2.4rem, 6vw, 5.5rem)/0.9 var(--font-display); letter-spacing: -0.05em; color: var(--brand); }
.casa__cifras span { font-size: var(--step-small); color: #8d979e; }

/* módulos */
.casa__modulos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.modulo { display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: 20px; background: var(--dark-2); transition: transform var(--t-ui) var(--ease-out); }
.modulo__ico { font-size: 28px; line-height: 1; }
.modulo h3 { font: 700 var(--step-body)/1 var(--font-display); text-transform: uppercase; letter-spacing: -0.02em; }
.modulo p { font-size: 15px; line-height: 1.5; color: color-mix(in srgb, var(--on-dark) 72%, transparent); }
.modulo--hot { background: var(--brand); color: var(--on-brand); }
.modulo--hot p { color: inherit; opacity: 0.85; }
@media (hover: hover) and (pointer: fine) { .modulo:hover { transform: translateY(-6px); } }

/* servicios conectados */
.casa__conectado { margin-top: clamp(56px, 7vw, 100px); }
.casa__conectado .h-small { margin-bottom: 24px; }
.conectados { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; list-style: none; }
.conectados li { padding: 12px 20px; border-radius: 999px; border: 2px solid var(--brand); font: 500 var(--step-body)/1 var(--font-text); transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
@media (hover: hover) and (pointer: fine) { .conectados li:hover { background: var(--brand); color: var(--on-brand); } }
.casa__stack { margin-top: 28px; font-size: var(--step-small); color: #8d979e; }

@media (max-width: 1000px) {
  .casa__lead { justify-self: start; }
  .casa__modulos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* debajo del portátil, el móvil y el chat uno al lado del otro */
  .casa__escaparate { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); gap: 16px; align-items: center; padding: 0; }
  .casa__portatil { grid-column: 1 / -1; }
  .casa__movil--a { position: relative; inset: auto; width: auto; }
  .casa__chat { position: relative; left: auto; bottom: auto; width: auto; max-width: none; }
  .casa__movil--b { display: none; }
}
@media (max-width: 600px) {
  .casa__cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .casa__modulos { grid-template-columns: 1fr; }
  .casa__movil--a { border-width: 5px; border-radius: 22px; }
  .casa__movil--a img { border-radius: 17px; }
  .casa__chat { padding: 12px; font-size: 12.5px; }
  .burbuja { max-width: 100%; }
  .casa__lead em { white-space: normal; }
}

/* ---------- Stack ---------- */

.stack { background: var(--hot); color: var(--on-hot); padding: var(--section) var(--margin); }
.stack .h-small { margin-bottom: 40px; }
.stack__label { font-size: var(--step-small); margin: 16px 0 0; }
.stack__label + .lineup { margin-top: 56px; }

.lineup { display: flex; flex-wrap: wrap; gap: 0 0.35em; font: 700 var(--step-display)/1.02 var(--font-display); text-transform: uppercase; letter-spacing: -0.04em; }
.lineup li { display: flex; align-items: baseline; gap: 0.35em; }
.lineup li:not(:last-child)::after { content: '/'; color: var(--hot-alt); }
.lineup--more { font: 400 var(--step-lead)/1.5 var(--font-code); text-transform: none; letter-spacing: 0; gap: 0 0.8em; }
.lineup--more li:not(:last-child)::after { content: ','; }
.lineup button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  transition: color var(--t-hover) ease;
}
.lineup button[aria-pressed="true"] { color: var(--hot-alt); }
@media (hover: hover) and (pointer: fine) { .lineup button:hover { color: var(--hot-alt); } }

.stack__hint { margin-top: 48px; font-size: var(--step-lead); font-weight: 500; min-height: 1.4em; }

/* ---------- Escena 3: vuelo entre las fotos ---------- */

.photos { background: var(--dark); color: var(--on-dark); }
.photos__stage { padding: var(--section) var(--margin); }

.photos__title {
  font: 700 var(--step-giant)/0.86 var(--font-display);
  text-transform: uppercase; letter-spacing: -0.05em;
  color: var(--brand);
  margin-bottom: 48px;
}
.photos__field { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.photos__field img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.photos__note { margin-top: 32px; font-size: var(--step-lead); }

.photos.is-live .photos__stage { padding: 0; perspective: 900px; }
.photos.is-live .photos__title {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0; text-align: center; white-space: nowrap; z-index: 2;
  pointer-events: none;
}
.photos.is-live .photos__field { position: absolute; inset: 0; z-index: 1; display: block; transform-style: preserve-3d; }
.photos.is-live .photos__field img {
  position: absolute; left: var(--x); top: var(--y);
  width: clamp(88px, min(17vw, 26svh), 300px);
  aspect-ratio: 3 / 4; object-fit: cover;
  translate: -50% -50%;
  opacity: 0;
}
.photos.is-live .photos__note {
  position: absolute; left: var(--margin); bottom: 40px; margin: 0; z-index: 3;
  max-width: calc(100% - var(--margin) * 2 - 88px);
  padding: 10px 16px; background: var(--dark);
}

/* ---------- Galería ---------- */

.gallery { background: var(--dark); color: var(--on-dark); padding: var(--section) var(--margin); }
.gallery__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 32px; margin-bottom: 32px; }
.gallery__count { font-size: var(--step-small); color: var(--brand); }
.gallery__filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.gallery__filters button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  background: transparent; color: var(--on-dark);
  border: 1.5px solid color-mix(in srgb, var(--on-dark) 35%, transparent); border-radius: 999px;
  font-weight: 500; cursor: pointer;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, border-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.gallery__filters button code { font-size: var(--step-small); opacity: 0.6; }
.gallery__filters button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.gallery__filters button:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .gallery__filters button:hover { border-color: var(--brand); } }

/* mosaico en columnas: cada foto conserva su proporción */
.gallery__grid { columns: 4 240px; column-gap: 12px; }
/* plegada: se ven unas pocas filas que se desvanecen; el botón la abre entera */
.gallery__wrap.is-collapsed { max-height: min(820px, 120svh); overflow: hidden; -webkit-mask: linear-gradient(#000 60%, transparent); mask: linear-gradient(#000 60%, transparent); }
.gallery__wrap.is-collapsed.is-short { -webkit-mask: none; mask: none; }
.gallery__more[hidden] { display: none; }
.gallery__more { display: flex; justify-content: center; margin-top: 8px; }
.gallery__wrap:not(.is-collapsed) + .gallery__more { margin-top: 40px; }
.gallery__toggle { border-radius: 999px; gap: 10px; }
.gallery__toggle .icon { width: 18px; height: 18px; transition: transform 500ms var(--ease-expo); }
.gallery__toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.shot { break-inside: avoid; margin-bottom: 12px; }
.shot[hidden] { display: none; }
.shot button { display: block; width: 100%; padding: 0; border: 0; background: var(--dark-2); cursor: zoom-in; overflow: hidden; border-radius: 4px; }
.shot img { width: 100%; height: auto; transition: transform 700ms var(--ease-expo), filter 400ms ease; }
@media (hover: hover) and (pointer: fine) {
  .shot button:hover img { transform: scale(1.06); }
  .gallery__grid:has(.shot button:hover) .shot button:not(:hover) img { filter: saturate(0.4) brightness(0.7); }
}

/* visor */
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0;
  padding: 64px 72px 72px; border: 0;
  background: transparent; color: var(--on-dark);
  overflow: hidden;
}
.viewer[open] { display: grid; place-items: center; animation: palette-in 420ms var(--ease-expo); }
.viewer::backdrop { background: rgba(3, 8, 11, 0.92); } /* taste-skill-ignore: fondo del visor */
.viewer__img { max-width: 100%; max-height: calc(100dvh - 160px); width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.viewer__caption { position: absolute; left: 72px; right: 72px; bottom: 22px; display: flex; justify-content: space-between; gap: 16px; font-size: var(--step-small); }
.viewer__caption code { color: var(--brand); white-space: nowrap; }
.viewer__btn { position: absolute; color: var(--on-dark); }
.viewer__btn--close { top: 16px; right: 16px; }
.viewer__btn--prev { left: 16px; top: 50%; translate: 0 -50%; }
.viewer__btn--next { right: 16px; top: 50%; translate: 0 -50%; }

/* ---------- Controles del panel de tema ---------- */

.segmented { display: inline-flex; background: var(--dark-2); padding: 6px; border-radius: 999px; }
.segmented button {
  min-height: 48px; padding: 0 24px;
  background: transparent; border: 0; border-radius: 999px;
  color: var(--on-dark); font-weight: 500; cursor: pointer;
  transition: background-color var(--t-ui) var(--ease-out), color var(--t-ui) ease;
}
.segmented button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.segmented button:active { transform: scale(0.96); }

.swatches { display: flex; flex-wrap: wrap; gap: 14px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: var(--step-small); font-weight: 500;
}
.swatch::before {
  content: ''; width: 50px; height: 50px; border-radius: 50%;
  background: var(--sw);
  outline: 3px solid transparent; outline-offset: 4px;
  transition: transform var(--t-ui) var(--ease-out), outline-color var(--t-ui) ease;
}
.swatch[aria-pressed="true"]::before { outline-color: var(--on-paper); }
@media (hover: hover) and (pointer: fine) { .swatch:hover::before { transform: scale(1.08); } }
.swatch:active::before { transform: scale(0.92); }

/* Transición circular al cambiar de tema (View Transitions) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: reveal-theme 800ms var(--ease-in-out); }
@keyframes reveal-theme { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 50%)); } to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 50%)); } }

/* ---------- Contacto: bocadillo y viñetas de cómic ---------- */

.contact {
  position: relative; isolation: isolate;
  background: var(--hot); color: var(--on-hot);
  padding: var(--section) var(--margin); overflow: clip;
}
/* trama de puntos y líneas de acción, como en una viñeta */
.contact::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--on-hot) 26%, transparent) 1.5px, transparent 1.8px) 0 0 / 14px 14px,
    repeating-conic-gradient(from 0deg at 22% 18%, color-mix(in srgb, var(--hot-alt) 22%, transparent) 0deg 4deg, transparent 4deg 13deg);
  -webkit-mask: radial-gradient(120% 90% at 22% 18%, #000 20%, transparent 75%);
          mask: radial-gradient(120% 90% at 22% 18%, #000 20%, transparent 75%);
}
.contact__top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 40px 24px; align-items: center; }
.contact__title { grid-column: 1 / -1; font-weight: 400; }
.contact__bubble {
  position: relative; display: inline-block;
  padding: 0.32em 0.5em 0.36em;
  background: var(--paper); color: var(--on-paper);
  border: 4px solid var(--on-hot); border-radius: 50% / 46%;
  box-shadow: 10px 10px 0 var(--on-hot);
  font: 700 clamp(1.75rem, 6.6vw, 7rem)/0.9 var(--font-display);
  text-transform: uppercase; letter-spacing: -0.05em; white-space: nowrap;
  rotate: -3deg;
}
/* la cola del bocadillo */
.contact__bubble::after {
  content: ''; position: absolute; left: 22%; bottom: -0.42em;
  width: 0.5em; height: 0.5em;
  background: var(--paper);
  border-right: 4px solid var(--on-hot); border-bottom: 4px solid var(--on-hot);
  transform: skewY(36deg) rotate(18deg);
}
.contact__bubble [data-rise] { display: inline-block; }
.contact__side { grid-column: 7 / span 6; display: flex; flex-direction: column; gap: 20px; }
.contact__lead { max-width: 40ch; font-size: var(--step-lead); line-height: 1.35; }
.contact__status { display: flex; align-items: center; gap: 12px; font-size: var(--step-small); }
.contact__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--hot-alt); }

.contact__cards {
  list-style: none;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px;
  margin-top: clamp(72px, 8vw, 120px);
}
.card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 28px;
  background: var(--paper); color: var(--on-paper);
  border: 3px solid var(--on-hot);
  box-shadow: 8px 8px 0 var(--on-hot);
  transition: translate var(--t-ui) var(--ease-out), box-shadow var(--t-ui) var(--ease-out);
}
.card:nth-child(2) { rotate: 1deg; }
.card:nth-child(3) { rotate: -1deg; }
.card__tag { font-size: var(--step-small); color: var(--soft); }
.card__name { font: 700 clamp(1.15rem, 0.5rem + 1.25vw, 1.9rem)/1 var(--font-display); overflow-wrap: anywhere; text-transform: uppercase; letter-spacing: -0.04em; }
.card__text { color: var(--soft); overflow-wrap: anywhere; flex: 1; }
.card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.card .button { background: var(--on-paper); color: var(--paper); min-height: 48px; padding: 0 22px; }
.card__copy {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  background: none; color: inherit; border: 2px solid currentColor; cursor: pointer;
  font: 500 var(--step-body)/1 var(--font-text);
  transition: transform var(--t-press) var(--ease-out);
}
.card__copy:active { transform: scale(0.96); }
.card__copy .icon { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) {
  .card:hover { translate: -4px -4px; box-shadow: 12px 12px 0 var(--on-hot); }
  .card .button:hover { background: var(--brand); color: var(--on-brand); }
  .card__copy:hover { color: var(--brand); }
}
[data-color="lima"]:not([data-mode="dark"]) .card__copy:hover { color: var(--brand-alt); }

/* ---------- Redes ---------- */

.social { background: var(--paper); color: var(--on-paper); padding: var(--section) var(--margin); }
.social .h-small { margin-bottom: 48px; }
.social__list { display: flex; flex-direction: column; gap: 8px; }
.social__row {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 4fr 3fr 4fr auto; align-items: center; gap: 24px;
  padding: 22px 24px;
  border-radius: 20px;
  background: rgba(127, 127, 127, 0.1);
  text-decoration: none;
  overflow: clip;
  transition: color 400ms var(--ease-out);
}
.social__row::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--brand);
  clip-path: inset(100% 0 0 0);
  transition: clip-path 500ms var(--ease-expo);
}
.social__name { font: 700 var(--step-head)/1 var(--font-display); text-transform: uppercase; letter-spacing: -0.04em; transition: translate 500ms var(--ease-expo); }
.social__handle { font-size: var(--step-small); }
.social__what { color: var(--soft); transition: color 400ms ease; }
.social__arrow { width: 32px; height: 32px; transition: transform 500ms var(--ease-expo); }
@media (hover: hover) and (pointer: fine) {
  .social__row:hover { color: var(--on-brand); }
  .social__row:hover::before { clip-path: inset(0); }
  .social__row:hover .social__name { translate: 12px 0; }
  .social__row:hover .social__what { color: var(--on-brand); }
  .social__row:hover .social__arrow { transform: rotate(45deg); }
}
.social__row:focus-visible { color: var(--on-brand); outline-offset: 2px; }
.social__row:focus-visible::before { clip-path: inset(0); }

/* ---------- Recorrido automático ---------- */

.tour {
  position: fixed; z-index: 25; right: var(--margin); bottom: var(--margin);
  display: flex; align-items: center; gap: 8px;
  height: 64px; padding: 0 24px 0 0;
  background: var(--btn); color: var(--on-btn);
  border: 0; border-radius: 999px;
  font: 600 var(--step-small)/1 var(--font-code);
  cursor: pointer;
  transition: transform var(--t-press) var(--ease-out);
}
.tour:active { transform: scale(0.94); }
.tour__ring { width: 64px; height: 64px; rotate: -90deg; flex: none; }
.tour__ring circle { fill: none; stroke: currentColor; stroke-width: 3; }
.tour__ring circle:first-child { opacity: 0.25; }
.tour__progress { stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--progress, 0) * 100); stroke-linecap: round; }
.tour .icon { position: absolute; left: 22px; width: 20px; height: 20px; fill: currentColor; stroke: none; transition: opacity 200ms ease, transform 300ms var(--ease-out); }
.tour__pause { opacity: 0; transform: scale(0.6); }
.tour[aria-pressed="true"] .tour__play { opacity: 0; transform: scale(0.6); }
.tour[aria-pressed="true"] .tour__pause { opacity: 1; transform: none; }

/* ---------- Pie ---------- */

.footer { background: var(--dark); color: var(--on-dark); padding: clamp(64px, 8vw, 112px) var(--margin) 32px; }
.footer__grid {
  display: grid; grid-template-columns: 5fr 2fr 2fr 2fr; gap: 40px 32px;
  padding-bottom: clamp(48px, 6vw, 80px);
}
.footer__mark { display: inline-block; font: 700 var(--step-head)/1 var(--font-display); letter-spacing: -0.04em; color: var(--brand); text-decoration: none; }
.footer__brand p { margin-top: 20px; max-width: 36ch; color: var(--soft); }
.footer__head { font-size: var(--step-small); font-weight: 400; color: var(--soft); margin-bottom: 18px; }
.footer__head code::before { content: '// '; color: var(--brand); }
.footer__col ul { display: flex; flex-direction: column; gap: 10px; }
.footer__col time { font-family: var(--font-code); }
.footer__bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px 32px;
  padding: 24px 190px 0 0;
  border-top: 1px solid rgba(127, 127, 127, 0.25); /* taste-skill-ignore: separador del pie */
  font-size: var(--step-small); color: var(--soft);
}
.footer__top { display: inline-flex; align-items: center; gap: 8px; color: var(--on-dark); }
.footer__top .icon { width: 16px; height: 16px; transition: transform var(--t-ui) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .footer__col a:hover, .footer__top:hover { color: var(--brand); }
  .footer__top:hover .icon { transform: translateY(-3px); }
}

/* ---------- Fondos de cómic y código ---------- */

/* Portada: trama de puntos que se desvanece y rayos de acción detrás de las partículas */
.hero__stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--on-hot) 18%, transparent) 1.4px, transparent 1.7px) 0 0 / 16px 16px,
    repeating-conic-gradient(from 0deg at 62% 50%, color-mix(in srgb, var(--hot-alt) 10%, transparent) 0deg 3deg, transparent 3deg 12deg);
  -webkit-mask: radial-gradient(70% 70% at 62% 50%, transparent 18%, #000 60%, transparent 100%);
          mask: radial-gradient(70% 70% at 62% 50%, transparent 18%, #000 60%, transparent 100%);
}

/* Fotos: cámara, focos y carrete en 3D (photo3d.js) detrás de las fotos, y el destello del flash */
.photos__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; display: none; }
.photos.is-live .photos__canvas { display: block; }
.photos__flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; background: radial-gradient(circle at 22% 78%, #fff, rgba(255, 255, 255, 0.35) 45%, transparent 80%); } /* taste-skill-ignore: luz del flash */
.photos__flash.is-on { animation: flash 700ms var(--ease-out); }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: 0.32; } 100% { opacity: 0; } }

/* Fotos: trama del color de marca sobre el fondo oscuro */
.photos { position: relative; isolation: isolate; }
.photos::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 30%, transparent) 1.4px, transparent 1.7px) 0 0 / 18px 18px;
  -webkit-mask: radial-gradient(80% 70% at 50% 50%, #000, transparent 80%);
          mask: radial-gradient(80% 70% at 50% 50%, #000, transparent 80%);
}

/* Stack: código de verdad, muy tenue, como papel pintado */
.stack { position: relative; isolation: isolate; overflow: clip; }
.bg-code {
  position: absolute; z-index: -1; top: var(--section); right: var(--margin);
  margin: 0; max-width: 60%;
  font: 400 clamp(0.75rem, 0.6rem + 0.4vw, 1rem)/1.7 var(--font-code);
  white-space: pre; opacity: 0.16; pointer-events: none; user-select: none;
  -webkit-mask: linear-gradient(90deg, transparent, #000 30%);
          mask: linear-gradient(90deg, transparent, #000 30%);
}

/* Código que fluye: onomatopeyas de cómic */
.code { position: relative; }
.code__fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.pow {
  position: absolute;
  display: grid; place-items: center;
  width: clamp(110px, 12vw, 190px); aspect-ratio: 1;
  background: var(--hot-alt); color: var(--on-hot);
  font: 700 clamp(0.85rem, 0.6rem + 0.8vw, 1.4rem)/1 var(--font-display);
  text-transform: uppercase; letter-spacing: -0.03em;
  clip-path: polygon(50% 0, 61% 22%, 85% 10%, 79% 36%, 100% 44%, 80% 58%, 92% 83%, 66% 77%, 56% 100%, 44% 79%, 18% 92%, 22% 66%, 0 54%, 20% 42%, 8% 16%, 36% 22%);
  filter: drop-shadow(5px 5px 0 var(--on-hot));
}
.pow--a { top: 6%; right: 8%; rotate: 10deg; }
.pow--b { bottom: 2%; left: 6%; rotate: -12deg; }
.pow--c { bottom: 2%; right: 30%; rotate: 6deg; }

/* ---------- Tableta ---------- */

@media (max-width: 1024px) {
  .footer__grid { grid-template-columns: 2fr 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
  .work.is-live .panel { width: 46vw; }
  .work.is-live .panel--shot, .work.is-live .panel--shot.panel--low { width: 72vw; }
  .work.is-live .panel--more { min-width: 40vw; }
  .about { row-gap: 80px; }
  .about__side { grid-column: 1 / span 12; }
  .about__body { grid-column: 1 / span 12; }
  .contact__side { grid-column: 1 / -1; }
  .contact__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact__cards .card:last-child { grid-column: 1 / -1; }
  .social__row { grid-template-columns: 1fr auto; gap: 6px 16px; }
  .social__handle { grid-row: 2; }
  .social__what { display: none; }
  .social__arrow { grid-column: 2; grid-row: 1 / span 2; }
}

/* ---------- Teléfono ---------- */

@media (max-width: 767px) {
  :root { --step-giant: 12.4vw; }
  .top__opt { display: none; }
  .top__nav { gap: 14px; }

  .hero__steps { top: 84px; translate: none; left: var(--margin); right: var(--margin); flex-direction: row; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
  .hero__steps li::before { width: 10px; }
  .hero__steps li.is-on::before { width: 24px; }
  .hero__hint { display: none; }
  .hero__intro { gap: 20px; }
  .work__title { font-size: 10vw; }

  .code__head { margin-bottom: 40px; }

  /* En el teléfono los proyectos son una lista: sin cajas, con aire entre ellos */
  .work__track { gap: 56px; }
  .panel, .panel--hot, .panel--paper { min-height: 0; padding: 0; background: none; color: var(--on-dark); }
  .panel--hot .panel__name { color: var(--brand); }
  .panel__media { grid-template-columns: 1fr; }
  .panel__cover { margin: 0 0 8px; }
  .panel__cover img { height: auto; aspect-ratio: 4 / 3; }

  .photos__field { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact__cards { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .gallery__grid { columns: 2; column-gap: 8px; }
  .gallery__wrap.is-collapsed { max-height: 640px; }
  .shot { margin-bottom: 8px; }
  .viewer { padding: 56px 12px 80px; }
  .viewer__btn--prev, .viewer__btn--next { top: auto; bottom: 16px; translate: none; }
  .viewer__caption { left: 64px; right: 64px; bottom: 24px; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
  .card { rotate: none !important; padding: 22px; }
  .bg-code { max-width: none; left: var(--margin); opacity: 0.1; }
  .pow { width: 92px; }
  .pow--c { display: none; }
  .pow--a { top: 3%; right: 4%; }
  .photos.is-live .photos__field img { width: min(36vw, 22svh); }

  .segmented button { padding: 0 16px; }
  .top { padding: 14px var(--margin); }
  .top__nav { gap: 10px; }
  .top__tools { gap: 6px; margin-left: 2px; }
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn .icon { width: 18px; height: 18px; }
  .tour { height: 56px; padding: 0; }
  .tour__ring { width: 56px; height: 56px; }
  .tour .icon { left: 18px; }
  .tour__label { display: none; }
  .palette { top: 68px; }

  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
  .footer__bar { padding-right: 72px; }
}

/* Teléfonos muy estrechos */
@media (max-width: 380px) {
  .top__opt2 { display: none; }
}

/* Pantallas bajas (móvil en horizontal, portátiles pequeños) */
@media (max-height: 520px) and (min-width: 560px) {
  .hero__steps { top: 50%; translate: 0 -50%; left: auto; flex-direction: column; align-items: flex-end; }
  .hero__intro { gap: 14px; }
  .hero__hint { display: none; }
  .photos.is-live .photos__title { font-size: min(12.4vw, 22svh); }
}

/* ---------- Movimiento fuera de las escenas ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .hero [data-load] { opacity: 0; transform: translateY(14px); animation: rise 600ms var(--ease-out) forwards; animation-delay: var(--d); }
  .hero__hint .icon { animation: nudge 1.6s var(--ease-in-out) infinite; }

  .js [data-reveal] {
    opacity: 0; transform: translateY(28px);
    transition: opacity 700ms var(--ease-out), transform 1000ms var(--ease-expo);
    transition-delay: calc(var(--i, 0) * 80ms);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }

  .js .contact__bubble { scale: 0.4; opacity: 0; transition: scale 900ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 300ms ease; }
  .js .contact__title.is-in .contact__bubble { scale: 1; opacity: 1; }
  .pow { animation: pow-wobble 2.8s var(--ease-in-out) infinite alternate; }
  .pow--b { animation-delay: -0.9s; }
  .pow--c { animation-delay: -1.8s; }
  .contact__dot { animation: pulse 2s var(--ease-out) infinite; }


  .js .lineup li { opacity: 0; transform: translateY(40%); transition: opacity 600ms var(--ease-out), transform 900ms var(--ease-expo); transition-delay: calc(var(--i, 0) * 60ms); }
  .js .lineup.is-in li { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-new(root) { animation: none; }
}

@keyframes line-up { to { transform: none; } }
@keyframes pow-wobble { to { transform: scale(1.08) rotate(-4deg); } }
@keyframes nudge { 50% { transform: translateY(4px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70%, 100% { box-shadow: 0 0 0 10px transparent; } } /* taste-skill-ignore: latido del punto de disponible */
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Inclinación 3D de tarjetas (main.js pone --rx/--ry al mover el ratón) ---------- */

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  [data-tilt] {
    position: relative;
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transform-style: preserve-3d;
    transition: transform 500ms var(--ease-out), background-color var(--t-ui) ease, color var(--t-ui) ease;
  }
  [data-tilt]:hover { transition: transform 120ms linear, background-color var(--t-ui) ease, color var(--t-ui) ease; }
  .panel[data-tilt] .panel__name, .panel[data-tilt] .panel__media, .panel[data-tilt] .panel__cover { transform: translateZ(40px); }
  /* brillo que sigue al cursor */
  .panel[data-tilt]::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.22), transparent 55%); /* taste-skill-ignore: brillo del cursor */
    opacity: 0; transition: opacity var(--t-ui) ease;
  }
  .panel[data-tilt]:hover::after { opacity: 1; }
}

/* ---------- Página de aviso legal y privacidad ---------- */

body.legal { background: var(--paper); color: var(--on-paper); }
.legal__top { display: flex; justify-content: space-between; align-items: center; padding: 20px var(--margin); font-size: var(--step-small); font-weight: 500; }
.legal__body { max-width: 760px; margin: 0 auto; padding: clamp(48px, 8vw, 120px) var(--margin); display: flex; flex-direction: column; gap: 48px; }
.legal__kicker { font-size: var(--step-small); color: var(--soft); margin-bottom: -32px; }
.legal__title { font: 700 clamp(2rem, 6vw, 4.5rem)/0.95 var(--font-display); text-transform: uppercase; letter-spacing: -0.04em; }
.legal__body section { display: flex; flex-direction: column; gap: 16px; }
.legal__body h2 { font: 700 var(--step-head)/1.05 var(--font-display); text-transform: uppercase; letter-spacing: -0.03em; }
.legal__body h2::before { content: '// '; font: 600 var(--step-small)/1 var(--font-code); color: var(--brand); vertical-align: middle; }
.legal__body ul { display: flex; flex-direction: column; gap: 12px; padding-left: 1.2em; list-style: square; }
.legal__body li::marker { color: var(--brand); }
.legal__body strong { font-weight: 500; }
.legal__foot { padding: 32px var(--margin); background: var(--dark); color: var(--on-dark); font-size: var(--step-small); }

/* galería: nace oculta y solo aparece si la zona privada (equipo de casa) responde */
.gallery[hidden], [data-needs-gallery][hidden], .gallery__filters[hidden] { display: none !important; }
.shot img { background: var(--dark-2); }

/* equipo de casa en directo (solo aparece si la zona privada responde y lo tengo activado) */
.vivo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; width: fit-content; max-width: 100%; margin: 0 0 28px; padding: 10px 16px; border-radius: 999px; background: var(--dark-2); font-family: var(--mono, 'JetBrains Mono', monospace); font-size: var(--step-small); }
.vivo[hidden] { display: none; }
.vivo b { font-weight: 600; }
.vivo__punto { width: 9px; height: 9px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgb(61 220 132 / .55); animation: vivo-late 2s ease-out infinite; }
.vivo__datos { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: color-mix(in srgb, currentColor 78%, transparent); }
.vivo__datos[hidden] { display: none; }
.vivo__datos b { color: var(--brand); font-variant-numeric: tabular-nums; }
.vivo__spark { width: 84px; height: 24px; overflow: visible; }
.vivo__spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: all 600ms ease; }
@keyframes vivo-late { 70% { box-shadow: 0 0 0 9px rgb(61 220 132 / 0); } 100% { box-shadow: 0 0 0 0 rgb(61 220 132 / 0); } }
@media (prefers-reduced-motion: reduce) { .vivo__punto { animation: none; } .vivo__spark polyline { transition: none; } }

/* gemelo 3D del servidor */
.gemelo { margin: 0 0 32px; max-width: 760px; border-radius: 22px; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 16%, var(--dark-2)), var(--dark-2)); transition: background 800ms ease; }
.gemelo[hidden] { display: none; }
.gemelo[data-luz='dia'] { background: radial-gradient(120% 90% at 50% 0%, #cfe6ff, color-mix(in srgb, var(--brand) 12%, #1b2430)); }
.gemelo canvas { display: block; width: 100%; aspect-ratio: 16 / 10; }
.gemelo figcaption { padding: 10px 16px 14px; font-size: var(--step-small); color: color-mix(in srgb, currentColor 70%, transparent); }

/* galería: pestañas y globo */
.gallery__tabs { display: flex; gap: 8px; margin: 0 0 18px; }
.gallery__tabs[hidden], .gallery__globo[hidden], .globo__tarjeta[hidden] { display: none; }
.gallery__tabs button { padding: 8px 18px; border-radius: 999px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.gallery__tabs button[aria-selected='true'] { background: var(--brand); border-color: var(--brand); color: var(--on-brand, #000); }
.gallery__globo { position: relative; margin-bottom: 24px; }
.gallery__globo canvas { display: block; width: 100%; height: min(70vh, 560px); touch-action: pan-y; cursor: grab; }
.gallery__globo canvas:active { cursor: grabbing; }
.globo__pista { position: absolute; left: 0; right: 0; bottom: 6px; margin: 0; text-align: center; font-size: var(--step-small); opacity: .6; pointer-events: none; }
.globo__tarjeta { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); width: min(92%, 420px); padding: 14px; border-radius: 16px; background: color-mix(in srgb, var(--dark-2) 92%, transparent); backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgb(0 0 0 / .45); }
.globo__sitio { margin: 0 0 10px; font-weight: 600; }
.globo__fotos { display: flex; gap: 8px; flex-wrap: wrap; }
.globo__fotos button { padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; }
.globo__fotos img { display: block; width: 72px; height: 72px; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { .gemelo { transition: none; } }
