/**
 * Mobile-first landing polish — RemodelGen v3
 * Optimized for phones (≤768px). Desktop gets lighter touch.
 */

/* ── Background orbs — see shared/funnel-v3.css (.flow-ambient-bg) ── */
.mobile-landing-bg,
.flow-ambient-bg {
  display: none;
  pointer-events: none;
}

.page .flow-ambient-bg {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.mobile-landing-bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: mlb-orb-drift 18s ease-in-out infinite alternate;
}

.mobile-landing-bg__orb--a {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -60px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.35) 0%, transparent 70%);
}

.mobile-landing-bg__orb--b {
  width: 220px;
  height: 220px;
  bottom: 18%;
  left: -70px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28) 0%, transparent 70%);
  animation-delay: -6s;
}

.mobile-landing-bg__orb--c {
  width: 160px;
  height: 160px;
  top: 42%;
  right: 10%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
  animation-delay: -12s;
}

.mobile-landing-bg__mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, black 0%, transparent 85%);
}

@keyframes mlb-orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(12px, -18px) scale(1.08); }
}

/* ── Quick zip picks ── */
.zip-quick-picks {
  margin-top: 0.75rem;
}

.zip-quick-picks__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.45rem;
}

.zip-quick-picks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.zip-quick-picks__chip {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.42rem 0.62rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.zip-quick-picks__chip:hover {
  border-color: #86efac;
  background: #f0fdf4;
}

.zip-quick-picks__chip:active {
  transform: scale(0.96);
}

.zip-quick-picks__chip.is-selected {
  border-color: #22c55e;
  background: #dcfce7;
  color: #166534;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

/* ── Activity ticker ── */
.activity-ticker {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
}

.activity-ticker__pulse {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: #22c55e;
  animation: social-live 1.4s ease-out infinite;
}

.activity-ticker__text {
  font-size: 0.76rem;
  font-weight: 600;
  color: #166534;
  line-height: 1.35;
  transition: opacity 0.28s ease;
}

.activity-ticker.is-fading .activity-ticker__text {
  opacity: 0.2;
}

/* ── Mobile stats row ── */
.mobile-stats-row {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.mobile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.55rem 0.35rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.mobile-stat strong {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.mobile-stat span {
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Testimonial stars & dots ── */
.landing-quote__stars {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: #f59e0b;
  margin-bottom: 0.25rem;
}

.landing-quote__dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.landing-quote__dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.2s, transform 0.2s;
}

.landing-quote__dots span.is-active {
  background: #16a34a;
  transform: scale(1.25);
}

/* ── Sticky mobile CTA dock ── */
.mobile-sticky-cta {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 0.55rem max(0.85rem, env(safe-area-inset-left)) max(0.65rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-right));
  background: linear-gradient(180deg, rgba(241, 245, 249, 0) 0%, rgba(241, 245, 249, 0.92) 28%, #f1f5f9 100%);
  backdrop-filter: blur(10px);
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-sticky-cta.is-visible {
  transform: translateY(0);
}

.mobile-sticky-cta__btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 54px;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: #fff;
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
  box-shadow:
    0 4px 16px rgba(22, 163, 74, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.15) inset;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, filter 0.15s;
}

.mobile-sticky-cta__btn:active {
  transform: scale(0.98);
}

.mobile-sticky-cta__label {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.mobile-sticky-cta__sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.88;
  margin-top: 0.1rem;
}

.mobile-sticky-cta__btn svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-left: auto;
}

.mobile-sticky-cta__btn--ready {
  background: linear-gradient(135deg, #4ade80 0%, #166534 100%);
  box-shadow: 0 6px 22px rgba(22, 163, 74, 0.55);
}

/* ── Desktop: hide mobile-only chrome ── */
@media (min-width: 769px) {
  .zip-quick-picks,
  .activity-ticker,
  .mobile-stats-row,
  .mobile-sticky-cta,
  .landing-quote__dots {
    display: none !important;
  }
}

/* ══════════════════════════════════════════
   MOBILE LANDING (≤768px) — primary experience
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  body.is-mobile-landing {
    overscroll-behavior-y: none;
  }

  body.is-mobile-landing .page {
    align-items: stretch;
    justify-content: flex-start;
    padding-top: max(0.65rem, env(safe-area-inset-top));
    padding-bottom: calc(max(5.5rem, env(safe-area-inset-bottom)) + 4rem);
    min-height: 100dvh;
    min-height: 100svh;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 42%, #eef2f7 100%);
  }

  body.is-mobile-landing .hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  body.is-mobile-landing .v3-funnel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
  }

  /* Hero typography */
  body.is-mobile-landing .mobile-landing__hero {
    padding-top: 0.25rem;
    animation: mlb-hero-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @keyframes mlb-hero-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  body.is-mobile-landing .logo {
    margin-bottom: 0.65rem;
  }

  body.is-mobile-landing .logo__img {
    height: clamp(2.5rem, 10.5vw, 3.25rem);
    max-width: min(220px, 72vw);
  }

  body.is-mobile-landing .social-proof {
    font-size: 0.68rem;
    padding: 0.32rem 0.62rem;
    margin-bottom: 0.55rem;
    max-width: 100%;
  }

  body.is-mobile-landing .headline {
    font-size: clamp(1.55rem, 7.8vw, 2rem);
    line-height: 1.22;
    letter-spacing: -0.035em;
    max-width: 14ch;
    margin-bottom: 0.4rem;
  }

  body.is-mobile-landing .subhead {
    font-size: 0.88rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    max-width: 28ch;
    color: #64748b;
  }

  /* Value props → 3-column grid */
  body.is-mobile-landing .value-props {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.9rem;
    width: 100%;
  }

  body.is-mobile-landing .value-props li {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    line-height: 1.25;
    padding: 0.45rem 0.25rem;
    white-space: normal;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  }

  body.is-mobile-landing .value-props svg {
    width: 15px;
    height: 15px;
  }

  /* Premium CTA card */
  body.is-mobile-landing .mobile-landing__zip {
    animation: mlb-card-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
  }

  @keyframes mlb-card-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  body.is-mobile-landing .cta-card {
    position: relative;
    border-radius: 20px;
    padding: 1.15rem 1rem 1rem;
    border: 1px solid #e2e8f0;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.8) inset,
      0 8px 24px -6px rgba(15, 23, 42, 0.14),
      0 20px 48px -12px rgba(22, 163, 74, 0.12);
    overflow: hidden;
  }

  body.is-mobile-landing .cta-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #22c55e, #16a34a, #059669);
  }

  body.is-mobile-landing .cta-card__step {
    font-size: 0.68rem;
    margin-bottom: 0.3rem;
  }

  body.is-mobile-landing .cta-card__label {
    font-size: 1.12rem;
    margin-bottom: 0.5rem;
  }

  /* Giant zip field */
  body.is-mobile-landing .zip-field {
    min-height: 58px;
    padding: 0 0.9rem;
    border-radius: 14px;
    border-width: 2px;
  }

  body.is-mobile-landing .zip-field input {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    font-variant-numeric: tabular-nums;
    padding: 0.8rem 0;
  }

  body.is-mobile-landing .zip-field__icon svg {
    width: 22px;
    height: 22px;
  }

  body.is-mobile-landing .zip-field__progress span {
    height: 4px;
  }

  body.is-mobile-landing .zip-preview {
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
  }

  body.is-mobile-landing .zip-hint {
    font-size: 0.68rem;
    text-align: center;
  }

  /* Quick picks horizontal scroll */
  body.is-mobile-landing .zip-quick-picks {
    display: block;
    margin-top: 0.65rem;
  }

  body.is-mobile-landing .zip-quick-picks__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
    margin: 0 -0.25rem;
    padding-inline: 0.25rem;
  }

  body.is-mobile-landing .zip-quick-picks__list::-webkit-scrollbar {
    display: none;
  }

  body.is-mobile-landing .zip-quick-picks__chip {
    flex-shrink: 0;
    font-size: 0.74rem;
    padding: 0.48rem 0.72rem;
    min-height: 36px;
  }

  /* Thumb-friendly CTA */
  body.is-mobile-landing .cta-card__btn {
    min-height: 56px;
    font-size: 1.08rem;
    border-radius: 14px;
    margin-top: 0.75rem;
    letter-spacing: -0.01em;
  }

  body.is-mobile-landing .cta-card__btn--ready {
    animation: mlb-btn-glow 2s ease-in-out infinite;
  }

  @keyframes mlb-btn-glow {
    0%, 100% { box-shadow: 0 6px 22px rgba(22, 163, 74, 0.5); }
    50% { box-shadow: 0 8px 28px rgba(22, 163, 74, 0.65), 0 0 0 4px rgba(34, 197, 94, 0.15); }
  }

  body.is-mobile-landing .cta-card__reassure {
    font-size: 0.7rem;
    margin-top: 0.55rem;
  }

  /* Social proof block */
  body.is-mobile-landing .landing-social {
    margin-top: 0.85rem;
    gap: 0.6rem;
    animation: mlb-social-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.16s both;
  }

  @keyframes mlb-social-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  body.is-mobile-landing .activity-ticker {
    display: flex;
  }

  body.is-mobile-landing .mobile-stats-row {
    display: grid;
  }

  body.is-mobile-landing .pro-strip {
    padding: 0.35rem 0;
  }

  body.is-mobile-landing .pro-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.62rem;
  }

  body.is-mobile-landing .landing-quote {
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.85);
    touch-action: pan-y;
  }

  body.is-mobile-landing .landing-quote__text {
    font-size: 0.84rem;
  }

  body.is-mobile-landing .landing-quote__dots {
    display: flex;
  }

  /* Trust footer on mobile landing */
  body.is-mobile-landing .trust {
    margin-top: 0.85rem !important;
    padding: 0.5rem 0 0 !important;
    border-top: 1px solid #e2e8f0;
  }

  body.is-mobile-landing .trust li:not(.trust__divider) {
    font-size: 0.6rem !important;
  }

  /* Sticky dock */
  body.is-mobile-landing .mobile-sticky-cta {
    display: block;
  }

  body.is-mobile-landing.keyboard-open .mobile-sticky-cta {
    transform: translateY(110%) !important;
  }

  /* Hide desktop value prop duplication when stats row shows */
  body.is-mobile-landing .value-props li:nth-child(1)::after {
    content: none;
  }

  /* Flow panel spacing */
  body.is-mobile-landing .flow-panel--tall {
    width: 100%;
  }

  body.is-mobile-landing .cta-form {
    margin-bottom: 0;
  }
}

