/* =========================================================
   Arpa Legal — landings
   Tokens + base + componentes utilitarios (sobre Tailwind CDN)
   ========================================================= */

:root {
  /* Brand */
  --brand-900: #003366;  /* azul corporativo Arpa — fondo principal */
  --brand-800: #00284F;  /* azul más profundo — urgencyBar, directForm */
  --brand-700: #004B8D;  /* azul más claro — gradientes internos */
  --brand-500: #2E6FB7;  /* azul vivo — glows */
  --accent:    #BE7D15;  /* dorado/ámbar corporativo Arpa */
  --accent-strong: #A06811;

  /* Surfaces */
  --ink:       #0B1220;
  --paper:     #FFFFFF;
  --paper-2:   #F4F6FB;

  /* Strokes */
  --stroke:      rgba(255, 255, 255, 0.12);
  --stroke-soft: rgba(255, 255, 255, 0.06);
  --stroke-dark: rgba(11, 18, 32, 0.08);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tailwind doesn't know about our custom stroke colors — alias as Tailwind utilities */
.border-stroke      { border-color: var(--stroke); }
.border-stroke-dark { border-color: var(--stroke-dark); }
.ring-stroke        { --tw-ring-color: var(--stroke); }
.shadow-card        { box-shadow: 0 1px 2px rgba(11,18,32,0.04), 0 8px 24px rgba(11,18,32,0.06); }

/* Force a monochrome dark logo to render as pure white silhouette.
   Works for any logo that is essentially dark ink on transparent background.
   Replace with a real white logo file when available and remove the filter. */
.logo-on-dark { filter: brightness(0) invert(1); }

/* =========================================================
   Base
   ========================================================= */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-feature-settings: "cv11", "ss01", "ss03"; }

/* Keep anchor targets clear of the sticky header */
[id] { scroll-margin-top: 84px; }

/* Urgency bar: collapsed, then slides up into place as soon as the user
   scrolls down (revealed by main.js). */
.urgency-reveal {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(16px);
  transition: max-height 0.5s var(--ease-out), opacity 0.45s var(--ease-out),
    transform 0.5s var(--ease-out);
}
.urgency-reveal.is-in {
  max-height: 200px;
  opacity: 1;
  transform: translateY(0);
}
/* Reduced motion (or no JS): show it immediately, no animation */
@media (prefers-reduced-motion: reduce) {
  .urgency-reveal {
    max-height: 200px;
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Selection */
::selection { background-color: rgba(245, 195, 107, 0.35); color: var(--ink); }

/* Skip link */
.skip-link {
  position: absolute;
  left: -10000px;
  top: 1rem;
  z-index: 50;
  background: var(--accent);
  color: var(--brand-900);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { left: 1rem; outline: 2px solid #fff; outline-offset: 2px; }

/* Global focus ring — visible, sober */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* Horizontal scroll containers */
.scroll-touch { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

/* =========================================================
   Press marquee — infinite loop of media logos over the dark bg
   ========================================================= */

.press-marquee {
  position: relative;
  overflow: hidden;
  /* fade edges so logos enter/exit smoothly */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.press-track {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  width: max-content;
  animation: press-scroll 24s linear infinite;
  will-change: transform;
}
.press-marquee:hover .press-track,
.press-marquee:focus-within .press-track { animation-play-state: paused; }

.press-logo {
  flex: none;
  /* logos are trimmed tight, so a fixed height now yields uniform optical size */
  height: 22px;
  width: auto;
  /* steady opacity — no per-logo hover (they are not clickable) */
  opacity: 0.85;
}
@media (min-width: 768px) { .press-logo { height: 26px; } }

@keyframes press-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Reduced motion → no animation, wrap statically */
@media (prefers-reduced-motion: reduce) {
  .press-track { animation: none; flex-wrap: wrap; gap: 1.5rem 2.5rem; }
}

/* =========================================================
   Eyebrow utility
   ========================================================= */

.eyebrow {
  font-family: "Plus Jakarta Sans", -apple-system, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
@media (min-width: 768px) { .eyebrow { font-size: 13px; } }

/* =========================================================
   CTA buttons
   ========================================================= */

.cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.75rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.005em;
  min-height: 56px;
  text-decoration: none;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), background-color 200ms var(--ease-out);
  cursor: pointer;
}
.cta-primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -8px rgba(245, 195, 107, 0.45);
}
.cta-primary:active { transform: translateY(0) scale(0.97); }

/* Compact variant for the sticky header */
.cta-compact {
  min-height: 40px;
  padding: 0.5rem 1.1rem;
  font-size: 14px;
}

/* Disabled state — used while a form is invalid or submitting */
.cta-primary:disabled,
.cta-primary[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--accent);
}

.cta-secondary-on-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  min-height: 48px;
  text-decoration: none;
  transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out);
  cursor: pointer;
}
.cta-secondary-on-dark:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
}
.cta-secondary-on-dark:active { transform: scale(0.97); }

