/* =========================================================
 * AI Homepage Builder — Frontend Styles (Refactored)
 * - Removes duplicate rules
 * - Fixes Latest Posts card alignment (CSS grid + clamps)
 * - Polishes Latest Posts CTA to look like a button
 * - Keeps Astra/Elementor-safe overrides (scoped to .ahb-* sections)
 * ======================================================= */

/* =========================
   HERO / GLOBAL SECTIONS
   ========================= */

.ahb-hero-section { text-align: center; }

/* Lead magnet background */
.ahb-lead-magnet-section {
  background: linear-gradient(135deg, #f5f9ff, #eef7ff);
}

/* Round hero image corners */
.ahb-hero-section .wp-block-image img { border-radius: 12px; }

/* Remove big top gap on hero blocks */
.wp-block-group.ahb-hero-section { margin-top: 0 !important; }

/* Remove big top gap on hub + subhub hero blocks */
.wp-block-group.ahb-hero-split{
  margin-top: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* Hero heading + text */
.ahb-hero-section h1 {
  font-size: clamp(2.2rem, 3vw, 2.7rem);
  line-height: 1.2;
}
.ahb-hero-section p.has-medium-font-size {
  font-size: 1rem;
  max-width: 540px;
}

/* About tagline */
.ahb-about-tagline {
  font-size: 0.95rem;
  margin-top: 4px;
  margin-bottom: 14px;
}
.ahb-about-tagline a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================
   QUICKSTART BAR
   ========================= */

.ahb-quickstart-bar {
  margin-top: -10px;
  border-top: 1px solid rgba(0,0,0,0.03);
  border-bottom: 1px solid rgba(0,0,0,0.03);
}
.ahb-quickstart-bar .ahb-quickstart-label {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}
.ahb-quickstart-bar .ahb-quickstart-pill .wp-block-button__link {
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 1.05rem;
  font-weight: 600;
}
.ahb-quickstart-bar .wp-block-buttons { flex-wrap: wrap; }

/* =========================
   STICKY MOBILE CTA BAR
   ========================= */

.ahb-sticky-mobile-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px;
  background: #0f63d8;
  color: #fff;
  display: none;
  z-index: 999;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.18);
}
.ahb-sticky-mobile-cta.is-visible {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ahb-sticky-mobile-cta a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
}
.ahb-sticky-mobile-cta__close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  margin-left: 12px;
  padding: 0;
  cursor: pointer;
}
@media (min-width: 783px) {
  .ahb-sticky-mobile-cta { display: none !important; }
}

/* =========================
   TRUST ROW
   ========================= */

.ahb-trust-row {
  border-top: 1px solid rgba(0,0,0,0.03);
  border-bottom: 1px solid rgba(0,0,0,0.03);
  background: #ffffff;
}
.ahb-trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  font-size: 0.85rem;
  margin: 0;
  padding-left: 0;
}
.ahb-trust-list li { list-style: none; }
.ahb-trust-list li::before {
  content: "✓ ";
  color: #15803d;
  font-weight: 600;
}
@media (max-width: 600px) {
  .ahb-trust-list { justify-content: flex-start; }
}

/* =========================
   BASE CARD LAYOUT (equal height)
   ========================= */

.ahb-featured-topics-section .ahb-silo-card,
.ahb-top-guides-section .ahb-guide-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Make Gutenberg columns stretch each card to equal height */
.ahb-featured-topics-section .wp-block-columns,
.ahb-top-guides-section .wp-block-columns,
.ahb-top-picks-section .wp-block-columns {
  align-items: stretch;
}
/* Each column becomes a flex container so the card can fill it */
.ahb-featured-topics-section .wp-block-column,
.ahb-top-guides-section .wp-block-column,
.ahb-top-picks-section .wp-block-column {
  display: flex;
}

/* Core cards should behave like full-height flex columns */
.ahb-silo-card,
.ahb-guide-card,
.ahb-top-picks-section .ahb-top-pick-card,
.ahb-aff-card,
.ahb-latest-card,
.ahb-nextstep-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Push common CTA rows to bottom */
.ahb-guide-card .wp-block-buttons,
.ahb-top-picks-section .ahb-top-pick-link-wrap,
.ahb-aff-card__cta,
.ahb-latest-card__more,
.ahb-nextstep-card .wp-block-buttons {
  margin-top: auto;
}

/* =========================
   TOPIC CARDS (Featured topics)
   ========================= */

.ahb-silo-card {
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
  text-align: left;
}
.ahb-silo-card .ahb-topic-icon img {
  max-width: 100%;
  border-radius: 999px;
  margin-bottom: 12px;
}
.ahb-silo-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.ahb-silo-card p { font-size: 0.95rem; }

