/* ============================================================
   El Operante · standalone landing-v5 · dark híbrido
   Envoltorio dark; ERP-sheet + PDF lightbox light (documentos).
   ============================================================ */

:root {
  /* Dark envelope */
  --bg: #0b0b14;
  --bg-soft: #0b0b14;
  --surface: #14161c;
  --surface-2: rgba(255,255,255,0.08);
  --text: #ffffff;
  --text-soft: rgba(255,255,255,0.66);
  --text-faint: rgba(255,255,255,0.40);
  --accent: #033CCC;
  --accent2: #1e5bff;
  --accent-soft: rgba(107,143,255,0.16);
  --accent-deep: #6b8fff;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  /* WhatsApp dark palette */
  --wa-out: #005c4b;
  --wa-in: #202c33;
  --wa-bg: #0b141a;
  --wa-head: #1f2c33;
  --wa-bar: #005c4b;
  --wa-text: #e9edef;
  --wa-text-soft: rgba(233,237,239,0.62);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  /* Variables ajustables. Defaults adaptados a standalone landing-v5. */
  --phone-scale: 0.98;
  --laptop-scale: 1.24;
  --laptop-y: 28px;
  --think-y: 0px;
  --stage-gap: 6px;
  --trail-w: 262px;
}
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
img { max-width: 100%; display: block; }

/* ============================================================
   Scrolly + sticky viewport (dark)
   ============================================================ */
.scrolly {
  position: relative;
  background: var(--bg);
}
.viewport-wrap {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: 1fr 144px;
  padding: 14px 24px 0;
  background: var(--bg);
}
.stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--stage-gap, 32px);
  align-items: center;
  min-height: 0;
}

.scroll-track { position: relative; z-index: 1; }
.step-anchor { height: 85vh; pointer-events: none; }

/* ============================================================
   iPhone column
   ============================================================ */
.phone-col {
  display: flex; justify-content: center; align-items: center;
  height: 100%;
  position: relative;
}

/* ============================================================
   Laptop column — dark chassis
   ============================================================ */
.laptop-col {
  display: flex; justify-content: center; align-items: center;
  height: 100%; position: relative;
  min-height: 0;
  min-width: 0;
}
.laptop-col .macbook {
  width: 100%;
  max-width: none;
  transform: translateY(var(--laptop-y, 0px)) scale(var(--laptop-scale, 1));
  transform-origin: center center;
  transition: transform 0.2s ease;
}
.laptop-col .viewport {
  background-size: cover !important;
  background-position: top center !important;
  background-repeat: no-repeat;
  transition: opacity 0.35s ease, background-image 0.35s ease;
  cursor: default !important;
}
.laptop-col .macbook:hover .viewport {
  background-position: top center !important;
}
.laptop-col .viewport:after { display: none !important; }

/* ============================================================
   ERP header mask — overlay sobre el viewport para tapar
   "PERFORMANCE LUBE DE GRUP..." y darle identidad neutra "Distribuidora".
   Cubre desde el top del viewport hasta ~6.5% (header de Odoo).
   ============================================================ */
.erp-header-mask {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6.4%;
  z-index: 5;
  background: #1a1c2b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 0.85em;
  letter-spacing: -0.2px;
  pointer-events: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.erp-header-mask::before {
  /* fila izquierda: módulo · nav */
  content: "odoo";
  position: absolute;
  left: 14px; top: 50%; transform: translateY(-50%);
  font-weight: 700;
  font-size: 1.05em;
  color: #ffffff;
  letter-spacing: -0.4px;
}
.erp-header-mask .ehm-co {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600;
  color: #ffffff;
}
.erp-header-mask .ehm-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e5bff, #033CCC);
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
}

/* Mask adicional sobre la zona de auditoría del cliente (datos privados).
   Solo activa cuando viewport tiene viewport-has-client-log */
.viewport-has-client-log .erp-client-log-mask {
  display: block;
}
.erp-client-log-mask {
  display: none;
  position: absolute;
  left: 0; right: 0;
  /* mask sobre la zona de auditoría del cliente */
  top: 86%;
  bottom: 0;
  z-index: 5;
  background: linear-gradient(to bottom,
    rgba(244,245,247,0) 0%,
    rgba(244,245,247,0.85) 22%,
    rgba(244,245,247,1) 100%);
  pointer-events: none;
}
.erp-client-log-mask::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 14%;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 0.78em;
  color: #6b7385;
  font-style: italic;
  letter-spacing: -0.2px;
}

