/* ============================================================
   Digital Energy B — Portal de entrada + sistema de vistas
   Se carga DESPUÉS de styles.css
   ============================================================ */

/* ---------- View switching ---------- */
.view { display: none; }
.view.is-active { display: block; }

/* lock scroll while portal is up */
body.portal-locked { overflow: hidden; }

/* ============================================================
   PORTAL — pantalla de entrada dividida
   ============================================================ */
.portal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--dark);
  opacity: 1;
  transition: opacity .5s ease, visibility .5s ease;
}
.portal.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.portal__brand {
  position: absolute;
  top: clamp(20px, 4vh, 36px);
  left: 0; right: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.portal__brand .brand {
  color: var(--on-dark);
  font-size: 1.25rem;
}
.portal__brand .brand .b-mark { color: var(--accent-2); }
.portal__brand .brand small { color: var(--on-dark-2); }

.portal__tagline {
  position: absolute;
  bottom: clamp(20px, 4vh, 36px);
  left: 0; right: 0;
  z-index: 6;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--on-dark-2);
  pointer-events: none;
}

/* each half */
.portal__half {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(28px, 5vw, 56px);
  transition: flex .5s ease;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
}
.portal__half::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: transform .8s cubic-bezier(.2,.7,.2,1), opacity .4s ease;
}
/* Consulting half — dark */
.portal__half--consulting { background: var(--dark); color: var(--on-dark); justify-content: flex-start; text-align: left; }
.portal__half--consulting::before {
  background:
    radial-gradient(120% 90% at 30% 20%, #211e18 0%, var(--dark) 60%);
}
.portal__half--consulting::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(255,255,255,.014) 22px 44px);
  z-index: 0;
}
/* Course half — accent-tinted */
.portal__half--course { background: #1a140a; color: var(--on-dark); border-left: 1px solid var(--line-dark); justify-content: flex-end; text-align: right; }
.portal__half--course::before {
  background:
    radial-gradient(120% 90% at 70% 25%, #2b1f0c 0%, #160f06 65%);
}

/* big watermark glyph behind each */
.portal__half .glyph-watermark {
  position: absolute;
  z-index: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1;
  font-size: clamp(14rem, 26vw, 30rem);
  opacity: .05;
  user-select: none;
  transition: opacity .5s ease, transform .8s cubic-bezier(.2,.7,.2,1);
}
.portal__half--consulting .glyph-watermark { color: #fff; right: -4vw; bottom: -8vh; }
.portal__half--course .glyph-watermark { color: var(--accent); left: -3vw; top: -6vh; }

.portal__content { position: relative; z-index: 2; max-width: 25ch; }

/* identidad de Pablo en la mitad de Consultoría */
.portal__id {
  position: absolute;
  left: clamp(28px, 5vw, 56px);
  bottom: clamp(60px, 9vh, 92px);
  z-index: 3;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(3px);
  max-width: min(94%, 440px);
}
.portal__id-av {
  width: 50px; height: 50px; flex: 0 0 auto; border-radius: 50%;
  object-fit: cover; border: 1.5px solid rgba(247,147,26,.55);
}
.portal__id-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.portal__id-role { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; }
.portal__id-cred { font-size: 0.8rem; color: var(--on-dark-2); line-height: 1.3; white-space: nowrap; }
.portal__id-social { display: flex; gap: 7px; margin-top: 8px; }
.portal__id-social a {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; color: var(--on-dark-2);
  border: 1px solid rgba(255,255,255,.16);
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}
.portal__id-social a:hover {
  color: var(--accent-2); border-color: rgba(247,147,26,.5);
  background: rgba(247,147,26,.12); transform: translateY(-2px);
}
.portal__num {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--on-dark-2);
  display: block;
  margin-bottom: 22px;
}
.portal__half--course .portal__num { color: var(--accent-2); }
.portal__content h2 {
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  margin-bottom: 16px;
}
.portal__content h2 em { font-style: normal; color: var(--accent-2); }
.portal__content p {
  color: var(--on-dark-2);
  font-size: 1.02rem;
  line-height: 1.55;
  margin-bottom: 30px;
  text-wrap: pretty;
}
.portal__enter {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-dark);
  border: 1px solid var(--line-dark);
  padding: 13px 22px;
  border-radius: 100px;
  transition: gap .25s ease, background .25s ease, color .25s ease, border-color .25s ease;
}
.portal__half--course .portal__enter { border-color: rgba(247,147,26,.35); }
.portal__enter svg { transition: transform .25s ease; }

/* imagen/watermark reacciona al hover del lado correspondiente del botón */
@media (hover: hover) and (pointer: fine) {
  .portal:has(.pswitch--consulting:hover) .portal__half--consulting .portal__art { opacity: .16; transform: scale(1.04); }
  .portal:has(.pswitch--course:hover) .portal__half--course .glyph-watermark { opacity: .14; transform: scale(1.05); }
}

/* imagen de Consultoría (apretón de manos) — aparece solo al hover */
.portal__half--consulting .portal__art {
  position: absolute;
  z-index: 0;
  right: clamp(0px, 3vw, 48px);
  bottom: clamp(24px, 9vh, 90px);
  width: clamp(170px, 24vw, 320px);
  aspect-ratio: 483 / 492;
  background: url(consultoria-handshake.png) no-repeat center / contain;
  opacity: .06;
  transform: scale(.98);
  transition: opacity .5s ease, transform .8s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}

/* ---------- Botón central partido ---------- */
.portal__switch {
  position: absolute;
  z-index: 5;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: stretch;
  border-radius: 100px;
  overflow: hidden;
  background: rgba(20,15,9,.95);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 20px 55px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08);
}
.pswitch {
  display: inline-flex;
  flex: none;
  width: clamp(142px, 19vw, 170px);
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-dark);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 16px 10px;
  transition: background .25s ease, color .25s ease, gap .25s ease;
}
.pswitch svg { transition: transform .25s ease; }
.portal__switch::after {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255,255,255,.24);
  z-index: 1;
  pointer-events: none;
}
.pswitch--course { color: var(--accent-2); }
.pswitch--consulting:hover { background: var(--on-dark); color: var(--dark); gap: 15px; }
.pswitch--consulting:hover svg { transform: translateX(-4px); }
.pswitch--course:hover { background: var(--accent); color: #1a1205; gap: 15px; }
.pswitch--course:hover svg { transform: translateX(4px); }
.pswitch:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }

@media (max-width: 480px) {
  .pswitch { padding: 13px 18px; font-size: 0.74rem; letter-spacing: 0.08em; }
}

/* ---------- View nav switcher (small, persistent in views) ---------- */
.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  background: var(--bg-2);
}
.dark-band .view-switch,
.nav.on-dark .view-switch { border-color: var(--line-dark); background: var(--dark-2); }
.view-switch a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 15px;
  border-radius: 100px;
  color: var(--ink-2);
  transition: background .2s ease, color .2s ease;
  cursor: pointer;
}
.nav.on-dark .view-switch a { color: var(--on-dark-2); }
.view-switch a.is-active { background: var(--ink); color: var(--bg); }
.nav.on-dark .view-switch a.is-active { background: var(--accent); color: #1a1205; }

/* back-to-portal pill */
.to-portal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 0;
}
.to-portal:hover { color: var(--ink); }
.nav-login { font-weight: 500; }
@media (max-width: 720px) { .nav-login { display: none; } }
.nav.on-dark .to-portal { color: var(--on-dark-2); }
.nav.on-dark .to-portal:hover { color: var(--on-dark); }

/* ---------- Dark navbar variant (for consulting view) ---------- */
.nav.on-dark {
  background: color-mix(in srgb, var(--dark) 78%, transparent);
}
.nav.on-dark.is-scrolled {
  background: color-mix(in srgb, var(--dark) 92%, transparent);
  border-bottom-color: var(--line-dark);
}
.nav.on-dark .brand { color: var(--on-dark); }
.nav.on-dark .brand .b-mark { color: var(--accent-2); }
.nav.on-dark .nav__links a { color: var(--on-dark-2); }
.nav.on-dark .nav__links a:hover,
.nav.on-dark .nav__links a.is-active { color: var(--on-dark); }
.nav.on-dark .nav__burger { border-color: var(--line-dark); }
.nav.on-dark .nav__burger span,
.nav.on-dark .nav__burger span::before,
.nav.on-dark .nav__burger span::after { background: var(--on-dark); }

