/* Media card (assets/js/preview-viewer.js): a setting's captures with its control over the picture, comparison
   modes and the lightbox. The overlay always uses dark colours: it sits on the picture in both themes. */
.mc { display: grid; gap: 8px; }
.mc-stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; border-radius: var(--r, 10px);
  background: #000; color: var(--ov-text); user-select: none; -webkit-user-select: none; touch-action: pan-y;
  border: 1px solid var(--border, #27272D); outline: none; isolation: isolate;
}
.mc-stage:focus-visible { box-shadow: 0 0 0 2px var(--accent, #5B8CFF); }
.mc-media { position: absolute; inset: 0; isolation: isolate; }
.mc-img, .mc-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.mc-img:not([src]) { visibility: hidden; }
.mc-b, .mc-side, .mc-divider { display: none; }
.mc-video { z-index: 1; }
.mc-video[hidden] { display: none; }

/* Modes */
.mc[data-mode="hover"] .mc-b { display: block; visibility: hidden; }
.mc[data-mode="hover"] .mc-stage.mc-pointer .mc-b,
/* keyboard focus on the picture itself; a clicked toolbar button keeps focus and must not hold B on screen */
.mc[data-mode="hover"] .mc-stage:focus-visible .mc-b { visibility: visible; }
.mc[data-mode="swipe"] .mc-stage { cursor: ew-resize; }
.mc[data-mode="swipe"] .mc-b { display: block; clip-path: inset(0 0 0 var(--mc-split, 50%)); }
.mc[data-mode="swipe"] .mc-divider { display: block; position: absolute; top: 0; bottom: 0; left: var(--mc-split, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px rgb(0 0 0 / .6); z-index: 2; pointer-events: none; }
.mc[data-mode="swipe"] .mc-divider::after { content: ""; position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--ov-panel); border: 2px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .5); }
.mc[data-mode="onion"] .mc-b { display: block; opacity: var(--mc-opacity, .5); }
.mc[data-mode="diff"] .mc-b { display: block; mix-blend-mode: difference; }
.mc[data-mode="side"] .mc-a, .mc[data-mode="side"] .mc-b { display: none; }
.mc[data-mode="side"] .mc-side { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; position: absolute; inset: 0; background: #000; }
.mc[data-mode="side"] .mc-side .mc-img { position: static; }

/* Labels of the shown values */
.mc-tag { position: absolute; top: 52px; z-index: 3; max-width: 45%; padding: 4px 9px; border-radius: 999px; background: var(--ov-bg); border: 1px solid var(--ov-line); font: 600 .75rem/1.2 var(--font, system-ui); color: var(--ov-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(6px); }
.mc-tag:empty { display: none; }
.mc-tag-a { left: 12px; }
.mc-tag-b { right: 12px; }
.mc:not(.mc-comparing) .mc-tag-a { top: auto; bottom: 62px; }
.mc-missing { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px; text-align: center; font-size: .95rem; color: var(--ov-text2); background: radial-gradient(circle, rgb(255 255 255 / .04), transparent 70%); }
.mc-spinner { position: absolute; right: 14px; bottom: 64px; z-index: 3; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .25); border-top-color: #fff; animation: mc-spin .8s linear infinite; }
@keyframes mc-spin { to { transform: rotate(360deg); } }

/* Bars over the picture: compact when idle, full on hover or focus; always full on touch */
.mc-bar { position: absolute; left: 0; right: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 12px; transition: opacity .15s, background .15s; }
.mc-top { top: 0; background: linear-gradient(rgb(0 0 0 / .55), transparent); opacity: .72; }
.mc-bottom { bottom: 0; background: linear-gradient(transparent, rgb(0 0 0 / .72)); padding-top: 22px; }
.mc-stage:hover .mc-top, .mc-stage:focus-within .mc-top, .mc-comparing .mc-top { opacity: 1; }
@media (hover: none) { .mc-top { opacity: 1; } }
.mc-grow { flex: 1; }
.mc-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--ov-line); background: var(--ov-bg); color: var(--ov-text); font: 600 .78rem/1 var(--font, system-ui); cursor: pointer; backdrop-filter: blur(6px); white-space: nowrap; }
.mc-btn:hover { background: rgb(40 40 48 / .8); }
.mc-btn:focus-visible { outline: 2px solid var(--ov-accent); outline-offset: 1px; }
.mc-btn.mc-active { background: var(--ov-accent); border-color: var(--ov-accent); color: var(--ov-on-accent); }
.mc-btn svg { width: 16px; height: 16px; }
.mc-btn.mc-icon { width: 32px; padding: 0; justify-content: center; }
.mc-modes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.mc-pickers { display: inline-flex; gap: 6px; }
.mc-pick-label { display: inline-flex; align-items: center; gap: 6px; font: 600 .75rem/1 var(--font, system-ui); color: var(--ov-text2); }
.mc-pick { height: 30px; border-radius: 8px; border: 1px solid var(--ov-line); background: rgb(9 9 11 / .8); color: var(--ov-text); font: 500 .8rem var(--font, system-ui); padding: 0 8px; max-width: 160px; }
.mc-range { width: 120px; accent-color: #fff; }

/* The setting's control in the bottom bar */
.mc-bottom .segmented { --raised: var(--ov-raised); --text: var(--ov-text); --text2: var(--ov-text2); --border: var(--ov-line2); background: var(--ov-panel); backdrop-filter: blur(6px); }
.mc-bottom .segmented input:checked + span { background: var(--ov-accent); color: var(--ov-on-accent); box-shadow: none; }
.mc-toggle { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px 4px 6px; border-radius: 999px; background: var(--ov-panel); border: 1px solid var(--ov-line); font: 600 .82rem/1 var(--font, system-ui); backdrop-filter: blur(6px); }
.mc-toggle .switch span { --raised: var(--ov-raised); --border: rgb(255 255 255 / .2); --text2: var(--ov-text2); --accent: var(--ov-accent); --on-accent: var(--ov-on-accent); }
.mc-seek { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; }
.mc-seek-track { position: relative; height: 26px; }
.mc-seek input[type="range"] { position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.mc-seek input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--ov-accent) var(--fill, 0%), rgb(255 255 255 / .3) var(--fill, 0%)); }
.mc-seek input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgb(255 255 255 / .3); }
.mc-seek input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--ov-accent); }
.mc-seek input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgb(91 140 255 / .35); }
.mc-seek input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.mc-seek input[type="range"]:focus-visible { outline: 2px solid var(--ov-accent); outline-offset: 4px; border-radius: 4px; }
.mc-ticks { position: absolute; left: 7px; right: 7px; bottom: 0; height: 5px; pointer-events: none; background: repeating-linear-gradient(90deg, rgb(255 255 255 / .55) 0 1px, transparent 1px calc(100% / var(--steps, 10))); background-size: calc(100% + 1px) 100%; }
.mc-readout { font: 600 .82rem/1 var(--mono, monospace); padding: 6px 9px; border-radius: 8px; background: var(--ov-panel); border: 1px solid var(--ov-line); min-width: 4.5em; text-align: center; }

