/**
 * Farmhouse Theme Stylesheet
 *
 * Warm, rustic design with earthy olive/wheat palette, serif-inspired
 * headings, and barn-wood texturing details.
 *
 * @package AI_Community_Page_Builder/themes/farmhouse
 * @since   1.0.0
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

.cpb-theme-farmhouse {
  --fh-primary:       #8B6914;
  --fh-primary-dark:  #6B5010;
  --fh-primary-light: #FEF3C7;
  --fh-green:         #7C9A6E;
  --fh-green-dark:    #5A7A4E;
  --fh-bg:            #FAF7F2;
  --fh-card:          #FFFFFF;
  --fh-border:        #E8DCC8;
  --fh-text:          #2D2416;
  --fh-muted:         #7A6848;
  --fh-shadow:        0 2px 8px rgba(139,105,20,.10);
  --fh-radius:        8px;
  --fh-font:          Georgia, "Times New Roman", serif;
  --fh-ui-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-family: var(--fh-ui-font);
  color: var(--fh-text);
  background: var(--fh-bg);
  line-height: 1.65;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.cpb-fh-hero {
  background: linear-gradient(135deg, #3D2B1F 0%, #5C3D2E 40%, #8B6914 80%, #C4952A 100%);
  padding: 60px 0 56px;
  position: relative;
  overflow: hidden;
}

.cpb-fh-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,.025) 2px,
    rgba(255,255,255,.025) 4px
  );
}

@media (min-width: 768px) { .cpb-fh-hero { padding: 80px 0 72px; } }

.cpb-fh-hero__inner { position: relative; z-index: 1; }

.cpb-fh-hero__inner .cpb-breadcrumbs       { color: rgba(255,255,255,.7); margin-bottom: 20px; }
.cpb-fh-hero__inner .cpb-breadcrumbs a      { color: rgba(255,255,255,.7); }
.cpb-fh-hero__inner .cpb-breadcrumbs a:hover{ color: #fff; }
.cpb-fh-hero__inner .cpb-breadcrumbs__item + .cpb-breadcrumbs__item::before { color: rgba(255,255,255,.4); }
.cpb-fh-hero__inner .cpb-breadcrumbs__item--current { color: rgba(255,255,255,.9); }

.cpb-fh-hero__title {
  font-family: var(--fh-font);
  font-size: 40px;
  font-weight: 700;
  color: #FDF6E3;
  margin: 0 0 10px;
  line-height: 1.15;
  letter-spacing: -.01em;
}
@media (min-width: 768px) { .cpb-fh-hero__title { font-size: 58px; } }

.cpb-fh-hero__location {
  font-size: 16px;
  color: rgba(253,246,227,.78);
  margin: 0;
}

/* ==========================================================================
   Stat Band
   ========================================================================== */

.cpb-fh-stats-band {
  background: var(--fh-green);
  padding: 20px 0;
}

/* Only stats with a value are printed (1–4 tiles). Below 640px: two per
   row, a lone last tile centred. 640px+: one row the tiles share evenly. */
.cpb-fh-stats-band__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.cpb-fh-stat {
  text-align: center;
  flex: 0 1 calc(50% - 8px);
}
@media (min-width: 640px) { .cpb-fh-stat { flex: 1 1 0; } }

.cpb-fh-stat__val {
  display: block;
  font-family: var(--fh-font);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}

.cpb-fh-stat__lbl {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: rgba(255,255,255,.8);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.cpb-fh-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-top: 44px;
  padding-bottom: 60px;
  align-items: start;
}

@media (min-width: 1024px) {
  .cpb-fh-layout {
    grid-template-columns: 1fr 300px;
    gap: 48px;
  }
}

