/* ==========================================================================
   SECRETOS DE CARMEN LUCÍA — MOBILE.CSS
   Mobile-first aggressive optimizations, animations, upsell modal,
   interactive elements, reading progress, social proof ticker
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. READING PROGRESS BAR
   -------------------------------------------------------------------------- */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--green-natural) 0%, var(--terracotta) 100%);
  z-index: 10000;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* --------------------------------------------------------------------------
   2. STICKY MINI HEADER
   -------------------------------------------------------------------------- */
#sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 900;
  background: rgba(255, 253, 247, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 2px 12px rgba(48, 67, 51, 0.06);
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#sticky-header.is-visible {
  transform: translateY(0);
}

.sticky-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.sticky-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold-soft);
  flex-shrink: 0;
}

.sticky-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.sticky-header-name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-header-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sticky-header-btn {
  background: linear-gradient(135deg, #B56B4A 0%, #9B5637 100%);
  color: #FFFDF7 !important;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 38px;
}

.sticky-header-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(181, 107, 74, 0.35);
}

/* --------------------------------------------------------------------------
   3. SCROLL REVEAL ANIMATIONS
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.reveal-stagger > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.15s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.25s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.35s; }
.reveal-stagger > *:nth-child(5) { transition-delay: 0.45s; }
.reveal-stagger > *:nth-child(6) { transition-delay: 0.55s; }
.reveal-stagger > *:nth-child(7) { transition-delay: 0.65s; }
.reveal-stagger > *:nth-child(8) { transition-delay: 0.75s; }

/* --------------------------------------------------------------------------
   4. UPSELL MODAL
   -------------------------------------------------------------------------- */
#upsell-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#upsell-modal.is-open {
  opacity: 1;
  pointer-events: all;
}

.upsell-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 32, 25, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.upsell-card {
  position: relative;
  z-index: 1;
  background: var(--cream);
  border-radius: 24px;
  padding: 2rem 1.5rem 1.75rem;
  width: 100%;
  max-width: 440px;
  max-height: 92svh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 24px 64px rgba(22, 32, 25, 0.35);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: none;
}

.upsell-card::-webkit-scrollbar { display: none; }

#upsell-modal.is-open .upsell-card {
  transform: scale(1) translateY(0);
}

.upsell-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--cream-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 2;
}

.upsell-close:hover {
  background: var(--border-light);
  color: var(--text-primary);
  transform: rotate(90deg);
}

/* Carmen portrait inside modal */
.upsell-portrait {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold-soft);
  margin: 0 auto 1rem auto;
  box-shadow: 0 4px 16px rgba(198, 161, 91, 0.25);
}

.upsell-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.upsell-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--green-dark);
  text-align: center;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.upsell-subtitle {
  font-size: 0.93rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

/* Choice cards grid */
.upsell-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 380px) {
  .upsell-choices {
    grid-template-columns: 1fr;
  }
}

.upsell-choice {
  border: 2px solid var(--border-card);
  border-radius: 16px;
  padding: 1.15rem 1rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: var(--cream);
}

.upsell-choice:hover {
  border-color: var(--green-natural);
  background: var(--green-light);
}

.upsell-choice.selected-basic {
  border-color: var(--green-natural);
  background: var(--green-light);
  box-shadow: 0 4px 16px rgba(82, 107, 74, 0.15);
}

.upsell-choice.selected-upsell {
  border-color: var(--terracotta);
  background: var(--terracotta-light);
  box-shadow: 0 4px 16px rgba(181, 107, 74, 0.2);
}

/* Upsell card has a badge */
.choice-upsell {
  border-color: var(--terracotta);
}

.upsell-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--terracotta);
  color: #FFFDF7;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.choice-icon {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  display: block;
}

.choice-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.choice-price {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.choice-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.choice-upsell .choice-price {
  color: var(--terracotta);
}

/* Confirm button */
.upsell-confirm-btn {
  width: 100%;
  background: linear-gradient(135deg, #B56B4A 0%, #9B5637 100%);
  color: #FFFDF7 !important;
  border: none;
  border-radius: var(--radius-pill);
  padding: 1rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 52px;
  box-shadow: 0 6px 20px rgba(181, 107, 74, 0.3);
  text-decoration: none;
}

.upsell-confirm-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(181, 107, 74, 0.4);
}

.upsell-confirm-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.upsell-skip {
  display: block;
  text-align: center;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-light);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0.5rem;
}

.upsell-skip:hover {
  color: var(--text-muted);
  text-decoration-color: var(--text-muted);
}

.upsell-divider {
  height: 1px;
  background: var(--border-light);
  margin: 1.25rem 0;
}

.upsell-trust {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   5. SOCIAL PROOF TICKER
   -------------------------------------------------------------------------- */
#social-ticker {
  position: fixed;
  bottom: 90px;
  left: 1rem;
  z-index: 998;
  background: var(--cream);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1rem;
  box-shadow: 0 4px 16px rgba(48, 67, 51, 0.1);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-110%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  pointer-events: none;
}