/* Chrome top bar (tab + URL) — DARK */
.chrome {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 4;
  font-family: var(--sans);
  user-select: none;
}
.chrome-tabs {
  display: flex; align-items: flex-end;
  height: 30px;
  background: #14161c;
  padding: 6px 8px 0;
  gap: 1px;
}
.chrome-tab {
  display: flex; align-items: center; gap: 6px;
  height: 26px;
  min-width: 140px;
  max-width: 220px;
  padding: 0 10px 0 12px;
  background: #1a1c2b;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.92);
  letter-spacing: -0.36px;
  position: relative;
}
.chrome-tab-fav {
  width: 12px; height: 12px;
  border-radius: 3px;
  background: var(--accent2);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5);
}
.chrome-tab-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  letter-spacing: -0.36px;
}
.chrome-tab-close {
  font-size: 16px;
  line-height: 1;
  color: rgba(255,255,255,0.6);
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.chrome-tab-new {
  border: none;
  background: transparent;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  cursor: default;
  border-radius: 50%;
  margin-left: 4px;
  align-self: center;
}
.chrome-urlbar {
  display: flex; align-items: center; gap: 10px;
  height: 38px;
  padding: 0 12px;
  background: #1a1c2b;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chrome-nav {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,0.58);
}
.chrome-nav svg { display: block; }
.chrome-address {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: #2a2d3e;
  border-radius: 999px;
  padding: 5px 12px;
  min-width: 0;
}
.chrome-address svg { color: rgba(255,255,255,0.5); flex-shrink: 0; }
.chrome-url {
  font-family: var(--sans);
  font-size: 12.5px;
  color: rgba(255,255,255,0.86);
  letter-spacing: -0.36px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chrome-menu {
  color: rgba(255,255,255,0.55);
  font-size: 18px;
  width: 26px;
  text-align: center;
  cursor: default;
}

/* ============================================================
   Audit trail (base)
   ============================================================ */
.trail {
  border: 1px solid rgba(107,143,255,0.18);
  border-radius: 12px;
  background: rgba(20,22,28,0.85);
  padding: 12px 16px 8px;
  height: 100%;
  min-height: 0;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 40px -16px rgba(0,0,0,0.7);
  color: #fff;
  margin-top: 10px;
}
.trail-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.trail-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 4px rgba(30,91,255,0.22);
}
.trail-title {
  font-size: 12px; font-weight: 600;
  letter-spacing: -0.36px;
  flex: 1;
  color: #fff;
}
.trail-counter {
  font-family: var(--mono);
  font-size: 11px; color: rgba(255,255,255,0.55);
  letter-spacing: -0.22px;
}
.trail-counter span { color: #fff; font-weight: 600; }
.trail-list {
  flex: 1; list-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex; flex-direction: column;
  gap: 2px;
  padding-right: 4px;
  margin: 0;
  min-width: 0;
}
.trail-list::-webkit-scrollbar { width: 6px; }
.trail-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* ============================================================
   Mobile drawer toggle (hidden on desktop)
   ============================================================ */
.trail-drawer-toggle {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 70;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(20,22,28,0.92);
  color: #fff;
  border: 1px solid rgba(107,143,255,0.28);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.6);
}
.trail-drawer-toggle .tdt-arrow { display: inline-block; transform: translateY(1px) rotate(0); transition: transform .25s ease; }
body.trail-drawer-open .trail-drawer-toggle .tdt-arrow { transform: translateY(1px) rotate(180deg); }

/* ============================================================
   Responsive base (refined further in mobile section)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
  .ph-bubble, .trail-row {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================
   MOBILE REDESIGN (<=720px)
   Layout: laptop ARRIBA (legible, no microscópica),
           iPhone ABAJO (foco principal del UX mobile, sin pisar la laptop),
           trail = drawer bottom collapsable con handle tap-friendly.

   Estrategia: NO usamos transform: scale() (deja ghost-space porque el
   bounding box no se achica, solo el render). Achicamos vía width real
   de .macbook y vía --ph-height del phone, así flow visual y real
   coinciden y el gap entre piezas es predecible.
   ============================================================ */
@media (max-width: 720px) {
  /* Modo embedded mobile: hasta que arranque el scroll, ocultamos laptop+phone
     y mostramos solo la portada. Apenas hay progress > 0, se revelan. */
  body.embedded.scrolly-pre .laptop-col,
  body.embedded.scrolly-pre .phone-col,
  body.embedded.scrolly-pre .trail-drawer-toggle {
    opacity: 0 !important;
    transform: translateY(24px) !important;
    pointer-events: none !important;
  }
  body.embedded .laptop-col,
  body.embedded .phone-col,
  body.embedded .trail-drawer-toggle {
    transition: opacity .35s ease, transform .35s ease;
  }
  .viewport-wrap {
    grid-template-rows: 1fr !important;
    padding: 10px 10px 56px;
    height: 100dvh;
    overflow: hidden;
  }
  /* Stage en mobile = 1 columna stack vertical, contenido centrado.
     Filas: laptop (auto) | gap visible | phone (auto). */
  body[data-variant="b"] .stage,
  .stage {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 24px;
    height: 100%;
    align-content: center;
    justify-items: center;
  }
  /* LAPTOP arriba, legible (~65% del ancho), sin transform-scale.
     max-width chico achica el bounding box real -> no hay ghost-space abajo. */
  .laptop-col {
    height: auto;
    width: 100%;
    order: 1;
    padding-top: 0;
    align-self: center;
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
  }
  .laptop-col .macbook {
    transform: none !important;
    transform-origin: center center !important;
    max-width: 92vw !important;
    width: 92vw !important;
    margin: 0 auto !important;
    padding: 3% 5% !important;
  }
  /* PHONE centrado debajo de la laptop, sin solaparse.
     transform-origin center para que ningún scale heredado lo "suba".
     --ph-height limitado a ~40dvh para que comparta el viewport con la laptop
     sin pisarla. */
  .phone-col {
    order: 2;
    height: auto;
    width: 100%;
    transform: none !important;
    transform-origin: center center !important;
    margin-top: 0;
    align-self: center;
    justify-self: center;
    --ph-height: min(40dvh, calc(58vw * 800 / 380)) !important;
  }
  .phone-col .ph {
    height: var(--ph-height);
    transform-origin: center center;
  }
  /* trail off-screen by default; drawer slides up SIN empujar el flow */
  body.mode-expand .trail,
  .trail {
    position: fixed !important;
    left: 8px; right: 8px;
    bottom: 56px;
    height: 56dvh !important;
    max-height: 56dvh !important;
    z-index: 65;
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding-left: 14px !important;
    transform: translateY(calc(100% + 80px)) !important;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 16px;
    align-self: auto !important;
  }
  body.trail-drawer-open.mode-expand .trail,
  body.trail-drawer-open .trail {
    transform: translateY(0) !important;
  }
  .trail-drawer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 20px;
    font-size: clamp(12.5px, 3.4vw, 14px);
  }
}

