/* ==========================================================================
   Media: cover triptych, program gallery buttons, 3D helix gallery, lightbox,
   and the public media page. Builds on tokens in style.css.
   ========================================================================== */

/* ── Cover: Feed · Educate · Play triptych (behind the 3D ball) ─────────── */
.hero-tri {
  position: absolute; z-index: 0; top: 0; bottom: 0; right: -6vw; width: 66%;
  display: flex; gap: 12px; transform: skewX(-9deg); transform-origin: 100% 100%;
  pointer-events: auto;
}
.hero-tri__panel {
  position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; background: var(--ink-3);
  transition: flex-grow 1000ms var(--ease-out), clip-path 1200ms var(--ease-out);
  transition-delay: 0ms, calc(var(--i, 0) * 160ms + 150ms);
}
/* Panels wipe up after the kick-off curtain (only when JS runs, so they're never stuck hidden). */
.js .hero-tri__panel { clip-path: inset(100% 0 0 0); }
.js .hero.is-in .hero-tri__panel, .motion-failed .hero-tri__panel { clip-path: inset(0 0 0 0); }
.hero-tri__panel.is-active { flex-grow: 1.9; }
.hero-tri__panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; z-index: 2; background: var(--tone); }
.hero-tri__panel::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to top, var(--tone-wash) 0%, transparent 46%),
    linear-gradient(to bottom, rgba(10, 19, 15, 0.55), transparent 28%);
  transition: opacity 600ms var(--ease);
}
.hero-tri__panel--heart { --tone: var(--heart-500); --tone-wash: rgba(150, 25, 18, 0.82); }
.hero-tri__panel--gold  { --tone: var(--gold);      --tone-wash: rgba(130, 84, 0, 0.82); }
.hero-tri__panel--brand { --tone: var(--brand-400); --tone-wash: rgba(10, 90, 45, 0.85); }
.hero-tri__imgs { position: absolute; inset: 0 -32%; transform: skewX(9deg); }
.hero-tri__imgs img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.14); transition: opacity 1400ms var(--ease);
}
.hero-tri__imgs img.is-on { opacity: 1; animation: tri-kenburns 16s ease-in-out infinite alternate; }
@keyframes tri-kenburns { from { transform: scale(1.14) translate3d(0, 0, 0); } to { transform: scale(1.24) translate3d(-2%, -2%, 0); } }
.hero-tri__label {
  position: absolute; z-index: 2; left: 18%; right: 8%; bottom: 36px; display: grid; gap: 2px;
  transform: skewX(9deg); color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.hero-tri__label b { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.25rem, 0.8rem + 1.2vw, 2rem); letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.hero-tri__label b::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18); }
.hero-tri__label small { font-size: 13px; opacity: 0; transform: translateY(6px); transition: opacity 500ms var(--ease), transform 600ms var(--ease-out); max-width: 26ch; }
.hero-tri__panel.is-active .hero-tri__label small { opacity: 0.92; transform: none; }
.hero__shade {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(90deg, var(--ink) 0%, var(--ink) 30%, rgba(10, 19, 15, 0.82) 40%, rgba(10, 19, 15, 0.18) 64%, rgba(10, 19, 15, 0) 80%),
    linear-gradient(to top, rgba(10, 19, 15, 0.75), transparent 28%);
}
.hero.has-tri .hero__grid { opacity: 0.18; }

@media (max-width: 899px) {
  .hero-tri { top: 0; bottom: auto; left: -10%; right: -10%; width: auto; height: calc(var(--header-h) + min(64vw, 300px) + 140px); gap: 6px; transform: skewX(-7deg); }
  .hero-tri__imgs { inset: 0 -22%; transform: skewX(7deg); }
  .hero-tri__label { left: 16%; bottom: 120px; transform: skewX(7deg); }
  .hero-tri__label b { font-size: 15px; gap: 6px; }
  .hero-tri__label b::before { width: 7px; height: 7px; box-shadow: none; }
  .hero-tri__label small { display: none; }
  .hero-tri__panel.is-active { flex-grow: 1.5; }
  .hero__shade { background: linear-gradient(to bottom, rgba(10, 19, 15, 0.35) 0%, rgba(10, 19, 15, 0.1) 22%, rgba(10, 19, 15, 0.55) 44%, var(--ink) 62%); }
}
@media (max-width: 599px) {
  .hero-tri { height: calc(var(--header-h) + min(52vw, 220px) + 130px); }
  .hero-tri__label { bottom: 104px; }
}