/* White-fill secondary — used on dark hero backgrounds when extra prominence is needed */
.cta-secondary-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-900);
  font-weight: 600;
  font-size: 15px;
  min-height: 48px;
  text-decoration: none;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.35);
  transition: background-color 200ms var(--ease-out), transform 200ms var(--ease-out);
  cursor: pointer;
}
.cta-secondary-white:hover { background: #F4F4F4; transform: translateY(-1px); }
.cta-secondary-white:active { transform: scale(0.97); }

.cta-secondary-on-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 999px;
  background: var(--brand-900);
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  min-height: 48px;
  text-decoration: none;
  transition: background-color 200ms var(--ease-out), transform 200ms var(--ease-out);
  cursor: pointer;
}
.cta-secondary-on-light:hover { background: #002244; }
.cta-secondary-on-light:active { transform: scale(0.97); }

/* =========================================================
   Cards
   ========================================================= */

/* Non-interactive content card — no hover affordance (not clickable). */
.card-on-dark {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
}

/* "Por qué elegirnos" card photos: slightly darken + desaturate to unify the 4 images. */
.whyus-img {
  filter: brightness(0.85) saturate(0.9);
}

.card-on-light {
  background: var(--paper);
  border: 1px solid var(--stroke-dark);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(11,18,32,0.04), 0 8px 24px rgba(11,18,32,0.04);
}

/* =========================================================
   Reveal — fade + slide-up on viewport entry
   Hidden state is gated behind .reveal-on (added by main.js once the
   IntersectionObserver is armed). If JS never runs, content stays visible.
   ========================================================= */

[data-reveal] {
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.reveal-on [data-reveal]:not(.is-visible) {
  opacity: 0;
  transform: translateY(12px);
}

/* =========================================================
   Quiz styling (rendered by quiz.js inside #quiz-root)
   ========================================================= */

.quiz-title       { font-family: "DM Sans", system-ui, sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; color: var(--brand-900); }
@media (min-width: 768px) { .quiz-title { font-size: 20px; } }

/* Sticky desktop header: aparece desde arriba cuando el hero sale del viewport */
#sticky-header.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* Hero entrance: Ken Burns suave en la imagen + fade-in de overlays */
@keyframes hero-image-enter {
  from { transform: scale(1.06); }
  to   { transform: scale(1); }
}
@keyframes hero-overlay-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.hero-image-enter {
  animation: hero-image-enter 1.6s var(--ease-out) 0.1s both;
  will-change: transform;
}
.hero-overlay-enter {
  animation: hero-overlay-enter 1.2s var(--ease-out) 0.05s both;
}

@media (prefers-reduced-motion: reduce) {
  .hero-image-enter, .hero-overlay-enter { animation: none; }
}

/* Oculta el CTA secundario del hero ("Ya lo tengo claro") cuando el usuario
   inicia el form (stepIndex > 0) para no competir con el flow del quiz.
   Mantiene el espacio para no romper el layout. */
body.quiz-on-data-step [data-cta-track="hero_cta_click:secondary"] {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.25s var(--ease-out), visibility 0s linear 0.25s;
}
.quiz-subtitle    { margin-top: 0.25rem; font-size: 14px; color: rgba(11,18,32,0.55); }
.quiz-progress    { margin-top: 1rem; height: 6px; width: 100%; overflow: hidden; border-radius: 999px; background: var(--paper-2); }
.quiz-progress-fill { height: 100%; background: var(--brand-900); border-radius: 999px; transition: width 0.4s var(--ease-out); }
.quiz-step-meta   { margin-top: 0.5rem; font-size: 12px; color: rgba(11,18,32,0.55); }
.quiz-question    { margin-top: 1.25rem; font-family: "DM Sans", system-ui, sans-serif; font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; color: var(--ink); }
@media (min-width: 768px) { .quiz-question { font-size: 24px; } }

.quiz-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--stroke-dark);
  border-radius: 14px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.quiz-option:hover { border-color: var(--brand-900); background: var(--paper-2); }
.quiz-option:active { transform: scale(0.98); }
.quiz-option .arrow {
  margin-left: 0.75rem;
  display: inline-flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--stroke-dark);
  color: rgba(11,18,32,0.55);
  font-size: 14px;
  transition: all 200ms var(--ease-out);
}
.quiz-option:hover .arrow { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }

.quiz-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 0;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  color: rgba(11,18,32,0.55);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.quiz-back:hover { color: var(--brand-900); }