/* ── Small phones (≤390px) ── */
@media (max-width: 390px) {
  body.is-mobile-landing .headline {
    font-size: 1.45rem;
    max-width: 13ch;
  }

  body.is-mobile-landing .value-props li {
    font-size: 0.56rem;
    padding: 0.38rem 0.18rem;
  }

  body.is-mobile-landing .zip-quick-picks__chip {
    font-size: 0.68rem;
    padding: 0.42rem 0.58rem;
  }

  body.is-mobile-landing .mobile-stat strong {
    font-size: 0.9rem;
  }

  body.is-mobile-landing .mobile-stat span {
    font-size: 0.58rem;
  }
}

/* ── Landscape phones ── */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
  body.is-mobile-landing .page {
    padding-top: 0.35rem;
    padding-bottom: 4rem;
  }

  body.is-mobile-landing .hero {
    justify-content: flex-start;
  }

  body.is-mobile-landing .logo {
    margin-bottom: 0.35rem;
  }

  body.is-mobile-landing .logo__img {
    height: 2rem;
  }

  body.is-mobile-landing .headline {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }

  body.is-mobile-landing .subhead,
  body.is-mobile-landing .value-props,
  body.is-mobile-landing .landing-social,
  body.is-mobile-landing .activity-ticker,
  body.is-mobile-landing .mobile-stats-row {
    display: none;
  }

  body.is-mobile-landing .cta-card {
    padding: 0.85rem 0.9rem;
  }

  body.is-mobile-landing .zip-quick-picks {
    display: none;
  }
}

