/* ==========================================================================
   "Where the joy of Learning Begins." stage tabs (academics.html, #stages only).
   Tab row modelled on the About Us "Our Core Values" tabs (about-values.css):
   cards in a row, the selected card filled blue. Behaviour is unchanged: the
   existing [data-tabs] script in site.js still switches the panels.
   Typography follows index.html (.hp-h2, .hp-script, .hp-body).
   ========================================================================== */

#stages {
  position: relative;
  overflow-x: clip;
}

#stages .st-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
}

#stages .st-head .hp-h2 {
  font-family: var(--hp-sans);
  font-size: clamp(36px, 3.6vw, 54px);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -.035em;
  color: var(--hp-navy);
  margin: 0;
  text-wrap: balance;
}

#stages .st-head .hp-script {
  font-size: 60px;
  line-height: 1;
  letter-spacing: 0;
  white-space: normal;
}

#stages .st-head .hp-body {
  font-family: var(--hp-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--hp-ink);
  max-width: 340px;
  margin: 0;
}

/* ---------- tab row ---------- */
#stages .st-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 48px;
}

#stages .st-tabs [role="tab"] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 150px;
  padding: 22px 22px 24px;
  border: 1px solid #e3e9f1;
  border-radius: 22px;
  background: #fff;
  color: var(--hp-navy);
  text-align: left;
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

#stages .st-tabs [role="tab"]:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(14, 42, 71, .08);
}

#stages .st-tabs [role="tab"]:focus-visible {
  outline: 2px solid var(--hp-orange);
  outline-offset: 3px;
}

#stages .st-tabs [role="tab"][aria-selected="true"] {
  background: var(--hp-blue);
  border-color: var(--hp-blue);
  color: #fff;
  box-shadow: 0 18px 36px rgba(10, 74, 149, .28);
}

#stages .st-num {
  font-family: var(--hp-nav);
  font-size: 17px;
  line-height: 1;
  color: var(--hp-orange);
}

#stages .st-tabs [role="tab"][aria-selected="true"] .st-num {
  color: #ffc59f;
}

#stages .st-name {
  font-family: var(--hp-serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.01em;
}

#stages .st-range {
  margin-top: auto;
  font-family: var(--hp-sans);
  font-size: 15px;
  line-height: 1.4;
  opacity: .8;
}

/* ---------- tablet ---------- */
@media (max-width: 1024px) {
  #stages .st-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- phone ---------- */
@media (max-width: 720px) {
  #stages .st-head {
    margin-bottom: 28px;
  }
  #stages .st-head .hp-h2 {
    font-size: clamp(32px, 8.8vw, 42px);
  }
  #stages .st-head .hp-script {
    font-size: 1.05em;
  }
  #stages .st-tabs {
    gap: 12px;
    margin-bottom: 32px;
  }
  #stages .st-tabs [role="tab"] {
    min-height: 120px;
    padding: 16px 16px 18px;
    border-radius: 18px;
  }
  #stages .st-name {
    font-size: 22px;
  }
  #stages .st-range {
    font-size: 14px;
  }
}

/* ---------- tab row: no peach pill behind the tabs (inherits .tabs in pages.css) ---------- */
#stages .st-tabs {
  display: grid;
  background: none;
  padding: 0;
  border-radius: 0;
  margin-top: 0;
}

/* ---------- panels: image and copy alternate sides ---------- */
#stages .panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

#stages .panel[hidden] {
  display: none;
}

#stages .panel:not([hidden]) {
  animation: st-in .6s cubic-bezier(.2, .7, .2, 1) both;
}

#stages .panel > img {
  width: 100%;
  max-width: 440px !important;
  margin: 0 auto !important;
  justify-self: center;
  height: auto;
}

/* right-to-left panels: image sits on the right, copy on the left */
#stages .panel.st-rev > img {
  order: 2;
}

#stages .panel .copy {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes st-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1024px) {
  #stages .panel,
  #stages .panel.st-rev {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  #stages .panel.st-rev > img {
    order: 0;
  }
  #stages .panel > img {
    max-width: 380px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #stages .panel:not([hidden]) {
    animation: none;
  }
}
