/* Playbook-style scroll grid, namespaced for Superior Paving */

.sp-playbook {
  position: relative;
  min-height: 80vh; /* longer scroll runway */
}

/* Sticky inner viewport */
.sp-playbook__content {
  position: sticky;
  top: 0;
  min-height: 80vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Grid + layers */
.sp-playbook__grid {
  --sp-playbook-gap: clamp(10px, 7.35vw, 20px);
  --sp-playbook-gutter: 2em;
  --sp-playbook-offset: 0;

  width: 1600px;
  max-width: calc(100% - (2 * var(--sp-playbook-gutter)));
  display: grid;
grid-template-columns: repeat(5, 1fr);
  
  grid-template-rows: repeat(3, auto);
  gap: var(--sp-playbook-gap);
  margin: 0 auto;
  align-content: center;

  position: relative;
}

@media (max-width: 600px) {
  .sp-playbook__grid {
    grid-template-columns: repeat(3, 1fr);
    --sp-playbook-offset: -1;
  }

  /* optional: hide first layer on small screens for less clutter */
  .sp-playbook__grid > .sp-playbook__layer:first-of-type {
    display: none;
  }
}

/* Each layer is a subgrid spanning the whole grid */
.sp-playbook__layer {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  grid-template-columns: subgrid;
  grid-template-rows: subgrid;
}

/* Position images inside each layer similar to original */

.sp-playbook__grid > .sp-playbook__layer:nth-of-type(1) div:nth-of-type(odd) {
  grid-column: 1;
}
.sp-playbook__grid > .sp-playbook__layer:nth-of-type(1) div:nth-of-type(even) {
  grid-column: -2;
}

.sp-playbook__grid > .sp-playbook__layer:nth-of-type(2) div:nth-of-type(odd) {
  grid-column: calc(2 + var(--sp-playbook-offset));
}
.sp-playbook__grid > .sp-playbook__layer:nth-of-type(2) div:nth-of-type(even) {
  grid-column: calc(-3 - var(--sp-playbook-offset));
}

.sp-playbook__grid > .sp-playbook__layer:nth-of-type(3) div {
  grid-column: calc(3 + var(--sp-playbook-offset));
}
.sp-playbook__grid > .sp-playbook__layer:nth-of-type(3) div:last-of-type {
  grid-row: -1;
}

/* Center scaler image cell */
.sp-playbook__scaler {
  position: relative;
  grid-area: 2 / calc(3 + var(--sp-playbook-offset));
  z-index: 2;
    width: 100%;
    height: 100%;
}

.sp-playbook__scaler img {
      position: absolute;
      top: 50%;
      left: 50%;
      translate: -50% -50%;
      object-fit: cover;
      border-radius: 10px;
      width: 100%;
      height: 100%;
}




/* Base image styling */
.sp-playbook__grid img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

/* Initial states for animation */
/* Layers start collapsed and invisible - JS will fan them out */

.sp-playbook__layer {
  opacity: 0;
  transform: scale(0);
  transform-origin: center center;
  will-change: transform, opacity;
}


.sp-playbook__scaler {
  position: relative;
  grid-area: 2 / calc(3 + var(--sp-playbook-offset));
  z-index: 2;

  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;

  background: #007845;      /* tweak for your design */
  color: #fff;           /* text color inside */
}


.sp-playbook__scaler {
  display: flex;
  align-items: center;     /* vertical centering */
  justify-content: center; /* horizontal centering */
}



.sp-playbook__center {
  width: 100%;
  max-width: 600px;        /* optional */
  padding: 2rem;
  text-align: center;
}


/* Center image stays in its grid cell; JS only scales it */
.sp-playbook__scaler img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
  will-change: transform;
}

/* ---------- Mobile layout ---------- */
@media (max-width: 767px) {
  .sp-playbook {
    min-height: 140vh; /* slightly less scroll runway on phones */
  }

  .sp-playbook__grid {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-inline: 1.25rem;

    /* single-column, vertical stack */
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 1rem;
  }

  /* Center card: full-width-ish, centered */
  .sp-playbook__scaler {
    grid-column: 1 / -1;
    grid-row: 2;              /* keep it in the middle visually */
    max-width: 90vw;
    width: 100%;
    margin: 0 auto;
    border-radius: 10px;
  }

  .sp-playbook__center {
    padding: 1.5rem;
  }

  /* Layers: simplify behind/around the center card */
  .sp-playbook__layer {
    grid-column: 1 / -1;
  }


}

