/**
 * ub/hero-slider - photo and video hero with the labelled tab rail.
 *
 * Desktop: each slide fills the stage; the copy sits where the editor put it,
 * over a scrim that grows from the copy's side (or from the bottom, or an even
 * wash). With the scrim off, the copy sits on a solid ink panel instead, so
 * white text never relies on the photograph for contrast.
 *
 * Phone: the photograph or video sits on top and the copy below it on ink, the
 * way the homepage hero stacks, so contrast never depends on the image there.
 *
 * Motion uses the brand curve, is under 0.7s, and is off under
 * prefers-reduced-motion. With scripting off, every slide is shown in turn.
 */
.ub-hs {
  --ub-hs-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --ub-hs-ink: 27, 16, 35;           /* --ink #1B1023 as an rgb triplet */
  --ub-hs-sky: #7FD9F5;
  /* Tall fills the screen below the header, up to 940px on a large monitor. */
  --ub-hs-h: clamp(560px, calc(100svh - var(--header-height, 132px)), 940px);
  /* Room at the foot for a band that overlaps the hero (see the door band rule
     at the end); the tab rail sits above it, so nothing covers the switcher. */
  --ub-hs-tuck: 0px;
  --ub-hs-box: calc(var(--ub-hs-h) + var(--ub-hs-tuck));
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--ink, #1B1023);
  color: var(--white, #fff);
}
.ub-hs--standard { --ub-hs-h: clamp(460px, 64svh, 660px); }
.ub-hs--full { --ub-hs-h: max(560px, calc(100svh - var(--header-height, 132px))); }

/* ---------- Stage and slides ---------- */
.ub-hs-stage {
  position: relative;
  display: grid;
  min-height: var(--ub-hs-box);
}
.ub-hs-slide {
  grid-area: 1 / 1;
  position: relative;
  display: grid;
  min-height: var(--ub-hs-box);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ub-hs-ease), visibility 0s linear 0.7s;
}
.ub-hs-slide.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s var(--ub-hs-ease), visibility 0s;
}

/* ---------- Media ---------- */
.ub-hs-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--ink, #1B1023);
}
.ub-hs-picture,
.ub-hs-picture img,
.ub-hs-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  object-position: var(--ub-hs-focus, 50% 50%);
}
.ub-hs-video { opacity: 0; transition: opacity 0.6s var(--ub-hs-ease); }
.ub-hs-video.is-playing { opacity: 1; }
/* A slow settle on the active photograph: scale only, no travel. */
.ub-hs-slide.is-active .ub-hs-picture img {
  animation: ub-hs-settle 9s var(--ub-hs-ease) both;
}
@keyframes ub-hs-settle {
  from { transform: scale(1.045); }
  to   { transform: scale(1); }
}

/* ---------- Scrims ---------- */
.ub-hs-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  --a1: 0.76;
  --a2: 0.45;
  --af: 0.55;
}
.ub-hs-slide--grad-soft   .ub-hs-scrim { --a1: 0.64; --a2: 0.34; --af: 0.44; }
.ub-hs-slide--grad-strong .ub-hs-scrim { --a1: 0.88; --a2: 0.6;  --af: 0.68; }

/* From the copy's side. The first stop holds full strength across the copy
   column so its contrast does not depend on what the photograph does there. */