/* ── Program cards → 3D gallery ─────────────────────────────────────────── */
button.program__media {
  display: block; width: 100%; height: 100%; padding: 0; border: 0; margin: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: zoom-in;
}
.program__open {
  position: absolute; z-index: 1; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill); background: rgba(10, 19, 15, 0.72); backdrop-filter: blur(8px);
  border: 1px solid var(--ink-line); font-size: 12px; font-weight: 700; color: #fff;
  transform: translateY(4px); opacity: 0.92; transition: transform var(--t) var(--ease-out), background-color var(--t), opacity var(--t);
}
.program__open svg { width: 14px; height: 14px; }
.program:hover .program__open, button.program__media:focus-visible .program__open { transform: none; opacity: 1; background: var(--brand-600); }
.program__cta {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 10px 0; border: 0; background: none;
  color: var(--brand-300); font: 700 14px/1 var(--font-body); cursor: pointer; justify-self: start;
}
.program__cta svg { width: 18px; height: 18px; transition: transform var(--t) var(--ease-out); }
.program__cta:hover svg { transform: translateX(4px); }

/* ── 3D helix gallery ───────────────────────────────────────────────────── */
html.g3d-open, html.g3d-open body, html.lbx-open, html.lbx-open body { overflow: hidden; }
.g3d {
  position: fixed; inset: 0; z-index: 240; display: grid; grid-template-rows: auto 1fr auto; color: #fff;
  opacity: 0; transition: opacity 400ms var(--ease);
}
.g3d.is-open { opacity: 1; }
.g3d.is-closing { opacity: 0; pointer-events: none; }
.g3d__bg { position: absolute; inset: 0; z-index: -1; background: radial-gradient(1100px 700px at 50% 62%, color-mix(in srgb, var(--accent) 32%, #0a130f), #05090a 72%); }
.g3d__bg::after {
  content: ""; position: absolute; inset: auto 0 0; height: 45%; opacity: 0.35;
  background-image: linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 56px 56px; transform: perspective(500px) rotateX(62deg); transform-origin: bottom;
  mask-image: linear-gradient(to top, #000, transparent 90%); -webkit-mask-image: linear-gradient(to top, #000, transparent 90%);
}
.g3d__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px var(--gutter) 0; }
.g3d__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.g3d__title h2 { font-size: clamp(1.5rem, 1rem + 2vw, 2.5rem); margin-top: 4px; }
.g3d__title p { color: var(--ink-muted); font-size: 14px; margin-top: 4px; }
.g3d__actions { display: flex; gap: 8px; flex: none; }
.g3d__btn, .lbx__btn, .lbx__nav {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08); color: #fff; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background-color var(--t), transform var(--t) var(--ease-out), border-color var(--t);
  text-decoration: none;
}
.g3d__btn:hover, .lbx__btn:hover, .lbx__nav:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.4); }
.g3d__btn:active, .lbx__btn:active, .lbx__nav:active { transform: scale(0.94); }
.g3d__btn svg, .lbx__btn svg, .lbx__nav svg { width: 20px; height: 20px; }
.g3d__btn--text { width: auto; padding: 0 16px; display: inline-flex; gap: 8px; font-size: 13px; font-weight: 600; }
.g3d__btn--text svg { width: 16px; height: 16px; }

