/* Landing v2 only. Loaded alongside orbit-demos.css (video-player chrome and the
   Astaren companion mark are unchanged and reused as-is from v1). Everything in
   this file is new: hero split, real-capture frame, mode rail, flow diagram,
   evidence matrix, and the no-JS mobile nav disclosure. */

/* ---------- scroll reveal: JS adds .reveal to a curated selector list (no HTML
   edits) and toggles .is-visible via IntersectionObserver as each element
   enters view. Fail-safe: content is visible by default; only once JS
   confirms it's actually wired (html.reveal-ready) does anything hide. If JS
   never runs, prefers-reduced-motion is on, or IntersectionObserver is
   unsupported, everything just stays visible — nothing depends on the
   animation to be readable. ---------- */
html:not(.reveal-ready) .reveal { opacity: 1; transform: none; }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Typed custom property so the conic-gradient's own angle can be keyframed
   directly (Chrome/Edge/Safari 16.4+; older Firefox just shows it static —
   acceptable degradation). This is what lets color travel around a *static*
   ring shape instead of the whole rounded-rect spinning like a diamond, which
   is what plain `transform: rotate()` on the ring produced. */
@property --guided-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* ---------- header nav (desktop default lives here so it always loses to the
   @media override below, regardless of where the page's own inline <style>
   block happens to sit in source order) ---------- */

.main-nav-inline { display: flex; align-items: center; gap: var(--space-8); }
.main-nav-inline a:not(.btn) { font-size: 0.9375rem; color: var(--l-secondary); padding-block: var(--space-3); }
.main-nav-inline a:not(.btn):hover { color: var(--l-ink); }

/* ---------- video demos: autoplay in v2, so the pause control must be
   persistent (not hover-only) and easy to find — bottom-right, always visible.
   WCAG 2.2.2 (Pause, Stop, Hide): auto-updating content needs a reachable,
   permanent way to stop it. ---------- */
.demo-actions { top: auto; bottom: 12px; opacity: 1; }
.demo-player:hover .demo-actions, .demo-player:focus-within .demo-actions { opacity: 1; }

/* ---------- revived "real capture" frame (was dead CSS in v1, now used) ---------- */

.real-capture {
  padding: var(--space-2);
  background: var(--l-surface-subtle);
  border: 1px solid var(--l-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 28px -22px rgb(28 37 48 / 0.35);
}

.real-capture img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--l-border);
}

.real-capture-caption {
  margin-top: var(--space-3);
  font-size: 0.8125rem;
  color: var(--l-secondary);
}

/* ---------- mobile nav: <details> disclosure, no JS ---------- */

.mobile-nav { display: none; }

@media (max-width: 720px) {
  .main-nav-inline { display: none; }
  .main-nav > .header-docs-link,
  .main-nav > .header-app-placeholder { display: none; }
  .mobile-nav { display: block; position: relative; }
  .mobile-nav summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding-inline: var(--space-4);
    border: 1px solid var(--l-border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--l-ink);
  }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav[open] summary { border-color: var(--l-accent); }
  .mobile-nav-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: var(--space-2);
    background: var(--l-surface);
    border: 1px solid var(--l-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 14px 40px #1c253022;
  }
  .mobile-nav-panel a,
  .mobile-nav-panel .mobile-nav-placeholder {
    display: block;
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    color: var(--l-ink);
  }
  .mobile-nav-panel a:hover { background: var(--l-surface-subtle); }
}

/* ---------- hero: 45/55 split ---------- */

.hero-v2 { padding: var(--space-14) 0 var(--space-10); }

.hero-v2-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-10);
  align-items: center;
}

@media (min-width: 900px) {
  .hero-v2-grid { grid-template-columns: 45fr 55fr; gap: var(--space-8); }
}

.hero-v2-proof { width: min(560px, 100%); margin-inline: auto; }

@media (min-width: 900px) {
  .hero-v2-proof { width: 100%; margin-inline: 0; }
}

.hero-photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 28px -22px rgb(28 37 48 / 0.35);
}

.hero-photo img { display: block; width: 100%; height: auto; }

/* ---------- mode rail: Estándar / Referencia / Guiado ---------- */

.mode-rail {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

@media (min-width: 720px) {
  .mode-rail { grid-template-columns: repeat(3, 1fr); }
}

.mode-rail-item {
  position: relative;
  padding: var(--space-5);
  border: 1px solid var(--l-border-strong);
  border-radius: var(--radius-lg);
  background: var(--l-surface);
  isolation: isolate;
}

/* Estándar: flat and gray, no motion at all — the lack of color/movement is
   itself the signal that no pedagogical instruction is configured. */
.mode-rail-item[data-mode="standard"] {
  background: var(--l-surface-subtle);
}

/* Referencia: a slow single-color breathing glow, in the real Astaren blue
   token used everywhere else on the site (not a new color). */
.mode-rail-item[data-mode="reference"] {
  border-color: color-mix(in srgb, var(--l-astaren-blue) 40%, var(--l-border-strong));
}

.mode-rail-item[data-mode="reference"]::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  z-index: -1;
  animation: mode-breathe-blue 3.4s ease-in-out infinite;
}

