/* ==========================================================================
   page-home.css — Homepage-specific layout, section polish, and components
   Scoped selectors keep these rules off other page templates.
   ========================================================================== */

/**
 * Table of Contents
 * 1. Hero
 * 2. Trust Bar
 * 3. Search Band
 * 4. Buyer / Seller Section Bands
 * 5. Featured Properties CTA Row
 * 6. Community Tile Cards — Image Hover
 * 7. County Search Band
 * 8. FAQ Accordion
 * 9. hr-fancy — zero margin on homepage (bands provide spacing)
 * 10. Featured Listings Fallback Card
 * 11. Responsive
 * 12. Dark Mode
 */

/* ==========================================================================
   1. Hero
   ========================================================================== */

.hero-intro {
  min-height: clamp(380px, 50vw, 580px) !important;
}

/* Strengthen WP's dim span — 20% is too thin for legibility */
.hero-intro .wp-block-cover__background.has-background-dim-20 {
  opacity: 0.35 !important;
}

/* Bottom-up gradient so h1/p text always has a dark substrate */
.hero-intro::after {
  position: absolute;
  height: 55%;
  background: var(--hero-overlay-gradient);
  pointer-events: none;
  content: "";
  inset: auto 0 0;
}

.hero-intro .wp-block-cover__inner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(2rem, 4vw, 4rem) var(--space-5);
  gap: var(--space-4);
}

.hero-intro h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  text-shadow: var(--shadow-hero-heading);
}

.hero-intro p {
  max-width: 60ch;
  font-size: clamp(1rem, 2vw, 1.175rem);
  line-height: 1.65;
  text-shadow: var(--shadow-hero-text);
}

.hero-intro .fc-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-2);
  gap: var(--space-3);
}

/* ==========================================================================
   2. Trust Bar
   ========================================================================== */

.trust-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 1.25rem var(--space-5);
  background: var(--kaplon-blue);
  border-bottom: 3px solid var(--kaplon-red);
  gap: 0;
}

.trust-bar__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 2rem;
  color: var(--white);
  text-align: center;
}

.trust-bar__stat + .trust-bar__stat {
  border-left: 1px solid var(--white-22a);
}

.trust-bar__value {
  font-size: clamp(1.5rem, 2.75vw, 1.9rem);
  font-weight: 700;
  line-height: 1.15;
}

.trust-bar__label {
  margin-top: 0.2rem;
  opacity: 0.88;
  font-size: 0.775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ==========================================================================
   3. Search Band
   ========================================================================== */

.search-band {
  background: var(--surface-2);
  padding-block: clamp(2.5rem, 5vw, 4rem);
  padding-inline: var(--space-5);
}

.search-band h2 {
  font-size: clamp(1.5rem, 3vw, 2.125rem);
  font-weight: 700;
}

.search-band .search-card {
  max-width: 840px;
  margin: var(--space-5) auto 0;
  padding: var(--space-6);
  border-top: 3px solid var(--kaplon-red);
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-xl);
}

/* Suppress the generic card lift on hover — search bar shouldn't float */
.search-band .search-card:hover {
  transform: none;
}

/* Live MLS badge above the search form */
.search-band__badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-3);
  padding: 0.3rem 0.9rem;
  background: color-mix(in oklab, var(--kaplon-blue) 8%, transparent);
  border: 1px solid color-mix(in oklab, var(--kaplon-blue) 20%, transparent);
  border-radius: var(--radius-pill);
  color: var(--kaplon-blue);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  gap: var(--space-2);
}

/* ==========================================================================
   4. Buyer / Seller Section Bands
   ========================================================================== */

.section-buy,
.section-sell {
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
  padding-inline: clamp(var(--space-5), 5vw, var(--space-8));
}

.section-buy > *,
.section-sell > * {
  max-width: 820px;
}

.section-buy {
  background: var(--surface-1);
  border-left: 4px solid var(--kaplon-blue);
}

.section-sell {
  background: var(--surface-2);
  border-left: 4px solid var(--kaplon-red);
}

.section-buy h2,
.section-sell h2 {
  font-size: clamp(1.5rem, 3vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
}

.section-buy h2 a,
.section-sell h2 a {
  color: inherit;
  text-decoration: none;
}

.section-buy ul,
.section-sell ul {
  padding-left: var(--space-5);
  margin-block: var(--space-4);
}

.section-buy li,
.section-sell li {
  margin-bottom: var(--space-2);
  padding-left: 1.6em;
  overflow: hidden;
  line-height: 1.65;
  list-style: none;
}

.section-buy li::before,
.section-sell li::before {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  margin-left: -1.6em;
  background: var(--kaplon-blue);
  vertical-align: -0.15em;
  content: "";
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/></svg>") no-repeat center;
}

.section-sell li::before {
  background: var(--kaplon-red);
}

/* ==========================================================================
   5. Featured Properties CTA Row
   ========================================================================== */

.featured-properties-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-block: var(--space-5);
}