.mc-note { margin: 0; font-size: .82rem; color: var(--text2, #A1A1AA); }
.mc-note[hidden] { display: none; }
.mc-badge { display: inline-block; font: 600 .71875rem/1 var(--font, system-ui); padding: 3px 7px; border-radius: 999px; background: color-mix(in srgb, var(--warn, #FBBF24) 18%, transparent); color: var(--warn, #FBBF24); }

/* Phones: the bars sit above and below the picture instead of covering most of it; the picture keeps 16:9 */
@media (max-width: 640px) {
  .mc:not(.mc-full) .mc-stage { aspect-ratio: auto; display: flex; flex-direction: column; background: #0D0D10; }
  .mc:not(.mc-full) .mc-media { position: relative; inset: auto; order: 2; aspect-ratio: 16 / 9; background: #000; }
  .mc:not(.mc-full) .mc-top { position: static; order: 1; opacity: 1; background: none; }
  .mc:not(.mc-full) .mc-bottom { position: static; order: 3; background: none; padding-top: 10px; }
  .mc:not(.mc-full) .mc-tag { top: 8px; }
  .mc:not(.mc-full):not(.mc-comparing) .mc-tag-a { top: auto; bottom: 8px; }
  .mc:not(.mc-full) .mc-spinner { bottom: 10px; }
  .mc-bar { padding: 8px; gap: 6px; }
  .mc-btn { height: 30px; padding: 0 9px; font-size: .76rem; }
  .mc-range { flex: 1; min-width: 90px; }
}
@media (max-width: 400px) { .mc-compare-label { display: none; } }

/* Lightbox */
.mc-lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 16px; border: 0; background: rgb(0 0 0 / .94); color: var(--ov-text); box-sizing: border-box; }
.mc-lightbox::backdrop { background: rgb(0 0 0 / .9); }
.mc-lightbox .mc { height: 100%; grid-template-rows: minmax(0, 1fr) auto; }
.mc-lightbox .mc-stage { aspect-ratio: auto; height: 100%; border: 0; }
.mc-lightbox .mc-note { color: var(--ov-muted); }

/* In the settings list: a setting with captures is a media card */
.row.media-row { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; }
.row.media-row .row-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.showcase { margin-top: 28px; }
.showcase .mc-stage { border-radius: var(--r-lg); }

/* A number without a range: captured values as chips, the regular field beside them */
.mc-open { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mc-open-field { background: var(--ov-panel); backdrop-filter: blur(6px); border-radius: 10px; padding: 3px; }
.mc-open-field input { width: 7.5em; background: transparent; color: var(--ov-text); border: 1px solid var(--ov-line2); border-radius: 7px; padding: 5px 8px; font: .86rem/1.2 var(--mono); }
