/* ============================================
   WEBBLOOM COMPONENT SYSTEM
   ============================================
   Shared, reusable CSS classes for all templates.
   Prefix: .wb-

   All components are responsive by default.
   Templates should use these classes instead of
   inventing per-page CSS for common layouts.

   Breakpoints:
   - Desktop: > 1024px
   - Tablet:  768px – 1024px
   - Mobile:  < 768px
   ============================================ */


/* ── LAYOUT: Sections ── */

.wb-section {
  padding: var(--wb-section-pad, 5em) 1.5em;
  position: relative;
  overflow: hidden;
}

.wb-section-sm { padding: 2.5em 1.5em; }
.wb-section-lg { padding: 7em 1.5em; }

.wb-inner {
  max-width: var(--wb-inner-max, 1100px);
  margin: 0 auto;
  width: 100%;
}

.wb-narrow {
  max-width: var(--wb-narrow-max, 800px);
  margin: 0 auto;
  width: 100%;
}

.wb-wide {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Break out of page builder wrapper constraints */
.wb-full-width {
  max-width: none;
  padding: 0;
  margin: 0;
}
.wb-full-width .content-block {
  max-width: none;
  padding: 0;
  margin: 0;
}


/* ── LAYOUT: Hero ── */

.wb-hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--wb-dark);
  color: var(--wb-white);
  position: relative;
  padding: 6em 1.5em;
}

.wb-hero-sm { min-height: 40vh; padding: 4em 1.5em; }
.wb-hero-lg { min-height: 85vh; }

/* Background overlay for hero images */
.wb-hero-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}
.wb-hero-overlay > * { position: relative; z-index: 2; }

.wb-hero h1,
.wb-hero .wb-h1 {
  font-family: var(--wb-font-heading);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700;
  color: var(--wb-white);
  margin: 0 0 0.4em;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.wb-hero .wb-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--wb-accent);
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
}


/* ── LAYOUT: Grids ── */

.wb-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2em;
}

.wb-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2em;
}

.wb-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2em;
}

/* Grid gap variants */
.wb-gap-sm { gap: 1em; }
.wb-gap-md { gap: 2em; }
.wb-gap-lg { gap: 3em; }
.wb-gap-xl { gap: 4em; }


/* ── LAYOUT: Feature Row (image + text) ── */

.wb-feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3em;
  align-items: center;
  padding: 2em 0;
}

/* Flip image/text order */
.wb-feature-row.wb-flip .wb-feature-image { order: 2; }
.wb-feature-row.wb-flip .wb-feature-text  { order: 1; }

.wb-feature-image img {
  width: 100%;
  height: auto;
  border-radius: var(--wb-radius-md);
  display: block;
}

.wb-feature-text h2,
.wb-feature-text h3 {
  font-family: var(--wb-font-heading);
  margin: 0 0 0.5em;
}

.wb-feature-text p {
  color: var(--wb-text-light);
  line-height: 1.7;
}


/* ── LAYOUT: Cards ── */

.wb-card {
  background: var(--wb-white);
  border-radius: var(--wb-radius-md);
  padding: 2em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wb-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.wb-card-flat {
  box-shadow: none;
  border: 1px solid #e5e7eb;
}

.wb-card-flat:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wb-card h3 {
  font-family: var(--wb-font-heading);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  margin: 0 0 0.5em;
}

.wb-card p {
  color: var(--wb-text-light);
  line-height: 1.6;
  margin: 0;
}

.wb-card-icon {
  font-size: 2rem;
  color: var(--wb-primary);
  margin-bottom: 0.75em;
}


/* ── TYPOGRAPHY ── */

.wb-h1 {
  font-family: var(--wb-font-heading);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.4em;
  color: var(--wb-text);
}

.wb-h2 {
  font-family: var(--wb-font-heading);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.3em;
  color: var(--wb-text);
}

.wb-h3 {
  font-family: var(--wb-font-heading);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.3em;
  color: var(--wb-text);
}

.wb-h4 {
  font-family: var(--wb-font-heading);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.2em;
  color: var(--wb-text);
}

.wb-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--wb-text-light);
  line-height: 1.6;
  max-width: 700px;
}

.wb-lead {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  line-height: 1.7;
  color: var(--wb-text);
}

.wb-text-center { text-align: center; }
.wb-text-left   { text-align: left; }
.wb-text-right  { text-align: right; }

.wb-text-center .wb-subtitle,
.wb-text-center .wb-lead {
  margin-left: auto;
  margin-right: auto;
}


/* ── BUTTONS ── */

