/* ═══════════════════════════════════════════════════════════════════════
   FastFixCell.com — Layout Flow Fix v4.0
   Unifies page rhythm, contrast, sticky nav offsets, and section flow.
   Loaded last among design CSS so it wins over conflicting rules.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Page shell ──────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height, 64px) + 16px);
}

body {
  background: var(--surface-0, #f8fafc);
  background-image: none;
  color: var(--text-primary, #0f172a);
  overflow-x: hidden;
}

/* Sticky header shouldn't cover section titles when jumping anchors */
#main-content,
main {
  display: block;
  padding-top: 0;
}

/* Mobile bottom action bar clearance */
@media (max-width: 767px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .cta-section,
  footer,
  .footer {
    margin-bottom: 8px;
  }
}

/* ── Sticky nav polish ───────────────────────────────────────── */
.ff-header {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.ff-header.scrolled {
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08) !important;
  border-bottom-color: rgba(37, 99, 235, 0.18) !important;
}
.ff-nav-links a {
  color: #334155 !important;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.ff-nav-links a:hover,
.ff-nav-links a:focus-visible {
  color: #0f172a !important;
  background: rgba(37, 99, 235, 0.08) !important;
}
.ff-nav-links a.active,
.ff-nav-links a.nav-cta {
  color: #fff !important;
}
.ff-nav-links a.nav-cta {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  border-radius: 999px;
  padding: 10px 16px !important;
  font-weight: 700;
}
.theme-toggle {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Section rhythm (the main “flow” fix) ────────────────────── */
.section,
section.services,
section.booking,
section.why-us,
section.testimonials,
section.carriers,
section.cta-section,
#broken-screen,
#backglass,
#services,
#booking,
#imei-check,
#shop,
#carriers,
#coverageSection,
#reviews,
#contact,
footer.footer,
.footer {
  position: relative;
  padding-block: clamp(56px, 8vw, 96px) !important;
  overflow: visible !important; /* don't clip cards/shadows */
  background-attachment: scroll !important; /* fixed backgrounds break Windows scroll */
}

/* Alternating light surfaces so sections read as a clear sequence */
#services,
#booking,
#imei-check,
#coverageSection {
  background: #f8fafc !important;
}
#backglass,
#shop,
.why-us,
.testimonials,
.carriers,
#reviews {
  background: #ffffff !important;
}
.cta-section {
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%) !important;
}

/* Kill decorative section pseudo layers that create muddy double-backgrounds */
.services::before,
.why-us::before,
.booking::before,
.testimonials::before,
.carriers::before,
.cta-section::before,
#imei-check::before,
#coverageSection::before,
#shop::before,
#services::before,
#booking::before {
  display: none !important;
}

/* Section headers — readable, left-aligned, consistent spacing */
.section-tag,
#services .section-tag,
#booking .section-tag,
#shop .section-tag,
#imei-check .section-tag {
  display: inline-flex !important;
  margin-bottom: 12px !important;
  color: #1d4ed8 !important;
  background: rgba(37, 99, 235, 0.1) !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  -webkit-text-fill-color: #1d4ed8 !important;
}

.section-title,
#services .section-title,
#booking .section-title,
#shop .section-title,
#imei-check .section-title,
.why-us .section-title,
.testimonials .section-title,
.carriers .section-title {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: none !important;
  background-image: none !important;
  font-size: clamp(1.75rem, 3.2vw, 2.5rem) !important;
  line-height: 1.15 !important;
  margin: 0 0 12px 0 !important;
  max-width: 18ch;
  text-wrap: balance;
}

.section-sub,
#services .section-sub,
#booking .section-sub,
#shop .section-sub,
#imei-check .section-sub {
  color: #475569 !important;
  -webkit-text-fill-color: #475569 !important;
  background: none !important;
  max-width: 62ch !important;
  margin: 0 0 28px 0 !important;
  line-height: 1.65 !important;
  font-size: clamp(1rem, 1.5vw, 1.125rem) !important;
}

/* ── Containers ──────────────────────────────────────────────── */
.container,
.ff-container {
  width: min(100%, 1200px) !important;
  max-width: 1200px !important;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px) !important;
}

/* ── Grids ───────────────────────────────────────────────────── */
.services-grid,
.features-grid,
.testimonials-grid,
.carriers-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 20px !important;
  align-items: stretch !important;
}

/* Cards: solid, readable, no glass mud */
.feature-card,
.testimonial-card,
.carrier-card,
.booking-form,
.booking-info,
.bg-series-card,
.bg-model-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06) !important;
}

.feature-card h3,
.testimonial-card h3,
.carrier-card h3,
.booking-form h3,
.booking-info h3 {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: none !important;
}

.feature-card p,
.testimonial-card p,
.carrier-card p {
  color: #475569 !important;
  -webkit-text-fill-color: #475569 !important;
}

