/* mediaview1 / xemediaview1 (03-11-2026): the media viewer of the news and comment editors (static/js/media-viewer.js,
   the same file as on bascdao.com). A click on a thumbnail of an editor shows the whole file. Only classes mv-*; the
   page's own CSS is not touched. Colours: the page's (news cyan + gold on the hub, the tribe colour on each tribe). */
.mv, .mv-zoom {
    --mv-a: var(--news-community-primary, var(--tribe-color, #14d9ff));
    --mv-b: var(--news-community-accent, var(--tribe-accent, #ffd166));
    --mv-line: color-mix(in srgb, var(--mv-a) 55%, transparent);
    --mv-glow: color-mix(in srgb, var(--mv-a) 22%, transparent);
    --mv-ink: #eef2fa;
    --mv-muted: #a5b4cc;
    --mv-panel: linear-gradient(160deg, rgba(22, 30, 48, 0.97), rgba(8, 12, 22, 0.97));
    --mv-font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* the thumbnails: a zoom cursor on the picture, the editors' buttons keep theirs */
.mv-thumb img, .mv-thumb video:not([controls]), img.mv-thumb { cursor: zoom-in; }
.mv-thumb:focus-visible { outline: 2px solid var(--mv-a); outline-offset: 3px; }

/* ---- the ⤢ badge (one, floating over the thumbnail under the pointer or the keyboard) ---- */
.mv-zoom { position: fixed; left: 0; top: 0; z-index: 2147483000; width: 32px; height: 32px; padding: 0; margin: 0;
    display: grid; place-items: center; border-radius: 50%; cursor: zoom-in; color: #fff;
    background: rgba(8, 12, 22, 0.8); border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--mv-a) 35%, transparent);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    animation: mv-pop 0.16s ease both; }
.mv-zoom[hidden] { display: none; }
.mv-zoom svg { width: 16px; height: 16px; flex: 0 0 auto; display: block; }
.mv-zoom::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(135deg, var(--mv-a), var(--mv-b));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); opacity: 0.9; }
.mv-zoom:hover, .mv-zoom:focus-visible { background: linear-gradient(135deg, var(--mv-a), var(--mv-b)); color: #050a14; outline: none;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 18px color-mix(in srgb, var(--mv-b) 40%, transparent); }
/* its tooltip, as the club's tooltips (tips.js): never the browser's */
.mv-tip { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px) scale(0.98); white-space: nowrap;
    padding: 7px 11px; border-radius: 11px; pointer-events: none; font: 600 0.8rem/1.3 var(--mv-font); color: var(--mv-ink);
    background: var(--mv-panel); border: 1px solid var(--mv-line);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 22px var(--mv-glow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    opacity: 0; transition: opacity 0.14s ease, transform 0.14s ease; }
.mv-tip::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px;
    background: rgba(9, 13, 24, 0.97); border-right: 1px solid var(--mv-line); border-bottom: 1px solid var(--mv-line); transform: rotate(45deg); }
.mv-zoom.is-low .mv-tip { bottom: auto; top: calc(100% + 10px); transform: translate(-50%, -4px) scale(0.98); }
.mv-zoom.is-low .mv-tip::after { bottom: auto; top: -6px; transform: rotate(225deg); }
.mv-zoom:hover .mv-tip, .mv-zoom:focus-visible .mv-tip, .mv-zoom.is-key .mv-tip { opacity: 1; transform: translate(-50%, 0); }

/* ---- the viewer ---- */
.mv { position: fixed; inset: 0; z-index: 2147483600; display: grid; grid-template-rows: auto minmax(0, 1fr);
    font-family: var(--mv-font); color: var(--mv-ink);
    background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--mv-a) 16%, transparent), transparent 60%), rgba(3, 6, 12, 0.9);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    opacity: 0; transition: opacity 0.18s ease; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; }