@media (max-width: 414px) {
  .viewport-wrap { padding: 8px 8px 52px; }
  .stage,
  body[data-variant="b"] .stage { gap: 18px; }
  .laptop-col .macbook {
    transform: none !important;
    max-width: 94vw !important;
    width: 94vw !important;
  }
  .phone-col {
    transform: none !important;
    margin-top: 0;
    --ph-height: min(38dvh, calc(62vw * 800 / 380)) !important;
  }
  .trail-drawer-toggle { font-size: 12px; padding: 10px 16px; }
}

@media (max-width: 360px) {
  .stage,
  body[data-variant="b"] .stage { gap: 14px; }
  .laptop-col .macbook {
    transform: none !important;
    max-width: 96vw !important;
    width: 96vw !important;
  }
  .phone-col {
    transform: none !important;
    --ph-height: min(36dvh, calc(66vw * 800 / 380)) !important;
  }
}

/* Tablet 721-1023: side-by-side phone+laptop compact, trail va al drawer */
@media (min-width: 721px) and (max-width: 1023px) {
  .viewport-wrap {
    grid-template-rows: 1fr !important;
    padding: 12px 14px;
    height: 100dvh;
  }
  .stage {
    grid-template-columns: auto 1fr !important;
    gap: 14px;
  }
  .laptop-col .macbook { transform: translateY(20px) scale(1.05); }
  /* trail = drawer también en tablet (drawer toggle visible) */
  body.mode-expand .trail,
  .trail {
    position: fixed !important;
    left: 8px; right: 8px;
    bottom: 56px;
    height: 60dvh !important;
    max-height: 60dvh !important;
    z-index: 65;
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding-left: 14px !important;
    transform: translateY(calc(100% + 80px)) !important;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 16px;
    align-self: auto !important;
    display: flex !important;
  }
  body.trail-drawer-open.mode-expand .trail,
  body.trail-drawer-open .trail { transform: translateY(0) !important; }
  .trail-drawer-toggle { display: inline-flex; align-items: center; gap: 8px; }
}

/* Disable :hover styles on touch devices to prevent sticky tap-state */
@media (hover: none) {
  .ph-clickable:hover { transform: none !important; }
}