/* ── Forms / booking flow ────────────────────────────────────── */
#booking {
  overflow: visible !important;
  transform: none !important;
  isolation: isolate;
  height: auto !important;
  max-height: none !important;
}
#booking .container {
  position: relative;
  z-index: 2;
  min-width: 0;
}
#booking .section-title {
  max-width: 22ch !important;
}
#booking .booking-steps {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin: 0 0 24px 0 !important;
}
#booking .booking-step {
  min-width: 0 !important;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  line-height: 1.35;
}
.booking-container {
  display: grid !important;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr) !important;
  gap: 24px !important;
  align-items: start !important;
  min-width: 0;
}
#booking .booking-form,
#booking .quick-prices,
#booking #bookingContent {
  min-width: 0;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}
#booking .form-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
#booking .form-group select,
#booking .form-group input,
#booking .form-group textarea {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .booking-container,
  #booking .booking-container {
    grid-template-columns: 1fr !important;
  }
  #booking .booking-steps {
    grid-template-columns: 1fr 1fr !important;
  }
}
@media (max-width: 560px) {
  #booking .booking-steps {
    grid-template-columns: 1fr !important;
  }
  #booking .form-row {
    grid-template-columns: 1fr;
  }
}

.booking-form,
.booking-info {
  padding: 24px !important;
}

.form-group label,
.booking label,
label {
  color: #334155 !important;
  font-weight: 600 !important;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea,
.form-input,
.form-select,
.form-textarea {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  min-height: 48px;
  font-size: 16px !important; /* prevent iOS zoom */
}
input:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
  outline: none !important;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn,
.btn-primary,
.btn-book,
.btn-secondary {
  min-height: 48px;
  border-radius: 12px !important;
  font-weight: 700 !important;
  cursor: pointer;
}
.btn-primary,
.btn-book {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #fff !important;
  border: none !important;
}
.btn-outline,
.btn-secondary {
  background: #fff !important;
  color: #1d4ed8 !important;
  border: 2px solid #2563eb !important;
}

/* ── Hero: keep cinematic dark band, then flow into light site ─ */
.hero {
  min-height: min(92vh, 860px) !important;
  padding-top: calc(var(--nav-height, 64px) + 24px) !important;
  padding-bottom: 56px !important;
  background: #0f172a !important;
  color: #f8fafc !important;
}
.hero .section-title,
.hero h1,
.hero .hero-title {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: none !important;
  max-width: 16ch;
}
.hero p,
.hero .hero-subtitle,
.hero .section-sub {
  color: #cbd5e1 !important;
  -webkit-text-fill-color: #cbd5e1 !important;
  max-width: 48ch;
}

/* Soft handoff from hero → content (visual flow) */
.hero + *,
.section-wave {
  margin-top: 0 !important;
}

/* ── Shop / IMEI readability ─────────────────────────────────── */
#shop,
#imei-check {
  color: #0f172a;
}
#shop input,
#imei-check input,
#imei-check select,
#imei-check textarea {
  background: #fff !important;
  color: #0f172a !important;
}

/* ── Coverage map grid ───────────────────────────────────────── */
#coverageStoreGrid {
  display: grid !important;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) !important;
  gap: 20px !important;
  align-items: stretch !important;
}
@media (max-width: 900px) {
  #coverageStoreGrid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Footer ──────────────────────────────────────────────────── */
footer,
.footer {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
footer a,
.footer a {
  color: #93c5fd !important;
}
footer a:hover,
.footer a:hover {
  color: #fff !important;
}

/* ── Cart drawer ─────────────────────────────────────────────── */
#cartDrawer {
  color: #0f172a;
  background: #fff !important;
}
#cartDrawer h2 {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}

/* ── Reduce layout jank from reveal animations ───────────────── */
.layout-reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}
.layout-reveal.is-visible {
  opacity: 1 !important;
  transform: none !important;
}

/* ── Tone down floating orbs so they don't fight content ─────── */
.orb {
  opacity: 0.22 !important;
  filter: blur(70px) !important;
  pointer-events: none !important;
}

/* ── Section wave dividers: subtle, non-breaking ─────────────── */
.section-wave {
  display: block;
  line-height: 0;
  height: 28px;
  overflow: hidden;
  background: transparent !important;
}
.section-wave svg {
  display: block;
  width: 100%;
  height: 28px;
}

/* ── Mobile nav open state ───────────────────────────────────── */
@media (max-width: 767px) {
  .ff-nav-links {
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  }
  .ff-nav-links a {
    width: 100%;
    padding: 14px 16px !important;
  }
  .services-grid,
  .features-grid,
  .testimonials-grid,
  .carriers-grid {
    grid-template-columns: 1fr !important;
  }
  .hero {
    min-height: auto !important;
    padding-bottom: 40px !important;
  }
}

/* ── Accessibility: visible focus ────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #2563eb !important;
  outline-offset: 2px !important;
}

/* ── Prefer reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* What We Fix � hard lock against scroll motion */
#services.services-static,
#services.services-static .container,
#services.services-static .section-title,
#services.services-static .section-sub,
#services.services-static .service-card {
  transform: none !important;
  will-change: auto !important;
  --section-parallax: 0px !important;
}
#services.services-static .service-card:hover {
  transform: translateY(-3px) !important;
}
