/**
 * FarmBrawl Landing — Mobile-first polish (loads LAST)
 * Fixes: overflow, skewed layouts, grid collapse, hero size wars, perf
 */

/* ─── Root containment ─── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.landing-page.landing-pixel {
  overflow-x: clip !important;
  max-width: 100% !important;
  width: 100% !important;
  position: relative;
}

body.landing-page.landing-pixel *,
body.landing-page.landing-pixel *::before,
body.landing-page.landing-pixel *::after {
  box-sizing: border-box;
}

/* Kill fixed mesh animations on small screens (major jank source) */
@media (max-width: 768px) {
  .vault-mesh {
    animation: none !important;
    background-size: 48px 48px !important;
    opacity: 0.55;
  }
  .vault-mesh::before {
    animation: none !important;
    opacity: 0.4 !important;
    transform: none !important;
  }

  /* No continuous glow / wobble on mobile GPUs */
  .landing-btn-play--hero {
    animation: none !important;
    will-change: auto !important;
  }
  .landing-page.landing-pixel .hero-beta-badge {
    animation: none !important;
    transform: rotate(10deg) !important;
    top: -8px !important;
    right: -8px !important;
  }

  /* Particles / orbs off (JS also skips; CSS belt-and-suspenders) */
  #hero-particles,
  .ambient-orbs,
  .landing-hero-grain {
    display: none !important;
  }

  .landing-hero-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Sections: no horizontal bleed */
  .landing-section,
  .landing-section-inner,
  .landing-section-inner--wide,
  .howtoplay,
  .howtoplay-inner,
  .landing-cta-band,
  .landing-footer,
  .landing-footer-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .landing-section,
  .landing-section-inner,
  .howtoplay-inner {
    padding-left: max(0.85rem, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(0.85rem, env(safe-area-inset-right, 0px)) !important;
  }

  /* ─── NAV ─── */
  .landing-page.landing-pixel .landing-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .landing-page.landing-pixel .landing-nav-inner {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.4rem !important;
    padding: 0.45rem 0.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .landing-page.landing-pixel .nav-zone-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .landing-page.landing-pixel .brand-logo-vault {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    max-width: 100%;
  }

  .landing-page.landing-pixel .brand-logo-vault img {
    width: 36px !important;
    height: 36px !important;
    flex-shrink: 0;
  }

  .landing-page.landing-pixel .brand-text-vault {
    font-size: clamp(0.55rem, 2.6vw, 0.72rem) !important;
    letter-spacing: 0.02em !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .landing-page.landing-pixel .nav-beta-badge {
    font-size: 0.45rem !important;
    padding: 0.15em 0.35em !important;
    flex-shrink: 0;
  }

  .landing-page.landing-pixel .nav-zone-center {
    display: contents; /* let menu take full row when open */
  }

  .landing-page.landing-pixel .landing-nav-toggle {
    display: inline-flex !important;
    flex-shrink: 0;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin-left: auto;
  }

  .landing-page.landing-pixel .nav-zone-right {
    display: none !important;
  }

  .landing-page.landing-pixel .landing-nav-links {
    flex-basis: 100%;
    order: 20;
    width: 100% !important;
    max-width: 100% !important;
  }

  .landing-page.landing-pixel .landing-nav-links.is-open {
    display: flex !important;
    flex-direction: column !important;
  }

  /* ─── HERO ─── */
  .landing-page.landing-pixel .landing-hero {
    min-height: auto !important;
    height: auto !important;
    padding:
      calc(4.25rem + env(safe-area-inset-top, 0px))
      max(0.85rem, env(safe-area-inset-left, 0px))
      2.25rem
      max(0.85rem, env(safe-area-inset-right, 0px)) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  /* Hero art has baked-in game chrome (missions bar / dock) — mask bottom */
  .landing-page.landing-pixel .landing-hero-bg {
    transform: none !important;
  }

  .landing-page.landing-pixel .landing-hero-overlay {
    background:
      linear-gradient(180deg, rgba(8, 6, 4, 0.35) 0%, rgba(8, 6, 4, 0.15) 40%, rgba(8, 6, 4, 0.55) 78%, rgba(8, 6, 4, 0.92) 100%) !important;
  }

  .landing-page.landing-pixel .landing-scroll-hint {
    z-index: 2;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
  }

  .landing-page.landing-pixel .landing-hero-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    transform: none !important; /* kill parallax leftover */
    opacity: 1 !important;
  }

  .landing-page.landing-pixel .landing-hero-panel {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 1.15rem 0.95rem 1.25rem !important;
    position: relative !important;
    overflow: visible !important;
  }

  /* Title: ONE rule wins — compact arcade wordmark, not huge clamp wars */
  .landing-page.landing-pixel .landing-hero-title,
  .landing-page.landing-pixel .landing-hero-title.hero-title-pixel {
    font-size: clamp(1.05rem, 5.8vw, 1.55rem) !important;
    line-height: 1.35 !important;
    letter-spacing: 0.03em !important;
    margin: 0.35rem 0 0.85rem !important;
    max-width: 100% !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    filter: none !important;
  }

  .landing-page.landing-pixel .hero-pixel-word {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.04em !important;
    max-width: 100%;
  }

  .landing-page.landing-pixel .hp-ch {
    font-size: inherit !important;
    text-shadow:
      2px 0 0 #0a0806,
      -2px 0 0 #0a0806,
      0 2px 0 #0a0806,
      0 -2px 0 #0a0806,
      2px 2px 0 #0a0806,
      -2px 2px 0 #0a0806,
      2px -2px 0 #0a0806,
      -2px -2px 0 #0a0806,
      0 3px 0 rgba(0, 0, 0, 0.4) !important;
  }

  .landing-page.landing-pixel .landing-hero-kicker {
    font-size: clamp(0.48rem, 2.6vw, 0.62rem) !important;
    padding: 0.35rem 0.55rem !important;
    max-width: 100%;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    text-align: center;
    justify-content: center;
    align-items: center !important;
    line-height: 1.2 !important;
    gap: 0.3rem !important;
  }

  .landing-page.landing-pixel .landing-hero-kicker i {
    flex-shrink: 0 !important;
    align-self: center !important;
    font-size: 0.55rem !important;
  }

  .landing-page.landing-pixel .landing-hero-lead {
    font-size: 0.92rem !important;
    line-height: 1.55 !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
  }

  .landing-page.landing-pixel .landing-hero-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .landing-page.landing-pixel .landing-btn-play--hero,
  .landing-page.landing-pixel .landing-btn-ghost-hero {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
    padding: 0.85rem 1rem !important;
  }

  .landing-page.landing-pixel .hero__trust {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.4rem !important;
    margin-top: 1.1rem !important;
    width: 100% !important;
    padding: 0 !important;
    list-style: none !important;
  }

  .landing-page.landing-pixel .hero__trust li {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 100% !important;
    font-size: 0.62rem !important;
    padding: 0.32rem 0.5rem !important;
    margin: 0 !important;
    white-space: nowrap;
  }

  .landing-page.landing-pixel .landing-scroll-hint {
    position: relative !important;
    bottom: auto !important;
    margin-top: 1.25rem !important;
    font-size: 0.75rem !important;
  }

  /* ─── GRIDS → single / dual column, no crooked cards ─── */
  .landing-page.landing-pixel .landing-social-proof {
    width: 100% !important;
    padding: 0 !important;
  }

  .landing-page.landing-pixel .landing-social-proof-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }

  .landing-page.landing-pixel .landing-social-proof-item {
    min-width: 0 !important;
    padding: 0.8rem 0.5rem !important;
    text-align: center !important;
  }

  .landing-page.landing-pixel .landing-social-proof-value {
    font-size: clamp(0.95rem, 4.5vw, 1.15rem) !important;
  }

  .landing-page.landing-pixel .landing-social-proof-label {
    font-size: 0.62rem !important;
    line-height: 1.25 !important;
  }

  .landing-page.landing-pixel .landing-why-grid,
  .landing-page.landing-pixel .landing-pillars-grid,
  .landing-page.landing-pixel .landing-features-grid,
  .landing-page.landing-pixel .landing-help-grid,
  .landing-page.landing-pixel .landing-steps,
  .landing-page.landing-pixel .howtoplay-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.9rem !important;
    width: 100% !important;
  }

  .landing-page.landing-pixel .landing-pillar-card,
  .landing-page.landing-pixel .landing-plant-card,
  .landing-page.landing-pixel .landing-feature-card,
  .landing-page.landing-pixel .landing-help-card,
  .landing-page.landing-pixel .landing-step,
  .landing-page.landing-pixel .howtoplay-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    transform: none !important;
    margin: 0 !important;
  }

  .landing-page.landing-pixel .landing-pillar-card:hover,
  .landing-page.landing-pixel .landing-plant-card:hover,
  .landing-page.landing-pixel .landing-help-card:hover {
    transform: none !important;
  }

  .landing-page.landing-pixel .landing-pillar-head {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.65rem !important;
  }

  .landing-page.landing-pixel .landing-pillar-card h3,
  .landing-page.landing-pixel .landing-pillar-title {
    font-size: 1rem !important;
    line-height: 1.35 !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
  }

  .landing-page.landing-pixel .landing-plants-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }

  .landing-page.landing-pixel .landing-section-title,
  .landing-page.landing-pixel .landing-why-title,
  .landing-page.landing-pixel .howtoplay-title,
  .landing-page.landing-pixel .landing-display {
    font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
    line-height: 1.25 !important;
    max-width: 100% !important;
    text-align: center !important;
  }

  .landing-page.landing-pixel .landing-section-lead,
  .landing-page.landing-pixel .landing-why-lead,
  .landing-page.landing-pixel .howtoplay-lead {
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
    max-width: 100% !important;
    text-align: center !important;
  }

  /* How-to-play timeline */
  .landing-page.landing-pixel .howtoplay-timeline {
    padding-left: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  .landing-page.landing-pixel .howtoplay-step {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    width: 100% !important;
    padding-left: 0 !important;
  }

  .landing-page.landing-pixel .howtoplay-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 0.75rem !important;
    padding: 1rem 0.85rem !important;
  }

  .landing-page.landing-pixel .howtoplay-img-wrap {
    width: 64px !important;
    height: 64px !important;
    flex-shrink: 0;
  }

  .landing-page.landing-pixel .howtoplay-text {
    width: 100% !important;
    min-width: 0 !important;
  }

  .landing-page.landing-pixel .howtoplay-text h3 {
    font-size: 0.95rem !important;
  }

  .landing-page.landing-pixel .howtoplay-text p {
    font-size: 0.85rem !important;
  }

  /* Aegis / Iris stacks */
  .landing-page.landing-pixel .landing-aegis,
  .landing-page.landing-pixel .landing-iris {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.1rem !important;
    text-align: center !important;
    justify-items: center !important;
  }

  .landing-page.landing-pixel .landing-aegis-img,
  .landing-page.landing-pixel .landing-iris-logo {
    max-width: min(220px, 70vw) !important;
    height: auto !important;
    margin: 0 auto !important;
  }

  .landing-page.landing-pixel .landing-iris-tags {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }

  .landing-page.landing-pixel .landing-iris-list {
    text-align: left !important;
    width: 100% !important;
  }

  /* FAQ */
  .landing-page.landing-pixel .landing-faq-item {
    width: 100% !important;
    padding: 0.9rem 0.85rem !important;
  }

  .landing-page.landing-pixel .landing-faq-question {
    font-size: 0.95rem !important;
  }

  .landing-page.landing-pixel .landing-faq-answer {
    font-size: 0.85rem !important;
  }

  /* CTA band */
  .landing-page.landing-pixel .landing-cta-band {
    padding: 2rem 0.85rem !important;
    text-align: center !important;
  }

  .landing-page.landing-pixel .landing-cta-band .landing-btn-play {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Footer */
  .landing-page.landing-pixel .landing-footer-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
    text-align: center !important;
  }

  .landing-page.landing-pixel .landing-footer-links {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.55rem 0.85rem !important;
  }

  .landing-page.landing-pixel .landing-footer-links a {
    font-size: 0.85rem !important;
  }

  /* Sticky bottom CTA — clear content, no double-pad wars */
  .landing-page.landing-pixel .landing-sticky-cta {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 90 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding:
      0.55rem
      max(0.75rem, env(safe-area-inset-left, 0px))
      calc(0.55rem + env(safe-area-inset-bottom, 0px))
      max(0.75rem, env(safe-area-inset-right, 0px)) !important;
    background: rgba(10, 8, 6, 0.94) !important;
    border-top: 2px solid #0a0806 !important;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .landing-page.landing-pixel .landing-sticky-cta a {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
  }

  body.landing-page.landing-pixel {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Images never blow layout */
  .landing-page.landing-pixel img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* content-visibility for below-fold paint savings */
  .landing-page.landing-pixel .landing-section--how,
  .landing-page.landing-pixel .howtoplay,
  .landing-page.landing-pixel .landing-section--alt,
  .landing-page.landing-pixel .landing-cta-band,
  .landing-page.landing-pixel .landing-footer {
    content-visibility: auto;
    contain-intrinsic-size: 1px 600px;
  }
}

