.services-board {
  padding-block: clamp(4rem, 8vw, var(--space-120));
  background: var(--pure-white);
}

/* ---- The horizontal band ---------------------------------------- */
.board {
  width: 100%;
  max-width: var(--board-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.spines {
  display: flex;
  gap: 3px;
  height: clamp(30rem, 62vh, 39rem);
  border-radius: 24px;
  overflow: hidden;
  background: var(--dozen-dark);
}

.spine {
  --tint: var(--dozen-blue);
  --ink: var(--pure-white);
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  transition: flex-grow 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.spine--1 {
  --tint: var(--dozen-blue);
  --ink: var(--pure-white);
}
.spine--2 {
  --tint: var(--dozen-teal);
  --ink: var(--dozen-dark);
}
.spine--3 {
  --tint: var(--dozen-red);
  --ink: var(--pure-white);
}
.spine--4 {
  --tint: var(--light-purple);
  --ink: var(--dozen-dark);
}
.spine--5 {
  --tint: var(--dozen-dark);
  --ink: var(--pure-white);
}

.spine__media,
.spine__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.spine__media img {
  object-fit: cover;
  object-position: center;
}

/* Brand veil: image bleeds through the top, color deepens toward the base
   where the copy sits. One static layer — no repaint on expand. */
.spine::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    178deg,
    color-mix(in srgb, var(--tint) 42%, transparent) 0%,
    color-mix(in srgb, var(--tint) 74%, transparent) 46%,
    color-mix(in srgb, var(--tint) 94%, transparent) 100%
  );
}

/* Full-cover control — the only focusable/clickable target per spine. */
.spine__trigger {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  padding: 0;
}

.spine__trigger:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -8px;
  border-radius: 18px;
}

/* ---- Collapsed rail (index + rotated name) ---------------------- */
.spine__rail {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: clamp(1.5rem, 2.4vw, var(--space-40));
  color: var(--ink);
  pointer-events: none;
  transition: opacity 300ms ease;
}

.spine__idx {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  opacity: 0.72;
}

.spine__name {
  margin-top: auto;
  margin-bottom: auto;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: clamp(1.125rem, 1.4vw, 1.375rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-shadow: 0 1px 12px color-mix(in srgb, var(--dozen-dark) 40%, transparent);
}

.spine--2 .spine__name,
.spine--4 .spine__name {
  text-shadow: none;
}

/* ---- Expanded detail -------------------------------------------- */
.spine__detail {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(0.75rem, 1.2vw, var(--space-20));
  padding: clamp(1.75rem, 2.6vw, var(--space-40));
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms ease 120ms;
}

.spine__detail-idx {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: 0.875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}

.spine__title {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-size: clamp(1.5rem, 2.1vw, 2rem);
  line-height: 1.08;
  max-width: 16ch;
}

.spine__tagline {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  font-style: italic;
  font-size: clamp(1.0625rem, 1.5vw, 1.375rem);
  line-height: 1.25;
  color: color-mix(in srgb, var(--ink) 92%, transparent);
}

.spine__caps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
  max-width: 42ch;
  border-top: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
}

.spine__caps li {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.3;
  padding-block: 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
}

/* ---- State: expanded -------------------------------------------- */
.spine:hover,
.spine:focus-within,
.spine--open {
  flex-grow: 5.6;
}

.spine:hover .spine__rail,
.spine:focus-within .spine__rail,
.spine--open .spine__rail {
  opacity: 0;
}

.spine:hover .spine__detail,
.spine:focus-within .spine__detail,
.spine--open .spine__detail {
  opacity: 1;
}

/* Default-open spine yields the moment any other spine is engaged. */
.spines:hover .spine--open:not(:hover):not(:focus-within),
.spines:focus-within .spine--open:not(:focus-within):not(:hover) {
  flex-grow: 1;
}

.spines:hover .spine--open:not(:hover):not(:focus-within) .spine__rail,
.spines:focus-within .spine--open:not(:focus-within):not(:hover) .spine__rail {
  opacity: 1;
}

.spines:hover .spine--open:not(:hover):not(:focus-within) .spine__detail,
.spines:focus-within
  .spine--open:not(:focus-within):not(:hover)
  .spine__detail {
  opacity: 0;
}

/* ---- Mobile: stacked expandable rows ---------------------------- */
@media (max-width: 640px) {
  .spines {
    flex-direction: column;
    height: auto;
    border-radius: 18px;
  }

  .spine {
    flex: 0 0 auto;
    height: 4.75rem;
    transition: height 500ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .spine:hover,
  .spine:focus-within,
  .spine--open {
    flex-grow: 0;
    height: 26rem;
  }

  .spines:hover .spine--open:not(:hover):not(:focus-within),
  .spines:focus-within .spine--open:not(:focus-within):not(:hover) {
    flex-grow: 0;
    height: 4.75rem;
  }

  .spine__rail {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding-inline: 1.5rem;
    padding-block: 0;
  }

  .spine__idx {
    margin: 0;
  }

  .spine__name {
    margin: 0;
    writing-mode: horizontal-tb;
    transform: none;
    white-space: normal;
    font-size: 1.0625rem;
    line-height: 1.15;
  }

  .spine__detail {
    justify-content: center;
    gap: 0.75rem;
  }
}

/* Honor reduced-motion: no bloom/opacity easing, just instant state. */
@media (prefers-reduced-motion: reduce) {
  .spine,
  .spine__rail,
  .spine__detail {
    transition: none;
  }
}
