/* ROW Schools — Story Stage (2026 redesign)
   Auto-advancing partner-school stories: stacked slides, spotlight hover,
   pill rail with visited checkmarks and cycle progress. */

.row-scstage {
  --scstage-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --scstage-ink: #14324a;
  --scstage-cream: #f9f5ec;
  padding: clamp(3.5rem, 7vw, 6.5rem) 0 clamp(4rem, 8vw, 7rem);
}

.row-scstage__shell {
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
}

/* ---------- Header ---------- */

.row-scstage__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 3rem;
  margin-bottom: clamp(1.75rem, 3.5vw, 2.75rem);
}

.row-scstage__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #8b3a52;
  font-family: "Barlow Condensed", "Avenir Next Condensed", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.row-scstage__eyebrow::before {
  content: "";
  width: 2.6rem;
  height: 2px;
  background: #8b3a52;
}

.row-scstage__heading-lockup h2 {
  margin: 0.6rem 0 0;
  color: var(--scstage-ink);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.row-scstage__intro {
  max-width: 24rem;
  margin: 0;
  color: rgba(20, 50, 74, 0.78);
  font-family: "Barlow", "Avenir Next", sans-serif;
  font-size: 1.02rem;
  line-height: 1.6;
}

/* ---------- Card + slides ---------- */

.row-scstage__card {
  position: relative;
  display: grid;
  border-radius: 1.75rem;
  box-shadow: 0 2.2rem 4.5rem rgba(9, 24, 38, 0.28);
  isolation: isolate;
}

.row-scstage__slide {
  --accent: #f0a5bb;
  --from: #56243e;
  --to: #31445c;
  position: relative;
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  padding: clamp(1.4rem, 2.6vw, 2.25rem);
  border-radius: 1.75rem;
  background:
    radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 42%),
    linear-gradient(150deg, var(--from), var(--to));
  color: #fff;
  visibility: hidden;
  opacity: 0;
  transition: opacity 520ms var(--scstage-ease), visibility 0s linear 520ms;
  overflow: hidden;
}

.row-scstage__slide.is-active {
  visibility: visible;
  opacity: 1;
  z-index: 1;
  transition: opacity 520ms var(--scstage-ease);
}

.row-scstage__slide[data-school-theme="lewis-clark"]  { --accent: #f0a5bb; --from: #56243e; --to: #31445c; }
.row-scstage__slide[data-school-theme="target-range"] { --accent: #ffdc84; --from: #5e451c; --to: #65503f; }
.row-scstage__slide[data-school-theme="russell"]      { --accent: #a9d0b2; --from: #24483e; --to: #294c58; }
.row-scstage__slide[data-school-theme="franklin"]     { --accent: #ffc0a8; --from: #69301f; --to: #673044; }
.row-scstage__slide[data-school-theme="hawthorne"]    { --accent: #a6ded4; --from: #234c5d; --to: #2b4c67; }

/* Spotlight that follows the cursor (motion-gated; coordinates set by JS). */
.row-scstage__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    620px circle at var(--scstage-x, 70%) var(--scstage-y, 30%),
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 420ms var(--scstage-ease);
  pointer-events: none;
  z-index: 0;
}

.row-scstage__card:hover .row-scstage__slide.is-active .row-scstage__glow {
  opacity: 1;
}

/* ---------- Media ---------- */

.row-scstage__media {
  position: relative;
  z-index: 1;
  margin: 0;
  border-radius: 1.15rem;
  overflow: hidden;
  min-height: 100%;
}

.row-scstage__media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 24rem;
  object-fit: cover;
}

.row-scstage__slide.is-active .row-scstage__media {
  animation: scstage-media 760ms var(--scstage-ease) both;
}

.row-scstage__media figcaption {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  border-radius: 0.7rem;
  background: rgba(9, 24, 38, 0.68);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: "Barlow Condensed", "Avenir Next Condensed", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.row-scstage__media figcaption span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--scstage-ink);
}

/* ---------- Content ---------- */

.row-scstage__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  padding: clamp(0.4rem, 1vw, 0.9rem) clamp(0.2rem, 1vw, 0.75rem) clamp(0.4rem, 1vw, 0.9rem) 0;
}

.row-scstage__slide.is-active .row-scstage__content > * {
  animation: scstage-rise 620ms var(--scstage-ease) both;
}

.row-scstage__slide.is-active .row-scstage__content > *:nth-child(1) { animation-delay: 60ms; }
.row-scstage__slide.is-active .row-scstage__content > *:nth-child(2) { animation-delay: 130ms; }
.row-scstage__slide.is-active .row-scstage__content > *:nth-child(3) { animation-delay: 200ms; }
.row-scstage__slide.is-active .row-scstage__content > *:nth-child(4) { animation-delay: 270ms; }
.row-scstage__slide.is-active .row-scstage__content > *:nth-child(5) { animation-delay: 340ms; }

.row-scstage__chapter {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  color: color-mix(in srgb, var(--accent) 82%, #fff);
  font-family: "Barlow Condensed", "Avenir Next Condensed", sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.row-scstage__chapter span + span {
  color: rgba(255, 255, 255, 0.55);
}

.row-scstage .row-scstage__content h3 {
  margin: 0;
  color: #fff !important;
  font-family: "Libre Baskerville", Georgia, serif !important;
  font-size: clamp(1.7rem, 2.9vw, 2.6rem);
  font-weight: 400 !important;
  letter-spacing: -0.015em !important;
  line-height: 1.08;
}

.row-scstage__story {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-family: "Barlow", "Avenir Next", sans-serif;
  font-size: 0.98rem;
  line-height: 1.62;
}

.row-scstage__paperwork {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.15rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--scstage-ink);
  font-family: "Barlow", "Avenir Next", sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 260ms var(--scstage-ease), box-shadow 260ms var(--scstage-ease);
}

.row-scstage__paperwork:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.7rem 1.4rem rgba(9, 24, 38, 0.35);
}

.row-scstage__paperwork:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Quote card — content-sized, never clipped. No fixed heights, no columns,
   no overflow tricks on the text path (hard-won rule from the tabs era). */
.row-scstage__quote {
  position: relative;
  align-self: stretch;
  margin: 0.2rem 0 0;
  padding: 1rem 1.15rem 1.05rem;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, rgba(255, 255, 255, 0.25));
  border-radius: 1rem;
  background: rgba(9, 24, 38, 0.32);
  backdrop-filter: blur(10px);
}

