/* ==========================================================================
 * highlights3.css — PRESET 2's highlight + story-player styling.
 * ==========================================================================
 * A scoped copy of the highlight CSS that lives in site.css. Every rule here
 * is prefixed with `html.preset3`, so it applies ONLY when preset 2 is active
 * (AZ_MODE === 2) and overrides the unscoped originals by specificity. Preset
 * 1's rules in site.css are never touched — edit this file freely to reshape
 * preset 2's highlights. The class names match stories3.js (a copy of
 * stories.js), so no markup changes are needed.
 * ========================================================================== */

/* Highlight row */
html.preset3 #highlights {
  display: flex;
  gap: 1.6rem;
  padding: 2.75rem 1.5rem;
  max-width: 100vw;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

html.preset3 #highlights::-webkit-scrollbar {
  display: none;
}

/* ---------- highlight items ---------- */

html.preset3 .hl-item {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  font: inherit;
}

/* position:relative is REQUIRED — the aura canvas centers itself inside. */
html.preset3 .hl-circle {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: visible;
}

html.preset3 .hl-cover {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* Fallback dot when a highlight has no cover image (stories3.js sets color inline). */
html.preset3 .hl-glyph {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  background: currentColor;
  box-shadow: 0 0 10px currentColor, 0 0 24px currentColor;
}

html.preset3 .hl-label {
  font: 500 12px/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #b9b9c4;
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

/* ---------- story player overlay (z:100) ---------- */

html.preset3 .story-player {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  /* No safe-area padding here (unlike preset1's site.css version) — it made
     the media sit lower in the standalone webapp than in Safari browsing,
     because iOS reports a real env(safe-area-inset-top) only in the webapp
     (Safari's own chrome already covers that zone, so it reports ~0 there).
     .sp-media is full-bleed instead; the progress bar and buttons already
     carry their own safe-area offset (see below), so they stay clear of the
     notch in both contexts without pushing the video down. */
}

html.preset3 .sp-progress {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 5;
}

html.preset3 .sp-bar {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
}

html.preset3 .sp-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: #f2f2f5;
}

html.preset3 .sp-close,
html.preset3 .sp-sound {
  position: absolute;
  z-index: 6;
  top: calc(24px + env(safe-area-inset-top));
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

html.preset3 .sp-close {
  right: 10px;
  font-size: 26px;
}

html.preset3 .sp-sound {
  right: 54px;
  font-size: 18px;
}

/* the display:grid above would defeat the hidden attribute's UA rule */
html.preset3 .sp-sound[hidden] {
  display: none;
}

html.preset3 .sp-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

html.preset3 .sp-media img,
html.preset3 .sp-media video {
  /* FILL the frame, not letterbox. width/height 100% + object-fit:cover makes
     the media cover the whole viewport; a portrait video on a portrait phone
     of the same aspect (e.g. the 1170x2532 story on a ~1:2.16 screen) fills it
     exactly with no bars and no visible crop. Wider/narrower frames crop the
     overflow rather than showing black bars. */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* STANDALONE WEBAPP ONLY, story-player media ONLY (scoped tightly to .sp-media;
   the emblem, mist, and Safari-tab browsing are all untouched). The webapp is
   truly fullscreen while Safari-with-toolbar shows a shorter viewport, so the
   webapp reveals more of the video's own (dark) top before the subject — a
   visible gap under the sound/close buttons that Safari doesn't have.
   object-position could NOT fix this: the video nearly matches the fullscreen
   aspect, so cover leaves ~no crop margin to reposition. transform physically
   moves it regardless. translateY(-...) lifts the subject up; the scale(>1)
   gives headroom so the bottom still fills after the lift (no black gap) and
   also mimics Safari's slightly-more-zoomed crop. Detected via html.standalone
   (JS, robust across iOS versions), not the display-mode media query alone.
   Tunable — nudge translateY/scale from the on-device look. */
html.preset3.standalone .sp-media img,
html.preset3.standalone .sp-media video {
  transform: translateY(-4%) scale(1.08);
}

/* MOBILE LANDSCAPE ONLY. Render the portrait video at the SAME scale it has in
   portrait (plus the 8% zoom), letting it overflow the short landscape viewport
   rather than shrinking to fit. In portrait the video is sized to the screen's
   SHORT edge (its width); in landscape the short edge is the HEIGHT, so
   width:100vh reproduces that exact size. height:auto keeps the aspect, so the
   video overflows top/bottom (clipped by the screen) with black bars at the
   sides; scale(1.08) is the same 8% zoom as the standalone portrait view. The
   standalone rule's translateY lift is portrait-only, so it's replaced by a
   plain scale here. Scoped to phone landscape (orientation, short height, touch)
   so portrait / tablet / desktop are untouched. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  html.preset3 .sp-media img,
  html.preset3 .sp-media video {
    width: 100vh;
    height: auto;
    transform: translateY(-6%) scale(1.08);
  }
  html.preset3.standalone .sp-media img,
  html.preset3.standalone .sp-media video {
    transform: translateY(-6%) scale(1.08);
  }
}

/* DESKTOP ONLY (pointer:fine = mouse-driven; phones/tablets are coarse, so
   they're excluded and keep their own rules above). On a wide desktop viewport
   object-fit:cover would blow the portrait video up to cover the width. Instead
   fit it to the FULL viewport height, centered (black bars at the sides), with
   the same 8% zoom as portrait — so it reads at full size, top/bottom trimmed
   only by that zoom. Portrait phone / landscape phone / tablet untouched. */
@media (pointer: fine) {
  html.preset3 .sp-media img,
  html.preset3 .sp-media video {
    width: auto;
    height: 100vh;
    object-fit: contain;
    transform: translateY(-13%) scale(2.67);
  }
}

/* Tap zones for prev/next navigation. */
html.preset3 .sp-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 33%;
  z-index: 4;
}

html.preset3 .sp-zone-left {
  left: 0;
}

html.preset3 .sp-zone-right {
  right: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  html.preset3 #highlights {
    gap: 1.1rem;
  }

  html.preset3 .hl-circle {
    width: 66px;
    height: 66px;
  }
}
