/* Homepage mobile theme: AI-search-first first viewport.
   Desktop (≥992px) is unchanged; rules only apply at ≤991px. */

.hero-mobile-brand,
.hero-mobile-primary {
  display: none;
}

@media (max-width: 991px) {
  .home-shell--mobile-ai {
    --hm-ink: #f8fafc;
    --hm-muted: rgba(248, 250, 252, 0.86);
    --hm-accent: #ffb74d;
    --hm-accent-deep: #e39a2a;
    --hm-ai: #00a3e0;
    --hm-ai-deep: #0284c7;
    background:
      radial-gradient(900px 360px at 8% -4%, rgba(4, 38, 82, 0.16), transparent 55%),
      linear-gradient(180deg, #eef4fb 0%, #ffffff 42%);
  }

  .home-shell--mobile-ai > .container {
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    width: 100%;
  }

  /* Full-bleed hero plane */
  .home-shell--mobile-ai .hero {
    min-height: calc(100svh - 118px);
    margin: 0 0 28px;
    border-radius: 0;
    overflow: hidden;
  }

  .home-shell--mobile-ai .hero::before {
    inset: 0;
    border-radius: 0;
    box-shadow: none;
    transform: scale(1.02);
    animation: homeMobileHeroIn 720ms ease-out both;
  }

  .home-shell--mobile-ai .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
      linear-gradient(180deg, rgba(8, 24, 42, 0.28) 0%, rgba(8, 24, 42, 0.42) 42%, rgba(8, 24, 42, 0.78) 100%),
      radial-gradient(120% 70% at 50% 100%, rgba(0, 163, 224, 0.22), transparent 55%);
    pointer-events: none;
  }

  .home-shell--mobile-ai .hero-grid {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: calc(100svh - 118px);
    width: 100%;
    max-width: none;
    margin: 0;
    /* Clear sticky mobile bottom nav so classic/map links stay visible */
    padding: 28px 18px calc(72px + env(safe-area-inset-bottom, 0px));
    gap: 0;
    animation: homeMobileCopyIn 640ms ease-out 80ms both;
  }

  .home-shell--mobile-ai .hero-copy {
    padding-left: 0;
    max-width: 36rem;
    width: 100%;
  }

  .home-shell--mobile-ai .hero-copy::before,
  .home-shell--mobile-ai .hero-copy::after {
    display: none;
  }

  .home-shell--mobile-ai .eyebrow {
    display: none;
  }

  .home-shell--mobile-ai .hero-mobile-brand {
    display: block;
    margin: 0 0 8px;
    font-family: "Yeseva One", "Arial Black", Arial, sans-serif;
    font-size: clamp(1.65rem, 7vw, 2.15rem);
    line-height: 1.05;
    letter-spacing: 0.01em;
    color: #fff;
    text-shadow: 0 2px 18px rgba(8, 24, 42, 0.45);
  }

  .home-shell--mobile-ai .hero-grid,
  .home-shell--mobile-ai .hero-copy {
    color: #fff;
  }

  .home-shell--mobile-ai .hero h1 {
    margin: 0 0 10px;
    font-size: clamp(1.55rem, 6.4vw, 2rem);
    line-height: 1.12;
    color: #fff !important;
    -webkit-text-stroke: 0;
    text-shadow: 0 2px 16px rgba(8, 24, 42, 0.4);
  }

  .home-shell--mobile-ai .hero h1.hero-title-zh {
    font-size: clamp(1.45rem, 6vw, 1.85rem);
  }

  .home-shell--mobile-ai .hero-copy > p:not(.hero-mobile-brand) {
    max-width: 28rem;
    margin: 0 0 18px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: rgba(248, 250, 252, 0.9) !important;
    opacity: 1;
  }

  /* AI search is the only primary control */
  .home-shell--mobile-ai .hero-mobile-primary {
    display: block;
    margin: 0 0 4px;
  }

  .home-shell--mobile-ai .hero-mobile-ai-label {
    display: block;
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
  }

  .home-shell--mobile-ai .hero-ai-form--mobile {
    margin: 0;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0;
    align-items: stretch;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
      0 16px 40px rgba(8, 24, 42, 0.28),
      0 0 0 1px rgba(255, 255, 255, 0.35);
    transition: box-shadow 180ms ease, transform 180ms ease;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile:focus-within {
    transform: translateY(-1px);
    box-shadow:
      0 20px 44px rgba(8, 24, 42, 0.34),
      0 0 0 2px rgba(0, 163, 224, 0.55);
  }

  .home-shell--mobile-ai .hero-ai-form--mobile.is-submitting .hero-ai-row--mobile {
    overflow: visible;
    opacity: 1;
    transform: none;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile input {
    width: 100%;
    min-width: 0;
    height: 52px;
    border: 0;
    border-radius: 0;
    padding: 0 14px;
    font-size: 1rem;
    color: #0f172a;
    background: transparent;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile input:focus {
    outline: none;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile button {
    position: relative;
    z-index: 1;
    height: 52px;
    min-width: 5.5rem;
    border: 0;
    border-radius: 0;
    padding: 0 16px;
    background: linear-gradient(135deg, var(--hm-ai) 0%, var(--hm-ai-deep) 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 800;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile button:disabled {
    opacity: 1;
  }

  .home-shell--mobile-ai #hero-ai-loading-hint-mobile {
    color: #bbf7d0;
  }

  .home-shell--mobile-ai .hero-mobile-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 14px;
    font-size: 0.9rem;
    font-weight: 700;
  }

  .home-shell--mobile-ai .hero-mobile-secondary a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 183, 77, 0.7);
    padding-bottom: 1px;
  }

  .home-shell--mobile-ai .hero-mobile-secondary a:hover,
  .home-shell--mobile-ai .hero-mobile-secondary a:focus {
    color: #fff;
    border-bottom-color: var(--hm-accent);
  }

  .home-shell--mobile-ai .hero-mobile-secondary__sep {
    color: rgba(255, 255, 255, 0.35);
  }

  /* Remove first-viewport clutter */
  .home-shell--mobile-ai .actions,
  .home-shell--mobile-ai .recent-searches,
  .home-shell--mobile-ai .hero-auth-wrap,
  .home-shell--mobile-ai .hero-note,
  .home-shell--mobile-ai .hero-agent-info,
  .home-shell--mobile-ai .hero-side,
  .home-shell--mobile-ai .hero-side--geo-glass {
    display: none !important;
  }

  /* Below-the-fold: quieter, single composition rhythm */
  .home-shell--mobile-ai .section {
    margin-bottom: 36px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .home-shell--mobile-ai .home-featured-layout {
    gap: 22px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .home-shell--mobile-ai .section-title {
    font-size: 1.55rem;
    margin-bottom: 6px;
  }

  .home-shell--mobile-ai .section-sub {
    margin-bottom: 14px;
    font-size: 0.92rem;
  }

  /* Featured Homes: show only four cards on mobile */
  .home-shell--mobile-ai #home-feed-grid > .listing-container:nth-child(n + 5) {
    display: none !important;
  }

  .home-shell--mobile-ai .home-community-rail {
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0;
  }

  .home-shell--mobile-ai .home-community-rail__head .section-sub {
    display: none;
  }

  /* Communities: name links only — no color blocks, blurbs, or counts */
  .home-shell--mobile-ai .home-featured-layout .community-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .home-shell.home-shell--mobile-ai .community-grid .community-card,
  .home-shell.home-shell--mobile-ai .community-grid .community-card:nth-child(n),
  .home-shell--mobile-ai .home-featured-layout .community-card {
    position: relative;
    margin: 0;
    padding: 0;
    min-height: 0;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.28);
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none;
  }

  .home-shell.home-shell--mobile-ai .community-grid .community-card::before,
  .home-shell--mobile-ai .home-featured-layout .community-card::before {
    display: none !important;
  }

  .home-shell--mobile-ai .home-featured-layout .community-card:hover {
    transform: none;
    box-shadow: none !important;
    border-color: rgba(148, 163, 184, 0.28);
  }

  .home-shell--mobile-ai .home-featured-layout .community-card p,
  .home-shell--mobile-ai .home-featured-layout .community-card .meta {
    display: none !important;
  }

  .home-shell--mobile-ai .home-featured-layout .community-card h4 {
    margin: 0;
    padding: 12px 2px;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    color: #0f4c81;
  }

  .home-shell--mobile-ai .home-featured-layout .community-card-link {
    z-index: 3;
  }

  .home-shell--mobile-ai .home-featured-layout .community-card-link:focus-visible + h4,
  .home-shell--mobile-ai .home-featured-layout .community-card:active h4 {
    color: #0369a1;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .home-shell--mobile-ai .why-card,
  .home-shell--mobile-ai .home-news-card {
    box-shadow: none;
    border-radius: 14px;
  }

  .home-shell--mobile-ai .home-news-excerpt {
    -webkit-line-clamp: 2;
  }

  .home-shell--mobile-ai .home-news-body {
    padding: 12px 12px 14px;
    gap: 6px;
  }

  .home-shell--mobile-ai .cta-band {
    margin-left: 14px;
    margin-right: 14px;
    border-radius: 16px;
  }
}

/* Homepage-only: quieter top nav pills on small screens */
@media (max-width: 991px) {
  body.page-home-mobile-ai .header-main .navigation__list {
    gap: 4px 5px !important;
    max-height: 4.6rem;
    overflow: hidden;
  }

  body.page-home-mobile-ai .header-main .navigation__item {
    min-width: 0 !important;
  }

  body.page-home-mobile-ai .header-main .navigation__link {
    min-height: 28px !important;
    padding: 4px 7px !important;
    font-size: 10.5px !important;
    border-radius: 8px !important;
    background: rgba(247, 251, 255, 0.92) !important;
  }
}

@keyframes homeMobileHeroIn {
  from {
    opacity: 0.55;
    transform: scale(1.06);
  }
  to {
    opacity: 1;
    transform: scale(1.02);
  }
}

@keyframes homeMobileCopyIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-shell--mobile-ai .hero::before,
  .home-shell--mobile-ai .hero-grid {
    animation: none !important;
  }

  .home-shell--mobile-ai .hero-ai-row--mobile,
  .home-shell--mobile-ai .hero-ai-row--mobile:focus-within {
    transition: none;
    transform: none;
  }
}