.mv[hidden] { display: none; }
.mv.is-open { opacity: 1; }
.mv-bar { display: flex; align-items: center; gap: 12px; padding: 12px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
    min-height: 64px; box-sizing: border-box; }
.mv-info { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.mv-name { font-size: 0.95rem; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-meta { font-size: 0.8rem; line-height: 1.3; color: var(--mv-muted); font-variant-numeric: tabular-nums; min-height: 1.04rem; }
.mv-count { flex: 0 0 auto; padding: 5px 11px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: var(--mv-ink); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); }
.mv-count[hidden] { display: none; }
.mv-btn { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; margin: 0; display: grid; place-items: center; border-radius: 50%;
    cursor: pointer; color: var(--mv-ink); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.mv-btn svg { width: 20px; height: 20px; flex: 0 0 auto; display: block; }
.mv-btn:focus-visible { outline: 2px solid var(--mv-a); outline-offset: 3px; }
.mv-btn:active { transform: scale(0.94); }
.mv-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 16px 24px; box-sizing: border-box; }
.mv-media { display: block; max-width: 92vw; max-height: min(86vh, calc(100vh - 104px)); max-height: min(86dvh, calc(100dvh - 104px));
    width: auto; height: auto; object-fit: contain; border-radius: 14px; background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: mv-in 0.2s ease both; -webkit-user-select: none; user-select: none; }
img.mv-media { -webkit-user-drag: none; }
video.mv-media { background: #000; min-width: min(320px, 92vw); }
.mv-nav { position: absolute; top: 50%; margin-top: 12px; width: 52px; height: 52px; transform: translateY(-50%);
    background: rgba(8, 12, 22, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.mv-nav:active { transform: translateY(-50%) scale(0.94); }
.mv-nav[hidden] { display: none; }
.mv-prev { left: max(16px, env(safe-area-inset-left)); }
.mv-next { right: max(16px, env(safe-area-inset-right)); }
.mv-spin { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -29px 0 0 -17px; border-radius: 50%; pointer-events: none;
    border: 3px solid rgba(255, 255, 255, 0.14); border-top-color: var(--mv-b); border-right-color: var(--mv-a);
    opacity: 0; transition: opacity 0.2s ease 0.25s; animation: mv-turn 0.8s linear infinite; z-index: 1; }
.mv.is-loading .mv-spin { opacity: 1; }
.mv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* hover only where there is a pointer (a tap on a phone never leaves an arrow lit) */
@media (hover: hover) {
    .mv-btn:hover { background: rgba(255, 255, 255, 0.13); border-color: var(--mv-line); box-shadow: 0 0 18px var(--mv-glow); }
    .mv-close:hover { background: linear-gradient(135deg, var(--mv-a), var(--mv-b)); color: #050a14; border-color: transparent; }
    .mv-nav:hover { background: linear-gradient(135deg, var(--mv-a), var(--mv-b)); color: #050a14; border-color: transparent; }
}

@keyframes mv-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes mv-pop { from { opacity: 0; } to { opacity: 1; } }   /* opacity only: the position is its transform */
@keyframes mv-turn { to { transform: rotate(360deg); } }

/* phone: the arrows go to the bottom corners, the picture keeps the whole width */
@media (max-width: 640px) {
    .mv-bar { min-height: 58px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
    .mv-stage { padding: 0 8px 76px; }
    .mv-media { max-width: calc(100vw - 16px); max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); border-radius: 12px; }
    .mv-nav { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); margin-top: 0; transform: none; width: 48px; height: 48px; }
    .mv-nav:active { transform: scale(0.94); }
    .mv-prev { left: calc(50% - 60px); }
    .mv-next { right: calc(50% - 60px); }
}
@media (prefers-reduced-motion: reduce) {
    .mv, .mv-media, .mv-zoom, .mv-tip, .mv-btn { transition: none; animation: none; }
    .mv-spin { animation-duration: 2.4s; }
}
.mv.mv-still, .mv.mv-still .mv-media { transition: none; animation: none; }
