/* Media pages: gallery, student-works, student-speaks, student-development-activity.
   Theme-aware: surfaces/text use tokens; anything on photography or video sits in an .is-dark island. */

/* Shared: thumbnails fill their tile, zoom cue on hover (development activity mosaic). */
.zoomable picture { display: block; height: 100%; }
.zoomable img { width: 100%; height: 100%; object-fit: cover; }
.zoomable::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgb(12 12 13 / 0.55));
  opacity: 0; transition: opacity 0.4s;
  box-shadow: inset 0 0 0 1px rgb(245 197 24 / 0.6);
  border-radius: inherit;
}
.zoomable:hover::after, .zoomable:focus-visible::after { opacity: 1; }

/* Shared compact page head (gallery, student works). */
.media-head { padding: calc(var(--header-h) + clamp(2rem, 1.2rem + 3.5vw, 4.5rem)) 0 clamp(0.5rem, 0.2rem + 1vw, 1.25rem); }
.media-head__inner { display: grid; gap: var(--space-4); }
.media-head__title { font-size: clamp(2.8rem, 1.4rem + 6vw, 7rem); line-height: 0.92; letter-spacing: -0.05em; }
.media-head .lead { color: var(--text-2); }

/* Shared play affordance. */
.poster__play-dot {
  width: clamp(56px, 3rem + 2vw, 76px); aspect-ratio: 1; display: grid; place-items: center; flex: none;
  border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 10px 40px -10px rgb(245 197 24 / 0.6);
  transition: transform 0.4s var(--ease-out);
}
.poster__play-dot .icon { width: 42%; height: 42%; margin-left: 6%; }
.poster__play-text { font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); letter-spacing: -0.02em; color: var(--text); }

/* ---------- Carousel (module: assets/js/modules/carousel.js) ---------- */
.carousel { display: grid; gap: clamp(1rem, 0.7rem + 1vw, 1.5rem); }
.carousel__viewport { max-width: 100%; min-width: 0;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scrollbar-width: none; border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.carousel__viewport::-webkit-scrollbar { display: none; }
.carousel__viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.carousel__track { display: flex; gap: clamp(0.75rem, 0.5rem + 1vw, 1.5rem); padding-inline: 6%; }
.carousel__slide { flex: 0 0 88%; scroll-snap-align: center; scroll-snap-stop: always; min-width: 0; }
.carousel__controls { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; }
.carousel__controls[hidden] { display: none; }
.carousel__btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line-strong); background: rgb(var(--fg-rgb) / 0.04); color: var(--text);
  transition: border-color 0.25s, background-color 0.25s;
}
.carousel__btn:hover { border-color: var(--text); }
.carousel__btn .icon { width: 20px; height: 20px; }
.carousel__btn[hidden] { display: none; }
.carousel__toggle { margin-right: auto; }
.carousel__toggle .carousel__icon-play { display: none; }
.carousel__toggle[data-state="paused"] .carousel__icon-play { display: contents; }
.carousel__toggle[data-state="paused"] .carousel__icon-pause { display: none; }
.carousel__status { min-width: 4.5rem; text-align: center; font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (min-width: 1024px) {
  .carousel__track { padding-inline: 9%; }
  .carousel__slide { flex-basis: 82%; }
}
@media (prefers-reduced-motion: no-preference) {
  .carousel__viewport { scroll-behavior: smooth; }
}

/* ---------- Gallery: featured showcase ---------- */
.showcase { padding-top: clamp(1rem, 0.5rem + 2vw, 2.5rem); }
.showcase .container { max-width: none; padding-inline: 0; }
.showcase .carousel__controls { padding-inline: var(--gutter, 1rem); max-width: var(--container, 1280px); margin-inline: auto; width: 100%; }
.showcase__slide { display: grid; gap: 0.9rem; }
.showcase__media {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--ink-3); border: 1px solid var(--line);
}
.showcase__media picture, .showcase__media img { width: 100%; height: 100%; object-fit: cover; background-size: cover; }
.showcase__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(245 197 24 / 0); transition: box-shadow 0.35s;
}
.showcase__media:hover::after, .showcase__media:focus-visible::after { box-shadow: inset 0 0 0 2px rgb(245 197 24 / 0.7); }
.carousel__slide:not(.is-current) .showcase__media { opacity: 0.55; transition: opacity 0.5s; }
.carousel__slide.is-current .showcase__media { opacity: 1; transition: opacity 0.5s; }
.showcase__caption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; }
.showcase__title { font-size: var(--step-2); letter-spacing: -0.03em; }
.showcase__meta, .project__meta { display: flex; gap: 0.9rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-2); }
.showcase__meta span + span::before, .project__meta span + span::before { content: "/"; margin-right: 0.9rem; color: var(--text-3); }