/* ── Hide landing chrome after funnel starts ── */
.page.page--flow-started [data-landing-only],
.page.page--flow-started .mobile-sticky-cta {
  display: none !important;
}

body.is-mobile-landing.page--flow-started .page,
.page.page--flow-started {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .mobile-landing-bg__orb,
  .cta-card--enter,
  .cta-card--nudge .cta-card__btn,
  .cta-card__btn--ready,
  body.is-mobile-landing .cta-card__btn--ready,
  .social-proof__live,
  .activity-ticker__pulse {
    animation: none !important;
  }

  .mobile-sticky-cta {
    transition: none;
  }

  body.is-mobile-landing .mobile-landing__hero,
  body.is-mobile-landing .mobile-landing__zip,
  body.is-mobile-landing .landing-social {
    animation: none !important;
  }
}

/* Touch device enhancements */
@media (hover: none) and (pointer: coarse) {
  body.is-mobile-landing .cta-card__btn {
    min-height: 58px;
  }

  body.is-mobile-landing .zip-quick-picks__chip {
    min-height: 40px;
  }

  body.is-mobile-landing .zip-field:focus-within {
    box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.2);
  }

  body.is-mobile-landing .cta-card__btn:active {
    transform: scale(0.97);
    filter: brightness(0.96);
  }

  body.is-mobile-landing .zip-quick-picks__chip:active {
    background: #dcfce7;
    border-color: #4ade80;
  }
}

/* Tall phones — extra breathing room */
@media (max-width: 768px) and (min-height: 740px) {
  body.is-mobile-landing .v3-funnel {
    justify-content: center;
    padding-block: 0.5rem;
  }

  body.is-mobile-landing .headline {
    font-size: clamp(1.65rem, 8vw, 2.1rem);
  }

  body.is-mobile-landing .cta-card {
    padding: 1.25rem 1.05rem 1.05rem;
  }

  body.is-mobile-landing .landing-social {
    margin-top: 1rem;
  }
}

/* iOS safe-area notch padding for sticky */
@supports (padding: max(0px)) {
  body.is-mobile-landing .mobile-sticky-cta {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
}
