/* =====================================================================
   Stories — the circular tray and the full-screen viewer
   ===================================================================== */

.stories-tray {
  /* The site nav is fixed, so the tray — the first thing in the document —
     has to clear it itself. When the tray is present, the page's own
     nav-clearing padding is removed below, so the gap never doubles. */
  padding: calc(var(--nav-h) + 16px) 0 6px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10,36,64,.55), transparent);
}
.stories-tray--mobile-only { display: none; }
@media (max-width: 900px) { .stories-tray--mobile-only { display: block; } }

.stories-tray__head {
  font: 650 .82rem/1 var(--font-body);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-dim); margin: 0 0 14px;
}

.stories-tray__rail {
  display: flex; gap: 16px; list-style: none; margin: 0; padding: 0 0 6px;
  overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.stories-tray__rail::-webkit-scrollbar { display: none; }
.stories-tray__rail > li { scroll-snap-align: start; flex: 0 0 auto; }

.story-dot {
  display: grid; justify-items: center; gap: 7px;
  background: none; border: 0; padding: 0; cursor: pointer;
  width: 82px;
}
.story-dot__ring {
  --ring-accent: var(--azure-bright);
  display: grid; place-items: center;
  width: 76px; height: 76px; border-radius: var(--r-full);
  /* Unseen rings carry the brand gradient; seen ones go quiet, the way the
     convention everybody already knows works. */
  background: conic-gradient(from 210deg, var(--blue-deep), var(--ring-accent) 45%, var(--gold) 72%, var(--blue-deep));
  transition: transform var(--t-mid) var(--ease-back);
}
.story-dot:hover .story-dot__ring { transform: scale(1.05); }
.story-dot:active .story-dot__ring { transform: scale(.97); }
.story-dot.is-seen .story-dot__ring { background: rgba(255,255,255,.18); }

.story-dot__inner {
  position: relative;
  width: 68px; height: 68px; border-radius: var(--r-full);
  padding: 3px; background: var(--navy-950);
  display: grid; place-items: center;
}
.story-dot__inner img {
  width: 100%; height: 100%; border-radius: var(--r-full); object-fit: cover;
  background: var(--navy-800);
}
.story-dot__badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 22px; height: 22px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--navy-950); border: 1px solid var(--border-strong); color: var(--azure-bright);
}
.story-dot__badge svg { width: 13px; height: 13px; }

.story-dot__label {
  font-size: var(--fs-micro); color: var(--text); max-width: 82px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.story-dot:focus-visible .story-dot__ring { outline: 2px solid var(--azure-bright); outline-offset: 3px; }

/* ---- Viewer ---------------------------------------------------------- */

.story-viewer {
  position: fixed; inset: 0; z-index: 200;
  background: #04070C;
  display: grid; place-items: center;
  touch-action: none;
}
.story-viewer[hidden] { display: none; }

.story-viewer__stage {
  position: relative;
  width: 100%; height: 100%;
  max-width: min(100vw, 56.25vh);          /* 9:16 */
  background: #05080D;
  overflow: hidden;
}
@media (min-width: 901px) {
  .story-viewer__stage { border-radius: var(--r-lg); height: min(100%, 94vh); box-shadow: var(--sh-3); }
}

.story-viewer__media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #05080D;
}
.story-viewer__media[hidden] { display: none; }

/* Progress bars, one segment per slide. */
.story-bars {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; gap: 4px; padding: 11px 12px 0;
}
.story-bars i { flex: 1; height: 3px; border-radius: 99px; background: rgba(255,255,255,.28); overflow: hidden; }
.story-bars i b { display: block; height: 100%; width: 0; background: #fff; border-radius: 99px; }
.story-bars i.is-done b { width: 100%; }

.story-head {
  position: absolute; top: 24px; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent);
  color: #fff;
}
.story-head img { width: 36px; height: 36px; border-radius: var(--r-full); object-fit: cover; }
.story-head__text { min-width: 0; }
.story-head b { display: block; font: 600 .92rem var(--font-display); letter-spacing: -.01em; }
.story-head small { font-size: var(--fs-micro); color: rgba(255,255,255,.66); }
.story-head__spacer { margin-left: auto; }
.story-head button {
  width: 38px; height: 38px; border-radius: var(--r-full);
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  color: #fff; display: grid; place-items: center; cursor: pointer;
}
.story-head button svg { width: 18px; height: 18px; }

/* Tap zones: back on the left third, forward on the rest, like everywhere else. */
.story-zone { position: absolute; top: 0; bottom: 0; z-index: 4; border: 0; background: none; cursor: pointer; }
.story-zone--prev { left: 0; width: 32%; }
.story-zone--next { right: 0; width: 68%; }

.story-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 50px 18px calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.82), transparent);
  color: #fff; pointer-events: none;
}
.story-caption p { margin: 0 0 12px; font-size: .95rem; line-height: 1.5; max-width: 34ch; }
.story-caption a {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 20px; border-radius: var(--r-full);
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.26);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #fff; font-size: var(--fs-sm); font-weight: 600;
}
.story-caption a:hover { background: rgba(255,255,255,.28); color: #fff; }

.story-viewer__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 7;
  width: 42px; height: 42px; border-radius: var(--r-full);
  display: none; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); color: #fff;
}
@media (min-width: 901px) {
  .story-viewer__nav { display: grid; }
  .story-viewer__nav--prev { left: max(16px, calc(50% - 56.25vh / 2 - 60px)); }
  .story-viewer__nav--next { right: max(16px, calc(50% - 56.25vh / 2 - 60px)); }
}

.story-viewer.is-paused .story-bars i b { animation-play-state: paused; }

.story-loading {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
  color: rgba(255,255,255,.6); font-size: var(--fs-sm);
}

@media (prefers-reduced-motion: reduce) {
  .story-dot__ring, .story-viewer__stage { transition: none; }
}


/* With a tray on the page, the first section no longer has to clear the nav.
   `has-story-tray-mobile` is set when the tray is hidden on desktop, so the
   offset is only removed at the widths where the tray is actually there. */
body.has-story-tray .hero__inner      { padding-top: 34px; }
body.has-story-tray .page-hero__inner { padding-top: clamp(28px, 4vw, 54px); }
body.has-story-tray .list-hero        { padding-top: clamp(26px, 4vw, 44px); }
body.has-story-tray .error-page       { padding-top: 34px; }

@media (max-width: 900px) {
  body.has-story-tray-mobile .hero__inner      { padding-top: 34px; }
  body.has-story-tray-mobile .page-hero__inner { padding-top: clamp(28px, 4vw, 54px); }
  body.has-story-tray-mobile .list-hero        { padding-top: clamp(26px, 4vw, 44px); }
  body.has-story-tray-mobile .error-page       { padding-top: 34px; }

  /* The hero is full-height by design; with a tray above it, trim it so the
     tray and the headline share the first screen. */
  body.has-story-tray .hero, body.has-story-tray-mobile .hero { min-height: calc(100svh - 150px); }
}
