/* ==========================================================================
   CABEZA DE PAPA STUDIO
   Shell del estudio: tinta oscura editorial.
   Cada juego toma el control cromático de la página al entrar (data-world).
   ========================================================================== */

/* ---------- Fuentes (self-hosted, Fontshare) ---------- */
@font-face { font-family: 'Clash Display'; src: url('../assets/fonts/ClashDisplay-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Clash Display'; src: url('../assets/fonts/ClashDisplay-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Clash Display'; src: url('../assets/fonts/ClashDisplay-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('../assets/fonts/GeneralSans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('../assets/fonts/GeneralSans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('../assets/fonts/GeneralSans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --font-display: 'Clash Display', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'General Sans', 'Segoe UI', system-ui, sans-serif;

  /* mundo: ESTUDIO (default) */
  --bg: #121114;
  --bg-soft: #1a191d;
  --ink: #f2efe9;
  --ink-dim: rgba(242, 239, 233, 0.62);
  --accent: #e5c04b; /* papa dorada: solo CTAs y detalles del estudio */
  --line: rgba(242, 239, 233, 0.14);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --world-fade: 900ms;
}

/* mundo: EÓLICA (bruma clara del bosque) */
body[data-world="eolica"] {
  --bg: #ccdedd;
  --bg-soft: #bdd3d1;
  --ink: #23423f;
  --ink-dim: rgba(35, 66, 63, 0.66);
  --accent: #d97f57; /* el salmón del globo */
  --line: rgba(35, 66, 63, 0.18);
}

/* mundo intermedio hacia EÓLICA: teal profundo, puente entre tinta y bruma */
body[data-world="eolica-pre"] {
  --bg: #24413d;
  --bg-soft: #2c4b46;
  --ink: #e9efec;
  --ink-dim: rgba(233, 239, 236, 0.6);
  --accent: #d97f57;
  --line: rgba(233, 239, 236, 0.15);
}

/* mundo: PINCELAZO (navy Mondrian) */
body[data-world="pincelazo"] {
  --bg: #0b0e26;
  --bg-soft: #12163a;
  --ink: #f4f2ec;
  --ink-dim: rgba(244, 242, 236, 0.62);
  --accent: #e63946; /* el rojo del lienzo */
  --line: rgba(244, 242, 236, 0.16);
}

/* mundo: PROYECTO 03 (más oscuro que el estudio) */
body[data-world="p03"] {
  --bg: #0c0b0e;
  --bg-soft: #131217;
  --ink: #f2efe9;
  --ink-dim: rgba(242, 239, 233, 0.5);
  --accent: #e5c04b;
  --line: rgba(242, 239, 233, 0.1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--ink);
  transition: background-color var(--world-fade) var(--ease-out), color var(--world-fade) var(--ease-out);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 0; }

::selection { background: var(--accent); color: #121114; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  height: 64px; padding: 0 clamp(1rem, 4vw, 3rem);
  color: var(--ink);
  transition: color var(--world-fade) var(--ease-out);
}
.nav::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
  opacity: 0.85;
  transition: background var(--world-fade) var(--ease-out);
}
.nav-mark {
  text-decoration: none; display: flex; align-items: center;
  opacity: 1; transition: opacity 450ms var(--ease-out);
}
.nav-mark .lockup-h { width: 124px; transition: opacity 200ms var(--ease-out); }
.nav-mark:hover .lockup-h { opacity: 0.85; }
.nav.nav-at-hero .nav-mark { opacity: 0; pointer-events: none; }
.nav-links { display: flex; gap: clamp(1.2rem, 3vw, 2.4rem); }
.nav-links a {
  text-decoration: none; font-weight: 500; font-size: 0.9rem; letter-spacing: 0.02em;
  opacity: 0.85; transition: opacity 200ms var(--ease-out);
}
.nav-links a:hover, .nav-links a:focus-visible { opacity: 1; }

/* ---------- Hero ---------- */
.hero { min-height: 100dvh; display: flex; align-items: center; position: relative; overflow: hidden; }
.hero-inner {
  width: 100%; max-width: 1400px; margin: 0 auto;
  padding: 5.5rem clamp(1rem, 4vw, 3rem) 3rem;
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: center; gap: clamp(1.5rem, 4vw, 4rem);
}
.hero-brand { margin: 0 0 2rem; }
.hero-brand .lockup-v { width: clamp(260px, 30vw, 430px); }
/* La entrada anima el contenedor (h1) y solo opacity en los grupos internos:
   un transform CSS sobre los <g> pisaría sus atributos transform del layout. */
.hero-brand { opacity: 0; animation: logo-in 900ms var(--ease-out) 100ms forwards; }
.hero-brand .wm { opacity: 0; animation: logo-fade 700ms var(--ease-out) 380ms forwards; }
@keyframes logo-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes logo-fade { to { opacity: 1; } }

.hero-tag {
  margin: 0 0 2.2rem; max-width: 26ch;
  font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--ink-dim);
  opacity: 0; animation: fade-up 700ms var(--ease-out) 500ms forwards;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 0.7em;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: 0.045em;
  color: #121114; background: var(--accent); text-decoration: none;
  padding: 0.9em 1.6em; border-radius: 999px;
  opacity: 0; animation: fade-up 700ms var(--ease-out) 650ms forwards;
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(229, 192, 75, 0.25); }
.hero-cta:active { transform: translateY(0) scale(0.98); }
.hero-cta-arrow { transition: transform 250ms var(--ease-out); }
.hero-cta:hover .hero-cta-arrow { transform: translateY(3px); }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Showreel: tres tiras verticales desfasadas */
.hero-reel {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(0.6rem, 1.4vw, 1.1rem);
  align-items: start; min-width: 0;
}
.reel-strip {
  border-radius: 18px; overflow: hidden; background: var(--bg-soft);
  aspect-ratio: 9 / 19.2; position: relative;
  opacity: 0; transform: translateY(40px);
  animation: strip-in 1000ms var(--ease-out) forwards;
}
.reel-a { animation-delay: 250ms; margin-top: 2.5rem; }
.reel-b { animation-delay: 400ms; }
.reel-c { animation-delay: 550ms; margin-top: 4.5rem; }
@keyframes strip-in { to { opacity: 1; transform: none; } }
.reel-strip video { width: 100%; height: 100%; object-fit: cover; }
.reel-c {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1a191d 20%, #0c0b0e 80%);
  border: 1px solid var(--line);
}
.reel-c-num {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4.5vw, 3.6rem);
  color: transparent; -webkit-text-stroke: 1.5px rgba(242, 239, 233, 0.35);
}

/* ---------- Secciones de juego ---------- */
.game { min-height: 100dvh; display: flex; align-items: center; position: relative; padding: clamp(4rem, 10vh, 7rem) 0; }
.game-inner {
  width: 100%; max-width: 1200px; margin: 0 auto; position: relative; z-index: 2;
  padding: 0 clamp(1rem, 4vw, 3rem);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center; gap: clamp(2rem, 5vw, 5rem);
}

.game-media { position: relative; display: flex; justify-content: center; }
.phone-frame {
  margin: 0; position: relative; width: min(340px, 78vw, 40dvh);
  border-radius: 28px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(10, 30, 28, 0.35);
}
.game-video { width: 100%; aspect-ratio: 9 / 20; object-fit: cover; }

.sound-toggle {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18, 17, 20, 0.55); color: #f2efe9;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform 200ms var(--ease-out), background 200ms var(--ease-out);
}
.sound-toggle:hover { transform: scale(1.08); background: rgba(18, 17, 20, 0.75); }
.sound-toggle:active { transform: scale(0.95); }