/* Guiado: the most "active" mode gets the most visual presence — the COLORS
   travel clockwise around a static ring; the card itself never rotates.

   Deliberately NOT the mask-composite:exclude "gradient border" trick: at
   this border-radius, that technique leaves faint corner seams (the
   content-box radius doesn't shrink to match the padding exactly), which is
   the "espacios en blanco" — gaps of page background peeking through at the
   rounded corners. Instead: ::before is a full, blurred, rotating gradient
   disc sitting behind the card; ::after is the card's own flat surface,
   sized exactly to the card (inset:0, radius:inherit) and stacked on top,
   masking ::before back down to nothing but a clean ring with no seams,
   because there's no boolean mask math — just two solid shapes overlapping.
   Breathing lives entirely on ::before, safely, since even at its dimmest
   there's still a full gradient disc underneath — never a gap, just fainter. */
.mode-rail-item[data-mode="guided"] { border-color: transparent; }

.mode-rail-item[data-mode="guided"]::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-lg) + 4px);
  z-index: -2;
  background: conic-gradient(from var(--guided-angle), #5b8cff, #8b7bf6, #d16bd6, #f2748a, #f4a340, #6fd08c, #5b8cff);
  filter: blur(5px);
  animation: mode-halo-angle 6s linear infinite, mode-halo-breathe 4.2s ease-in-out infinite;
  pointer-events: none;
}

.mode-rail-item[data-mode="guided"]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  background: var(--l-surface);
  pointer-events: none;
}

@keyframes mode-breathe-blue {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--l-astaren-blue) 32%, transparent); }
  50% { box-shadow: 0 0 16px 3px color-mix(in srgb, var(--l-astaren-blue) 32%, transparent); }
}

@keyframes mode-halo-angle { to { --guided-angle: 360deg; } }

@keyframes mode-halo-breathe {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .mode-rail-item[data-mode="reference"]::before,
  .mode-rail-item[data-mode="guided"]::before {
    animation: none;
  }
  .mode-rail-item[data-mode="reference"]::before {
    box-shadow: 0 0 12px 2px color-mix(in srgb, var(--l-astaren-blue) 26%, transparent);
  }
  .mode-rail-item[data-mode="guided"]::before { opacity: 0.85; }
}

.mode-rail-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--l-muted);
  text-transform: uppercase;
}

.mode-rail-item h4 {
  margin: var(--space-2) 0 var(--space-2);
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--l-ink);
}

.mode-rail-item p { color: var(--l-secondary); font-size: 0.9375rem; }

/* ---------- cómo funciona: numbered flow, HTML/CSS only ---------- */

.flow { padding-block: var(--space-10); border-top: 1px solid var(--l-border); }

.flow-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: var(--space-8);
  counter-reset: flow-step;
}

.flow-step {
  position: relative;
  display: flex;
  gap: var(--space-5);
  padding-block: var(--space-4);
}

.flow-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -4px;
  width: 1px;
  background: var(--l-border-strong);
}

.flow-step-index {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--l-border-strong);
  background: var(--l-surface);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--l-ink);
}

.flow-step[data-actor="astaren"] .flow-step-index {
  border-color: var(--l-astaren-blue);
  color: var(--l-astaren-blue);
}

.flow-step-body h4 { margin: 0 0 var(--space-1); font-size: 1rem; color: var(--l-ink); }
.flow-step-body p { margin: 0; color: var(--l-secondary); font-size: 0.9375rem; }

/* ---------- fundamento científico: compact matrix, not feature cards ---------- */

.evidence-v2 { padding-block: var(--space-10); border-top: 1px solid var(--l-border); }

.evidence-matrix {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-6);
  font-size: 0.9375rem;
}

.evidence-matrix th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--l-muted);
  font-weight: 600;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--l-border-strong);
}

.evidence-matrix td {
  padding: var(--space-4) var(--space-4) var(--space-4) 0;
  border-bottom: 1px solid var(--l-border);
  vertical-align: top;
  color: var(--l-secondary);
}

.evidence-matrix td:first-child { color: var(--l-ink); font-weight: 500; }

.evidence-matrix .cite-link { display: inline-block; margin-top: var(--space-1); }

@media (max-width: 720px) {
  .evidence-matrix, .evidence-matrix thead, .evidence-matrix tbody, .evidence-matrix tr, .evidence-matrix td { display: block; }
  .evidence-matrix thead { display: none; }
  .evidence-matrix tr { padding-block: var(--space-4); border-bottom: 1px solid var(--l-border-strong); }
  .evidence-matrix td { border-bottom: none; padding: var(--space-1) 0; }
  .evidence-matrix td::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--l-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
}