/* Form fields shared by quiz + direct form */
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.field-label .req { color: #DC2626; margin-left: 2px; }

.field-input,
.field-textarea {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--stroke-dark);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--brand-900);
  box-shadow: 0 0 0 3px rgba(10, 31, 68, 0.12);
}
.field-input[aria-invalid="true"],
.field-textarea[aria-invalid="true"] { border-color: #DC2626; }
.field-textarea { min-height: 120px; resize: vertical; }
.field-error { margin-top: 0.35rem; font-size: 13px; color: #B91C1C; }

/* Phone field with changeable country-code prefix (select) */
.phone-group { display: flex; align-items: stretch; margin-top: 0.5rem; }
.phone-prefix {
  flex: none;
  border: 1px solid var(--stroke-dark);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background-color: var(--paper-2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 0 1.6rem 0 0.75rem;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230B1220' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}
.phone-prefix:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.phone-group .phone-input {
  margin-top: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.phone-group:focus-within .phone-prefix { border-color: var(--brand-900); }

.consent {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  font-size: 14px;
  color: rgba(11,18,32,0.65);
  align-items: flex-start;
}
.consent input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
  accent-color: var(--brand-900);
}
.consent a { color: var(--brand-900); text-decoration: underline; }

.submit-error {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #FEF2F2;
  color: #991B1B;
  font-size: 14px;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

/* =========================================================
   Quiz on dark — variante para el form sobre fondo navy (hero)
   Refleja los estilos del quiz claro, con tinta clara y superficies translúcidas.
   ========================================================= */

.quiz-on-dark .quiz-title         { color: #BE7D15; }
.quiz-on-dark .quiz-subtitle      { color: rgba(255, 255, 255, 0.65); }
.quiz-on-dark .quiz-progress      { background: rgba(255, 255, 255, 0.12); }
.quiz-on-dark .quiz-progress-fill { background: var(--accent); }
.quiz-on-dark .quiz-step-meta     { color: rgba(255, 255, 255, 0.55); }
.quiz-on-dark .quiz-question      { color: #fff; }

.quiz-on-dark .quiz-option {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.quiz-on-dark .quiz-option:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: var(--accent);
}
.quiz-on-dark .quiz-option .arrow {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.7);
}
.quiz-on-dark .quiz-option:hover .arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-900);
}

.quiz-on-dark .quiz-back        { color: rgba(255, 255, 255, 0.65); }
.quiz-on-dark .quiz-back:hover  { color: var(--accent); }

.quiz-on-dark .field-label      { color: #fff; }
.quiz-on-dark .field-input,
.quiz-on-dark .field-textarea {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.quiz-on-dark .field-input::placeholder,
.quiz-on-dark .field-textarea::placeholder { color: rgba(255, 255, 255, 0.4); }
.quiz-on-dark .field-input:focus,
.quiz-on-dark .field-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(186, 154, 107, 0.20);
}

.quiz-on-dark .consent          { color: rgba(255, 255, 255, 0.7); }
.quiz-on-dark .consent a        { color: var(--accent); }
.quiz-on-dark .consent input[type="checkbox"] { accent-color: var(--accent); }

.quiz-on-dark .phone-prefix {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
}
.quiz-on-dark .phone-prefix option { background: var(--brand-900); color: #fff; }

.quiz-on-dark .submit-error {
  background: rgba(220, 38, 38, 0.18);
  color: #fecaca;
}

/* =========================================================
   Timeline (Cómo funciona) — scroll-driven fill + node activation
   ========================================================= */

.timeline-wrap { position: relative; }
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline-line,
.timeline-fill {
  position: absolute;
  left: 19px;
  width: 2px;
  border-radius: 2px;
}
.timeline-line { top: 20px; bottom: 20px; background: rgba(255, 255, 255, 0.14); }
.timeline-fill { top: 20px; height: 0; background: var(--accent); transition: height 120ms linear; }

.timeline-item {
  position: relative;
  display: flex;
  gap: 1.25rem;
  padding-bottom: 2.5rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-node {
  position: relative;
  z-index: 1;
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-800);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  transition: background-color 300ms var(--ease-out), border-color 300ms var(--ease-out),
    color 300ms var(--ease-out), transform 300ms var(--ease-out);
}
.timeline-node.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-900);
  transform: scale(1.06);
}
.timeline-content { padding-top: 5px; }

@media (min-width: 768px) {
  .timeline-item { gap: 1.75rem; padding-bottom: 3rem; }
}

/* =========================================================
   FAQ accordion
   ========================================================= */

.faq-trigger[aria-expanded="true"] .faq-icon svg { transform: rotate(45deg); }
.faq-trigger[aria-expanded="true"] + .faq-panel { grid-template-rows: 1fr; }

/* =========================================================
   Sticky CTA mobile (rendered by sticky-cta.js)
   ========================================================= */

.sticky-cta-wrap.is-visible { transform: translateY(0); opacity: 1; }