@media (min-width: 1024px) {
  .cpb-fh-sidebar {
    position: sticky;
    top: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
}

@media (max-width: 1023px) {
  .cpb-fh-sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

@media (max-width: 640px) { .cpb-fh-sidebar { grid-template-columns: 1fr; } }

/* ==========================================================================
   Sections
   ========================================================================== */

.cpb-fh-section { margin-bottom: 44px; }
.cpb-fh-section:last-child { margin-bottom: 0; }

.cpb-fh-section__title {
  font-family: var(--fh-font);
  font-size: 24px;
  font-weight: 700;
  color: var(--fh-primary-dark);
  margin: 30px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--fh-border);
}

.cpb-fh-section p { font-size: 15px; line-height: 1.75; margin: 0 0 14px; }
.cpb-fh-section p:last-child { margin-bottom: 0; }

/* ==========================================================================
   FAQs
   ========================================================================== */

.cpb-fh-faqs {
  background: var(--fh-card);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  overflow: hidden;
}

.cpb-fh-faq-toggle {
  color: var(--fh-text);
  font-family: var(--fh-ui-font);
  font-size: 15px;
  padding: 17px 20px;
}
.cpb-fh-faq-toggle:hover { background: var(--fh-primary-light); color: var(--fh-primary-dark); }

.cpb-fh-faqs .cpb-faq-item { border-bottom-color: var(--fh-border); }
.cpb-fh-faqs .cpb-faq-item:last-child { border-bottom: none; }

.cpb-fh-faq-body__inner { padding-top: 0; padding-bottom: 0; padding-left: 20px; padding-right: 20px; }

/* ==========================================================================
   Sidebar
   ========================================================================== */

.cpb-fh-agent-card,
.cpb-fh-sidebar-card {
  background: var(--fh-card);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 24px;
  box-shadow: var(--fh-shadow);
}

.cpb-fh-agent-card { text-align: center; }

.cpb-fh-agent-card__photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  margin: 0 auto 14px;
  border: 3px solid var(--fh-border);
}

.cpb-fh-agent-card__photo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--fh-green);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.cpb-fh-agent-card__name  { font-family: var(--fh-font); font-size: 18px; font-weight: 700; margin: 0 0 4px; color: var(--fh-text); }
.cpb-fh-agent-card__title { font-size: 13px; color: var(--fh-muted); margin: 0 0 14px; }

.cpb-fh-agent-card__link {
  display: block;
  font-size: 14px;
  color: var(--fh-primary);
  margin-bottom: 6px;
  text-align: left;
}
.cpb-fh-agent-card__link:hover { text-decoration: underline; }

.cpb-fh-agent-card__cta {
  display: block;
  background: var(--fh-green);
  color: #fff !important;
  padding: 11px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  margin-top: 14px;
  transition: background .2s;
}
.cpb-fh-agent-card__cta:hover { background: var(--fh-green-dark); }

.cpb-fh-sidebar-card__title {
  font-family: var(--fh-font);
  font-size: 15px;
  font-weight: 700;
  color: var(--fh-primary-dark);
  margin: 0 0 12px;
}

.cpb-fh-nearby-list { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.cpb-fh-nearby-list li { padding: 7px 0; border-bottom: 1px solid var(--fh-border); }
.cpb-fh-nearby-list li:last-child { border-bottom: none; }
.cpb-fh-nearby-list a { font-size: 14px; color: var(--fh-primary); }
.cpb-fh-nearby-list a:hover { text-decoration: underline; }

/* ==========================================================================
   Video + Content Image (Farmhouse)
   ========================================================================== */

.cpb-fh-image-break {
  margin: 24px 0 32px;
  border-radius: 8px;
  overflow: hidden;
}
.cpb-fh-image-break__img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.cpb-fh-section--qf-video {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: center;
}
.cpb-fh-section--qf-video > .cpb-section-label,
.cpb-fh-section--qf-video > .cpb-fh-section__title {
  width: 100%;
}
.cpb-fh-section--qf-video > .cpb-quick-facts {
  flex: 1;
  min-width: 0;
}
.cpb-fh-qf-video {
  flex: 1;
  min-width: 280px;
}

.cpb-responsive-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
}
.cpb-responsive-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  .cpb-fh-section--qf-video { flex-direction: column; }
}