#social-ticker.show {
  transform: translateX(0);
  opacity: 1;
}

@media (min-width: 768px) {
  #social-ticker {
    bottom: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   6. CHAPTER CARDS — Interactive expand on mobile
   -------------------------------------------------------------------------- */
.chapter-extra {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
  opacity: 0;
  font-size: 0.87rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 0;
}

.chapter-card.expanded .chapter-extra {
  max-height: 150px;
  opacity: 1;
  margin-top: 0.75rem;
}

.chapter-expand-hint {
  font-size: 0.75rem;
  color: var(--green-natural);
  font-weight: 600;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: opacity 0.2s ease;
}

.chapter-card.expanded .chapter-expand-hint {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.chapter-card {
  cursor: pointer;
  user-select: none;
}

/* Chevron arrow on chapter card */
.chapter-card::after {
  content: '↓';
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.85rem;
  color: var(--text-light);
  transition: transform 0.3s ease;
}

.chapter-card.expanded::after {
  transform: rotate(180deg);
  color: var(--green-natural);
}

/* --------------------------------------------------------------------------
   7. VALUE COUNTER ANIMATION
   -------------------------------------------------------------------------- */
.counter-val {
  font-family: var(--font-serif);
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1;
  transition: color 0.3s ease;
}

.price-amount.is-counting {
  animation: priceGlow 0.4s ease;
}

@keyframes priceGlow {
  0% { color: var(--terracotta); }
  100% { color: var(--green-dark); }
}

/* --------------------------------------------------------------------------
   8. MICRO-ANIMATIONS
   -------------------------------------------------------------------------- */

/* Pulse ring on offer card */
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(198, 161, 91, 0.35), 0 16px 40px rgba(48, 67, 51, 0.12); }
  70% { box-shadow: 0 0 0 12px rgba(198, 161, 91, 0), 0 16px 40px rgba(48, 67, 51, 0.12); }
  100% { box-shadow: 0 0 0 0 rgba(198, 161, 91, 0), 0 16px 40px rgba(48, 67, 51, 0.12); }
}

.offer-card-main {
  animation: pulseRing 2.5s ease-in-out infinite;
  animation-delay: 1.5s;
}

/* Button idle shimmer */
@keyframes btnShimmer {
  0% { left: -100%; }
  100% { left: 150%; }
}

.btn.btn-primary::after {
  animation: btnShimmer 3.5s ease-in-out infinite;
  animation-delay: 2s;
}

/* Benefit cards stagger */
.benefits-grid .benefit-card:nth-child(1) { transition-delay: 0.05s; }
.benefits-grid .benefit-card:nth-child(2) { transition-delay: 0.15s; }
.benefits-grid .benefit-card:nth-child(3) { transition-delay: 0.25s; }
.benefits-grid .benefit-card:nth-child(4) { transition-delay: 0.35s; }
.benefits-grid .benefit-card:nth-child(5) { transition-delay: 0.45s; }
.benefits-grid .benefit-card:nth-child(6) { transition-delay: 0.55s; }

/* Emotional lines stagger */
.emotional-lines-box .emotional-line:nth-child(1) { transition-delay: 0.05s; }
.emotional-lines-box .emotional-line:nth-child(2) { transition-delay: 0.15s; }
.emotional-lines-box .emotional-line:nth-child(3) { transition-delay: 0.25s; }
.emotional-lines-box .emotional-line:nth-child(4) { transition-delay: 0.35s; }
.emotional-lines-box .emotional-line:nth-child(5) { transition-delay: 0.45s; }
.emotional-lines-box .emotional-line:nth-child(6) { transition-delay: 0.55s; }

/* Hero CTA pulse attention-getter (runs once, 3s after load) */
@keyframes heroCtaPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); box-shadow: 0 12px 36px rgba(181, 107, 74, 0.5); }
  100% { transform: scale(1); }
}

.btn-cta-hero.attention {
  animation: heroCtaPulse 0.7s ease-in-out;
}

