/* =========================================================
   Media & Gallery page (high-school-tour/media/)
   Builds on style.css: same colours, type and header.
   ========================================================= */

/* ---------- Hero ---------- */
.m-hero {
  position: relative; overflow: hidden; color: #fff;
  background: var(--purple-deep);
  padding: 150px 0 64px; min-height: 64vh; display: flex; align-items: flex-end;
}
.m-hero-bg {
  position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  opacity: .55; transform: rotate(-4deg) scale(1.25);
}
.m-hero-bg .tile {
  background: center / cover no-repeat; border-radius: 10px;
  animation: m-drift 18s ease-in-out infinite alternate;
}
.m-hero-bg .tile:nth-child(even) { animation-direction: alternate-reverse; }
@keyframes m-drift { from { transform: translateY(-6%); } to { transform: translateY(6%); } }
.m-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(36,24,62,.55) 0%, rgba(36,24,62,.75) 45%, var(--purple-deep) 100%);
}
.m-hero .wrap { position: relative; z-index: 2; }
.m-hero .presents { font-size: .82rem; letter-spacing: .3em; text-transform: uppercase; color: #d9cfe8; font-weight: 600; }
.m-hero h1 {
  font-family: var(--font-display); text-transform: uppercase; font-weight: 800;
  font-size: clamp(3rem, 10vw, 6.6rem); line-height: .92; margin: 10px 0 18px; color: #fff;
}
.m-hero h1 span { color: var(--pink); }
.m-hero .tagline { font-size: clamp(1.05rem, 2vw, 1.25rem); max-width: 600px; color: #e4dcf0; font-weight: 600; }
.m-stats { display: flex; flex-wrap: wrap; gap: 12px 34px; list-style: none; padding: 22px 0 0; margin: 26px 0 0; border-top: 1px solid rgba(255,255,255,.2); }
.m-stats li { font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: #cfc6e2; font-weight: 700; }
.m-stats b { display: block; font-family: var(--font-head); font-size: 2.2rem; letter-spacing: 0; color: #fff; line-height: 1.05; }

/* ---------- School picker (sticky under the header) ---------- */
.m-picker {
  position: sticky; top: 72px; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); box-shadow: 0 6px 18px rgba(36,24,62,.06);
}
.m-picker .wrap { padding: 10px 0; }
.m-switch-box { position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.m-switch {
  display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; max-width: 100%;
  padding: 6px; border-radius: 999px; border: 1.5px solid var(--lav-line);
  background: #fff; color: var(--purple); font: inherit; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.m-switch:hover, .m-switch[aria-expanded="true"] { border-color: var(--pink); box-shadow: 0 4px 14px rgba(224,53,124,.14); }
.m-switch .txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.m-switch .txt small { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.m-switch .txt strong { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-switch.soon .crest-sm { filter: grayscale(1); opacity: .6; }
.m-switch-cta {
  flex: none; display: inline-flex; align-items: center; gap: 4px; margin-left: 4px;
  padding: 8px 10px 8px 14px; border-radius: 999px; background: var(--pink); color: #fff; font-size: .82rem; font-weight: 700;
}
.m-switch-cta svg { width: 20px; height: 20px; fill: currentColor; transition: transform .2s; }
.m-switch[aria-expanded="true"] .m-switch-cta svg { transform: rotate(180deg); }
/* Until the visitor has switched once, the button pulses and a hint points at it */
.m-picker-hint { margin: 0; font-size: .8rem; font-weight: 700; color: var(--pink); }
.m-picker-hint.gone { display: none; }
.m-hint-arrow { display: inline-block; margin-left: 2px; animation: m-nudge 1.2s ease-in-out infinite; }
.m-switch.fresh .m-switch-cta { animation: m-ring 1.8s ease-out infinite; }
@keyframes m-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }
@keyframes m-ring { 0% { box-shadow: 0 0 0 0 rgba(224,53,124,.5); } 70%, 100% { box-shadow: 0 0 0 10px rgba(224,53,124,0); } }

/* The list of schools */
.m-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: min(440px, calc(100vw - 32px)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 18px 48px rgba(36,24,62,.2); overflow: hidden;
}
.m-menu[hidden] { display: none; }
.m-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.m-menu-head strong { font-size: 1rem; color: var(--purple); }
.m-menu-close { border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.m-menu-search {
  margin: 6px 16px 8px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--lav-line);
  font: inherit; font-size: .95rem; color: var(--purple); background: #faf8fd;
}
.m-menu-search:focus { outline: none; border-color: var(--pink); background: #fff; }
.m-menu-search[hidden] { display: none; }
.m-menu-list { overflow-y: auto; padding: 4px 8px 12px; overscroll-behavior: contain; }
.m-menu-group[hidden], .m-opt[hidden] { display: none; }
.m-menu-group h4 {
  margin: 10px 8px 4px; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.m-menu-group h4 span { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: #f1ecf7; letter-spacing: 0; }
.m-opt {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 8px; border: 0; border-radius: 12px; background: none; color: var(--purple); font: inherit; cursor: pointer;
}
.m-opt:hover, .m-opt:focus-visible { background: #f6f1fb; outline: none; }
.m-opt .txt { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.m-opt strong { font-size: .93rem; }
.m-opt small { font-size: .76rem; color: var(--muted); }
.m-opt.soon .crest-sm { filter: grayscale(1); opacity: .6; }
.m-opt.soon strong { color: var(--muted); }
.m-opt-tag { flex: none; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pink); border: 1.5px solid currentColor; border-radius: 999px; padding: 2px 8px; }
.m-opt-check { flex: none; width: 20px; height: 20px; fill: var(--pink); visibility: hidden; }
.m-opt.on { background: #fbeef4; }
.m-opt.on .m-opt-check { visibility: visible; }
.m-menu-empty { margin: 0; padding: 4px 24px 18px; color: var(--muted); font-size: .9rem; }
.m-menu-scrim { display: none; }
.crest-sm { filter: grayscale(1); opacity: .6; }
.m-school.soon.on { border-style: solid; color: #fff; }
.m-school.soon.on .crest-sm { filter: none; opacity: 1; }
.m-soon { border: 2px dashed #d9d0e8; border-radius: 18px; padding: 40px 24px; text-align: center; max-width: 640px; margin: 0 auto; }
.m-soon h3 { font-size: 1.4rem; margin: 0 0 8px; }
.m-soon p { color: var(--muted); margin: 0 auto 20px; max-width: 46ch; }
.crest-sm {
  flex: none; width: 38px; height: 38px; border-radius: 50%; background: #fff; overflow: hidden;
  display: grid; place-items: center; border: 2px solid #f3c6d9;
}
.crest-sm img { width: 100%; height: 100%; object-fit: contain; }
.crest-sm i { font-style: normal; font-weight: 800; font-size: .8rem; color: var(--purple); }
@media (max-width: 620px) {
  .m-switch { flex: 1; }
  .m-switch-cta .lbl { display: none; }
  .m-switch-cta { padding: 8px; }
  .m-picker-hint { display: none; }
  /* On phones the list becomes a bottom sheet */
  .m-menu {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 78vh; border-radius: 20px 20px 0 0; z-index: 120;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .m-menu-scrim { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(36,24,62,.45); }
  .m-menu-scrim[hidden] { display: none; }
  body.m-menu-open { overflow: hidden; }
  /* lift the bar over the scrim, and drop the blur so the sheet is placed against the screen, not the bar */
  body.m-menu-open .m-picker { z-index: 130; backdrop-filter: none; }
  .m-opt { padding: 10px 8px; }
}

/* ---------- One section per school ---------- */
#school-panel { scroll-margin-top: 170px; }
.m-school-sec { padding-top: clamp(40px, 6vw, 72px); }
.m-school-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin-bottom: 34px; }
.m-visit-crest {
  width: 96px; height: 96px; border-radius: 50%; background: #fff; border: 4px solid #f3c6d9;
  display: grid; place-items: center; overflow: hidden;
}
.m-visit-crest img { width: 100%; height: 100%; object-fit: contain; }
.m-school-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 2px 0 8px; max-width: none; }
.m-visit-meta { display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--muted); font-weight: 600; font-size: .95rem; margin: 0; }
.m-visit-meta span + span::before { content: "•"; margin: 0 12px; color: var(--pink); }
.m-story { color: var(--text); margin: 14px 0 0; max-width: 680px; }
.m-share { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.m-share .btn.wa { background: #1f9d55; border-color: #1f9d55; }
.m-share .btn.wa:hover { background: #17834a; border-color: #17834a; }
.btn.ghost-dark { background: transparent; color: var(--purple); border-color: var(--purple); }
.btn.ghost-dark:hover { background: var(--lav-card); }
@media (max-width: 620px) {
  .m-school-head { gap: 14px; }
  .m-visit-crest { width: 58px; height: 58px; border-width: 3px; margin-top: 4px; }
  .m-school-head h2 { font-size: 1.6rem; }
  .m-school-head .tag { font-size: .62rem; letter-spacing: .14em; }
  .m-visit-meta { flex-direction: column; font-size: .9rem; }
  .m-visit-meta span + span::before { content: none; }
}

.m-school-body.has-film { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 24px; align-items: start; }
.m-film-col { position: sticky; top: 160px; display: grid; gap: 18px; }
.m-film-col.many { position: static; } /* a stack of films would be taller than the screen */
@media (max-width: 860px) {
  .m-school-body.has-film { grid-template-columns: 1fr; }
  .m-film-col { position: static; max-width: 320px; width: 100%; margin: 0 auto 8px; }
}
.m-film { margin: 0; }
.m-film .frame {
  position: relative; aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden;
  background: var(--purple-deep); box-shadow: 0 18px 40px rgba(36,24,62,.25);
  border: 5px solid var(--purple-deep);
}
.m-film.yt .frame { aspect-ratio: 16 / 9; }
.m-film.wide { margin: 0 0 34px; }
.m-film.wide .frame { aspect-ratio: 16 / 9; }
/* Films always fit whole on screen below the fixed header (72px) and sticky school bar (73px) */
.m-film { --bars: 145px; scroll-margin-top: calc(var(--bars) - 80px + 12px); } /* html already pads 80px */
.m-film.wide .frame { margin: 0 auto; width: min(100%, (100vh - var(--bars) - 28px) * 16 / 9); width: min(100%, (100svh - var(--bars) - 28px) * 16 / 9); }
.m-film:not(.wide):not(.yt) .frame { margin: 0 auto; width: min(100%, (100vh - 230px) * 9 / 16); width: min(100%, (100svh - 230px) * 9 / 16); }
.m-film.wide video { object-fit: contain; }
.m-film figcaption span { display: block; color: var(--muted); font-size: .92rem; margin-top: 2px; }
.m-film video, .m-film iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; background: #000; }
.m-play {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; border: 0; cursor: pointer; background: var(--pink); color: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(224,53,124,.6);
  animation: m-pulse 2.2s infinite; transition: transform .15s, opacity .2s;
}
.m-play:hover { transform: scale(1.06); }
.m-play svg { width: 34px; height: 34px; fill: currentColor; margin-left: 4px; }
.m-film.playing .m-play { opacity: 0; pointer-events: none; }
@keyframes m-pulse { 70% { box-shadow: 0 0 0 22px rgba(224,53,124,0); } 100% { box-shadow: 0 0 0 0 rgba(224,53,124,0); } }
.m-film figcaption { margin-top: 10px; text-align: center; }
.m-film figcaption strong { font-family: var(--font-head); color: var(--purple); }

/* Sponsors of a visit */
.m-sponsors { margin: 0 0 34px; padding: 20px 0 0; border-top: 1px solid var(--line); }
.m-sponsors h3 { text-align: center; font-size: .74rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.m-sponsors ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.m-sponsors li { flex: 0 1 190px; }
.m-sponsors li {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 1.5px solid var(--lav-line); border-radius: 12px; padding: 16px 12px 12px; text-align: center;
}
.m-sponsors img { height: 64px; width: 100%; object-fit: contain; }
.m-sponsors span { font-size: .82rem; font-weight: 600; color: var(--purple); line-height: 1.3; }
@media (max-width: 620px) {
  .m-sponsors ul { gap: 8px; }
  .m-sponsors li { flex-basis: calc(50% - 4px); }
  .m-sponsors img { height: 52px; }
}

/* ---------- Photo grid ---------- */
.m-photos-title { font-size: 1.15rem; color: var(--purple); margin: 0 0 12px; }
.m-photos-title span { font-size: .85rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.m-school-body.has-film .m-photos-title { margin-top: 0; }

/* Justified rows: each tile grows by its aspect ratio, so rows stay level and photos keep their order */
.m-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.m-grid::after { content: ""; flex-grow: 999999; }
.m-tile {
  position: relative; display: block; overflow: hidden; border-radius: 10px; background: var(--lav-card);
  flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * 230px);
  animation: m-in .5s ease both;
}
.m-tile i { display: block; }
.m-tile img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.02); transition: opacity .4s, transform .5s ease;
}
.m-tile.ld img { opacity: 1; transform: none; }
.m-tile::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(transparent 55%, rgba(36,24,62,.45)); opacity: 0; transition: opacity .2s;
}
.m-tile:hover img { transform: scale(1.05); }
.m-tile:hover::after, .m-tile:focus-visible::after { opacity: 1; }
.m-tile:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
@keyframes m-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 620px) {
  /* Phones: an even grid of square tiles */
  .m-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .m-grid::after { content: none; }
  .m-tile { aspect-ratio: 1; border-radius: 4px; }
  .m-tile i { display: none; }
}
.m-more { text-align: center; margin-top: 30px; }
.m-more .btn[hidden] { display: none; }

/* ---------- Up next ---------- */
.m-upnext { list-style: none; padding: 0; margin: 30px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.m-upnext li { display: flex; align-items: center; gap: 14px; background: #fff; border: 1.5px dashed var(--lav-line); border-radius: 12px; padding: 12px 16px 12px 12px; }
.m-upnext li > span:nth-child(2) { flex: 1; min-width: 0; }
.m-upnext strong { display: block; color: var(--purple); font-size: .97rem; line-height: 1.25; }
.m-upnext small { color: var(--muted); }
.m-upnext time { flex: none; font-size: .78rem; font-weight: 700; color: var(--pink); }
.m-upnext .crest-sm { width: 44px; height: 44px; }
.m-upnext-more { margin-top: 28px; }

/* ---------- Lightbox ---------- */
body.lb-open { overflow: hidden; }
.lb {
  --fade: 1;
  position: fixed; inset: 0; z-index: 100; color: #fff;
  background: rgba(20,13,36, calc(.97 * var(--fade)));
  display: grid; grid-template-rows: auto 1fr auto auto;
  opacity: 0; transition: opacity .2s;
}
.lb.show { opacity: 1; }
.lb[hidden] { display: none; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.lb-count { font-weight: 700; letter-spacing: .08em; font-size: .9rem; color: #d9cfe8; }
.lb-actions { display: flex; gap: 6px; }
.lb-btn, .lb-nav {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; transition: background .15s;
}
.lb-btn:hover, .lb-nav:hover { background: var(--pink); }
.lb-btn svg, .lb-nav svg { width: 22px; height: 22px; fill: currentColor; }
.lb-btn.busy { opacity: .55; pointer-events: none; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; touch-action: pan-y; }
.lb-stage img {
  position: absolute; top: 0; bottom: 0; left: 72px; right: 72px; width: calc(100% - 144px); height: 100%;
  object-fit: contain; user-select: none; -webkit-user-drag: none;
  opacity: 0; transform: scale(.985); transition: opacity .25s, transform .25s;
}
.lb-stage img.in { opacity: 1; transform: none; }
.lb-spinner {
  position: absolute; width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--pink);
  animation: m-spin .8s linear infinite; opacity: 0; transition: opacity .2s;
}
.lb-stage.loading .lb-spinner { opacity: 1; transition-delay: .25s; }
@keyframes m-spin { to { transform: rotate(360deg); } }
.lb-nav { position: absolute; top: 50%; margin-top: -22px; width: 52px; height: 52px; }
.lb-nav.prev { left: 14px; }
.lb-nav.next { right: 14px; }
.lb-caption { text-align: center; padding: 10px 16px 4px; color: #d9cfe8; font-size: .95rem; }
.lb-caption { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lb-caption strong { color: #fff; }
.lb-caption .crest-sm { width: 28px; height: 28px; border-width: 1.5px; }
.lb-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px 14px; scrollbar-width: none; }
.lb-strip::-webkit-scrollbar { display: none; }
.lb-strip button { flex: none; width: 54px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #2a1f4f; cursor: pointer; opacity: .5; transition: opacity .15s, border-color .15s; }
.lb-strip button.on, .lb-strip button:hover { opacity: 1; }
.lb-strip button.on { border-color: var(--pink); }
.lb-strip img { width: 100%; height: 100%; object-fit: cover; }
.lb-toast {
  position: absolute; left: 50%; bottom: 96px; transform: translate(-50%, 10px);
  background: #fff; color: var(--purple); font-weight: 700; padding: 10px 18px; border-radius: 999px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.lb-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 700px) {
  .lb-stage img { left: 0; right: 0; width: 100%; }
  .lb-nav { display: none; }
  .lb-strip button { width: 44px; height: 44px; }
}

/* Header link for the current page */
.nav a[aria-current="page"] { color: var(--pink); }

@media (prefers-reduced-motion: reduce) {
  .m-hero-bg .tile, .m-play, .m-tile, .m-hint-arrow, .m-switch-cta { animation: none; }
}

/* Next school in the Up next list */
.m-upnext li.is-next { background: var(--purple); border: 0; }
.m-upnext li.is-next strong { color: #fff; }
.m-upnext li.is-next small { color: #d8cfea; }
.m-next-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.m-next-side .stamp-next { position: static; transform: rotate(-9deg); margin: 4px 4px 0 0; }
.m-next-side .stamp-next b { font-size: .95rem; }
.m-upnext li.is-next time { color: #f3c6d9; font-size: .7rem; }
@media (min-width: 700px) { .m-upnext li.is-next { grid-column: span 2; } }
