/* Results page flow and spacing refinements.
   Loaded after results-polish.css so it can safely normalize the final report. */

body[data-page="results"],
html[data-path="results.html"] body {
  background: var(--rr-bg-alt, #f4f7fa);
}

.main-narrow {
  width: min(100%, 1040px);
  padding-top: clamp(2rem, 5vw, 4.5rem);
  padding-bottom: clamp(3rem, 8vw, 7rem);
}

#results-main {
  display: grid;
  gap: clamp(2rem, 5vw, 4.75rem);
}

#results-main > * {
  min-width: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

#type-reveal-section,
#top-match-section,
#future-self-section,
#thrive-here-section,
#locked-teasers-section,
#ask-reroot-promo-section,
#share-card-section,
#personality,
#results-screenshot-hero,
#results-share-top,
#results-insights,
#mid-upgrade-slot,
#budget-snapshot-section,
#upgrade-slot,
#share-section {
  scroll-margin-top: 96px;
}

#type-reveal-section:empty,
#top-match-section:empty,
#future-self-section:empty,
#current-city-comparison-section:empty,
#life-upgrade-section:empty,
#thrive-here-section:empty,
#locked-teasers-section:empty,
#ask-reroot-promo-section:empty,
#share-card-section:empty,
#personality:empty,
#results-screenshot-hero:empty,
#results-share-top:empty,
#results-insights:empty,
#matches-grid:empty,
#mid-upgrade-slot:empty,
#budget-snapshot-section:empty,
#upgrade-slot:empty,
#share-section:empty {
  display: none !important;
}

.results-fit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: stretch;
}

.results-fit-grid > * {
  min-width: 0;
  height: 100%;
}

.results-fit-grid > * > :first-child,
#current-city-comparison-section > :first-child,
#life-upgrade-section > :first-child {
  height: 100%;
}

.results-destinations-intro {
  max-width: 720px;
  padding-top: clamp(0.5rem, 2vw, 1.5rem);
}

.results-destinations-intro h2 {
  margin-bottom: 0.75rem;
}

.results-destinations-intro p {
  max-width: 62ch;
  margin-bottom: 0;
}

#matches-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: stretch;
}

#matches-grid > * {
  min-width: 0;
  height: 100%;
}

#export-actions,
.results-bottom-actions {
  padding-top: clamp(0.25rem, 1vw, 0.75rem);
  gap: 0.85rem;
}

#export-actions > *,
.results-bottom-actions > * {
  min-width: min(100%, 210px);
}

#budget-snapshot-section,
#share-section {
  margin: 0 !important;
}

.disclaimer-inline {
  max-width: 780px;
  margin: clamp(2.5rem, 6vw, 5rem) auto 0;
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--rr-line, rgba(17, 24, 39, 0.1));
  font-size: 0.8125rem;
  line-height: 1.65;
  text-align: center;
}

#results-main h1,
#results-main h2,
#results-main h3,
#results-main h4 {
  text-wrap: balance;
}

#results-main p,
#results-main li {
  text-wrap: pretty;
}

#results-main p + p {
  margin-top: 0.8rem;
}

#results-main h2 + p,
#results-main h3 + p,
#results-main h4 + p {
  margin-top: 0.45rem;
}

#results-main ul,
#results-main ol {
  margin-top: 0.85rem;
}

#results-main li + li {
  margin-top: 0.45rem;
}

#results-main .card,
#results-main .rr-card,
#results-main [class*="-card"],
#results-main [class*="-panel"] {
  padding: clamp(1.25rem, 3vw, 2.25rem);
}

#results-main .card > * + *,
#results-main .rr-card > * + *,
#results-main [class*="-card"] > * + *,
#results-main [class*="-panel"] > * + * {
  margin-top: 0.9rem;
}

#results-main .card > h2 + *,
#results-main .card > h3 + *,
#results-main .rr-card > h2 + *,
#results-main .rr-card > h3 + *,
#results-main [class*="-card"] > h2 + *,
#results-main [class*="-card"] > h3 + * {
  margin-top: 0.65rem;
}

#results-loading-overlay .reroot-loading-card {
  width: min(calc(100% - 2rem), 420px);
  padding: clamp(1.5rem, 5vw, 2.5rem);
}

#results-loading-overlay .reroot-loading-title {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

#results-loading-overlay .reroot-loading-copy {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .results-fit-grid,
  #matches-grid {
    grid-template-columns: 1fr;
  }

  #export-actions,
  .results-bottom-actions {
    align-items: stretch;
  }

  #export-actions > *,
  .results-bottom-actions > * {
    flex: 1 1 100%;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .main-narrow {
    padding-top: 1.5rem;
    padding-bottom: 3.5rem;
  }

  #results-main {
    gap: 2rem;
  }

  #results-main .card,
  #results-main .rr-card,
  #results-main [class*="-card"],
  #results-main [class*="-panel"] {
    padding: 1.15rem;
    border-radius: 10px;
  }

  .results-destinations-intro {
    padding-top: 0;
  }

  .disclaimer-inline {
    margin-top: 2.5rem;
    padding-left: 0;
    padding-right: 0;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .main-narrow {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  #results-main {
    display: block;
  }

  #results-main > * {
    margin-bottom: 24pt !important;
  }

  .results-fit-grid,
  #matches-grid {
    display: block;
  }

  .results-fit-grid > *,
  #matches-grid > * {
    margin-bottom: 18pt;
    break-inside: avoid;
  }

  #export-actions,
  .results-bottom-actions,
  #ask-reroot-promo-section,
  #share-card-section,
  #results-share-top,
  #share-section {
    display: none !important;
  }

  .disclaimer-inline {
    margin-top: 24pt;
    border-top: 1px solid #d7dce2;
  }
}