/* ============================================
   BUILD 2.4 — Mobile homepage simplification
   Progressive disclosure. Presentation only.
   ============================================ */

body.page-home {
  --home-space: clamp(1.25rem, 4vw, 2rem);
  --home-card-radius: 22px;
  --home-search-h: 3.25rem;
  background:
    linear-gradient(180deg, #fffaf5 0%, #f8fafc 28%, #ffffff 100%);
}

body.page-home .hero-brand,
body.page-home .hero-trust,
body.page-home .hero-actions {
  display: none;
}

/* ——— Search-first AI hero ——— */
body.page-home .home-search-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1.35rem, 3.5vw, 2.5rem) 0 clamp(1.15rem, 3vw, 1.75rem);
  background:
    linear-gradient(
      155deg,
      #dbeafe 0%,
      #e0e7ff 22%,
      #fce7f3 48%,
      #ffedd5 72%,
      #ecfeff 100%
    );
}
body.page-home .home-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
body.page-home .home-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.78;
}
body.page-home .home-hero-orb--a {
  width: min(24rem, 72vw);
  height: min(24rem, 72vw);
  top: -20%;
  left: -14%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.5), transparent 70%);
}
body.page-home .home-hero-orb--b {
  width: min(18rem, 58vw);
  height: min(18rem, 58vw);
  top: 4%;
  right: -12%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3), transparent 70%);
}
body.page-home .home-hero-orb--c {
  width: min(17rem, 55vw);
  height: min(17rem, 55vw);
  bottom: -22%;
  left: 18%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.34), transparent 70%);
}
body.page-home .home-hero-orb--d {
  width: min(13rem, 42vw);
  height: min(13rem, 42vw);
  bottom: 6%;
  right: 14%;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.3), transparent 70%);
}
body.page-home .home-hero-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(37, 99, 235, 0.16);
  opacity: 0.55;
}
body.page-home .home-hero-ring--a {
  width: min(11rem, 38vw);
  height: min(11rem, 38vw);
  top: 12%;
  right: 8%;
  border-color: rgba(14, 165, 233, 0.28);
}
body.page-home .home-hero-ring--b {
  width: min(7.5rem, 28vw);
  height: min(7.5rem, 28vw);
  bottom: 18%;
  left: 6%;
  border-color: rgba(249, 115, 22, 0.26);
  transform: rotate(18deg);
}
body.page-home .home-hero-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(rgba(37, 99, 235, 0.2) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 90%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 90%);
}
body.page-home .home-search-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 48rem;
}
body.page-home .home-search-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
}
body.page-home .home-search-title {
  margin: 0 0 0.55rem;
  font-size: clamp(1.45rem, 5.2vw, 2.2rem);
  letter-spacing: -0.03em;
  line-height: 1.18;
  font-weight: 800;
  color: #0f172a;
  text-wrap: balance;
}
body.page-home .home-search-support {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: #334155;
  max-width: 36rem;
}
body.page-home .home-search-form {
  display: grid;
  gap: 0.75rem;
}
body.page-home .home-search-form .search-box-inner {
  min-height: var(--home-search-h);
  border-radius: 999px;
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.35rem 0.4rem 0.35rem 1rem;
}
body.page-home .home-search-form .search-input {
  font-size: 1rem;
  min-height: 2.5rem;
}
body.page-home .home-search-form .search-submit {
  min-height: 2.6rem;
  border-radius: 999px;
  padding-inline: 1.15rem;
}
body.page-home .home-search-form .search-category {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body.page-home .home-search-form .search-results.is-open {
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
}

/*
 * Search pin is NOT sticky by default.
 * Root cause of iPhone headline loss: wrapping kicker+title in position:sticky; top:0
 * made them slide under the opaque site header while the search stayed visible.
 * Headline/eyebrow must scroll away naturally — never display:none.
 */
body.page-home .home-search-kicker,
body.page-home .home-search-title {
  display: block;
  visibility: visible;
  opacity: 1;
  max-height: none;
  overflow: visible;
  transform: none;
}
body.page-home .home-search-pin {
  position: relative;
  top: auto;
  z-index: auto;
  transition:
    padding 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}
/* Compact sticky search — search field only, after deliberate scroll (>=120px) */
body.page-home.home-search-stuck .home-search-pin {
  position: sticky;
  top: var(--home-sticky-top, var(--nav-height, 4.5rem));
  z-index: 60;
  padding: 0.55rem 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
body.page-home.home-search-stuck .home-search-form .search-box-inner {
  min-height: 2.75rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* Suggestion chips — lighter than primary Search CTA */
body.page-home .home-suggest {
  margin-top: 1rem;
}
body.page-home .home-suggest-label {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: #334155;
}
body.page-home .home-suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
body.page-home .home-suggest-chips > li {
  flex: 1 1 calc(50% - 0.55rem);
  min-width: min(100%, 9.5rem);
}
body.page-home .home-suggest-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.2;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}
body.page-home .home-suggest-chip:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}
body.page-home .home-suggest-chip:active {
  transform: translateY(0);
  background: #eff6ff;
}
body.page-home .home-suggest-chip:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
body.page-home .home-suggest-icon {
  flex: 0 0 auto;
  font-size: 1.05rem;
  line-height: 1;
}

/* Zero-height load sentinel — must not affect hero layout */
body.page-home .home-search-sentinel {
  display: block;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ——— Section spacing ——— */
body.page-home main > .section {
  padding-block: clamp(1.5rem, 3.5vw, 2.75rem);
}
body.page-home main > .home-explore {
  /* Collapsed Explore More shouldn't leave a tall empty band */
  padding-block: clamp(1.1rem, 2.8vw, 1.75rem);
}
body.page-home .section-header {
  margin-bottom: 1.15rem;
}
body.page-home .section-header h2 {
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
}
body.page-home .section-header p {
  margin-top: 0.55rem;
  max-width: 40rem;
}

/* ——— Toolkit swipe rail ——— */
/* Flex (not single-row grid) so mobile cards aren't forced to the tallest height */
body.page-home #toolkits-root .home-toolkit-rail {
  display: flex;
  align-items: flex-start; /* don't stretch short cards to the tallest */
  gap: 0.9rem;
  overflow-x: auto;
  padding: 0.15rem 0.15rem 0.75rem;
  margin: 0 -0.15rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
body.page-home #toolkits-root .home-toolkit-rail::-webkit-scrollbar {
  display: none;
}
body.page-home .home-toolkit-card {
  scroll-snap-align: start;
  flex: 0 0 min(18.5rem, 78vw);
  width: min(18.5rem, 78vw);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: start;
  min-height: 6.75rem;
  padding: 1.1rem 1.1rem;
  border-radius: var(--home-card-radius);
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.95), #fff);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.07);
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
body.page-home .home-toolkit-card:hover,
body.page-home .home-toolkit-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
  outline: none;
}
body.page-home .home-toolkit-card__icon {
  width: 2.75rem;
  height: 2.75rem;
  margin-top: 0.1rem;
  border-radius: 14px;
  display: grid;
  place-content: center;
  background: var(--color-primary-soft);
  font-size: 1.35rem;
  flex-shrink: 0;
}
body.page-home .home-toolkit-card__copy {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}
body.page-home .home-toolkit-card__copy strong {
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
body.page-home .home-toolkit-card__copy span {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
body.page-home .home-toolkit-card__arrow {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.15rem;
  align-self: center;
  line-height: 1;
}
body.page-home .home-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}
body.page-home .home-view-all:hover {
  text-decoration: underline;
}
body.page-home #toolkits-all[hidden] {
  display: none !important;
}
body.page-home #toolkits-all {
  margin-top: 1.25rem;
}
body.page-home #toolkits-all .toolkit-grid {
  margin-top: 0.75rem;
}