.ub-hs-slide--grad-side.ub-hs-slide--left .ub-hs-scrim {
  background: linear-gradient(90deg,
    rgba(var(--ub-hs-ink), var(--a1)) 0%,
    rgba(var(--ub-hs-ink), var(--a1)) 34%,
    rgba(var(--ub-hs-ink), var(--a2)) 58%,
    rgba(var(--ub-hs-ink), 0) 86%);
}
.ub-hs-slide--grad-side.ub-hs-slide--right .ub-hs-scrim {
  background: linear-gradient(270deg,
    rgba(var(--ub-hs-ink), var(--a1)) 0%,
    rgba(var(--ub-hs-ink), var(--a1)) 34%,
    rgba(var(--ub-hs-ink), var(--a2)) 58%,
    rgba(var(--ub-hs-ink), 0) 86%);
}
.ub-hs-slide--grad-side.ub-hs-slide--center .ub-hs-scrim {
  background: radial-gradient(ellipse 62% 70% at 50% 55%,
    rgba(var(--ub-hs-ink), var(--a1)) 0%,
    rgba(var(--ub-hs-ink), var(--a2)) 62%,
    rgba(var(--ub-hs-ink), 0.18) 100%);
}
.ub-hs-slide--grad-bottom .ub-hs-scrim {
  background: linear-gradient(0deg,
    rgba(var(--ub-hs-ink), var(--a1)) 0%,
    rgba(var(--ub-hs-ink), var(--a1)) 24%,
    rgba(var(--ub-hs-ink), var(--a2)) 52%,
    rgba(var(--ub-hs-ink), 0) 82%);
}
.ub-hs-slide--grad-full .ub-hs-scrim { background: rgba(var(--ub-hs-ink), var(--af)); }

/* ---------- Copy ---------- */
/* `.ub-hs .ub-hs-body`, not `.ub-hs-body`: the theme's `.container` shorthand
   (padding: 0 var(--gutter)) loads after block CSS and would zero the top. */
.ub-hs .ub-hs-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  min-height: var(--ub-hs-box);
  padding-top: 72px;
  padding-bottom: 72px;
}
.ub-hs--multi .ub-hs-body,
.ub-hs:has(.ub-hs-bar) .ub-hs-body { padding-bottom: calc(156px + var(--ub-hs-tuck)); }
.ub-hs-slide--v-center .ub-hs-body { justify-content: center; }
.ub-hs-slide--v-top .ub-hs-body    { justify-content: flex-start; }
.ub-hs-slide--center .ub-hs-body   { align-items: center; }
.ub-hs-slide--right .ub-hs-body    { align-items: flex-end; }

.ub-hs-copy {
  max-width: 640px;
  padding-left: 30px;
  border-left: 3px solid var(--ub-blue, #00A7E0);
}
.ub-hs-slide--center .ub-hs-copy {
  max-width: 760px;
  padding-left: 0;
  border-left: 0;
  text-align: center;
}
/* Scrim off: a solid panel carries the copy. */
.ub-hs-slide--panel .ub-hs-copy {
  padding: 40px 44px 44px;
  background: rgba(var(--ub-hs-ink), 0.92);
  box-shadow: var(--shadow-lg, 0 18px 50px rgba(0, 0, 0, 0.28));
}
.ub-hs-slide--panel.ub-hs-slide--left .ub-hs-copy,
.ub-hs-slide--panel.ub-hs-slide--right .ub-hs-copy { padding-left: 40px; }

.ub-hs-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  color: var(--ub-hs-sky);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
}
.ub-hs-slide--center .ub-hs-eyebrow { justify-content: center; }
.ub-hs-slide--center .ub-hs-eyebrow::before,
.ub-hs-slide--center .ub-hs-eyebrow::after {
  content: '';
  width: 44px;
  height: 2px;
  background: var(--ub-blue, #00A7E0);
}
.ub-hs-title {
  margin: 0;
  color: var(--white, #fff);
  font-size: clamp(2.5rem, min(5vw, 7.4vh), 4.6rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.034em;
  text-wrap: balance;
}
.ub-hs-accent {
  display: block;
  color: var(--ub-hs-sky);
}
.ub-hs-text {
  max-width: 54ch;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.18rem;
  line-height: 1.6;
}
.ub-hs-slide--center .ub-hs-text { margin-inline: auto; }
.ub-hs-text a { color: var(--ub-hs-sky); text-underline-offset: 3px; }
.ub-hs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}
.ub-hs-slide--center .ub-hs-actions { justify-content: center; }

/* Copy arrives with the slide: a short rise, inside the brand's 16px. */
.ub-hs-slide.is-active .ub-hs-copy > * {
  animation: ub-hs-rise 0.7s var(--ub-hs-ease) both;
}
.ub-hs-slide.is-active .ub-hs-copy > :nth-child(2) { animation-delay: 0.06s; }
.ub-hs-slide.is-active .ub-hs-copy > :nth-child(3) { animation-delay: 0.12s; }
.ub-hs-slide.is-active .ub-hs-copy > :nth-child(4) { animation-delay: 0.18s; }
@keyframes ub-hs-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Tab rail ---------- */
.ub-hs-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  padding: 64px 0 calc(30px + var(--ub-hs-tuck));
  background: linear-gradient(to top, rgba(var(--ub-hs-ink), 0.88) 0%, rgba(var(--ub-hs-ink), 0.55) 55%, rgba(var(--ub-hs-ink), 0) 100%);
  pointer-events: none;
}
.ub-hs-bar-inner {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  pointer-events: auto;
}
.ub-hs-tabs {
  display: grid;
  flex: 1 1 auto;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 22px;
  max-width: 820px;
}
.ub-hs-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 16px 0 2px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ub-hs-tab::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.28);
}
.ub-hs-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--ub-blue, #00A7E0);
}
.ub-hs-tab.is-active .ub-hs-progress { width: 100%; }
.ub-hs.is-rotating .ub-hs-tab.is-active .ub-hs-progress {
  width: 0;
  animation: ub-hs-progress var(--ub-hs-interval, 8s) linear forwards;
}
.ub-hs.is-held .ub-hs-tab.is-active .ub-hs-progress { animation-play-state: paused; }
@keyframes ub-hs-progress { to { width: 100%; } }

