/* ===========================================================
   Portada 3D de GanchoI
   Escena three.js (hero3d.js) + columnas de texto + interruptor
   "Sin sistema" / "Agenda Blindada".
   =========================================================== */

@property --h-in  { syntax: '<color>'; inherits: true; initial-value: #4a1407; }
@property --h-mid { syntax: '<color>'; inherits: true; initial-value: #1e0b06; }
@property --h-out { syntax: '<color>'; inherits: true; initial-value: #0a0605; }

.h3d {
  --h-in: #4a1407;
  --h-mid: #1e0b06;
  --h-out: #0a0605;
  --h-accent: #E8350A;
  --h-accent-ink: #fff;
  --spark: 232, 53, 10;
  position: relative;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
  color: var(--cream);
  background: radial-gradient(ellipse 70% 80% at 50% 55%, var(--h-in) 0%, var(--h-mid) 50%, var(--h-out) 100%);
  transition: --h-in 1.4s cubic-bezier(.4, 0, .2, 1), --h-mid 1.4s cubic-bezier(.4, 0, .2, 1), --h-out 1.4s cubic-bezier(.4, 0, .2, 1);
  isolation: isolate;
}
.h3d.is-con {
  --h-in: #4d3d12;
  --h-mid: #1e180a;
  --h-out: #0a0906;
  --h-accent: #C8A84B;
  --h-accent-ink: #111;
  --spark: 200, 168, 75;
}
/* Viñeta y grano suave para dar profundidad */
.h3d::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, transparent 18%, transparent 80%, #1A1A1A 100%);
}

/* Chispas que suben (equivalente a las burbujas del ejemplo) */
.h3d-sparks { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.h3d-spark {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  background: rgba(var(--spark), 1);
  box-shadow: 0 0 10px rgba(var(--spark), .8);
  transition: background 1.2s, box-shadow 1.2s;
  animation: h3dRise linear forwards;
}
@keyframes h3dRise {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  10%  { opacity: var(--o, .5); }
  85%  { opacity: var(--o, .5); }
  100% { transform: translate3d(var(--dx, 30px), -110vh, 0); opacity: 0; }
}

/* Escena 3D */
.h3d-stage { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.h3d-canvas { display: block; width: 100%; height: 100%; transition: filter .2s linear; }
.h3d.no-webgl .h3d-stage { display: none; }

/* Columnas */
.h3d-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 118px 4% 44px;
  pointer-events: none;
}
.h3d-inner a, .h3d-inner button { pointer-events: auto; }

.h3d-left {
  width: min(480px, 34vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}
.h3d-left .eyebrow { align-self: flex-start; background: rgba(0, 0, 0, .25); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.h3d-title {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(52px, min(5.4vw, 9.5vh), 104px);
  line-height: .9;
  letter-spacing: -.02em;
  margin: 0;
  text-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.h3d-title strong { display: block; color: var(--red); font-weight: 800; }
.h3d-lead { margin: 0; font-size: 17px; line-height: 1.65; color: rgba(245, 240, 232, .72); max-width: 470px; }

.h3d-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.h3d-cta {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 7px 7px 7px 24px;
  border-radius: 100px;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .02em;
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background .3s, border-color .3s;
}
.h3d-cta:hover { transform: translateY(-3px); background: rgba(0, 0, 0, .7); border-color: rgba(255, 255, 255, .3); }
.h3d-cta-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--h-accent);
  color: var(--h-accent-ink);
  font-size: 20px;
  transition: background 1.2s, color 1.2s, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.h3d-cta:hover .h3d-cta-icon { transform: rotate(-45deg); }
.h3d-link { color: rgba(245, 240, 232, .75); font-weight: 600; font-size: 15px; border-bottom: 1px solid rgba(245, 240, 232, .3); padding-bottom: 2px; transition: color .3s, border-color .3s; }
.h3d-link:hover { color: #fff; border-color: #fff; }

.h3d-badge { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.h3d-badge-icon {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
}
.h3d-badge-icon svg { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.h3d-badge-title { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(245, 240, 232, .6); font-weight: 700; }
.h3d-badge-sub { display: block; font-size: 14px; font-weight: 700; }

/* Columna derecha: interruptor + titular lateral */
.h3d-right {
  width: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  text-align: right;
  padding-top: 5vh;
}
.h3d-switch { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.h3d-switch-label { margin: 0 0 46px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: rgba(245, 240, 232, .55); }
.h3d-cards { display: flex; gap: 14px; }
.h3d-card {
  width: 148px;
  padding: 18px 12px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--cream);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-align: center;
  transition: border-color .4s, background .4s, transform .4s cubic-bezier(.175, .885, .32, 1.275);
}
.h3d-card:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .35); }
.h3d-card.active { border-color: var(--h-accent); background: rgba(255, 255, 255, .07); }
.h3d-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.h3d-card.hint { animation: h3dHint 1.6s ease-in-out 3; }
@keyframes h3dHint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 168, 75, 0); }
  50% { box-shadow: 0 0 0 8px rgba(200, 168, 75, .25); }
}
.h3d-card-name { font-size: 13px; font-weight: 700; margin-top: 12px; }
.h3d-card-sub { font-size: 12px; color: rgba(245, 240, 232, .6); }

/* Mini móvil ilustrado dentro de cada tarjeta */
.h3d-card-art {
  position: relative;
  width: 58px;
  height: 98px;
  margin-top: -64px;
  padding: 22px 8px 8px;
  border-radius: 14px;
  background: linear-gradient(160deg, #1c1c1c, #0b0b0b);
  border: 2px solid #2d2d2d;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, .5);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1);
}
.h3d-card:hover .h3d-card-art { transform: translateY(-12px) rotate(-10deg) scale(1.1); }
.h3d-card-art i { display: block; height: 11px; border-radius: 6px; background: #3b3b3b; }
.h3d-card-art i:nth-child(2) { width: 78%; }
.h3d-card-art i:nth-child(3) { width: 90%; }
.h3d-card-art b {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--red);
  color: #fff;
}
.h3d-card-art.con i { background: rgba(200, 168, 75, .75); }
.h3d-card-art.con b { background: var(--gold); color: #111; }

.h3d-arrows { display: flex; gap: 10px; }
.h3d-arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  transition: background .3s, border-color .3s;
}
.h3d-arrow:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); }

.h3d-side {
  display: grid;
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(52px, min(5.4vw, 9.5vh), 104px);
  line-height: .9;
  letter-spacing: -.02em;
  text-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.h3d-side > span { grid-area: 1 / 1; transition: opacity .6s ease, transform .8s cubic-bezier(.16, 1, .3, 1); }
.h3d-side em { font-style: normal; color: var(--h-accent); transition: color 1.2s; }
.h3d-side-con { opacity: 0; transform: translateY(30px); }
.h3d.is-con .h3d-side-sin { opacity: 0; transform: translateY(-30px); }
.h3d.is-con .h3d-side-con { opacity: 1; transform: none; }

/* Indicador de scroll */
.h3d-scroll {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 3;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 2px solid rgba(245, 240, 232, .35);
  border-radius: 14px;
}
.h3d-scroll span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: rgba(245, 240, 232, .8);
  animation: h3dScroll 1.8s ease-in-out infinite;
}
@keyframes h3dScroll {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* Entrada escalonada del texto */
.h3d-in { opacity: 0; transform: translateY(26px); animation: h3dIn .9s cubic-bezier(.16, 1, .3, 1) forwards; animation-delay: calc(.2s + var(--i, 0) * .12s); }
@keyframes h3dIn { to { opacity: 1; transform: none; } }

/* Franja con los 3 datos (antes estaba dentro de la portada) */
.h3d-strip { padding: 0 0 70px; background: var(--black); }
.h3d-strip .stats { margin: 0 auto; transform: translateY(-1px); }

/* Cabecera en la portada: transparente arriba, sólida al bajar */
body.home .navbar { background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; transition: background .4s, border-color .4s; }
body.home .navbar.is-scrolled { background: rgba(26, 26, 26, .94); border-bottom-color: rgba(92, 92, 92, .35); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
@media (min-width: 1001px) {
  body.home .desktop-nav {
    gap: 4px;
    padding: 6px;
    border-radius: 100px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15), inset 0 0 0 1px rgba(255, 255, 255, .05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  body.home .desktop-nav a { padding: 9px 18px; border-radius: 100px; font-size: 13px; transition: background .3s, color .3s; }
  body.home .desktop-nav a:hover { background: var(--gold); color: #111; }
}

/* Portátiles pequeños */
@media (max-width: 1200px) {
  .h3d-left { width: min(440px, 36vw); }
  .h3d-right { width: 300px; }
  .h3d-card { width: 134px; }
  .h3d-lead { font-size: 16px; }
}
@media (max-height: 760px) and (min-width: 900px) {
  .h3d-inner { padding-top: 100px; padding-bottom: 28px; }
  .h3d-left { gap: 18px; }
  .h3d-lead { font-size: 15px; line-height: 1.55; }
  .h3d-switch-label { margin-bottom: 40px; }
}

/* Móvil y tablet vertical: todo apilado, el móvil 3D entre el texto y el interruptor */
@media (max-width: 899px) {
  .h3d { height: auto; min-height: 0; }
  .h3d-inner { flex-direction: column; justify-content: flex-start; gap: 6px; padding: 104px 20px 36px; height: auto; }
  .h3d-left { width: 100%; gap: 20px; }
  .h3d-title { font-size: 48px; }
  .h3d-lead { font-size: 16px; }
  .h3d-badge { display: none; }
  .h3d-stage { position: relative; inset: auto; height: min(62vh, 540px); margin: 0 -20px; }
  .h3d.no-webgl .h3d-stage { display: none; }
  .h3d-right { width: 100%; align-items: center; text-align: center; padding-top: 0; }
  .h3d-switch { align-items: center; }
  .h3d-switch-label { margin-bottom: 42px; }
  .h3d-side { display: none; }
  .h3d-scroll { display: none; }
  .h3d-strip { padding: 0 0 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .h3d-in { animation: none; opacity: 1; transform: none; }
  .h3d-scroll span, .h3d-card.hint { animation: none; }
  .h3d, .h3d-side > span { transition: none; }
}