.g3d__scene { position: relative; overflow: hidden; cursor: grab; touch-action: none; outline: none; perspective-origin: 50% 46%; }
.g3d__scene.is-dragging { cursor: grabbing; }
.g3d__stage { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; will-change: transform; }
.g3d__card {
  position: absolute; left: calc(var(--card-w) / -2); top: calc(var(--card-h) / -2); width: var(--card-w); height: var(--card-h);
  padding: 0; border: 0; border-radius: 18px; overflow: hidden; background: #1a2a22; cursor: pointer;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.85);
  transition: box-shadow 300ms var(--ease);
}
.g3d__card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.g3d__card.is-front { box-shadow: 0 0 0 3px var(--accent), 0 40px 90px -24px rgba(0, 0, 0, 0.95); }
.g3d__card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.g3d__shine { position: absolute; inset: 0; background: linear-gradient(125deg, rgba(255, 255, 255, 0.2), transparent 38%); pointer-events: none; }
.g3d__play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(229, 55, 44, 0.92); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.g3d__play svg { width: 22px; height: 22px; margin-left: 3px; color: #fff; }
.g3d__loading { position: absolute; inset: 0; display: grid; place-items: center; }
.g3d__loading span { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.g3d__foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 0 var(--gutter) 24px; max-width: 900px; width: 100%; margin: 0 auto; }
.g3d__meta { display: grid; gap: 10px; text-align: center; min-width: 0; }
.g3d__cap { font-size: 15px; font-weight: 600; min-height: 1.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g3d__progress { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.g3d__progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 400ms var(--ease-out); }
.g3d__hint {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); padding: 8px 16px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.45); font-size: 12px; letter-spacing: 0.04em; color: #e6eee9; pointer-events: none; white-space: nowrap;
  transition: opacity 500ms var(--ease);
}
.g3d__hint.is-gone { opacity: 0; }
@media (max-width: 699px) {
  .g3d__head { padding-top: 14px; }
  .g3d__btn--text span { display: none; }
  .g3d__btn--text { width: 44px; padding: 0; }
  .g3d__card { border-radius: 14px; }
  .g3d__foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); gap: 10px; }
  .g3d__cap { font-size: 13px; }
  .g3d__hint { bottom: 80px; font-size: 11px; }
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */
.lbx { position: fixed; inset: 0; z-index: 260; display: grid; place-items: center; opacity: 0; transition: opacity 220ms var(--ease); }
.lbx.is-open { opacity: 1; }
.lbx.is-closing { opacity: 0; pointer-events: none; }
.lbx__bg { position: absolute; inset: 0; background: rgba(5, 9, 10, 0.95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.lbx__stage { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: 70px 84px 110px; touch-action: pan-y; }
.lbx__slide { margin: 0; display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.lbx__slide img, .lbx__slide video { display: block; width: auto; height: auto; max-width: min(1500px, 100%); max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); object-fit: contain; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); background: #000; }
.lbx__yt { position: relative; width: min(1100px, 88vw); aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.lbx__yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lbx__bar { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; color: #fff; }
.lbx__count { font-size: 13px; font-weight: 600; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.lbx__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.lbx__nav:active { transform: translateY(-50%) scale(0.94); }
.lbx__nav--prev { left: 18px; }
.lbx__nav--next { right: 18px; }
.lbx__cap { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); width: min(720px, 90vw); text-align: center; font-size: 15px; line-height: 1.45; color: #e6eee9; }
.lbx__cap b { display: block; margin-bottom: 4px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-300); }
@keyframes lbx-in-r { from { opacity: 0; transform: translateX(48px) scale(0.98); } }
@keyframes lbx-in-l { from { opacity: 0; transform: translateX(-48px) scale(0.98); } }
@media (max-width: 699px) {
  .lbx__stage { padding: 58px 8px 128px; }
  .lbx__slide img, .lbx__slide video { max-height: calc(100dvh - 200px); border-radius: 8px; }
  .lbx__nav { top: auto; bottom: 22px; transform: none; width: 48px; height: 48px; }
  .lbx__nav:active { transform: scale(0.94); }
  .lbx__nav--prev { left: 16px; }
  .lbx__nav--next { right: 16px; }
  .lbx__cap { bottom: 30px; width: calc(100vw - 150px); font-size: 13px; }
}

/* ── Public media page ──────────────────────────────────────────────────── */
.media-hero { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: calc(var(--header-h) + var(--s-64)) 0 var(--s-48); }
.media-hero__mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; opacity: 0.22; transform: rotate(-6deg) scale(1.25); pointer-events: none; }
.media-hero__mosaic img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; border-radius: 6px; }
.media-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--ink) 25%, rgba(10, 19, 15, 0.6)), linear-gradient(to top, var(--ink), transparent 40%); }
.media-hero .container { position: relative; z-index: 1; }
.media-hero h1 { font-size: var(--fs-64); max-width: 14ch; margin-top: var(--s-16); }
.media-hero p { color: var(--ink-muted); font-size: var(--fs-20); max-width: 52ch; margin-top: var(--s-16); }
.media-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s-24); }

