/* ===========================================================================
   Berial Systems — estilos de la landing (shell).
   Las secciones internas se irán añadiendo por fases.
   =========================================================================== */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }

/* ---------- Layout ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--container-pad); }
.section-block { padding: 110px 0; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

.eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--sage); margin-bottom: 14px;
}
.eyebrow-dark { color: #6C8671; }  /* sage AA sobre fondo oscuro (4.68:1) */
.section-h2 {
  font-size: 34px; font-weight: 500; line-height: 1.2;
  letter-spacing: -0.01em; color: var(--ink); margin: 0;
}
.section-rule { width: 40px; height: 2px; background: var(--sage); border: none; margin: 16px 0 0; }
.section-stub-note { color: var(--ink-3); font-size: 14px; margin-top: 28px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; line-height: 1;
  border-radius: var(--radius-md); padding: 12px 24px;
  border: 1.5px solid transparent; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn-pri { background: var(--cta); color: #fff; }
.btn-pri:hover { background: var(--cta-hover); }
.btn-sec { background: transparent; color: var(--cta); border-color: var(--cta); }
.btn-sec:hover { background: rgba(47,106,78,0.07); }
.btn-copper { background: #C9824A; color: #fff; }
.btn-copper:hover { background: #b87040; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Barra de progreso de scroll ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--sage); transform: scaleX(0); transform-origin: left center;
  z-index: 300; pointer-events: none;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px; z-index: 200;
  background: var(--nav-bg-0);
  transition: background-color .28s ease, border-color .28s ease, backdrop-filter .28s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}
.nav-logo { line-height: 0; }
.nav-logo img { height: 30px; width: auto; object-fit: contain; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-link {
  font-size: 13px; font-weight: 500; letter-spacing: 0.01em; color: var(--ink-2);
  padding: 4px 0; border-bottom: 1.5px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.nav-link:hover, .nav-link.is-active { color: var(--ink); border-bottom-color: var(--sage); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-cta { font-size: 13px; padding: 9px 20px; }

/* Theme toggle */
.theme-toggle {
  position: relative; width: 56px; height: 28px; border-radius: 8px;
  border: 1.5px solid var(--border-2); background: var(--surface); padding: 0;
}
.theme-toggle-track { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 7px; color: var(--ink-3); }
.theme-ico { opacity: .45; }
.theme-toggle.is-dark .theme-ico-moon { opacity: .9; }
.theme-toggle:not(.is-dark) .theme-ico-sun { opacity: .9; }
.theme-toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 6px; background: var(--bg);
  border: 1px solid var(--border-2);
  transition: left .26s cubic-bezier(.4,0,.2,1);
}
.theme-toggle.is-dark .theme-toggle-knob { left: 30px; }

/* Hamburger (móvil) */
.hamburger { display: none; width: 38px; height: 38px; border-radius: 8px;
  border: 1.5px solid var(--border-2); background: var(--surface); position: relative; }
.hamburger span {
  position: absolute; left: 9px; width: 20px; height: 1.8px; background: var(--ink);
  transition: transform .26s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
.hamburger span:nth-child(1) { top: 13px; }
.hamburger span:nth-child(2) { top: 18px; }
.hamburger span:nth-child(3) { top: 23px; }
.hamburger.is-open span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* Menú móvil drawer */
.nav-overlay { position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: rgba(15,20,17,0.38); backdrop-filter: blur(2px); z-index: 198;
  opacity: 0; transition: opacity .24s ease; }
.nav-overlay.is-open { opacity: 1; }
.nav-drawer { position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 199;
  background: var(--bg); border-bottom: 1px solid var(--border);
  box-shadow: 0 18px 44px -26px rgba(0,0,0,.55); padding: 10px 24px 22px;
  max-height: calc(100vh - var(--nav-h)); overflow-y: auto;
  transform: translateY(-12px); opacity: 0;
  transition: transform .24s cubic-bezier(.22,.61,.36,1), opacity .24s ease; }
.nav-drawer.is-open { transform: translateY(0); opacity: 1; }
.nav-drawer-link { display: block; padding: 15px 6px; font-size: 15px; color: var(--ink-2);
  border-bottom: 1px solid var(--hairline); border-left: 2px solid transparent; }
.nav-drawer-link.is-active { color: var(--ink); border-left-color: var(--sage); padding-left: 12px; }
.nav-drawer-cta { margin-top: 18px; width: 100%; padding: 14px; }

/* ---------- Hero (calcado de Sections.jsx HeroSection) ---------- */
.hero {
  position: relative; min-height: clamp(520px, 82vh, 740px);
  display: flex; align-items: center; overflow: hidden;
  background: var(--bg); padding-top: 68px;
}
.hero-scene { position: absolute; inset: 0; z-index: 0; }
.hero-wash { position: absolute; inset: 0; pointer-events: none; background: var(--hero-wash); }
.hero-inner { position: relative; z-index: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 48px 48px 40px; }
.hero-content { max-width: 760px; }
.hero-h1 {
  font-family: var(--font-display); font-size: clamp(40px, 6.4vw, 76px); line-height: 1.06;
  font-weight: 500; color: var(--ink); letter-spacing: -0.025em; margin: 8px 0 0;
}
.hero-line { display: block; }
.hero-line.is-accent { color: var(--sage); }
.hero-rule { width: 48px; height: 2px; background: var(--sage); border: none; margin: 26px 0 24px; }
.hero-sub { font-family: var(--font-body); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 0 0 32px; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* word clip-reveal del H1 */
.word-clip { display: inline-block; overflow: hidden; vertical-align: bottom; line-height: 1.18; }
.word-r { display: inline-block; animation: wordReveal 0.78s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes wordReveal { from { transform: translateY(110%); } to { transform: translateY(0); } }

/* entrada hero (heroReveal) */
@keyframes heroReveal { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
.h-r { animation: heroReveal 0.75s ease-out both; }
.h-r-3 { animation-delay: 220ms; }
.h-r-4 { animation-delay: 340ms; }
.h-r-5 { animation-delay: 460ms; }

/* reveal genérico */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .65s ease-out, transform .65s ease-out; }
[data-reveal].is-revealed { opacity: 1; transform: translateY(0); }

/* ---------- Cinta de logos ---------- */
.ticker-section { background: var(--bg); }
.ticker-heading { text-align: center; padding: 4px 0 28px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--sage); }
.ticker-band { background: #171A16; overflow: hidden; padding: 30px 0; position: relative; }
.ticker-band::before, .ticker-band::after { content: ""; position: absolute; top: 0; bottom: 0; width: 72px; z-index: 1; pointer-events: none; }
.ticker-band::before { left: 0; background: linear-gradient(to right, #171A16, transparent); }
.ticker-band::after { right: 0; background: linear-gradient(to left, #171A16, transparent); }
.ticker-track { display: flex; align-items: center; width: max-content; animation: ticker 26s linear infinite; }
.ticker-item { flex-shrink: 0; display: flex; align-items: center; height: 44px; margin: 0 38px; }
/* Los logos ya vienen como silueta hueso con la densidad igualada y el tamaño
   equilibrado ópticamente (ver build_client_logos.py), así que se dibujan a su
   tamaño intrínseco: no hay que forzar ni alto ni ancho desde aquí. */
.ticker-logo { display: block; opacity: 0.85; }
/* -33.3333% = una copia exacta de las 3 que emite la plantilla. */
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-33.3333%); } }

/* ---------- CTA final ---------- */
.cta-final { background: #0F1411; position: relative; overflow: hidden; }
.cta-final-inner { padding: 100px 0; max-width: 640px; position: relative; z-index: 1; }
.cta-final-h2 { font-size: 38px; font-weight: 500; line-height: 1.18; letter-spacing: -0.01em; color: #F7F4ED; margin: 0; }
.cta-final-p { font-size: 16px; line-height: 1.7; color: #D8D1C2; max-width: 520px; margin: 18px 0 0; }
.cta-final-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 32px; }
.cta-final-mailto { font-size: 14px; color: #6C8671; border-bottom: 1px solid #3D5040; padding-bottom: 2px; }
.cta-final-mailto:hover { color: #D8D1C2; }

/* ---------- Footer ---------- */
.footer { background: #0F1411; border-top: 1px solid #2C362E; padding: 64px 0 36px; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 48px; flex-wrap: wrap; gap: 32px; }
.footer-brand img { height: 26px; margin-bottom: 16px; }
.footer-tagline { font-size: 11px; letter-spacing: 0.08em; color: #6C8671; margin: 0; }
/* Ubicación: misma familia visual que el lema, un paso más apagada. #6C8671 es
   el sage ya validado en AA sobre el fondo oscuro del footer (4.68:1). */
.footer-geo { font-size: 11px; letter-spacing: 0.08em; color: #6C8671; margin: 8px 0 0; opacity: 0.75; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col-h { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #6C8671; }
.footer-link { font-size: 13px; color: #8EA894; transition: color .16s ease; }
.footer-link:hover { color: #D8D1C2; }
.footer-hr { border: none; border-top: 1px solid #2C362E; margin: 0 0 24px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-copy { font-size: 12px; color: #6C8671; }  /* era #3D5040 (2.14:1, ilegible) -> AA */
.footer-email { font-size: 12px; color: #6C8671; }
.footer-email:hover { color: #D8D1C2; }

/* ---------- Drawer de diagnóstico ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 400; display: flex; justify-content: flex-end;
  background: rgba(15,20,17,0.38); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .28s ease;
}
/* Cerrado: oculto de verdad. Sin esto, display:flex anula el atributo [hidden]
   y el overlay (opacity:0) tapa toda la página interceptando los clics. */
.modal-bg[hidden] { display: none; }
.modal-bg.is-open { opacity: 1; }
.modal-panel {
  width: 460px; max-width: 100%; height: 100%; background: var(--surface);
  overflow-y: auto; transform: translateX(100%); transition: transform .28s cubic-bezier(.22,.61,.36,1);
  display: flex; flex-direction: column;
}
.modal-bg.is-open .modal-panel { transform: translateX(0); }
.modal-header { position: sticky; top: 0; z-index: 10; background: var(--surface-muted);
  border-bottom: 1px solid var(--border); padding: 28px 32px 20px; }
.modal-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--ink); }
.modal-counter { font-size: 12px; color: var(--ink-3); margin-left: 12px; }
.modal-close { background: none; border: none; color: var(--ink-3); padding: 4px; line-height: 0; }
.modal-close:hover { color: var(--ink); }
.modal-progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.modal-progress-bar { height: 100%; width: 0; background: var(--sage); border-radius: 2px; transition: width .4s ease; }
.modal-body { padding: 32px; }
.modal-block { width: 100%; margin-top: 4px; }
/* Aviso de privacidad bajo el botón de envío: presente y legible, sin robar
   protagonismo al CTA. --ink-3 mantiene el contraste AA sobre el fondo claro. */
.form-legal { font-size: 11.5px; line-height: 1.5; color: var(--ink-3); margin: 10px 0 0; text-align: center; }
.form-legal a { color: inherit; text-decoration: underline; }

.question-text { font-family: var(--font-display); font-size: 20px; font-weight: 500; line-height: 1.4; color: var(--ink); margin: 0 0 28px; }
.question-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { text-align: left; padding: 14px 18px; border-radius: 6px; border: 1.5px solid var(--border-2);
  background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 500; transition: all .18s ease; }
.quiz-option:hover { border-color: var(--sage); background: rgba(95,124,101,0.06); color: var(--cta); }

.result-box { border: 1px solid var(--border); border-radius: 8px; padding: 20px 22px; margin-bottom: 28px; }
.result-badge { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.result-title { font-family: var(--font-display); font-size: 20px; font-weight: 500; color: var(--ink); margin: 0; }
.result-desc { font-size: 15px; line-height: 1.7; color: var(--ink-2); margin: 0 0 28px; }
.result-rec { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px; margin-bottom: 28px; }
.result-rec-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sage); margin-bottom: 7px; }
.result-rec p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }

.form-title { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--ink); margin: 0 0 4px; }
.form-subtitle { font-size: 14px; color: var(--ink-3); margin: 0 0 20px; }
.diag-form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field i { color: var(--accent); font-style: normal; }
.field em { color: var(--ink-4); font-style: normal; }
.field input, .field textarea {
  font-family: inherit; font-size: 14px; padding: 11px 14px; border-radius: 6px;
  border: 1.5px solid var(--border-2); background: var(--surface); color: var(--ink);
  transition: border-color .16s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--sage); }
.field textarea { min-height: 80px; resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.step-success { text-align: center; padding: 40px 0; }
.success-check { width: 60px; height: 60px; border-radius: 50%; background: rgba(47,106,78,0.1);
  border: 1.5px solid var(--cta); color: var(--cta); display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; }
.success-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; color: var(--ink); margin: 0 0 12px; }
.success-text { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin: 0 0 32px; }

.question-card.slide { animation: questionSlide .35s ease-out both; }
@keyframes questionSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .container { padding: 0 32px; }
  .hero-inner { padding-left: 32px; padding-right: 32px; }
}
@media (max-width: 880px) {
  .nav { padding: 0 20px; }
  .nav-links, .nav-cta { display: none; }
  .hamburger { display: block; }
}
@media (max-width: 720px) {
  .container { padding: 0 20px; }
  .hero-inner { padding: 44px 20px 36px; }
  .section-block { padding: 72px 0; }
  .section-h2 { font-size: 28px; }
  .cta-final-h2 { font-size: 28px; }
}
@media (max-width: 520px) {
  .section-block { padding: 52px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-header { padding: 22px 22px 18px; }
  .modal-body { padding: 24px 22px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; }
  [data-reveal], [data-reveal-word] { opacity: 1 !important; transform: none !important; transition: none !important; }
  * { animation-duration: .001ms !important; transition-duration: .05ms !important; }
}