/* --------------------------------------------------------------------------
   9. AGGRESSIVE MOBILE OPTIMIZATIONS (max-width: 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {

  /* Base */
  html { font-size: 15px; }
  body { padding-bottom: 80px; }

  /* Containers */
  .container, .container-narrow {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Sections */
  .section {
    padding-top: 2.75rem;
    padding-bottom: 2.75rem;
  }

  /* Typography */
  h1, .hero-title-v2 {
    font-size: 1.85rem !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em;
  }

  h2 {
    font-size: 1.65rem !important;
    line-height: 1.28 !important;
  }

  h3 { font-size: 1.1rem; }

  .section-subtitle {
    font-size: 0.98rem;
    margin-bottom: 2rem;
  }

  /* Badge */
  .badge-pill { font-size: 0.7rem; padding: 0.4rem 0.9rem; }

  /* Buttons — full width, large touch targets */
  .btn {
    min-height: 54px;
    font-size: 0.97rem;
    padding: 0.95rem 1.5rem;
    width: 100%;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .btn-secondary { width: auto; }

  /* Hero */
  .hero-v2-content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  .hero-subtitle-v2 {
    font-size: 1rem !important;
    margin-bottom: 1.25rem;
  }

  .hero-trust-strip { gap: 0.35rem; font-size: 0.75rem; flex-wrap: wrap; justify-content: center; }

  /* Grids — single column */
  .presentation-cards,
  .benefits-grid,
  .testimonials-grid,
  .audience-grid,
  .chapters-grid,
  .bonuses-grid,
  .identification-grid,
  .about-grid,
  .mockup-display-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  /* About grid — portrait first */
  .about-grid {
    display: flex !important;
    flex-direction: column;
  }

  .about-grid .about-portrait-card {
    order: -1;
    max-width: 100%;
  }

  /* Identification — image first on mobile */
  .identification-grid {
    display: flex !important;
    flex-direction: column;
  }

  /* Cards */
  .card-feature { padding: 1.5rem 1.25rem; }
  .benefit-card { padding: 1.5rem 1.25rem; }
  .chapter-card { padding: 1.25rem 1rem; }
  .bonus-card { padding: 1.5rem 1.25rem; }
  .testimonial-card { padding: 1.5rem 1.25rem; }

  /* Transformation comparison */
  .transformation-comparison {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  /* Offer card */
  .offer-card-main {
    padding: 2rem 1.25rem;
    border-radius: 20px;
  }

  .price-amount { font-size: 4rem !important; }

  /* Value table */
  .value-table-row {
    font-size: 0.88rem;
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .value-table-header { font-size: 1rem; padding: 0.85rem 1rem; }

  /* Guarantee card */
  .guarantee-card {
    flex-direction: column !important;
    text-align: center !important;
    padding: 2rem 1.25rem;
    gap: 1.25rem;
  }

  /* Final CTA */
  .final-cta-box {
    padding: 2.25rem 1.25rem;
    border-radius: 20px;
  }

  .final-mockup-mini { max-width: 220px; }

  /* FAQ */
  .faq-question {
    font-size: 0.97rem;
    padding: 1.1rem 1rem;
  }

  /* Emotional section */
  .emotional-section { padding-bottom: 4rem; }
  .emotional-lines-box { font-size: 1.05rem; }

  /* Hero mockup — hide on very small mobile to save space */
  .hero-spacer-col { display: none !important; }

  /* Mockup gallery card */
  .mockup-gallery-card { padding: 0.5rem; }

  /* Score spacing */
  .bonus-card { margin-bottom: 0; }

  /* Sticky mobile bar compact */
  .sticky-mobile-bar {
    padding: 0.65rem 0.75rem;
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
  }

  /* Chapter bg number smaller on mobile */
  .chapter-bg-num { font-size: 4rem; }

  /* Mockup tags row */
  .mockup-tags-row { gap: 0.5rem; }

  /* Social ticker above sticky */
  #social-ticker {
    bottom: 80px;
  }

  /* Sticky header — show on mobile + desktop */
  #sticky-header {
    padding: 0.6rem 1rem;
  }

  .sticky-header-name { font-size: 0.88rem; }
  .sticky-header-sub { display: none; }
  .sticky-header-btn { font-size: 0.78rem; padding: 0.5rem 0.9rem; }
}

/* Very small screens */
@media (max-width: 380px) {
  h2 { font-size: 1.5rem !important; }
  .hero-title-v2 { font-size: 1.65rem !important; }
  .price-amount { font-size: 3.5rem !important; }
  .btn { font-size: 0.9rem; padding: 0.9rem 1.25rem; }
}

/* --------------------------------------------------------------------------
   10. TOUCH & SAFE AREAS
   -------------------------------------------------------------------------- */
button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

.btn, .faq-question, .chapter-card, .upsell-choice {
  touch-action: manipulation;
}

/* Safe area for sticky bar */
.sticky-mobile-bar {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

/* Safe area for body when sticky visible */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* --------------------------------------------------------------------------
   11. DESKTOP ADJUSTMENTS — Prevent mobile styles from leaking
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .chapter-card { cursor: default; }
  .chapter-card::after { display: none; }
  .chapter-expand-hint { display: none; }
  #social-ticker { bottom: 2rem; }
  
  #sticky-header {
    padding: 0.75rem 2rem;
  }

  .sticky-header-name { font-size: 1rem; }
}

/* --------------------------------------------------------------------------
   12. REDUCED MOTION SUPPORT
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .offer-card-main { animation: none; }
  .btn.btn-primary::after { animation: none; }
  .btn-cta-hero.attention { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