.albums { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--gutter) 12px; margin: 0 calc(var(--gutter) * -1); scrollbar-width: none; }
.albums::-webkit-scrollbar { display: none; }
.album-chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px 6px 6px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; text-decoration: none;
  transition: border-color var(--t), background-color var(--t), transform var(--t) var(--ease-out);
}
.album-chip:hover { border-color: var(--text); transform: translateY(-1px); }
.album-chip img, .album-chip .album-chip__all { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--ink); }
.album-chip .album-chip__all { display: grid; place-items: center; color: var(--brand-300); }
.album-chip .album-chip__all svg { width: 16px; height: 16px; }
.album-chip small { color: var(--muted); font-weight: 600; }
.album-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.album-chip[aria-pressed="true"] small { color: var(--brand-300); }

.media-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: var(--s-24) 0 var(--s-16); }
.media-toolbar h2 { font-size: var(--fs-32); }
.media-toolbar p { color: var(--muted); font-size: 14px; }

.mwall { columns: 4 260px; column-gap: 12px; }
.mwall__item {
  break-inside: avoid; margin: 0 0 12px; position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  background: var(--paper-2); cursor: zoom-in; box-shadow: var(--sh-sm);
  opacity: 0; transform: translateY(16px); animation: wall-in 600ms var(--ease-out) forwards; animation-delay: calc(var(--d, 0) * 40ms);
}
@keyframes wall-in { to { opacity: 1; transform: none; } }
.mwall__item img { display: block; width: 100%; height: auto; transition: transform 700ms var(--ease-out); }
.mwall__item:hover img { transform: scale(1.04); }
.mwall__item:focus-visible { outline: 3px solid var(--brand-400); outline-offset: 3px; }
.mwall__cap { position: absolute; inset: auto 0 0; padding: 32px 14px 12px; background: linear-gradient(transparent, rgba(10, 19, 15, 0.82)); color: #fff; font-size: 13px; font-weight: 600; text-align: left; opacity: 0; transform: translateY(8px); transition: opacity var(--t), transform var(--t) var(--ease-out); }
.mwall__item:hover .mwall__cap, .mwall__item:focus-visible .mwall__cap { opacity: 1; transform: none; }
.mwall__play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(229, 55, 44, 0.92); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.mwall__play svg { width: 20px; height: 20px; margin-left: 3px; }
.mwall__dur { position: absolute; right: 10px; top: 10px; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(10, 19, 15, 0.75); color: #fff; font-size: 12px; font-weight: 600; }
.mwall-more { display: flex; justify-content: center; margin: var(--s-32) 0 0; }
.mwall-empty { text-align: center; padding: var(--s-64) 0; color: var(--muted); }
@media (hover: none) { .mwall__cap { opacity: 1; transform: none; } }
@media (max-width: 599px) {
  .mwall { columns: 2; column-gap: 8px; }
  .mwall__item { margin-bottom: 8px; border-radius: 12px; }
  .mwall__cap { font-size: 11px; padding: 24px 8px 8px; }
  .mwall__play { width: 42px; height: 42px; }
  .media-hero__mosaic { grid-template-columns: repeat(4, 1fr); }
  .album-chip { min-height: 40px; font-size: 13px; padding-right: 12px; }
  .album-chip img, .album-chip .album-chip__all { width: 28px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-tri__imgs img.is-on { animation: none; }
  .mwall__item { animation: none; opacity: 1; transform: none; }
}