/* ---------- Gallery: project grid ---------- */
.projects__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.5rem); }
.projects__filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.projects__filters[hidden] { display: none; }
.chip {
  min-height: 44px; padding: 0.55em 1.1em; border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong); background: rgb(var(--fg-rgb) / 0.03); color: var(--text-2);
  font-weight: 500; font-size: 0.95rem; transition: border-color 0.25s, background-color 0.25s, color 0.25s;
}
.chip:hover { border-color: var(--text); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.projects__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 1rem + 1.5vw, 2.5rem) clamp(0.75rem, 0.5rem + 1vw, 1.5rem); }
.project { display: grid; gap: 0.45rem; align-content: start; }
.project[hidden] { display: none; }
.project__media {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--ink-3); border: 1px solid var(--line);
}
.project__media picture { display: block; height: 100%; }
.project__media img { width: 100%; height: 100%; object-fit: cover; background-size: cover; transition: transform 0.9s var(--ease-out); }
.project__media:hover img { transform: scale(1.04); }
.project__media:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.project__title { font-size: var(--step-1); letter-spacing: -0.02em; margin-top: 0.35rem; }
@media (min-width: 1024px) { .projects__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 479px) { .project__meta span + span { display: none; } }

/* ---------- Gallery lightbox (project-aware; styles extend app.css .lightbox) ---------- */
.glightbox[open] { display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 4.5rem 1rem 1rem; gap: 0.75rem; }
.glightbox__figure { display: grid; gap: 0.75rem; justify-items: center; max-width: min(92vw, 1600px); min-height: 0; }
.glightbox__stage { min-height: 0; display: grid; place-items: center; }
.glightbox .glightbox__stage img { max-width: min(92vw, 1600px); max-height: calc(100dvh - 16rem); width: auto; height: auto; border-radius: var(--radius-sm); object-fit: contain; }
.glightbox__caption { text-align: center; display: grid; gap: 0.2rem; }
.glightbox__title { font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); }
.glightbox__desc { color: var(--text-2); font-size: 0.95rem; }
.glightbox__count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-2); }
.glightbox__thumbs { display: flex; gap: 0.5rem; justify-content: center; }
.glightbox__thumbs[hidden] { display: none; }
.glightbox__thumb { width: 64px; height: 44px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; opacity: 0.6; transition: opacity 0.25s, border-color 0.25s; }
.glightbox__thumb img { width: 100%; height: 100%; object-fit: cover; }
.glightbox__thumb[aria-current="true"] { border-color: var(--brand); opacity: 1; }
.glightbox__thumb:hover { opacity: 1; }
.glightbox .lightbox__prev, .glightbox .lightbox__next { background: rgb(12 12 13 / 0.6); }
@media (max-width: 640px) {
  .glightbox .lightbox__prev, .glightbox .lightbox__next { top: auto; bottom: 1rem; transform: none; }
  .glightbox[open] { padding-bottom: 5rem; }
}

