/* base tokens and responsive layout matching the reference visuals */
:root {
  --spb-bg: #ffffff;
  --spb-fg: #1a1a1a;
  --spb-muted: #6b7280;
  --spb-card: #ffffff;
  --spb-accent: #e84b3a; /* warm red */
  --spb-radius: 16px;
  --spb-gap: 16px;
  --spb-item-h: 200px; /* single image tile height desktop/tablet */
  --spb-sticky-offset: 0px; /* adjust if header overlaps */
}

.spb-section {
  background: var(--spb-bg);
  color: var(--spb-fg);
  /* Reduced bottom padding from 16px to 0px to eliminate extra space between sections */
  padding: 24px 0 0;
}

.spb-header {
  max-width: 1100px;
  margin: 0 auto 16px;
  padding: 0 16px;
  text-align: center;
}

.spb-kicker {
  color: var(--spb-accent);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 6px;
}

.spb-title {
  font-size: 28px;
  line-height: 1.25;
  margin: 0 0 8px;
}

@media (min-width: 768px) {
  .spb-title {
    font-size: 34px;
  }
}

/* Stage & pin: whole row sticks while left images scroll */
.spb-stage {
  position: relative;
}
.spb-pin {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Left column */
.spb-left {
  display: none;
}
@media (min-width: 768px) {
  .spb-left {
    display: block;
  }
  .spb-frame {
    height: calc((var(--spb-item-h) * 3) + (var(--spb-gap) * 2)); /* show 3 images */
    overflow: hidden;
    border-radius: var(--spb-radius);
  }
  .spb-images {
    display: flex;
    flex-direction: column;
    gap: var(--spb-gap);
    will-change: transform;
    transition: transform .05s linear;
  }
  .spb-image {
    height: var(--spb-item-h);
    border-radius: var(--spb-radius);
    overflow: hidden;
  }
  .spb-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

/* Right column (sticky boxes) */
.spb-right {
  position: relative;
}
.spb-boxes {
  position: sticky;
  top: var(--spb-sticky-offset); /* was 80px */
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 900px) {
  .spb-boxes {
    /* enforce two columns with rows equal to image tile height */
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: var(--spb-item-h); /* row height matches .spb-image height */
    gap: var(--spb-gap);
    align-items: stretch; /* ensure items fill the row height */
  }
}
.spb-box {
  background: var(--spb-card);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(232, 75, 58, 0.25);
  /* let boxes stretch to the grid row height and center content */
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center; /* center titles/descriptions within the set row height */
}
.spb-box-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--spb-fg);
}
.spb-box-desc {
  margin: 0;
  color: var(--spb-muted);
  font-size: 14px;
  line-height: 1.6; /* keep readable line-height within centered layout */
}

/* Mobile stacked layout: image + box repeated */
.spb-mobile {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
.spb-m-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}
.spb-m-col {
  min-width: 0;
}
.spb-m-image .spb-mobile-image {
  border-radius: var(--spb-radius);
  overflow: hidden;
  height: 100%;
}
.spb-m-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 4 / 3; /* stable height on small screens */
}
.spb-m-box .spb-mobile-box {
  background: var(--spb-card);
  border-radius: 16px;
  padding: 16px;
  height: 100%;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(232, 75, 58, 0.25);
}

/* Hide mobile layout on >=768px, show pinned layout */
@media (min-width: 768px) {
  .spb-mobile {
    display: none;
  }
}

/* Hide the entire desktop/sticky stage on mobile to prevent duplicates */
@media (max-width: 767px) {
  .spb-stage {
    display: none !important;
  }
}

/* Tablet fine-tuning */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --spb-item-h: 200px;
  }
  /* if needed, you can re-introduce offset: 
     .spb-boxes { top: 64px; } */
}

/* Accessibility: reduce motion */
@media (prefers-reduced-motion: reduce) {
  .spb-images {
    transition: none !important;
  }
}