/* ---------- Consulting hero ---------- */
.chero { position: relative; overflow: hidden; }
.chero__inner { padding-top: clamp(48px,8vw,90px); padding-bottom: clamp(48px,8vw,96px); }
.chero__grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 640px;
  margin-inline: auto;
  justify-items: center;
  text-align: center;
  align-items: center;
}
.chero h1 { margin-bottom: 24px; }
.chero .lead { max-width: 46ch; margin-inline: auto; }
.chero__cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; justify-content: center; }

/* identidad compacta en el hero */
.chero__id {
  display: inline-flex; align-items: center; gap: 16px;
  margin: 40px auto 0; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--bg-2);
  text-align: left;
}
.chero__id-avatar {
  width: 56px; height: 56px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden; color: var(--ink-2);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 22%, transparent), var(--bg));
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.chero__id-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chero__id-text { display: flex; flex-direction: column; gap: 2px; }
.chero__id-role { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; }
.chero__id-cred { font-size: 0.84rem; color: var(--ink-2); line-height: 1.32; }
.chero__id-social { display: flex; gap: 8px; margin-left: 4px; }
.chero__id-social a {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--ink-2);
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}
.chero__id-social a:hover {
  color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); transform: translateY(-2px);
}
@media (max-width: 520px) {
  .chero__id { flex-direction: column; text-align: center; }
  .chero__id-text { align-items: center; }
}

/* consulting "for who" cards */
.who-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: clamp(36px,5vw,56px);
}
.who-cell { background: var(--bg); padding: clamp(24px,3vw,34px); }
.who-cell .idx { display:block; margin-bottom: 18px; }
.who-cell h3 { font-size: 1.2rem; margin-bottom: 8px; }
.who-cell p { color: var(--ink-2); font-size: 0.97rem; }
.who-grid--4 { grid-template-columns: repeat(4, 1fr); }
.who-cell--soon { background: var(--bg-2); }
.who-cell--soon h3, .who-cell--soon p { opacity: .62; }

/* badge "Próximamente" */
.soon-badge {
  display: inline-block; vertical-align: middle;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-2);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 3px 9px; margin-left: 8px; white-space: nowrap;
}
.svc--soon { opacity: .74; }
.svc--soon:hover { transform: none; border-color: var(--line); }
.svc--soon h3 .soon-badge { opacity: 1; }

/* process steps */
.steps { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; margin-top: clamp(36px,5vw,56px); }
.step { }
.step .n {
  font-family: var(--mono); font-size: 0.8rem; color: var(--accent-ink);
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
  display: block;
}
.step h4 { font-size: 1.12rem; margin-bottom: 7px; }
.step p { color: var(--ink-2); font-size: 0.95rem; }

/* responsive portal + consulting */
@media (max-width: 1040px) {
  .who-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .portal { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .portal__half--consulting { justify-content: center; text-align: center; padding-bottom: clamp(80px, 15vh, 130px); }
  .portal__half--course { border-left: 0; border-top: 1px solid var(--line-dark); justify-content: center; text-align: center; padding-top: clamp(80px, 15vh, 130px); }
  .chero__grid { grid-template-columns: 1fr; }
  .who-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .view-switch { display: none; }
  .steps { grid-template-columns: 1fr; }
}
