/* ==========================================================================
   PPI Alumni — Memory viewer (batch 22)
   Full-screen gallery for the Memories wall (public pages + Admin →
   Memories). Self-contained: its own tokens, no icon font, so it looks the
   same under style.css/features.css and under admin.css.
   ========================================================================== */
.mv {
    --mv-navy: #0b1f4b;
    --mv-ink: #0f172a;
    --mv-text: #334155;
    --mv-muted: #64748b;
    --mv-line: #e2e8f0;
    --mv-blue: #2563eb;
    --mv-gold: #f59e0b;
    --mv-gold-grad: linear-gradient(135deg, #fde68a 0%, #fbbf24 45%, #f59e0b 100%);
    --mv-blue-grad: linear-gradient(135deg, #2563eb 0%, #1e40af 55%, #0d9488 130%);
    --mv-radius: 22px;
    position: fixed; inset: 0; z-index: 5000;
    font-family: inherit; color: #fff;
    opacity: 0; transition: opacity .22s ease;
    -webkit-font-smoothing: antialiased;
}
.mv[hidden] { display: none; }
.mv.is-open { opacity: 1; }
.mv *, .mv *::before, .mv *::after { box-sizing: border-box; }
.mv svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mv svg .mv-fill { fill: currentColor; stroke: none; }
.mv__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

html.mv-lock, html.mv-lock body { overflow: hidden; }
html.mv-lock body { padding-right: var(--mv-sbw, 0); }

.mv__backdrop {
    position: absolute; inset: 0;
    background:
        radial-gradient(60% 50% at 18% 12%, rgba(37, 99, 235, 0.28), transparent 70%),
        radial-gradient(50% 45% at 88% 92%, rgba(245, 158, 11, 0.16), transparent 70%),
        rgba(4, 10, 26, 0.94);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}

.mv__shell {
    position: relative; height: 100%;
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
    padding: 14px 28px 18px; gap: 14px;
    transform: translateY(10px) scale(.985); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.mv.is-open .mv__shell { transform: none; }

/* ---- top bar ---- */
.mv__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.mv__brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.mv__brand-icon {
    width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--mv-gold-grad); color: #78350f; box-shadow: 0 10px 24px -12px rgba(245, 158, 11, 0.9);
}
.mv__label { font-weight: 800; font-size: 15px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mv__count {
    flex: none; white-space: nowrap; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.86);
}
.mv--single .mv__count { display: none; }
.mv__tools { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.mv:focus, .mv__shell:focus { outline: none; }
.mv__tool {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; min-width: 42px; padding: 0 14px;
    border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08);
    color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; text-decoration: none; cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.mv__tool:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.mv__tool--close { padding: 0; width: 42px; }
.mv__tool--close:hover { background: #fff; color: var(--mv-navy); }
.mv__tool[hidden] { display: none; }
.mv__tool:focus-visible, .mv__nav:focus-visible, .mv__thumb:focus-visible, .mv__btn:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }

/* ---- main: photo stage + story panel ---- */
.mv__main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 30vw, 400px); gap: 22px; min-height: 0; }
.mv__stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; touch-action: pan-y pinch-zoom; }
.mv__figure { position: relative; margin: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.mv__img {
    display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
    border-radius: 16px; background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1);
}
.mv__figure:not(.is-in) .mv__img { opacity: 0; transform: scale(.985); }
.mv__figure.is-loading .mv__img { opacity: 0; }
.mv__figure.is-broken .mv__img { display: none; }
.mv__spinner {
    position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: #fbbf24; opacity: 0; pointer-events: none;
    animation: mv-spin .8s linear infinite; transition: opacity .2s;
}
.mv__figure.is-loading .mv__spinner { opacity: 1; transition-delay: .15s; }
@keyframes mv-spin { to { transform: rotate(360deg); } }