.wb-btn {
  display: inline-block;
  padding: 0.8em 2em;
  font-family: var(--wb-font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--wb-radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  line-height: 1.4;
}

.wb-btn-primary {
  background: var(--wb-primary);
  color: var(--wb-white);
  border-color: var(--wb-primary);
}
.wb-btn-primary:hover {
  background: var(--wb-primary-hover);
  border-color: var(--wb-primary-hover);
  color: var(--wb-white);
}

.wb-btn-secondary {
  background: var(--wb-secondary);
  color: var(--wb-white);
  border-color: var(--wb-secondary);
}
.wb-btn-secondary:hover {
  background: var(--wb-secondary-hover);
  border-color: var(--wb-secondary-hover);
  color: var(--wb-white);
}

.wb-btn-outline {
  background: transparent;
  color: var(--wb-primary);
  border-color: var(--wb-primary);
}
.wb-btn-outline:hover {
  background: var(--wb-primary);
  color: var(--wb-white);
}

.wb-btn-white {
  background: var(--wb-white);
  color: var(--wb-dark);
  border-color: var(--wb-white);
}
.wb-btn-white:hover {
  background: transparent;
  color: var(--wb-white);
  border-color: var(--wb-white);
}

.wb-btn-lg { padding: 1em 2.5em; font-size: 1.1rem; }
.wb-btn-sm { padding: 0.5em 1.5em; font-size: 0.9rem; }

.wb-btn-group {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}


/* ── SECTION THEMES ── */

.wb-dark {
  background: var(--wb-dark);
  color: var(--wb-white);
}
.wb-dark h1, .wb-dark h2, .wb-dark h3, .wb-dark h4,
.wb-dark .wb-h1, .wb-dark .wb-h2, .wb-dark .wb-h3, .wb-dark .wb-h4 {
  color: var(--wb-white);
}
.wb-dark p, .wb-dark .wb-subtitle {
  color: #b8c0d0;
}

.wb-light {
  background: var(--wb-light);
}

.wb-white {
  background: var(--wb-white);
}

.wb-primary-bg {
  background: var(--wb-primary);
  color: var(--wb-white);
}
.wb-primary-bg h1, .wb-primary-bg h2, .wb-primary-bg h3,
.wb-primary-bg p, .wb-primary-bg .wb-subtitle { color: var(--wb-white); }


/* ── SPACING UTILITIES ── */

.wb-pad-none { padding: 0; }
.wb-pad-sm   { padding: 2em 1.5em; }
.wb-pad-md   { padding: 4em 1.5em; }
.wb-pad-lg   { padding: 6em 1.5em; }
.wb-pad-xl   { padding: 8em 1.5em; }

.wb-mt-0 { margin-top: 0; }
.wb-mb-0 { margin-bottom: 0; }
.wb-mt-1 { margin-top: 1em; }
.wb-mb-1 { margin-bottom: 1em; }
.wb-mt-2 { margin-top: 2em; }
.wb-mb-2 { margin-bottom: 2em; }
.wb-mt-3 { margin-top: 3em; }
.wb-mb-3 { margin-bottom: 3em; }


/* ── ANIMATION HELPERS ── */

/* Scroll-reveal animation classes — handled by IntersectionObserver in main.js */
.wb-fade-in,
.wb-slide-up,
.wb-slide-left,
.wb-slide-right,
.wb-zoom-in      { opacity: 0; transform: translateY(0); transition: opacity 0.6s ease, transform 0.6s ease; }

.wb-slide-up     { transform: translateY(30px); }
.wb-slide-left   { transform: translateX(-30px); }
.wb-slide-right  { transform: translateX(30px); }
.wb-zoom-in      { transform: scale(0.95); }

/* When visible (observer adds .wb-visible) */
.wb-fade-in.wb-visible,
.wb-slide-up.wb-visible,
.wb-slide-left.wb-visible,
.wb-slide-right.wb-visible,
.wb-zoom-in.wb-visible { opacity: 1; transform: translateY(0) translateX(0) scale(1); }

/* GSAP marker classes — no CSS needed, used by JS */
/* .wb-stagger  — parent: GSAP staggers children on scroll */
/* .wb-parallax — element: GSAP adds parallax movement */

/* GSAP fallback: if GSAP doesn't load, reveal content after 3s */
.wb-gsap-target { opacity: 0; }
.gsap-fallback .wb-gsap-target,
.no-js .wb-gsap-target { opacity: 1; }


/* ── DIVIDER ── */

.wb-divider {
  width: 60px;
  height: 3px;
  background: var(--wb-primary);
  border: none;
  margin: 1em 0;
}
.wb-text-center .wb-divider {
  margin-left: auto;
  margin-right: auto;
}


/* ── RESPONSIVE VISIBILITY ── */

.wb-hidden-mobile  { }
.wb-hidden-tablet  { }
.wb-hidden-desktop { }
.wb-show-mobile    { display: none; }


/* ── IMAGE UTILITIES ── */

.wb-img-rounded  { border-radius: var(--wb-radius-md); }
.wb-img-circle   { border-radius: 50%; }
.wb-img-cover    { width: 100%; height: 100%; object-fit: cover; }
.wb-img-shadow   { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }


/* ============================================
   RESPONSIVE — TABLET (768px – 1024px)
   ============================================ */

@media (max-width: 1024px) {
  .wb-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .wb-grid-3 { grid-template-columns: repeat(2, 1fr); }

  .wb-feature-row {
    gap: 2em;
  }

  .wb-hero { min-height: 55vh; padding: 4em 1.5em; }
  .wb-hero-lg { min-height: 65vh; }

  .wb-hidden-tablet { display: none !important; }
}


/* ============================================
   RESPONSIVE — MOBILE (< 768px)
   ============================================ */

@media (max-width: 767px) {
  .wb-grid-2,
  .wb-grid-3,
  .wb-grid-4 {
    grid-template-columns: 1fr;
  }

  .wb-feature-row {
    grid-template-columns: 1fr;
    gap: 1.5em;
  }
  /* On mobile, always image first regardless of flip */
  .wb-feature-row.wb-flip .wb-feature-image { order: 0; }
  .wb-feature-row.wb-flip .wb-feature-text  { order: 0; }

  .wb-hero { min-height: 50vh; padding: 3em 1em; }
  .wb-hero-sm { min-height: 30vh; }

  .wb-section { padding: 3em 1em; }
  .wb-section-lg { padding: 4em 1em; }

  .wb-btn-group {
    flex-direction: column;
    align-items: stretch;
  }
  .wb-btn-group .wb-btn {
    text-align: center;
  }

  .wb-hidden-mobile { display: none !important; }
  .wb-show-mobile   { display: block; }
}