/* ==========================================================================
   6. Community Tile Cards — Image Hover
   ========================================================================== */

.featured-communities .card {
  overflow: hidden;
}

.featured-communities .wp-block-image {
  margin-bottom: 0;
  overflow: hidden;
  border-radius: var(--radius-3) var(--radius-3) 0 0;
}

/* Redundant with h3 — hide caption text */
.featured-communities .wp-block-image figcaption {
  display: none;
}

/* Make anchor a positioned container for the explore overlay */
.featured-communities .wp-block-image a {
  position: relative;
  display: block;
  overflow: hidden;
}

.featured-communities .wp-block-image img {
  display: block;
  width: 100%;
  transition: transform 0.45s var(--anim-ease-out);
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.featured-communities .card:hover .wp-block-image img {
  transform: scale(1.06);
}

/* "Explore →" pill fades in on card hover */
.featured-communities .wp-block-image a::after {
  position: absolute;
  bottom: var(--space-3);
  left: 50%;
  padding: 0.35rem 1.1rem;
  opacity: 0;
  background: var(--white-90);
  border-radius: var(--radius-pill);
  color: var(--kaplon-blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
  content: "Explore →";
  transition:
    opacity var(--anim-duration-fast) var(--anim-ease-out),
    transform var(--anim-duration-fast) var(--anim-ease-out);
  transform: translateX(-50%) translateY(6px);
}

.featured-communities .card:hover .wp-block-image a::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.featured-communities .card h3 {
  margin-top: var(--space-3);
  font-size: clamp(1rem, 1.75vw, 1.25rem);
  font-weight: 600;
}

.featured-communities .card h3 a {
  color: var(--kaplon-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.featured-communities .card h3 a:hover {
  color: var(--kaplon-red);
}

/* Limit microcopy to 2 lines */
.featured-communities .card p {
  display: -webkit-box;
  margin-top: var(--space-2);
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* ==========================================================================
   7. County Search Band
   ========================================================================== */

.county-search-band {
  max-width: 1180px;
  margin: clamp(2rem, 4vw, 3rem) auto;
  padding: clamp(1.5rem, 3vw, 2rem);
  background:
    linear-gradient(90deg, var(--button-red-bg) 0 4px, transparent 4px),
    color-mix(in oklab, var(--surface-2) 88%, var(--white));
  border: 1px solid color-mix(in oklab, var(--gray-900) 10%, transparent);
  border-radius: var(--radius-3);
  box-shadow: 0 10px 24px color-mix(in oklab, var(--black) 7%, transparent);
}

.county-search-band h3 {
  margin-bottom: var(--space-2);
  color: var(--gray-900);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 700;
}

.county-search-band > p {
  max-width: 72ch;
  margin-bottom: var(--space-5);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

.county-search-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.county-search-link {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 1rem 1.1rem;
  overflow: hidden;
  background: var(--white);
  border: 1px solid color-mix(in oklab, var(--gray-900) 14%, transparent);
  border-radius: 6px;
  box-shadow: 0 1px 2px color-mix(in oklab, var(--black) 8%, transparent);
  color: var(--gray-900);
  text-decoration: none;
  transition:
    background-color 0.15s ease-out,
    border-color 0.15s ease-out,
    box-shadow 0.15s ease-out,
    transform 0.15s ease-out;
}

.county-search-link::after {
  position: absolute;
  right: 1rem;
  bottom: 0.85rem;
  opacity: 0.72;
  color: var(--button-red-bg);
  font-weight: 700;
  content: "->";
  transition:
    opacity 0.15s ease-out,
    transform 0.15s ease-out;
}

.county-search-link span {
  display: block;
  color: var(--gray-900);
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.15;
}

.county-search-link small {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.county-search-link:hover,
.county-search-link:focus-visible {
  background: var(--white);
  border-color: color-mix(in oklab, var(--button-red-bg) 48%, var(--gray-300));
  box-shadow: 0 10px 20px color-mix(in oklab, var(--black) 12%, transparent);
  color: var(--gray-900);
  transform: translateY(-2px);
}

.county-search-link:hover::after,
.county-search-link:focus-visible::after {
  opacity: 1;
  transform: translateX(3px);
}

/* ==========================================================================
   8. FAQ Accordion
   ========================================================================== */

details.faq-item {
  overflow: hidden;
  border-bottom: 1px solid var(--gray-border);
}

details.faq-item:first-of-type {
  border-top: 1px solid var(--gray-border);
}

details.faq-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-2);
  color: var(--kaplon-blue);
  font-size: 1rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  transition: color 0.2s ease;
  gap: var(--space-4);
}

details.faq-item summary::-webkit-details-marker {
  display: none;
}

/* Chevron icon via CSS mask — rotates when open */
details.faq-item summary::after {
  display: block;
  flex-shrink: 0;
  width: 1.1em;
  height: 1.1em;
  background: currentcolor;
  content: "";
  transition: transform 0.25s var(--anim-ease-out);
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>") no-repeat center;
}

details.faq-item[open] {
  border-left: 3px solid var(--kaplon-red);
}

details.faq-item[open] summary::after {
  transform: rotate(180deg);
}

details.faq-item summary:hover {
  color: var(--kaplon-red);
}

details.faq-item > p,
details.faq-item > div {
  padding: 0 var(--space-2) var(--space-5);
  color: var(--text-secondary);
  font-size: 0.975rem;
  line-height: 1.7;
}

details.faq-item > p a {
  color: var(--kaplon-blue);
}

details.faq-item > p a:hover {
  color: var(--kaplon-red);
  text-decoration: underline;
}

/* ==========================================================================
   8. hr-fancy — scoped to homepage; section bands provide visual separation
   ========================================================================== */

body.home .hr-fancy {
  margin-block: 0 !important;
}

/* ==========================================================================
   9. Featured Listings Fallback Card
   ========================================================================== */

.featured-properties-fallback {
  display: none;
  max-width: 640px;
  margin: var(--space-6) auto;
  padding: var(--space-7) var(--space-6);
  background: var(--surface-2);
  border-top: 3px solid var(--kaplon-red);
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-card-xl);
  text-align: center;
}

.featured-properties-fallback h3 {
  margin-bottom: var(--space-3);
  color: var(--kaplon-blue);
  font-size: 1.35rem;
  font-weight: 700;
}

.featured-properties-fallback p {
  margin-bottom: var(--space-5);
  color: var(--text-secondary);
}

.featured-properties-fallback .fc-list {
  justify-content: center;
}

/* ==========================================================================
   11. Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .county-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .county-search-band {
    padding: var(--space-5);
  }

  .county-search-grid {
    grid-template-columns: 1fr;
  }

  .county-search-link {
    min-height: 76px;
  }

  .trust-bar__stat {
    padding: 0.5rem 1.25rem;
  }

  .trust-bar__stat + .trust-bar__stat {
    border-left: none;
  }

  .section-buy,
  .section-sell {
    border-left-width: 3px;
  }
}

/* ==========================================================================
   12. Dark Mode (colors only — no layout/spacing)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  html[data-kaplon-color-mode="system"] .section-sell {
    background: var(--dark-surface-alt);
  }

  html[data-kaplon-color-mode="system"] details.faq-item summary {
    color: var(--text-primary-dark);
  }

  html[data-kaplon-color-mode="system"] details.faq-item > p,
  html[data-kaplon-color-mode="system"] details.faq-item > div {
    color: var(--text-secondary-dark);
  }

  html[data-kaplon-color-mode="system"] .featured-communities .card p {
    color: var(--text-secondary-dark);
  }

  html[data-kaplon-color-mode="system"] .county-search-band {
    background:
      linear-gradient(90deg, var(--button-red-bg) 0 4px, transparent 4px),
      var(--dark-surface);
    border-color: var(--dark-border);
  }

  html[data-kaplon-color-mode="system"] .county-search-band h3,
  html[data-kaplon-color-mode="system"] .county-search-link span {
    color: var(--text-primary-dark);
  }

  html[data-kaplon-color-mode="system"] .county-search-band > p,
  html[data-kaplon-color-mode="system"] .county-search-link small {
    color: var(--text-secondary-dark);
  }

  html[data-kaplon-color-mode="system"] .county-search-link {
    background: var(--dark-surface-alt);
    border-color: var(--dark-border);
  }
}

html[data-kaplon-color-mode="dark"] .section-sell {
  background: var(--dark-surface-alt);
}

html[data-kaplon-color-mode="dark"] details.faq-item summary {
  color: var(--text-primary-dark);
}

html[data-kaplon-color-mode="dark"] details.faq-item > p,
html[data-kaplon-color-mode="dark"] details.faq-item > div {
  color: var(--text-secondary-dark);
}

html[data-kaplon-color-mode="dark"] .featured-communities .card p {
  color: var(--text-secondary-dark);
}

html[data-kaplon-color-mode="dark"] .county-search-band {
  background:
    linear-gradient(90deg, var(--button-red-bg) 0 4px, transparent 4px),
    var(--dark-surface);
  border-color: var(--dark-border);
}

html[data-kaplon-color-mode="dark"] .county-search-band h3,
html[data-kaplon-color-mode="dark"] .county-search-link span {
  color: var(--text-primary-dark);
}

html[data-kaplon-color-mode="dark"] .county-search-band > p,
html[data-kaplon-color-mode="dark"] .county-search-link small {
  color: var(--text-secondary-dark);
}

html[data-kaplon-color-mode="dark"] .county-search-link {
  background: var(--dark-surface-alt);
  border-color: var(--dark-border);
}