/* What's Nearby — Per-category tab colors (Farmhouse — with theme prefix for specificity) */
.cpb-theme-farmhouse .cpb-wn-tab[data-cat="0"]:hover { background: rgba(37,99,235,.12); color: #2563EB; }
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="0"],
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="0"]:hover { background: #2563EB; color: #fff; border-color: #2563EB; }
.cpb-theme-farmhouse .cpb-wn-tab[data-cat="1"]:hover { background: rgba(5,150,105,.12); color: #059669; }
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="1"],
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="1"]:hover { background: #059669; color: #fff; border-color: #059669; }
.cpb-theme-farmhouse .cpb-wn-tab[data-cat="2"]:hover { background: rgba(249,115,22,.12); color: #F97316; }
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="2"],
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="2"]:hover { background: #F97316; color: #fff; border-color: #F97316; }
.cpb-theme-farmhouse .cpb-wn-tab[data-cat="3"]:hover { background: rgba(239,68,68,.12); color: #EF4444; }
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="3"],
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="3"]:hover { background: #EF4444; color: #fff; border-color: #EF4444; }
.cpb-theme-farmhouse .cpb-wn-tab[data-cat="4"]:hover { background: rgba(236,72,153,.12); color: #EC4899; }
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="4"],
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="4"]:hover { background: #EC4899; color: #fff; border-color: #EC4899; }
.cpb-theme-farmhouse .cpb-wn-tab[data-cat="5"]:hover { background: rgba(124,58,237,.12); color: #7C3AED; }
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="5"],
.cpb-theme-farmhouse .cpb-wn-tab--active[data-cat="5"]:hover { background: #7C3AED; color: #fff; border-color: #7C3AED; }

/* Amenity card SVG icon — Farmhouse */
.cpb-theme-farmhouse .cpb-amenity-card__icon {
  color: var(--fh-primary, #6b7c4e);
  display: block;
  margin-bottom: 12px;
}


/* ---- Agent headshot fix (prevent global height: auto override) ---- */
.cpb-fh-agent-hero-card__photo {
  height: 60px;
  object-fit: cover;
}

/* ---- Mobile fixes ---- */
@media (max-width: 767px) {
  .cpb-fh-content {
    padding: 0 16px;
  }
  .cpb-fh-section__title {
    font-size: calc(var(--mah-base, 1rem) * 1.4);
    word-break: break-word;
  }
  .cpb-fh-image-break__img {
    max-width: 100%;
    height: auto;
  }
  .cpb-fh-section--map .cpb-map-with-panel {
    grid-template-columns: 1fr;
  }
  .cpb-fh-section--map .cpb-map-with-panel__map {
    min-height: 300px;
  }
  .cpb-fh-stats-band__inner {
    gap: 8px;
    padding: 16px 12px;
  }
  .cpb-fh-stat__val {
    font-size: calc(var(--mah-base, 1rem) * 1.1);
  }
  .cpb-fh-stat__lbl {
    font-size: calc(var(--mah-base, 1rem) * 0.65);
  }
  .cpb-fh-section--qf-video {
    flex-direction: column;
  }
  .cpb-fh-qf-video {
    max-width: 100%;
  }
  .cpb-theme-farmhouse .cpb-shopping-cols {
    text-align: center;
  }
  .cpb-theme-farmhouse .cpb-quick-facts__row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
  }
  .cpb-theme-farmhouse .cpb-quick-facts__value {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .cpb-fh-content {
    padding: 0 12px;
  }
  .cpb-fh-section {
    padding: 32px 0;
  }
}

/* ==========================================================================
   IDX Listings — Farmhouse (warm, rustic, cozy earthen tones)
   ========================================================================== */

.cpb-theme-farmhouse .cpb-listings-showcase {
  margin-top: 12px;
}
/* Row: clearfix only — work WITH IMPress floats */
.cpb-theme-farmhouse .cpb-listings-showcase .impress-property-showcase.impress-row {
  margin: 0;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-property-showcase.impress-row::after {
  content: '';
  display: table;
  clear: both;
}
/* Card: keep IMPress float, force 3-col widths via calc() */
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property {
  float: left !important;
  width: calc((100% - 52px) / 3) !important;
  margin: 0 26px 26px 0;
  padding: 0;
  background: var(--fh-card);
  border: 1px solid var(--fh-border);
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--fh-shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  box-sizing: border-box;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:nth-child(3n) {
  margin-right: 0;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:nth-child(3n+1) {
  clear: left;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(139, 105, 20, .18);
  border-color: var(--fh-primary-light);
}
@media (max-width: 900px) {
  .cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property {
    width: calc((100% - 20px) / 2) !important;
    margin: 0 20px 20px 0;
  }
  .cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:nth-child(3n) {
    margin-right: 20px;
  }
  .cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:nth-child(3n+1) {
    clear: none;
  }
  .cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:nth-child(2n) {
    margin-right: 0;
  }
  .cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:nth-child(2n+1) {
    clear: left;
  }
}
@media (max-width: 560px) {
  .cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property {
    width: 100% !important;
    float: none !important;
    margin: 0 0 18px 0 !important;
    clear: both !important;
  }
}
/* Photo anchor — DON'T clip; price + address sit INSIDE this anchor */
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-photo {
  display: block;
  position: relative;
  overflow: visible;
  text-decoration: none;
  color: inherit;
}
/* Image — fixed height for uniform card layout */
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property img {
  width: 100%;
  height: 240px !important;
  object-fit: cover;
  border: 0;
  border-radius: 0;
  display: block;
  background: var(--fh-primary-light);
  filter: saturate(1.02);
  transition: transform .5s ease;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-showcase-property:hover img {
  transform: scale(1.05);
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-price {
  display: block;
  text-align: center;
  font-family: var(--fh-font);
  font-size: 24px;
  font-weight: 700;
  color: var(--fh-primary-dark);
  padding: 18px 20px 4px;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-status { display: none; }
.cpb-theme-farmhouse .cpb-listings-showcase .impress-address {
  display: block;
  text-align: center;
  margin: 0;
  padding: 0 20px 16px;
  font-size: 14px;
  color: var(--fh-muted);
  line-height: 1.55;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-street {
  display: block;
  text-align: center;
  font-family: var(--fh-font);
  font-weight: 700;
  color: var(--fh-text);
  font-size: 15px;
  margin-bottom: 2px;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-cityname,
.cpb-theme-farmhouse .cpb-listings-showcase .impress-state {
  color: var(--fh-muted);
  display: inline;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-beds-baths-sqft {
  margin: 0;
  padding: 14px 20px 18px;
  border-top: 1px dashed var(--fh-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
  gap: 10px 16px;
  font-size: 13px;
  color: var(--fh-text);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cpb-theme-farmhouse .cpb-listings-showcase .impress-beds,
.cpb-theme-farmhouse .cpb-listings-showcase .impress-baths,
.cpb-theme-farmhouse .cpb-listings-showcase .impress-sqft,
.cpb-theme-farmhouse .cpb-listings-showcase .impress-acres {
  display: inline-flex;
  align-items: center;
}

.cpb-theme-farmhouse .cpb-listings-cta-wrap {
  text-align: center;
  margin-top: 40px;
}
.cpb-theme-farmhouse .cpb-listings-cta.cpb-fh-listings-btn {
  display: inline-block;
  background: var(--fh-green);
  color: #fff !important;
  padding: 13px 32px;
  border-radius: 6px;
  font-family: var(--fh-ui-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .03em;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(124, 154, 110, .25);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.cpb-theme-farmhouse .cpb-listings-cta.cpb-fh-listings-btn:hover {
  background: var(--fh-green-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(90, 122, 78, .32);
}
