/**
 * Ethos R8.4.9 homepage final quality-control layer.
 *
 * Small, homepage-scoped refinements that preserve the approved visual
 * direction while improving navigation, touch behavior, and mobile flow.
 */

/* Keep the accepted cinematic header, then make its scrolled state compact. */
body.home .site-header.is-scrolled {
  background: rgba(245, 244, 241, 0.98);
  border-bottom-color: var(--mist);
  box-shadow: 0 8px 32px rgba(11, 11, 12, 0.06);
  color: var(--home-ink, var(--ink));
  height: 76px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

body.home .site-header.is-scrolled .site-header__inner {
  min-height: 76px;
}

body.home .site-header.is-scrolled .site-brand--ethos,
body.home .site-header.is-scrolled .site-brand--ethos img {
  height: 52px;
  width: 52px;
}

/* The county controls remain legible and comfortably tappable at every size. */
.ethos-home-markets .ethos-editorial-map__controls button,
.ethos-home-markets .ethos-editorial-map__county-group button {
  min-height: 44px;
}

.ethos-home-markets .ethos-editorial-map__controls button {
  color: rgba(243, 239, 230, 0.72);
}

.ethos-home-markets .ethos-editorial-map__county-group button {
  border-color: rgba(243, 239, 230, 0.28);
  color: rgba(243, 239, 230, 0.88);
}

.ethos-home-markets .ethos-editorial-map__satellite .ethos-zoom button {
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  width: 44px;
}

@media (max-width: 820px) {
  /* The body alone reserves the fixed rail; the homepage needs no second pad. */
  .ethos-home-master {
    padding-bottom: 0;
  }

  body.home .site-header,
  body.home .site-header.is-scrolled {
    height: 72px;
  }

  body.home .site-header__inner,
  body.home .site-header.is-scrolled .site-header__inner {
    min-height: 72px;
  }

  body.home .site-brand--ethos,
  body.home .site-brand--ethos img,
  body.home .site-header.is-scrolled .site-brand--ethos,
  body.home .site-header.is-scrolled .site-brand--ethos img {
    height: 46px;
    width: 46px;
  }

  /* Preserve the editorial cards as a swipeable, edge-to-edge discovery rail. */
  .ethos-home-lifestyles__grid {
    display: grid;
    gap: 12px;
    grid-auto-columns: min(78vw, 420px);
    grid-auto-flow: column;
    grid-template-columns: none;
    margin-inline: -18px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 18px 18px;
    scroll-padding-inline: 18px;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .ethos-home-lifestyles__grid::-webkit-scrollbar {
    display: none;
  }

  .ethos-home-lifestyle {
    aspect-ratio: 4 / 5;
    margin-bottom: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  /* Present every county as a stable two-column touch grid on small screens. */
  .ethos-home-markets .ethos-editorial-map__county-group > div {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    overflow: visible;
    padding: 0;
  }

  .ethos-home-markets .ethos-editorial-map__county-group button {
    line-height: 1.35;
    padding: 8px 6px;
    white-space: normal;
    width: 100%;
  }

  .ethos-home-lifestyle__copy {
    bottom: 28px;
    left: 28px;
  }

  .ethos-home-lifestyle__arrow {
    bottom: 26px;
    height: 44px;
    right: 24px;
    width: 44px;
  }

  .ethos-home-fit {
    margin-top: 18px;
  }

  .ethos-home-markets .ethos-editorial-map__controls {
    min-height: 52px;
    scroll-padding-inline: 4px;
  }

  .ethos-home-markets .ethos-editorial-map__controls button {
    font-size: 11px;
    min-height: 52px;
    padding-inline: 2px;
  }

  .ethos-home-markets .ethos-editorial-map__county-group h3 {
    font-size: 10px;
  }

  .ethos-home-markets .ethos-editorial-map__county-group button {
    font-size: 10.5px;
  }
}

@media (max-width: 782px) {
  body.admin-bar.home .site-header,
  body.admin-bar.home .site-header.is-scrolled {
    top: 46px;
  }
}

@media (max-width: 700px) {
  body.home {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  body.home .mobile-action-rail {
    height: calc(64px + env(safe-area-inset-bottom));
    min-height: calc(64px + env(safe-area-inset-bottom));
  }

  body.home .mobile-action-rail a {
    min-height: 64px;
  }

  /* Leave breathing room above the fixed Search / Value / Fit action rail. */
  .ethos-home-hero__inner {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .ethos-home-lifestyles__grid {
    grid-auto-columns: 82vw;
    margin-inline: -16px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }

  .ethos-home-hero__inner {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ethos-home-lifestyles__grid {
    scroll-behavior: auto;
  }
}