/* Make entire topic card clickable (if you output .ahb-topic-card-link) */
.ahb-silo-card a.ahb-topic-card-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.ahb-silo-card a.ahb-topic-card-link:hover { text-decoration: none; }

/* =========================
   TOP GUIDES (cards + thumbs + CTA)
   Supports:
   - old 3-column columns layout
   - Query Loop layout
   ========================= */

.ahb-guide-card {
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
  gap: 12px;
}
.ahb-guide-card h3 { margin: 0; }
.ahb-guide-card p { margin: 0; }

/* Old "3 columns" mode */
.ahb-top-guides-section .wp-block-columns { align-items: stretch; }
.ahb-top-guides-section .wp-block-column { display:flex; }
.ahb-top-guides-section .wp-block-column > .wp-block-group.ahb-guide-card { flex: 1; }

/* Query Loop mode grid */
.ahb-top-guides-section .wp-block-query.ahb-top-guides-query .wp-block-post-template.ahb-top-guides-grid{
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  gap:24px;
  list-style:none;
  padding:0;
  margin:24px 0 0;
}
.ahb-top-guides-section .wp-block-query.ahb-top-guides-query li.wp-block-post{
  display:flex;
  flex:1 1 calc(33.333% - 24px);
}
.ahb-top-guides-section .wp-block-query.ahb-top-guides-query li.wp-block-post > .ahb-guide-card{ flex:1; }
@media (max-width: 900px){
  .ahb-top-guides-section .wp-block-query.ahb-top-guides-query li.wp-block-post{ flex:1 1 calc(50% - 24px); }
}
@media (max-width: 600px){
  .ahb-top-guides-section .wp-block-query.ahb-top-guides-query li.wp-block-post{ flex:1 1 100%; }
}

/* Thumbnails — enforce a consistent 220px for attention */
.ahb-guide-card__thumb,
.ahb-top-guides-section .ahb-guide-card figure.wp-block-post-featured-image{
  width: 100%;
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  margin: 0 0 12px 0 !important;
  display: block !important;
  background: #f1f5f9;
}
.ahb-guide-card__thumb > a,
.ahb-top-guides-section .ahb-guide-card figure.wp-block-post-featured-image > a{
  display:block;
  width:100%;
  height:100%;
}
.ahb-guide-card__image,
.ahb-top-guides-section .ahb-guide-card figure.wp-block-post-featured-image img{
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
  object-position: center;
}
.ahb-guide-card__thumb--placeholder{
  width:100%;
  height:220px;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(0,0,0,.08), rgba(0,0,0,.02));
}

/* Make read-more look like a button (theme-safe) */
.ahb-top-guides-section .ahb-guide-card .wp-block-read-more,
.ahb-top-guides-section .ahb-guide-card .wp-block-read-more__link,
.ahb-top-guides-section .ahb-guide-card a.wp-block-read-more,
.ahb-top-guides-section .ahb-guide-card .wp-block-post-excerpt__more-link,
.ahb-guide-card .ahb-guide-card__more a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,.08);
  background: var(--wp--preset--color--primary, #0b5fff);
  color: #fff !important;
  text-decoration: none !important;
}
.ahb-top-guides-section .ahb-guide-card .wp-block-read-more:hover,
.ahb-top-guides-section .ahb-guide-card .wp-block-read-more__link:hover,
.ahb-top-guides-section .ahb-guide-card a.wp-block-read-more:hover,
.ahb-top-guides-section .ahb-guide-card .wp-block-post-excerpt__more-link:hover,
.ahb-guide-card .ahb-guide-card__more a:hover {
  filter: brightness(0.95);
}

/* =========================
   TOP PICKS (homepage strip)
   ========================= */

.ahb-top-picks-section .ahb-top-pick-card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
  padding: 16px;
}
.ahb-top-picks-section .ahb-top-pick-image img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  margin-bottom: 10px;
}
.ahb-top-picks-section .ahb-top-pick-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}
.ahb-top-picks-section .ahb-top-pick-link {
  font-size: 0.9rem;
  font-weight: 600;
}

/* =========================
   LATEST ARTICLES (Latest Posts cards)
   Fixes alignment: CSS grid + clamps + button CTA
   ========================= */

.ahb-latest-posts-grid{
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
  align-items: stretch;
}
@media (max-width: 1024px){
  .ahb-latest-posts-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px){
  .ahb-latest-posts-grid{ grid-template-columns: 1fr; }
}

.ahb-latest-card{
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
  padding: 16px;

  /* neutralize old flex sizing if any legacy CSS exists */
  flex: initial !important;
  max-width: none !important;
  width: auto !important;
  box-sizing: border-box;
}