/* ─── Extra-small phones ─── */
@media (max-width: 380px) {
  .landing-page.landing-pixel .landing-plants-grid,
  .landing-page.landing-pixel .landing-social-proof-grid {
    grid-template-columns: 1fr !important;
  }

  .landing-page.landing-pixel .brand-text-vault {
    display: none !important; /* logo only — stops squeeze */
  }

  .landing-page.landing-pixel .landing-hero-title,
  .landing-page.landing-pixel .landing-hero-title.hero-title-pixel {
    font-size: 1rem !important;
  }
}

/* ─── Landscape phones ─── */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 480px) {
  .landing-page.landing-pixel .landing-hero {
    padding-top: calc(3.5rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 1.25rem !important;
    min-height: auto !important;
  }

  .landing-page.landing-pixel .landing-hero-panel {
    padding: 0.75rem 0.85rem !important;
  }

  .landing-page.landing-pixel .landing-scroll-hint {
    display: none !important;
  }

  body.landing-page.landing-pixel {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ─── Reduced motion always respected ─── */
@media (prefers-reduced-motion: reduce) {
  .vault-mesh,
  .vault-mesh::before,
  .landing-btn-play--hero,
  .landing-page.landing-pixel .hero-beta-badge,
  .particle,
  .ambient-orb {
    animation: none !important;
  }

  .landing-page.landing-pixel .landing-hero-content,
  .landing-page.landing-pixel .landing-hero-bg {
    transform: none !important;
    opacity: 1 !important;
  }
}