.ub-hs-num {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.ub-hs-tab-label {
  /* Up to two lines, so six tabs keep whole labels ("Our Seaside Campus"). */
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.ub-hs-tab:hover .ub-hs-tab-label,
.ub-hs-tab.is-active .ub-hs-tab-label { color: var(--white, #fff); }
.ub-hs-tab.is-active .ub-hs-num { color: var(--ub-hs-sky); }
.ub-hs-tab:focus-visible {
  outline: 2px solid var(--ub-hs-sky);
  outline-offset: 4px;
}
.ub-hs-current { display: none; }

.ub-hs-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 0;
  background: rgba(var(--ub-hs-ink), 0.35);
  color: var(--white, #fff);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s var(--ub-hs-ease), border-color 0.2s var(--ub-hs-ease);
}
.ub-hs-toggle:hover { border-color: var(--white, #fff); background: rgba(var(--ub-hs-ink), 0.7); }
.ub-hs-toggle:focus-visible { outline: 2px solid var(--ub-hs-sky); outline-offset: 3px; }
.ub-hs-toggle[hidden] { display: none; }
.ub-hs-icon--play { display: none; }
.ub-hs-toggle.is-paused .ub-hs-icon--play { display: block; }
.ub-hs-toggle.is-paused .ub-hs-icon--pause { display: none; }

/* ---------- A door band directly below ----------
   The door band rides 70px up over whatever hero precedes it (desktop only;
   below 1100px it sits flat). The hero grows by that much and keeps the strip
   clear, so the band covers photo, never the tabs or the Pause button. */
@media (min-width: 1101px) {
  .ub-hs:has(+ .doors:not(.doors--flat)) { --ub-hs-tuck: var(--doors-overlap, 70px); }
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .ub-hs-copy { max-width: 560px; }
  .ub-hs-tabs { gap: 16px; }
}

/* ---------- Phone: media on top, copy below on ink ---------- */
@media (max-width: 768px) {
  .ub-hs,
  .ub-hs--standard,
  .ub-hs--full { --ub-hs-h: auto; }
  .ub-hs-stage { display: block; min-height: 0; }
  .ub-hs-slide { display: none; min-height: 0; opacity: 1; visibility: visible; transition: none; }
  .ub-hs-slide.is-active { display: block; animation: ub-hs-fade 0.45s var(--ub-hs-ease) both; }
  @keyframes ub-hs-fade { from { opacity: 0; } to { opacity: 1; } }

  .ub-hs-media {
    position: relative;
    aspect-ratio: 4 / 3;
  }
  /* The photograph runs into the ink below it. */
  .ub-hs-media::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 34%;
    background: linear-gradient(to top, var(--ink, #1B1023), rgba(var(--ub-hs-ink), 0));
  }
  .ub-hs-scrim { display: none; }
  .ub-hs .ub-hs-body,
  .ub-hs--multi .ub-hs-body,
  .ub-hs:has(.ub-hs-bar) .ub-hs-body {
    min-height: 0;
    padding-top: 6px;
    padding-bottom: 30px;
    align-items: stretch;
  }
  .ub-hs-copy,
  .ub-hs-slide--center .ub-hs-copy,
  .ub-hs-slide--panel .ub-hs-copy {
    max-width: none;
    padding: 0 0 0 20px;
    border-left: 3px solid var(--ub-blue, #00A7E0);
    background: none;
    box-shadow: none;
    text-align: left;
  }
  .ub-hs-slide--center .ub-hs-eyebrow { justify-content: flex-start; }
  .ub-hs-slide--center .ub-hs-eyebrow::before,
  .ub-hs-slide--center .ub-hs-eyebrow::after { content: none; }
  .ub-hs-title { font-size: clamp(2.1rem, 9.4vw, 2.8rem); }
  .ub-hs-text { font-size: 1.06rem; margin-top: 16px; }
  .ub-hs-actions,
  .ub-hs-slide--center .ub-hs-actions { flex-direction: column; justify-content: flex-start; margin-top: 26px; }
  .ub-hs-actions .btn { width: 100%; text-align: center; }

  .ub-hs-bar {
    position: static;
    padding: 0 0 28px;
    background: none;
  }
  .ub-hs-bar-inner { flex-wrap: wrap; align-items: center; gap: 10px; }
  .ub-hs-tabs {
    flex: 0 1 auto;
    grid-auto-columns: 44px;
    gap: 8px;
  }
  .ub-hs-tab {
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.34);
  }
  .ub-hs-tab::before,
  .ub-hs-progress { display: none; }
  .ub-hs-tab .ub-hs-num { color: rgba(255, 255, 255, 0.85); letter-spacing: 0.06em; }
  .ub-hs-tab.is-active { border-color: var(--ub-blue, #00A7E0); background: var(--ub-blue, #00A7E0); }
  .ub-hs-tab.is-active .ub-hs-num { color: var(--ink, #1B1023); }
  /* The label is still the tab's accessible name; the current one is shown below. */
  .ub-hs-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ub-hs-current {
    display: block;
    flex: 1 0 100%;
    order: 3;
    margin: 4px 0 0;
    color: var(--white, #fff);
    font-size: 0.86rem;
    font-weight: 700;
  }
  .ub-hs-toggle { margin-left: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ub-hs-slide,
  .ub-hs-slide.is-active,
  .ub-hs-video { transition: none; }
  .ub-hs-slide.is-active .ub-hs-picture img,
  .ub-hs-slide.is-active .ub-hs-copy > *,
  .ub-hs-slide.is-active { animation: none; }
  .ub-hs.is-rotating .ub-hs-tab.is-active .ub-hs-progress { animation: none; width: 100%; }
}

/* ---------- Scripting off: every slide, one after another ---------- */
@media (scripting: none) {
  .ub-hs-stage { display: block; }
  .ub-hs-slide { opacity: 1; visibility: visible; }
  .ub-hs-slide + .ub-hs-slide { border-top: 1px solid rgba(255, 255, 255, 0.12); }
  .ub-hs-bar { display: none; }
  .ub-hs--multi .ub-hs-body { padding-bottom: 72px; }
}
@media (scripting: none) and (max-width: 768px) {
  .ub-hs-slide { display: block; }
  .ub-hs--multi .ub-hs-body { padding-bottom: 30px; }
}
