/* ── viewer: media previews modelled on mature editors (Air, VEED, Dropbox) ── */
:root { --stage: #0f0e0d; --stage-line: rgba(255,255,255,.06); --vw-glass: rgba(22,20,18,.72); --vw-glass-line: rgba(255,255,255,.09); --vw-ink: #f3eee8; }
[data-theme=light] { --stage: #ece8e2; --stage-line: rgba(0,0,0,.06); --vw-glass: rgba(255,255,255,.78); --vw-glass-line: rgba(0,0,0,.08); --vw-ink: #1c1916; }

/* stage: a calm, flat backdrop; transparency is shown only under the picture itself */
.stage, .img2-view { background: var(--stage) !important; background-image: none !important; border-color: var(--stage-line); }
.stage[data-bg=light] { background: #f6f4f0 !important; }
.stage[data-bg=checker] { background-color: var(--checker-2) !important; background-image: linear-gradient(45deg,var(--checker) 25%,transparent 25%,transparent 75%,var(--checker) 75%),linear-gradient(45deg,var(--checker) 25%,transparent 25%,transparent 75%,var(--checker) 75%) !important; background-size: 20px 20px !important; background-position: 0 0,10px 10px !important; }
.stage > img, .stage > canvas, .stage .img2-wrap > :is(img,canvas):first-child, .stage .img2-fit, .img2-compare-wrap :is(img,canvas) {
  background-color: #fff; background-image: linear-gradient(45deg,#e9e6e1 25%,transparent 25%,transparent 75%,#e9e6e1 75%),linear-gradient(45deg,#e9e6e1 25%,transparent 25%,transparent 75%,#e9e6e1 75%);
  background-size: 14px 14px; background-position: 0 0,7px 7px;
  border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 2px 6px rgba(0,0,0,.18), 0 18px 48px -12px rgba(0,0,0,.45);
}
.stage { padding: clamp(14px, 3vw, 28px); }

/* floating controls on the stage */
.vw-ctl { position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--vw-glass); border: 1px solid var(--vw-glass-line); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: .0; transform: translateY(4px); transition: opacity .2s, transform .25s var(--ease-out, ease); }
.stage:hover > .vw-ctl, .stage:focus-within > .vw-ctl, .vw-max > .vw-ctl { opacity: 1; transform: none; }
@media (hover: none) { .vw-ctl { opacity: 1; transform: none; } }
.vw-b { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--vw-ink); cursor: pointer; transition: background .15s, transform .12s; }
.vw-b:hover { background: color-mix(in oklab, var(--vw-ink) 12%, transparent); }
.vw-b:active { transform: scale(.92); }
.vw-b svg, .vp-b svg { width: 17px; height: 17px; }

/* full screen: native where possible, fixed overlay elsewhere (iPhone) */
.stage:fullscreen, .vw-max.stage { border-radius: 0; border: 0; min-height: 100dvh; }
.stage:fullscreen > :is(img,canvas), .vw-max.stage > :is(img,canvas) { max-height: calc(100dvh - 60px) !important; max-width: calc(100vw - 40px) !important; }
.vw-max { position: fixed !important; inset: 0 !important; z-index: 900; margin: 0 !important; border-radius: 0 !important; width: 100vw !important; height: 100dvh !important; max-height: none !important; }
.vw-lock, .vw-lock body { overflow: hidden; }

/* file header: name + facts, like a document title bar */
.vw-head { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 2px 2px 0; }
.vw-fi { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.vw-fi svg { width: 18px; height: 18px; }
.vw-name { font: 600 14px/1.25 var(--f-ui); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vw-chips { display: flex; gap: 4px; flex: none; }
.vw-chips i { font: 500 11px/1 var(--f-mono, ui-monospace, monospace); font-style: normal; color: var(--text-2); padding: 5px 7px; border-radius: 7px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.img2-tb.has-head { flex-wrap: nowrap; }
.img2-tb.has-head > .vw-head { flex: 1 1 auto; margin-right: 6px; }
.img2-tb.has-head > .hint.num, .img2-tb.has-head > .sp { display: none; }
@media (max-width: 760px) {
  .vw-chips i:nth-child(n+3) { display: none; }
  .vw-name { font-size: 13px; }
  .img2-tb.has-head { flex-wrap: wrap; row-gap: 6px; }
  .img2-tb.has-head > .vw-head { flex: 1 0 100%; margin: 0; }
}

/* ───────── video player ───────── */
.vp { position: relative; border-radius: var(--r-lg, 18px); overflow: hidden; background: #000; isolation: isolate; outline: none; line-height: 0; }
.vp > video { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #000; border: 0 !important; border-radius: 0 !important; }
.vp.vw-max > video, .vp:fullscreen > video { max-height: 100dvh; height: 100%; }
.vp-big { position: absolute; left: 50%; top: calc(50% - 26px); width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(16,14,12,.5); color: #fff; display: grid; place-items: center; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); cursor: pointer; opacity: 0; transform: scale(.8); transition: opacity .2s, transform .3s cubic-bezier(.3,1.4,.5,1); pointer-events: none; }
.vp-big svg { width: 26px; height: 26px; margin-left: 3px; }
.vp.paused .vp-big { opacity: 1; transform: none; pointer-events: auto; }
.vp-big:hover { background: rgba(16,14,12,.7); transform: scale(1.06) !important; }
.vp-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 30px 10px 10px; line-height: 1; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .25s; }
.vp:hover .vp-bar, .vp.paused .vp-bar, .vp:focus-within .vp-bar { opacity: 1; transform: none; }
@media (hover: none) { .vp-bar { opacity: 1; transform: none; } }
.vp-b { height: 32px; min-width: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: #fff; cursor: pointer; font: 600 12px var(--f-ui); flex: none; transition: background .15s, transform .12s; }
.vp-b:hover { background: rgba(255,255,255,.14); }
.vp-b:active { transform: scale(.92); }
.vp-rate { padding: 0 6px; font-variant-numeric: tabular-nums; }
.vp-time { font: 500 12px var(--f-mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 4px; flex: none; }
.vp-time s { text-decoration: none; opacity: .5; }
.vp-scrub { position: relative; flex: 1; min-width: 60px; height: 34px; border-radius: 8px; background: rgba(255,255,255,.14); cursor: pointer; touch-action: none; overflow: visible; outline: none; }
.vp-scrub:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.vp-strip { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; opacity: 0; transition: opacity .5s; object-fit: cover; }
.vp-strip.on { opacity: .85; }
.vp-buf { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: rgba(255,255,255,.08); pointer-events: none; }
.vp-prog { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px 0 0 8px; background: color-mix(in oklab, var(--accent) 34%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--accent) 70%, transparent); pointer-events: none; }
.vp-head { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.4); pointer-events: none; transition: transform .15s; }
.vp-scrub.drag .vp-head { transform: scaleX(1.6); }
.vp-tip { position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); padding: 4px 7px; border-radius: 7px; background: rgba(12,11,10,.9); font: 500 11px var(--f-mono, ui-monospace, monospace); color: #fff; white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.vp-scrub:hover .vp-tip, .vp-scrub.drag .vp-tip { opacity: 1; }
@media (max-width: 560px) { .vp-rate { display: none; } .vp-time { font-size: 11px; } .vp-bar { gap: 2px; padding: 24px 6px 6px; } }

/* ───────── PDFs: paper on a calm desk ───────── */
.pdf-scroll { background: var(--stage) !important; border-color: var(--stage-line) !important; }
.pdf-page { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.2), 0 16px 40px -10px rgba(0,0,0,.45) !important; }
.pdf-th .pg, .pg { box-shadow: 0 0 0 1px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.14), 0 8px 20px -8px rgba(0,0,0,.4) !important; border-radius: 3px !important; }
.pdf-tool { background: var(--vw-glass); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }

/* ───────── the opening flight ───────── */
.vw-fly { position: fixed; z-index: 9999; border-radius: 14px; overflow: hidden; pointer-events: none; transform-origin: 0 0; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 24px 60px -12px rgba(0,0,0,.55), 0 8px 16px rgba(0,0,0,.18); will-change: transform; }
.vw-fly img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vw-fly.go { box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 10px 30px -10px rgba(0,0,0,.4); transition: box-shadow .6s; }
.vw-fly.pdf { padding: 14% 12%; display: flex; flex-direction: column; }
.vw-fly.pdf .pp { display: flex; flex-direction: column; gap: 7%; flex: 1; }
.vw-fly.pdf .pp i { display: block; height: 5%; min-height: 4px; border-radius: 2px; background: #d9d4cc; }
.vw-fly.pdf .pp i:first-child { width: 62%; height: 8%; background: #b9b2a7; }
.vw-fly.pdf .pp i.s { width: 74%; }
.vw-fly.pdf b { align-self: flex-start; font: 800 10px/1 var(--f-ui); color: #fff; background: #e5484d; padding: 4px 6px; border-radius: 5px; letter-spacing: .04em; }
.vw-fly.wait { background: linear-gradient(110deg, #ece8e2 30%, #f8f6f2 50%, #ece8e2 70%) 0 0 / 300% 100%; animation: vw-shim 1.1s linear infinite; }
@keyframes vw-shim { to { background-position: -150% 0; } }
.vw-fly { transition: left .3s cubic-bezier(.32,.72,0,1), top .3s cubic-bezier(.32,.72,0,1), width .3s cubic-bezier(.32,.72,0,1), height .3s cubic-bezier(.32,.72,0,1); }
.vw-fly.go { transition: none; }
@media (max-width: 760px) {
  .img2-tb.has-head > .sp { display: block; }
  .img2-tb .btn.sm:not(.icon) .lbl { font-size: 0; gap: 0; }
  .img2-tb .btn.sm:not(.icon) { padding-inline: 9px; }
}
.pdf-scroll:focus, .pdf-scroll:focus-visible { outline: none; }
.pdf-scroll:focus-visible { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent); }
.pdf-thumbs .pdf-th:not(.sel) { background: transparent; border-color: transparent; }
.pdf-thumbs .pdf-th.sel { background: color-mix(in oklab, var(--accent) 10%, transparent); box-shadow: none; }