/* ——— Featured calculators (Quick Picks) ——— */
body.page-home .home-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: stretch;
}
body.page-home .home-calc-card {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  height: 100%;
  min-height: 5.5rem;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
body.page-home .home-calc-card:hover,
body.page-home .home-calc-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  outline: none;
}
body.page-home .home-calc-card strong {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
body.page-home .home-calc-card span {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* ——— Category tiles ——— */
body.page-home .home-category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: stretch;
}
body.page-home .home-category-card {
  display: grid;
  place-content: center;
  gap: 0.45rem;
  height: 100%;
  min-height: 6.25rem;
  padding: 1.1rem 0.85rem;
  border-radius: var(--home-card-radius);
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
body.page-home .home-category-card:hover,
body.page-home .home-category-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  outline: none;
}
body.page-home .home-category-card__icon {
  font-size: 1.55rem;
  line-height: 1;
}
body.page-home .home-category-card strong {
  font-size: 1rem;
}

/* ——— Explore More (collapsed) ——— */
body.page-home .home-explore {
  border-top: 1px solid var(--color-border);
  background: #f8fafc;
}
body.page-home .home-explore-details {
  border: 1px solid var(--color-border);
  border-radius: var(--home-card-radius);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
body.page-home .home-explore-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.15rem;
  font-weight: 750;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
body.page-home .home-explore-details > summary::-webkit-details-marker {
  display: none;
}
body.page-home .home-explore-details > summary::after {
  content: "▼";
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  transition: transform 160ms ease;
}
body.page-home .home-explore-details[open] > summary::after {
  transform: rotate(180deg);
}
body.page-home .home-explore-body {
  padding: 0 1.2rem 1.35rem;
  display: grid;
  gap: 1.25rem;
  border-top: 1px solid var(--color-border);
}
body.page-home .home-explore-body .search-chip-groups {
  margin-top: 0.75rem;
}
body.page-home .home-explore-body .hero-popular-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
body.page-home .home-seo-links {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Soft-hide secondary homepage chrome by default */
body.page-home .home-secondary {
  display: none;
}

/* Homepage footer: slightly tighter, less empty band above copyright */
body.page-home .site-footer {
  padding-top: 3.5rem;
}
body.page-home .footer-top {
  gap: 2.25rem;
  margin-bottom: 2.25rem;
}
body.page-home [data-newsletter][hidden] {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

@media (min-width: 900px) {
  body.page-home #toolkits-root .home-toolkit-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.95rem;
    overflow: visible;
    scroll-snap-type: none;
    margin: 0;
    padding: 0.1rem 0 0.35rem;
  }
  body.page-home .home-toolkit-card {
    width: auto;
    flex: unset;
    height: 100%;
    /* Shared height so 2-line and 4-line blurbs stay visually even */
    min-height: 9.5rem;
    align-items: start;
  }
  body.page-home .home-calc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.page-home .home-category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  body.page-home .home-search-hero-inner {
    max-width: 44rem;
    text-align: center;
  }
  body.page-home .home-search-support {
    margin-inline: auto;
  }
  body.page-home .home-suggest-chips {
    justify-content: center;
  }
  body.page-home .home-suggest-chips > li {
    flex: 0 1 14rem;
  }
  body.page-home .home-suggest-chip {
    justify-content: center;
  }
  body.page-home .home-search-form .search-box-inner {
    box-shadow:
      0 14px 36px rgba(15, 23, 42, 0.1),
      0 0 0 1px rgba(255, 255, 255, 0.85) inset;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-home .home-toolkit-card,
  body.page-home .home-calc-card,
  body.page-home .home-category-card,
  body.page-home .home-search-pin,
  body.page-home .home-suggest-chip,
  body.page-home .home-explore-details > summary::after {
    transition: none !important;
  }
  body.page-home .home-toolkit-card:hover,
  body.page-home .home-calc-card:hover,
  body.page-home .home-category-card:hover,
  body.page-home .home-suggest-chip:hover,
  body.page-home .home-suggest-chip:active {
    transform: none !important;
  }
}
