/* ==========================================================================
   ANNOUNCEMENT STORIES  (.story*)
   --------------------------------------------------------------------------
   Loaded by the home page and by an institution profile, which is why it is
   its own sheet rather than a section of index.css: the profile has no use
   for the rest of that file, and the home page has no use for bagca.css.
   ========================================================================== */

.story-row {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 2px 2px 12px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
/* The bar is replaced by the dots below the rail, so it is suppressed rather
   than styled — two scroll indicators under one row is one too many. */
.story-row { scrollbar-width: none; }
.story-row::-webkit-scrollbar { display: none; }

.story-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}
.story-dots[hidden] { display: none; }
.story-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line-5);
  cursor: pointer;
  transition: background-color .18s var(--ease), transform .18s var(--ease);
}
.story-dot:hover { background: var(--muted-3); }
.story-dot.is-on { background: var(--ink); transform: scale(1.28); }
.story-dot:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.story-cell { flex: none; scroll-snap-align: start; }

/* A story cover, not an avatar: the picture is the ground and the announcement
   is printed on it. The coloured border keeps the ring's job — telling a
   school's story from a nursery's — now that the circle is gone. */
/* 212 × 18 gap × 5 tiles = 1132 in a 1136 container: the row fills the width
   and stops, so the dots below only appear once the viewport is narrower. */
.story {
  position: relative;
  display: block;
  width: 212px;
  aspect-ratio: 9 / 16;
  border: 2.5px solid var(--brand);
  border-radius: var(--r-md);
  background: var(--ink);
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.story--kg { border-color: var(--kg); }
.story:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 36px -22px rgba(15, 20, 32, .55);
}
.story:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.story-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story-mono {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-size: 34px;
  font-weight: 700;
  color: rgba(255, 255, 255, .5);
}
/* One wash now, from the foot up: the top stop existed to hold the type chip
   off a bright sky, and the chip is gone. A light building photograph still
   swallows white type at the bottom, so that half stays. */
.story-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(9, 12, 20, .93) 0%, rgba(9, 12, 20, .58) 34%, rgba(9, 12, 20, 0) 66%);
}

.story-text {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.story-who {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  font-family: var(--font-head);
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.014em;
  color: #fff;
}

/* The kicker is the whole header here, so it does not need a title's air —
   and style.css:961 gives it a 10px bottom margin meant for sitting ABOVE a
   title, which inside this flex row lifted it 5px off the link's centre. */
.sec-head--rail { margin-bottom: 16px; }
.sec-head--rail .kicker { margin-bottom: 0; }

@media (max-width: 560px) {
  .story-row { gap: 12px; }
  .story { width: 150px; }
  /* The tile loses 12px of width on a phone but keeps its height, so the
     headline gets a line back rather than one taken away — three clipped
     five of the nine titles mid-word. */
  .story-line { font-size: 13.5px; -webkit-line-clamp: 5; }
}

/* --- the viewer ----------------------------------------------------------
   A 9:16 panel over a blackout, one announcement per slide. The rail above
   only names the poster; this is where the announcement is actually read.
   Server-rendered and `hidden`, so with JS off it never appears at all.
   ------------------------------------------------------------------------ */

.story-view {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px;
  background: rgba(9, 12, 20, .88);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
}
.story-view[hidden] { display: none; }

.story-stage {
  position: relative;
  flex: none;
  width: min(420px, 100%);
  height: min(84vh, 780px);
  max-height: 100%;
  aspect-ratio: 9 / 16;
}

.story-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 18px 18px;
  border-radius: var(--r-xl);
  background: linear-gradient(168deg, #0F1420 0%, #1D2438 52%, #2B3654 100%);
  color: #fff;
  overflow: hidden;
}
.story-slide[hidden] { display: none; }
.story-slide--kg {
  background: linear-gradient(168deg, #17143A 0%, #2B2670 52%, #443CA0 100%);
}

/* progress */
.story-bars { display: flex; gap: 4px; }
.story-bar {
  flex: 1;
  height: 3px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .28);
  overflow: hidden;
}
.story-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
}
.story-bar.is-done i { width: 100%; }
.story-bar.is-live i { width: 100%; transition: width var(--story-dur, 7s) linear; }

/* who posted */
.story-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0 0;
}
.story-head-av {
  flex: none;
  display: block;
  width: 34px;
  height: 34px;
  border: 1.5px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}
.story-head-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-head-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.story-head-name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-head-when { font-size: 11px; line-height: 1; color: rgba(255, 255, 255, .62); }
.story-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
}
.story-close:hover { background: rgba(255, 255, 255, .24); }

/* the announcement */
.story-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 20px;
}
.story-chip {
  align-self: flex-start;
  padding: 6px 11px;
  border-radius: var(--r-xs);
  background: var(--brand);
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}
.story-slide--kg .story-chip { background: var(--kg); color: var(--kg-ink); }
.story-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(22px, 5.2vw, 27px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.026em;
  text-wrap: balance;
}
.story-pic {
  flex: 1;
  min-height: 0;
  display: block;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.story-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-where {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, .72);
}

.story-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--r-ctl);
  background: #fff;
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.014em;
  color: var(--ink);
}
.story-cta:hover { background: var(--brand); }

/* prev / next */
.story-nav {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.story-nav:hover { background: rgba(255, 255, 255, .26); }
.story-nav[disabled] { opacity: .3; cursor: default; }
.story-nav:focus-visible,
.story-close:focus-visible,
.story-cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (max-width: 620px) {
  .story-view { gap: 0; padding: 0; }
  .story-stage { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
  .story-slide { border-radius: 0; padding: 14px 16px 22px; }
  /* On a phone the panel is the whole screen, so the chevrons move inside it
     and sit against the edges rather than beside a floating card. */
  .story-nav {
    position: fixed;
    top: 50%;
    z-index: 1;
    width: 38px;
    height: 38px;
    transform: translateY(-50%);
  }
  .story-nav--prev { left: 8px; }
  .story-nav--next { right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .story-bar.is-live i { transition: none; }
}