.game-copy { max-width: 34rem; }
.game-title { margin: 0 0 1.2rem; font-family: var(--font-display); }
.game-title-eolica {
  font-weight: 500; font-size: clamp(2.6rem, 6vw, 4.6rem);
  letter-spacing: 0.34em; line-height: 1;
  /* Sin text-indent: alineado a la izquierda el sangrado desplazaba el título
     0,34em (~25px) fuera del eje de la descripción. El espacio sobrante del
     tracking queda a la derecha, donde no afecta la alineación. */
  text-indent: 0;
}
.pincelazo-wordmark { width: min(430px, 100%); height: auto; }
.game-desc { margin: 0 0 1.1rem; font-size: clamp(1rem, 1.5vw, 1.15rem); color: var(--ink-dim); max-width: 38ch; }
.game-meta {
  margin: 0 0 2rem; font-weight: 500; font-size: 0.82rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-dim);
}
.meta-sep { margin: 0 0.6em; opacity: 0.5; }

.btn-store {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
  color: var(--bg); background: var(--ink); text-decoration: none;
  padding: 0.85em 1.5em; border-radius: 999px;
  transition: transform 250ms var(--ease-out), background-color var(--world-fade) var(--ease-out), color var(--world-fade) var(--ease-out);
}
.btn-store:hover { transform: translateY(-2px); }
.btn-store:active { transform: scale(0.98); }
.btn-store.is-pending { cursor: default; opacity: 0.75; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-store.is-pending:hover { transform: none; }

/* --- Eólica: luciérnagas ambientales --- */
.firefly {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #ffd9a0; box-shadow: 0 0 12px 4px rgba(255, 217, 160, 0.5);
  opacity: 0; pointer-events: none;
}
.game-eolica.in-view .firefly { animation: firefly 7s ease-in-out infinite; }
.ff-1 { top: 18%; left: 6%; animation-delay: 0s !important; }
.ff-2 { top: 62%; right: 4%; animation-delay: 2.2s !important; }
.ff-3 { bottom: 10%; left: 22%; animation-delay: 4.1s !important; }
@keyframes firefly {
  0%, 100% { opacity: 0; transform: translate(0, 0); }
  25% { opacity: 0.9; }
  50% { opacity: 0.35; transform: translate(14px, -22px); }
  75% { opacity: 0.8; transform: translate(-8px, -34px); }
}

/* --- Pincelazo: composición Mondrian --- */
.game-pincelazo { overflow: hidden; }
.mondrian { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.mz { position: absolute; opacity: 0; transform: scale(0.9); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.game-pincelazo.in-view .mz { opacity: 1; transform: none; }
.mz-red    { background: #d32f2f; width: clamp(90px, 16vw, 230px); height: clamp(150px, 26vh, 300px); top: 9%; left: 4%; transition-delay: 100ms; }
.mz-blue   { background: #1e56c8; width: clamp(70px, 12vw, 180px); height: clamp(100px, 18vh, 210px); bottom: 8%; right: 0; transition-delay: 250ms; }
.mz-yellow { background: #e8b52a; width: clamp(40px, 6vw, 90px);  height: clamp(60px, 10vh, 120px); top: 22%; right: 12%; transition-delay: 400ms; }
.mz-bone   { background: #e8e4da; width: clamp(60px, 9vw, 140px); height: clamp(80px, 14vh, 170px); bottom: 0; left: 18%; transition-delay: 550ms; }
.phone-frame-pincelazo { box-shadow: 0 30px 80px rgba(0, 0, 8, 0.55); }

/* ---------- Proyecto 03 ---------- */
.p03 {
  min-height: 88dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative; overflow: hidden;
  padding: 5rem 0;
}
.p03-marquee {
  position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%);
  overflow: hidden; white-space: nowrap; pointer-events: none; opacity: 0.14;
}
.p03-track { display: inline-flex; animation: marquee 30s linear infinite; }
.p03-track span {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(4rem, 12vw, 10rem); letter-spacing: 0.02em;
  color: transparent; -webkit-text-stroke: 1px var(--ink);
}
@keyframes marquee { to { transform: translateX(-50%); } }

.p03-inner { position: relative; z-index: 2; text-align: center; padding: 0 1.5rem; }
.p03-title {
  margin: 0 0 1.4rem; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3rem, 9vw, 7.5rem); line-height: 0.95; letter-spacing: -0.01em;
}
.p03-line { margin: 0 auto 1rem; max-width: 34ch; color: var(--ink-dim); font-size: clamp(0.95rem, 1.4vw, 1.1rem); }
.p03-meta { margin-bottom: 0; }

/* ---------- Estudio ---------- */
.studio { padding: clamp(6rem, 16vh, 10rem) 0; }
.studio-inner { max-width: 1200px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem); }
.studio-title {
  margin: 0 0 1.6rem; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.2rem, 5.5vw, 4.4rem); line-height: 1.05; letter-spacing: -0.015em;
}
.studio-body { margin: 0; max-width: 52ch; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-dim); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 3.5rem 0 2.5rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem); }
.footer-brand { display: flex; align-items: center; gap: 1.4rem; margin: 0 0 2.2rem; }
.footer-brand .logo-svg { width: clamp(72px, 9vw, 104px); height: auto; cursor: pointer; }
.footer-brand-name {
  margin: 0; font-family: var(--font-display); font-weight: 700; color: var(--ink);
  font-size: clamp(1.3rem, 3vw, 1.9rem); letter-spacing: 0.01em; line-height: 1.1;
}
.footer-brand-name span {
  display: block; font-weight: 500; font-size: 0.42em; letter-spacing: 0.5em; color: var(--accent);
}
.footer-mail {
  display: inline-block; margin-top: 0.5rem; color: var(--ink); font-weight: 500;
  font-size: 0.95rem; text-decoration: none; border-bottom: 1px solid var(--accent);
  padding-bottom: 1px; transition: opacity 200ms var(--ease-out);
}
.footer-mail:hover { opacity: 0.7; }
.footer-cols { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 2.5rem; }
.footer-place { margin: 0; color: var(--ink-dim); font-size: 0.95rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.8rem; }
.footer-link { font-size: 0.95rem; font-weight: 500; }
.footer-link.is-pending { color: var(--ink-dim); opacity: 0.55; cursor: default; }
a.footer-link { text-decoration: none; transition: opacity 200ms; }
a.footer-link:hover { opacity: 0.7; }
.footer-note { margin: 0; font-size: 0.82rem; color: var(--ink-dim); opacity: 0.7; }

/* ---------- Personalidad de motion por universo (sutil) ---------- */
/* Eólica: atmosférica, flotante */
.game-eolica .reveal { transition-duration: 1150ms; transform: translateY(34px); }
.game-eolica .reveal.in-view { transform: none; }
/* Pincelazo: gráfica, precisa, más directa */
.game-pincelazo .reveal { transition-duration: 600ms; transform: translateY(18px); }
.game-pincelazo .reveal.in-view { transform: none; }
/* Proyecto 03: contenida, seca; solo aparece, sin desplazarse */
.p03 .reveal { transition-duration: 950ms; transform: none; }

/* ---------- Papa: ojos animables ---------- */
/* Sin will-change: promover estos nodos a capa propia hace que Chrome rasterice
   el SVG en la capa y los ojos pierden definición (medido: -8% de nitidez).
   Parpadeo y mirada son gestos raros y baratos; no necesitan la promoción. */
.eye, .eye-move { transform-box: fill-box; transform-origin: 50% 50%; }
.logo-svg .potato-shape { pointer-events: auto; }

/* ---------- Reveals genéricos ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out); }
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- Focus ---------- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}
.hero-cta:focus-visible, .btn-store:focus-visible { border-radius: 999px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 5.5rem; gap: 2.2rem; }
  .hero-brand .lockup-v { width: min(78vw, 340px); margin: 0 auto; }
  .hero-copy { text-align: center; }
  .hero-tag { margin-left: auto; margin-right: auto; }
  .hero-reel { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .reel-a { margin-top: 1.2rem; } .reel-c { margin-top: 2.2rem; }
  .game-inner, .game-inner-flip { grid-template-columns: 1fr; gap: 2.5rem; }
  .game-inner-flip .game-copy { order: 2; }
  .game-inner-flip .game-media { order: 1; }
  .game-copy { text-align: center; margin: 0 auto; }
  /* Centrado: acá sí compensa el espacio de tracking sobrante a la derecha */
  .game-title-eolica { text-indent: 0.34em; }
  .game-desc { margin-left: auto; margin-right: auto; }
  .pincelazo-wordmark { margin: 0 auto; }
  .footer-cols { flex-direction: column; }
}

@media (max-width: 480px) {
  .nav { height: 56px; }
  .nav-mark .lockup-h { width: 107px; }
  .footer-brand { flex-direction: column; align-items: flex-start; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-tag, .hero-cta, .reel-strip { animation: none; opacity: 1; transform: none; }
  .hero-brand, .hero-brand .wm { animation: none; opacity: 1; transform: none; }
  .eye, .eye-move { transition: none !important; transform: none !important; }
  .p03-track { animation: none; }
  .game-eolica.in-view .firefly { animation: none; opacity: 0; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .mz { opacity: 1; transform: none; transition: none; }
  body { transition: none; }
}