/* ---------- Typographic film posters (student works) ---------- */
.poster {
  --hue: 45;
  position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: end; justify-items: start;
  gap: 0.6rem; width: 100%; text-align: left; color: var(--text);
  border-radius: var(--radius); border: 1px solid var(--line);
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
  background:
    radial-gradient(120% 90% at 85% 0%, hsl(var(--hue) 70% 45% / 0.35), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, rgb(245 197 24 / 0.12), transparent 60%),
    linear-gradient(160deg, #18181b, #0c0c0d 70%);
}
.poster::after { /* letterbox bars */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(#000 0 0) top / 100% 7% no-repeat, linear-gradient(#000 0 0) bottom / 100% 7% no-repeat;
  opacity: 0.55;
}
.poster__frame { position: absolute; inset: 12%; pointer-events: none; z-index: -1; }
.poster__frame::before {
  content: ""; position: absolute; inset: 0;
  --c: rgb(255 255 255 / 0.45); --l: 22px; --w: 1.5px;
  background:
    linear-gradient(var(--c) 0 0) top left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c) 0 0) top left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c) 0 0) top right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c) 0 0) top right / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c) 0 0) bottom left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c) 0 0) bottom left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c) 0 0) bottom right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c) 0 0) bottom right / var(--w) var(--l) no-repeat;
}
.poster__kicker { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.poster__title { font-family: var(--font-display); font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; font-size: var(--step-3); max-width: 14ch; text-wrap: balance; }
.poster__play { display: inline-flex; align-items: center; gap: 0.9rem; margin-top: 0.4rem; }
.poster:hover .poster__play-dot, .voice-feature__media:hover .poster__play-dot, .voice__media:hover .poster__play-dot { transform: scale(1.08); }
.poster:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.poster--feature { aspect-ratio: 16 / 9; min-height: 320px; }
.poster--feature .poster__title { font-size: clamp(2.6rem, 1.2rem + 6vw, 7.5rem); max-width: 12ch; }
.poster--feature .poster__play { position: absolute; right: clamp(1.25rem, 0.8rem + 2vw, 2.5rem); bottom: clamp(1.25rem, 0.8rem + 2vw, 2.5rem); margin: 0; }
@media (max-width: 640px) {
  .poster--feature { aspect-ratio: 4 / 5; }
  .poster--feature .poster__play { position: static; }
}
.poster--tile { aspect-ratio: 4 / 3; }
.poster--tile .poster__title { font-size: var(--step-2); }
.poster--tile .poster__play { position: absolute; top: clamp(1rem, 0.6rem + 1.5vw, 1.75rem); right: clamp(1rem, 0.6rem + 1.5vw, 1.75rem); margin: 0; }
.poster--tile .poster__play-dot { width: 52px; }
.poster--stage { aspect-ratio: 16 / 9; width: 100%; height: 100%; border: 0; border-radius: 0; }
.poster--stage .poster__title { font-size: clamp(2rem, 1rem + 5vw, 6rem); }

.films__head, .voices__head { margin-bottom: clamp(1.25rem, 1rem + 1vw, 2rem); }
.films__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(0.75rem, 0.5rem + 1vw, 1.5rem); }
.films__item { grid-column: span 2; }
.films__item:nth-child(-n+2) { grid-column: span 3; }
@media (max-width: 1023px) {
  .films__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .films__item, .films__item:nth-child(-n+2) { grid-column: span 1; }
  .films__item:first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .films__grid { grid-template-columns: minmax(0, 1fr); }
  .films__item:first-child { grid-column: auto; }
}

/* ---------- Student speaks ---------- */
.voices-hero { position: relative; overflow: clip; padding: calc(var(--header-h) + clamp(2rem, 1.2rem + 3.5vw, 4.5rem)) 0 clamp(0.5rem, 0.2rem + 1vw, 1.25rem); }
.voices-hero__inner { display: grid; gap: var(--space-4); }
.voices-hero__title { font-size: clamp(2.8rem, 1.4rem + 6vw, 7rem); line-height: 0.92; letter-spacing: -0.05em; max-width: 11ch; }
.voices-hero__mark { position: absolute; right: clamp(-2rem, -1rem + -2vw, 0rem); top: calc(var(--header-h) + 1rem); color: var(--accent); opacity: 0.12; pointer-events: none; }
.voices-hero__mark .icon { width: clamp(8rem, 5rem + 14vw, 20rem); height: auto; aspect-ratio: 1; }

