/*
 * sitepilot-blocks — canonical-class compatibility layer (Gutenberg conversion, Phase 7).
 *
 * The ~52 `semantic` families already style the canonical class vocabulary
 * (.hero-content, .services-grid, .service-card, .section-heading-group …) in
 * their base.css. The ~28 `bem` + 2 `bem-under` families do NOT — their base.css
 * styles .card/.grid/.section__header instead. This stylesheet gives the canonical
 * classes a sensible, ON-BRAND layout (it consumes each family's own --color-*/
 * --radius/--space CSS variables, with fallbacks) so block-rendered pages look
 * right on every family.
 *
 * EVERY selector is wrapped in :where() → ZERO specificity. Any real family rule
 * (even a single-class selector) overrides these, so semantic families are
 * completely unaffected; only the gaps on bem families get filled.
 */

:where(.section) { padding-block: var(--space-16, 5rem); }
:where(.container) { max-width: var(--container-max, 1200px); margin-inline: auto; padding-inline: var(--space-6, 1.5rem); }

/* hero */
:where(.hero) { padding-block: var(--space-20, 6rem); }
:where(.hero-content) { max-width: 820px; margin-inline: auto; text-align: center; }
:where(.hero-cta-group) { display: flex; flex-wrap: wrap; gap: var(--space-4, 1rem); justify-content: center; margin-top: var(--space-6, 1.5rem); }
:where(.hero-media) { margin-top: var(--space-8, 2rem); }
:where(.hero-media img) { width: 100%; border-radius: var(--radius-lg, 12px); }

/* section heading */
:where(.section-heading-group) { text-align: center; max-width: 720px; margin-inline: auto; margin-bottom: var(--space-10, 3rem); }
:where(.section-marker) { display: block; width: 40px; height: 3px; margin: 0 auto var(--space-4, 1rem); background: var(--color-accent, var(--color-primary, currentColor)); border-radius: 2px; }
:where(.section-label) { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; color: var(--color-accent, var(--color-primary, inherit)); margin-bottom: var(--space-2, .5rem); }
:where(.section-title) { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.2; }
:where(.section-subtitle) { margin-top: var(--space-3, .75rem); color: var(--color-text-muted, var(--color-text, inherit)); }

/* grids */
:where(.services-grid, .features-grid, .portfolio-grid, .team-grid, .blog-grid,
       .pricing-grid, .testimonials-grid, .reviews-grid, .gallery-grid, .shop-grid,
       .process-grid, .columns-grid, .menu-grid, .stats-row, .logos-strip) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6, 1.5rem);
}
:where(.stats-row) { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); text-align: center; }
:where(.logos-strip) { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); align-items: center; }
:where(.gallery-grid) { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* cards */
:where(.service-card, .feature-card, .team-card, .blog-card, .pricing-card,
       .testimonial-card, .review-card, .portfolio-item, .process-step,
       .product-card, .column, .timeline-item, .menu-category) {
  background: var(--color-bg-card, var(--color-surface, transparent));
  border: 1px solid var(--color-border, rgba(128,128,128,.18));
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-6, 1.5rem);
}
:where(.service-icon, .feature-icon) { width: 44px; height: 44px; margin-bottom: var(--space-4, 1rem); color: var(--color-accent, var(--color-primary, currentColor)); }
:where(.service-icon svg, .feature-icon svg) { width: 100%; height: 100%; }
:where(.service-number, .process-number) { display: inline-block; font-weight: 700; color: var(--color-accent, var(--color-primary, inherit)); margin-bottom: var(--space-2, .5rem); }

/* media inside cards — constrain aspect so empty/dummy images don't render as
   oversized boxes (a fleet-QA driver on image-heavy sections; real photos fill
   these in production). object-fit:cover keeps real images tidy too. */
:where(.team-photo-wrapper img, .blog-card-image img, .portfolio-item img,
       .product-image img, .gallery-item img, .card img, .service-media img,
       .feature-media img) {
  width: 100%; height: auto; border-radius: var(--radius-md, 8px);
}
:where(.portfolio-item, .gallery-item, .blog-card-image, .team-photo-wrapper,
       .product-image, .service-media, .feature-media) img {
  aspect-ratio: 4 / 3; object-fit: cover;
}
:where(.gallery-item) { aspect-ratio: 4 / 3; overflow: hidden; }
:where(.gallery-item img) { height: 100%; }
:where(.team-photo-wrapper img) { aspect-ratio: 1 / 1; }

/* testimonials / reviews */
:where(.testimonial-stars, .review-stars) { color: var(--color-accent, #f5b301); margin-bottom: var(--space-2, .5rem); }
:where(.testimonial-author, .review-author) { margin-top: var(--space-4, 1rem); display: flex; flex-direction: column; }

/* faq */
:where(.faq-list) { max-width: 780px; margin-inline: auto; display: flex; flex-direction: column; gap: var(--space-3, .75rem); }
:where(.faq-item) { border: 1px solid var(--color-border, rgba(128,128,128,.18)); border-radius: var(--radius-md, 8px); overflow: hidden; }
:where(.faq-item__question) { width: 100%; text-align: start; padding: var(--space-4, 1rem); background: none; border: 0; font: inherit; cursor: pointer; display: flex; justify-content: space-between; gap: var(--space-4, 1rem); }
:where(.faq-item__answer) { padding: 0 var(--space-4, 1rem) var(--space-4, 1rem); }

/* pricing */
:where(.pricing-card.featured) { border-color: var(--color-accent, var(--color-primary, currentColor)); }
:where(.pricing-price) { font-size: 2rem; font-weight: 700; margin-block: var(--space-3, .75rem); }
:where(.pricing-badge) { display: inline-block; padding: .2em .7em; border-radius: 999px; background: var(--color-accent, var(--color-primary, #333)); color: var(--color-on-accent, #fff); font-size: .75rem; }

/* contact / about two-column */
:where(.contact-grid, .about-grid) { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-8, 2rem); align-items: start; }
:where(.contact-item) { display: flex; align-items: center; gap: var(--space-3, .75rem); margin-bottom: var(--space-3, .75rem); }
:where(.contact-item svg) { width: 20px; height: 20px; flex: none; color: var(--color-accent, var(--color-primary, currentColor)); }
:where(.about-image) { width: 100%; border-radius: var(--radius-lg, 12px); }

/* map */
:where(.map-embed iframe) { width: 100%; border: 0; border-radius: var(--radius-lg, 12px); }

/* generic safety */
:where(.sitepilot-block-preview img) { max-width: 100%; }