.ahb-latest-card__thumb{
  height: 220px;
  margin: 0 0 12px;
  border-radius: 12px;
  overflow: hidden;
}
.ahb-latest-card__thumb > a{
  display:block;
  width:100%;
  height:100%;
}
.ahb-latest-card__image{
  display:block;
  width:100% !important;
  height:100% !important;
  object-fit: cover;
  object-position: center;
}

.ahb-latest-card__title{
  font-size: 1rem;
  margin: 0 0 6px;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.6em;
}
.ahb-latest-card__excerpt{
  font-size: 0.9rem;
  margin-bottom: 10px;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: 4.1em;
}

/* CTA polish: render the "View details" link as a button.
   Supports both:
   - <a class="ahb-latest-card__more">
   - <p class="ahb-latest-card__more"><a ...></a></p>
*/
a.ahb-latest-card__more,
.ahb-latest-card__more a{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;

  border: 1px solid rgba(0,0,0,.08);
  background: var(--wp--preset--color--primary, #0b5fff);
  color: #fff !important;

  text-decoration: none !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
}
a.ahb-latest-card__more:hover,
.ahb-latest-card__more a:hover{
  filter: brightness(0.95);
  text-decoration: none !important;
}
a.ahb-latest-card__more:focus,
.ahb-latest-card__more a:focus{
  outline: 2px solid rgba(11,95,255,0.35);
  outline-offset: 2px;
}

/* Astra underline/shadow kill-switch inside AHB card sections */
body .ahb-latest-posts-section .ahb-latest-posts-grid a,
body .ahb-top-guides-section a,
body .ahb-top-picks-section a{
  text-decoration: none !important;
  box-shadow: none !important;
  border-bottom: none !important;
}
body .ahb-latest-posts-section .ahb-latest-posts-grid a:hover,
body .ahb-top-guides-section a:hover,
body .ahb-top-picks-section a:hover{
  opacity: 0.92;
}

/* =========================
   NEXT STEP THUMBNAILS
   ========================= */

.ahb-card-thumb {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 12px 0;
  background: rgba(0,0,0,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ahb-card-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  object-position: center;
  display: block;
}
.ahb-card-thumb--fallback {
  height: 220px;
  color: rgba(17,24,39,0.55);
}
.ahb-card-thumb--fallback .ahb-fallback-icon {
  width: 62px;
  height: 62px;
}
.ahb-nextstep-card h3 { margin-top: 0; }

/* =========================
   STARTER GUIDES GRID (reuses latest grid spacing)
   ========================= */

.ahb-starter-guides-grid { margin-top: 16px; row-gap: 32px; }

.ahb-starter-badge {
  display: inline-block;
  margin: 8px 0 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
}

/* =========================
   AFFILIATE PRODUCTS STRIP (Top 3)
   ========================= */

.ahb-aff-products-section {
  padding: 40px 0;
  background: #f8fafc;
}
.ahb-aff-products-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
.ahb-aff-products-heading {
  text-align: center;
  font-size: 2rem;
  margin: 0 0 20px;
  position: relative;
  z-index: 1;
}
.ahb-aff-products-heading::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: #ff9900;
}

.ahb-aff-products-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
  justify-content: center;
}

/* Card */
.ahb-aff-card {
  flex: 0 0 calc(33.333% - 16px);
  max-width: calc(33.333% - 16px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.06);
  padding: 16px 18px;
  text-align: center;
  overflow: hidden;
}
@media (max-width: 1024px) {
  .ahb-aff-card { flex: 0 0 calc(50% - 12px); max-width: calc(50% - 12px); }
}
@media (max-width: 700px) {
  .ahb-aff-card { flex: 0 0 100%; max-width: 100%; }
}

/* Thumb: fixed height, centered image (no stretching) */
.ahb-aff-card__thumb {
  height: 240px;
  margin-bottom: 12px;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ahb-aff-card__thumb a {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}
.ahb-aff-card__thumb img.ahb-aff-card__image {
  display: block;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
}

/* Badge */
.ahb-aff-card__badge {
  display: inline-block;
  margin: 6px 0 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
}

/* Predictable content heights */
.ahb-aff-card__title {
  font-size: 1.1rem;
  margin: 8px 0 6px;
  line-height: 1.25;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.6em;
}
.ahb-aff-card__spec {
  margin: 4px 0 8px;
  font-size: 0.95rem;
  line-height: 1.25;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: 2.4em;
}
.ahb-aff-card__desc {
  font-size: 0.9rem;
  margin: 0 0 12px;
  line-height: 1.35;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: 4.1em;
}

/* CTA pinned to bottom */
.ahb-aff-card__cta {
  margin-top: auto;
  padding-top: 10px;
}
.ahb-aff-card__button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: #ff9900;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.ahb-aff-card__button:hover { filter: brightness(0.96); }

/* Micro-trust note */
.ahb-aff-products-note {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 14px;
}