.voice-feature__inner { display: grid; gap: clamp(1rem, 0.6rem + 1.5vw, 2rem); align-items: end; }
.voice-feature__media {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--ink-3); border: 1px solid var(--line);
}
.voice-feature__media picture { display: block; height: 100%; }
.voice-feature__media img { width: 100%; height: 100%; object-fit: cover; background-size: cover; transition: transform 1.2s var(--ease-out); }
.voice-feature__media:hover img { transform: scale(1.03); }
.voice-feature__media::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 55%, rgb(12 12 13 / 0.6)); }
.voice-feature__play { position: absolute; left: clamp(1rem, 0.6rem + 2vw, 2.25rem); bottom: clamp(1rem, 0.6rem + 2vw, 2.25rem); z-index: 1; display: inline-flex; align-items: center; gap: 0.9rem; }
.voice-feature__media:focus-visible, .voice__media:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.voice-feature__text { display: grid; gap: 0.4rem; }
.voice-feature__mark { color: var(--accent); }
.voice-feature__mark .icon { width: 2.6rem; height: 2.6rem; }
.voice-feature__name { font-size: clamp(2.2rem, 1.3rem + 4vw, 4.8rem); line-height: 0.95; letter-spacing: -0.045em; }
@media (min-width: 1024px) {
  .voice-feature__inner { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
  .voice-feature__text { padding-bottom: 0.5rem; }
}

.voices__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.25rem, 0.8rem + 1.5vw, 2rem) clamp(0.75rem, 0.5rem + 1vw, 1.25rem); }
.voice { display: grid; gap: 0.7rem; align-content: start; }
.voice__media {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: var(--radius); background: var(--ink-3); border: 1px solid var(--line);
}
.voice__media picture { display: block; height: 100%; }
.voice__media img { width: 100%; height: 100%; object-fit: cover; background-size: cover; transition: transform 0.9s var(--ease-out); }
.voice__media:hover img { transform: scale(1.04); }
.voice__media::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 60%, rgb(12 12 13 / 0.55)); }
.voice__play { position: absolute; left: 0.9rem; bottom: 0.9rem; z-index: 1; }
.voice__play .poster__play-dot { width: 48px; }
.voice__name { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); letter-spacing: -0.02em; line-height: 1.1; }
.voice__name::before { content: ""; width: 1.2rem; height: 2px; background: var(--brand); flex: none; }
@media (min-width: 768px) { .voices__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .voices__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---------- Video takeover dialog (student works + speaks) ---------- */
.takeover {
  position: fixed; inset: 0; z-index: var(--z-modal); width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; padding: 0; background: rgb(6 6 7 / 0.97); color: var(--text);
}
.takeover::backdrop { background: rgb(0 0 0 / 0.8); }
.takeover[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.takeover__bar, .takeover__controls { display: flex; align-items: center; gap: 1rem; padding: 0.9rem clamp(1rem, 0.5rem + 2vw, 2rem); }
.takeover__bar { justify-content: space-between; }
.takeover__title { font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); letter-spacing: -0.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.takeover__btn { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); background: rgb(var(--fg-rgb) / 0.04); }
.takeover__btn:hover { border-color: var(--text); }
.takeover__btn .icon { width: 22px; height: 22px; }
.takeover__stage { display: grid; place-items: center; min-height: 0; padding-inline: clamp(0rem, -1rem + 3vw, 2rem); }
.takeover__stage > * { width: min(100%, calc((100dvh - 10rem) * 16 / 9)); aspect-ratio: 16 / 9; max-height: 100%; }
.takeover__stage video { background: #000; object-fit: contain; border-radius: var(--radius-sm); }
.takeover__stage iframe { border: 0; border-radius: var(--radius-sm); }
.takeover__controls { justify-content: center; }
.takeover__toggle {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 52px; padding: 0 1.5rem 0 1.1rem;
  border-radius: var(--radius-pill); background: var(--brand); color: var(--brand-ink); font-weight: 700;
}
.takeover__toggle .icon { width: 22px; height: 22px; }
.takeover__toggle-pause { display: none; }
.takeover[data-state="playing"] .takeover__toggle-play { display: none; }
.takeover[data-state="playing"] .takeover__toggle-pause { display: contents; }
.takeover__toggle:hover { background: var(--brand-hover); }
.takeover__toggle:focus-visible, .takeover__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .takeover[open] { animation: takeover-in 0.45s var(--ease-out); }
  @keyframes takeover-in { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }
}

/* ---------- Development activity: staggered pair grid ---------- */
.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 0.6rem + 1.5vw, 2rem); }
.mosaic__item { border-radius: var(--radius); aspect-ratio: 4 / 3; background: var(--ink-3); border: 1px solid var(--line); }
.mosaic__item:nth-child(even) { transform: translateY(clamp(0rem, -2rem + 8vw, 5rem)); }
.activities { padding-bottom: calc(var(--section) * 0.5 + clamp(0rem, -2rem + 8vw, 5rem)); }
@media (max-width: 640px) {
  .mosaic { grid-template-columns: minmax(0, 1fr); }
  .mosaic__item:nth-child(even) { transform: none; }
}

/* Film stills behind the poster titles */
.poster { isolation: isolate; }
.poster__img { position: absolute; inset: 0; z-index: -1; }
.poster__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease-out); }
.poster__img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(12 12 13 / 0.05) 30%, rgb(12 12 13 / 0.85) 100%); }
.poster:hover .poster__img img, .poster:focus-visible .poster__img img { transform: scale(1.04); }
.carousel__controls { flex-wrap: wrap; max-width: 100%; }