.row-scstage__quote-mark {
  display: block;
  height: 1rem;
  color: var(--accent);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.7rem;
  line-height: 1;
}

.row-scstage__quote p {
  margin: 0.35rem 0 0;
  color: #fff;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.58;
  text-wrap: pretty;
}

.row-scstage__quote--long p {
  font-size: 0.85rem;
  line-height: 1.52;
}

.row-scstage__quote cite {
  display: block;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: color-mix(in srgb, var(--accent) 70%, #fff);
  font-family: "Barlow Condensed", "Avenir Next Condensed", sans-serif;
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Pill rail ---------- */

.row-scstage__nav {
  margin-top: clamp(1.4rem, 2.6vw, 2rem);
}

.row-scstage__rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.row-scstage__pill {
  --pill-accent: #8b3a52;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1.15rem 0.5rem 0.55rem;
  border: 1px solid rgba(20, 50, 74, 0.16);
  border-radius: 999px;
  background: #fff;
  color: var(--scstage-ink);
  font-family: "Barlow", "Avenir Next", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 260ms var(--scstage-ease), border-color 260ms var(--scstage-ease),
    background-color 260ms var(--scstage-ease), color 260ms var(--scstage-ease);
}

.row-scstage__pill[data-school-theme="lewis-clark"]  { --pill-accent: #8b3a52; }
.row-scstage__pill[data-school-theme="target-range"] { --pill-accent: #a3781f; }
.row-scstage__pill[data-school-theme="russell"]      { --pill-accent: #37684a; }
.row-scstage__pill[data-school-theme="franklin"]     { --pill-accent: #a04a2c; }
.row-scstage__pill[data-school-theme="hawthorne"]    { --pill-accent: #2f6274; }

.row-scstage__pill:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--pill-accent) 55%, transparent);
}

.row-scstage__pill:focus-visible {
  outline: 3px solid var(--pill-accent);
  outline-offset: 3px;
}

.row-scstage__pill.is-active {
  background: var(--pill-accent);
  border-color: var(--pill-accent);
  color: #fff;
}

.row-scstage__pill-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--pill-accent) 14%, #fff);
  color: var(--pill-accent);
  font-family: "Barlow Condensed", "Avenir Next Condensed", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  transition: background-color 260ms var(--scstage-ease), color 260ms var(--scstage-ease);
}

.row-scstage__pill.is-active .row-scstage__pill-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.row-scstage__pill-check {
  position: absolute;
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 260ms var(--scstage-ease), transform 260ms var(--scstage-ease);
}

.row-scstage__pill.is-visited .row-scstage__pill-number { opacity: 0; }
.row-scstage__pill.is-visited .row-scstage__pill-check  { opacity: 1; transform: scale(1); }
.row-scstage__pill.is-visited {
  border-color: color-mix(in srgb, var(--pill-accent) 45%, transparent);
}

.row-scstage__pill-number {
  transition: opacity 260ms var(--scstage-ease);
}

/* Cycle progress underline — animates only while auto-advance is live. */
.row-scstage__pill-progress {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.22rem;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transform: scaleX(0);
  transform-origin: left center;
}

.row-scstage.is-playing .row-scstage__pill.is-active .row-scstage__pill-progress {
  animation: scstage-progress var(--scstage-interval, 6000ms) linear forwards;
}

.row-scstage__hint {
  margin: 0.9rem 0 0;
  color: rgba(20, 50, 74, 0.78);
  font-family: "Barlow", "Avenir Next", sans-serif;
  font-size: 0.78rem;
  text-align: center;
}

/* ---------- Keyframes ---------- */

@keyframes scstage-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scstage-media {
  from { opacity: 0; transform: scale(1.035); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scstage-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------- Breakpoints ---------- */

@media (max-width: 920px) {
  .row-scstage__slide {
    grid-template-columns: 1fr;
  }

  .row-scstage__media img {
    min-height: 0;
    aspect-ratio: 16 / 10;
    height: auto;
  }

  .row-scstage__intro {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .row-scstage__shell {
    width: calc(100% - 1.6rem);
  }

  .row-scstage__slide {
    padding: 1rem;
  }

  .row-scstage__pill {
    padding: 0.45rem 0.9rem 0.45rem 0.5rem;
    font-size: 0.72rem;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .row-scstage__slide,
  .row-scstage__slide.is-active,
  .row-scstage__slide.is-active .row-scstage__media,
  .row-scstage__slide.is-active .row-scstage__content > *,
  .row-scstage__pill,
  .row-scstage__paperwork,
  .row-scstage__glow {
    animation: none !important;
    transition: none !important;
  }

  .row-scstage__pill-progress {
    display: none;
  }

  .row-scstage__glow {
    opacity: 0 !important;
  }
}