/* A story without a photo: a large quote card on the stage. */
.mv__quote {
    display: none; position: relative; width: min(620px, 100%); padding: 56px 48px 52px; border-radius: 26px;
    background:
        radial-gradient(70% 60% at 100% 0%, rgba(16, 185, 129, 0.22), transparent 70%),
        linear-gradient(160deg, #ecfdf5 0%, #ffffff 58%);
    color: var(--mv-navy); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
}
.mv--text .mv__quote, .mv__figure.is-broken .mv__quote { display: block; }
.mv--text .mv__img { display: none; }
.mv__quote-mark { display: block; color: #10b981; opacity: .35; margin-bottom: 14px; }
.mv__quote-mark svg { width: 56px; height: 56px; }
.mv__quote-title { margin: 0; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.25; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.mv__quote-by { margin: 18px 0 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: #047857; min-width: 0; overflow-wrap: anywhere; }
.mv__quote-by::before { content: ''; flex: none; width: 28px; height: 2px; border-radius: 2px; background: currentColor; opacity: .5; }
.mv__quote-by:empty { display: none; }

.mv__nav {
    position: absolute; top: 50%; z-index: 2; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(10, 20, 45, 0.55); color: #fff;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transition: background .2s, color .2s, transform .2s;
}
.mv__nav svg { width: 24px; height: 24px; }
.mv__nav--prev { left: 6px; }
.mv__nav--next { right: 6px; }
.mv__nav:hover { background: #fbbf24; border-color: #fbbf24; color: var(--mv-navy); transform: scale(1.06); }
.mv--single .mv__nav { display: none; }

/* ---- story panel ---- */
.mv__panel {
    background: #fff; color: var(--mv-text); border-radius: var(--mv-radius); padding: 26px 26px 22px;
    overflow-y: auto; overscroll-behavior: contain; min-height: 0; max-height: 100%; align-self: center;
    display: flex; flex-direction: column; gap: 16px;
    box-shadow: 0 40px 90px -36px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}
.mv__panel:focus { outline: none; }
.mv__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mv__chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.3; font-variant-numeric: tabular-nums;
}
.mv__chip svg { width: 15px; height: 15px; }
.mv__chip--year { background: #eff6ff; color: #1d4ed8; border: 1px solid rgba(37, 99, 235, 0.2); }
.mv__chip--featured { background: var(--mv-gold-grad); color: #78350f; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.mv__chip--status { text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.mv__chip--approved { background: #dcfce7; color: #166534; }
.mv__chip--pending { background: #fef3c7; color: #92400e; }
.mv__chip--rejected { background: #fee2e2; color: #991b1b; }
.mv .mv__title { margin: 0; font-family: inherit; font-size: 25px; line-height: 1.25; font-weight: 800; color: var(--mv-ink); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.mv__story { margin: 0; font-size: 15.5px; line-height: 1.75; color: var(--mv-text); white-space: pre-line; overflow-wrap: anywhere; }
.mv__story--empty { color: var(--mv-muted); font-style: italic; }

.mv__author { display: flex; align-items: center; gap: 14px; padding-top: 16px; border-top: 1px dashed #cbd5e1; }
.mv__avatar {
    width: 48px; height: 48px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
    background: var(--mv-blue-grad); color: #fff; font-weight: 800; font-size: 18px;
    border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22), 0 8px 18px -8px rgba(30, 64, 175, 0.7);
}
.mv__avatar--gold { background: var(--mv-gold-grad); color: var(--mv-navy); box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35), 0 8px 18px -8px rgba(245, 158, 11, 0.8); }
.mv__who { display: grid; gap: 1px; min-width: 0; }
.mv__who-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--mv-muted); }
.mv .mv__who-name { font-size: 15.5px; font-weight: 800; color: var(--mv-ink); text-decoration: none; overflow-wrap: anywhere; }
.mv a.mv__who-name:hover { color: var(--mv-blue); text-decoration: underline; }
.mv__who-meta { font-size: 13px; color: var(--mv-muted); overflow-wrap: anywhere; min-width: 0; }

.mv__facts { list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 9px; border-radius: 16px; background: #f8fafc; border: 1px solid var(--mv-line); }
.mv__facts li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--mv-text); min-width: 0; }
.mv__facts li svg { width: 17px; height: 17px; color: var(--mv-blue); }
.mv__facts li span, .mv__facts li a { overflow-wrap: anywhere; min-width: 0; }
.mv__facts a { color: var(--mv-blue); font-weight: 700; text-decoration: none; }
.mv__facts a:hover { text-decoration: underline; }

.mv__actions { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 16px; border-bottom: 1px dashed #cbd5e1; }
.mv__btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
    border-radius: 12px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
    border: 1px solid var(--mv-line); background: #fff; color: var(--mv-ink); transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.mv__btn svg { width: 18px; height: 18px; }
.mv__btn--primary { background: var(--mv-blue); border-color: var(--mv-blue); color: #fff; }
.mv__btn--primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.mv__btn--outline:hover, .mv__btn--ghost:hover { border-color: var(--mv-blue); color: var(--mv-blue); }
.mv__btn--danger { color: #b91c1c; border-color: #fecaca; background: #fff5f5; }
.mv__btn--danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.mv__btn--gold { background: var(--mv-gold-grad); border-color: transparent; color: #422006; box-shadow: 0 12px 24px -14px rgba(245, 158, 11, 0.95); }
.mv__btn--gold:hover { color: #422006; box-shadow: 0 16px 30px -14px rgba(245, 158, 11, 1); }

.mv__cta {
    margin-top: auto; display: grid; gap: 10px; padding: 16px; border-radius: 16px;
    background: linear-gradient(135deg, #fffbeb, #fff7ed); border: 1px solid #fde68a;
}
.mv__cta-text { margin: 0; font-size: 13.5px; font-weight: 700; color: #92400e; }

/* ---- filmstrip ---- */
.mv__thumbs {
    display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; justify-content: safe center;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.mv__thumbs:empty { display: none; }
.mv__thumb {
    flex: none; width: 74px; height: 56px; padding: 0; border-radius: 12px; overflow: hidden; cursor: pointer;
    border: 2px solid transparent; background: rgba(255, 255, 255, 0.08); opacity: .55;
    transition: opacity .2s, border-color .2s, transform .2s;
}
.mv__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mv__thumb--text { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #ecfdf5, #d1fae5); color: #059669; }
.mv__thumb--text svg { width: 26px; height: 26px; }
.mv__thumb:hover { opacity: .9; }
.mv__thumb.is-active { opacity: 1; border-color: #fbbf24; transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(251, 191, 36, 0.9); }

/* ---- what opens it ---- */
[data-mv-open] { cursor: zoom-in; }
.mv--admin .mv__cta { display: none; }

/* Admin → Memories: the thumbnail and the title open the viewer. */
body.admin-body .mem-admin-thumb { position: relative; transition: box-shadow .2s, border-color .2s; }
body.admin-body button.mem-admin-thumb { padding: 0; font: inherit; font-size: 18px; cursor: zoom-in; }
body.admin-body .mem-admin-thumb:hover, body.admin-body .mem-admin-thumb:focus-visible { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); outline: none; }
body.admin-body .mem-admin-thumb__zoom {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(11, 31, 75, 0.45); color: #fff; opacity: 0; transition: opacity .2s;
}
body.admin-body .mem-admin-thumb__zoom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.admin-body .mem-admin-thumb:hover .mem-admin-thumb__zoom, body.admin-body .mem-admin-thumb:focus-visible .mem-admin-thumb__zoom { opacity: 1; }
body.admin-body .mem-admin-title {
    appearance: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 700; color: inherit;
    text-align: left; cursor: zoom-in; line-height: 1.35; border-radius: 4px;
}
body.admin-body .mem-admin-title:hover { color: #2563eb; text-decoration: underline; text-underline-offset: 3px; }
body.admin-body .mem-admin-title:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ---- tablet / phone ---- */
@media (max-width: 900px) {
    .mv__shell { padding: 0; gap: 0; grid-template-rows: auto minmax(0, 1fr); }
    .mv__bar { padding: 10px 12px; min-height: 0; }
    .mv__label { font-size: 14px; }
    .mv__tool--orig span { display: none; }
    .mv__tool--orig { padding: 0; width: 42px; }
    .mv__main { display: flex; flex-direction: column; gap: 0; }
    .mv__stage { flex: 0 0 auto; height: 44vh; height: 44svh; min-height: 230px; padding: 0 10px 14px; }
    .mv--text .mv__stage { height: auto; min-height: 0; padding: 4px 12px 16px; }
    .mv__img { border-radius: 12px; }
    .mv__quote { padding: 28px 24px 26px; border-radius: 20px; }
    .mv--text .mv__quote { padding: 24px 62px 24px; }
    .mv__brand { gap: 8px; }
    .mv__brand-icon { width: 34px; height: 34px; border-radius: 10px; }
    .mv__quote-mark svg { width: 40px; height: 40px; }
    .mv__quote-title { font-size: 21px; }
    .mv__nav { width: 40px; height: 40px; margin-top: -27px; }
    .mv__nav svg { width: 20px; height: 20px; }
    .mv__nav--prev { left: 14px; }
    .mv__nav--next { right: 14px; }
    .mv__panel { flex: 1 1 auto; max-height: none; align-self: stretch; border-radius: 22px 22px 0 0; padding: 22px 18px 26px; }
    .mv__title { font-size: 21px; }
    .mv__story { font-size: 15px; }
    .mv__thumbs { display: none; }
    .mv__actions .mv__btn { flex: 1 1 auto; }
}

/* Phone on its side: photo left, story right. */
@media (max-width: 900px) and (max-height: 500px) {
    .mv__main { flex-direction: row; }
    .mv__stage, .mv--text .mv__stage { flex: 1 1 56%; height: auto; min-height: 0; padding: 0 8px 10px; }
    .mv__panel { flex: 1 1 44%; border-radius: 18px 0 0 0; padding: 16px 16px 20px; }
    .mv__quote { padding: 20px 56px; }
    .mv__quote-title { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .mv, .mv__shell, .mv__img, .mv__thumb, .mv__nav { transition: none; }
    .mv__shell { transform: none; }
    .mv__spinner { animation-duration: 2s; }
}
