/*
 * Shared video player, lightbox and media thumbnails for the export catalog
 * and the truck showroom. Colours follow the host design through
 * --otc-accent when present.
 */

/* ------------------------------------------------------ theme shield --- */
/*
 * Page builders and themes style bare elements site-wide: an Elementor kit colours
 * every heading, link and button and fills every svg; theme resets restyle form
 * fields and tables. Two defences keep the plugin looking the same on any theme.
 *
 * 1. Every selector in the plugin's front-end CSS carries :not(#ob-scope). It
 *    matches everything and adds one ID to the specificity, so class-based theme
 *    rules (hover and focus states included) cannot override the plugin, while the
 *    plugin's own rules keep their order. Add it to new selectors too; the test
 *    tests/css-scope.php checks every file.
 * 2. The resets below return the elements themes like to style to browser defaults
 *    inside the plugin's markup. This file loads first (catalog.css and base.css
 *    depend on it) and :where() keeps them at the lowest plugin specificity, so the
 *    plugin's own rules still win over them.
 */
:is(.otc, .otc-layer, .obtc-trucks, .otm-lightbox):not(#ob-scope) :where(h1, h2, h3, h4, h5, h6, button, input, select, option, textarea, label, legend, table, caption, thead, tbody, tfoot, tr, th, td, figcaption) { all: revert; }
:is(.otc, .otc-layer, .obtc-trucks, .otm-lightbox):not(#ob-scope) :where(a) { font: inherit; letter-spacing: inherit; text-transform: inherit; }
:is(.otc, .otc-layer, .obtc-trucks, .otm-lightbox):not(#ob-scope) :where(button:not(:disabled)) { cursor: pointer; }
:is(.otc, .otc-layer, .obtc-trucks, .otm-lightbox):not(#ob-scope) :where(svg[fill="none"]) { fill: none; }
:is(.otc, .otc-layer, .obtc-trucks, .otm-lightbox):not(#ob-scope) :where(svg:not([fill])) { fill: initial; }

.otm-sr:not(#ob-scope) { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html.otm-locked:not(#ob-scope) { overflow: hidden; }

/* ------------------------------------------------------------ player --- */
.otm-player:not(#ob-scope) { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0b1412; border-radius: inherit; overflow: hidden; }
.otm-player.is-portrait:not(#ob-scope) { aspect-ratio: 9 / 16; max-height: min(78vh, 720px); margin-inline: auto; width: auto; height: min(78vh, 720px); max-width: 100%; }
.otm-player:not(#ob-scope) video, .otm-player:not(#ob-scope) iframe { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.otm-poster:not(#ob-scope) { all: unset; box-sizing: border-box; position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; background: #0b1412; }
.otm-poster:not(#ob-scope) img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .92; transition: transform .4s ease, opacity .2s; }
.otm-player.is-portrait:not(#ob-scope) .otm-poster img { object-fit: contain; }
.otm-poster:hover:not(#ob-scope) img { transform: scale(1.02); opacity: 1; }
.otm-poster:focus-visible:not(#ob-scope) { outline: 3px solid var(--otc-accent, #1b6b57); outline-offset: -3px; }
.otm-play:not(#ob-scope) { position: relative; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--otc-accent, #1b6b57); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .2s; }
.otm-play:not(#ob-scope) svg { width: 34px; height: 34px; margin-left: 4px; }
.otm-poster:hover:not(#ob-scope) .otm-play { transform: scale(1.07); }
.otm-caption:not(#ob-scope) { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 12px; padding: 36px 18px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); color: #fff; font-size: 14px; text-align: left; }
.otm-caption:not(#ob-scope) strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otm-caption:not(#ob-scope) span { flex: none; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .45); font-variant-numeric: tabular-nums; font-size: 12px; }

/* ------------------------------------------------------------ thumbs --- */
.otm-thumb:not(#ob-scope) { position: relative; flex: none; width: 76px; height: 76px; margin: 0; padding: 0; border: 1px solid rgba(16, 35, 31, .14); border-radius: 12px; background: #fff; overflow: hidden; cursor: pointer; }
.otm-thumb:not(#ob-scope) img { width: 100%; height: 100%; object-fit: cover; display: block; }
.otm-thumb:not(.is-video):not(#ob-scope) img { object-fit: contain; padding: 5px; box-sizing: border-box; }
.otm-thumb[aria-pressed=true]:not(#ob-scope) { border-color: var(--otc-accent, #1b6b57); box-shadow: inset 0 0 0 2px var(--otc-accent, #1b6b57); }
.otm-thumb-blank:not(#ob-scope) { display: block; width: 100%; height: 100%; background: #1b2926; }
.otm-thumb-play:not(#ob-scope) { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .28); color: #fff; }
.otm-thumb-play:not(#ob-scope) svg { width: 26px; height: 26px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.otm-thumb-time:not(#ob-scope) { position: absolute; right: 4px; bottom: 4px; padding: 1px 5px; border-radius: 5px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- lightbox --- */
.otm-lightbox:not(#ob-scope) { position: fixed; inset: 0; z-index: 100050; display: none; grid-template-rows: auto minmax(0, 1fr) auto auto; background: rgba(6, 12, 11, .96); color: #fff; font-family: inherit; }
.otm-lightbox.is-open:not(#ob-scope) { display: grid; }
.otm-lb-stage:not(#ob-scope) { grid-row: 2; display: grid; place-items: center; min-height: 0; padding: 12px 72px; }
.otm-lb-stage:not(#ob-scope) > img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; background: #fff; }
.otm-lb-stage:not(#ob-scope) .otm-player { width: min(100%, 1200px); max-height: 100%; border-radius: 12px; }
.otm-lb-stage:not(#ob-scope) .otm-player.is-portrait { width: auto; height: 100%; max-height: 100%; }
.otm-lb-bar:not(#ob-scope) { grid-row: 3; display: flex; gap: 14px; justify-content: center; align-items: center; padding: 6px 16px; font-size: 14px; color: rgba(255, 255, 255, .8); }
.otm-lb-count:not(#ob-scope) { font-variant-numeric: tabular-nums; }
.otm-lb-title:not(#ob-scope) { color: #fff; font-weight: 600; }
.otm-lb-strip:not(#ob-scope) { grid-row: 4; display: flex; gap: 8px; justify-content: center; overflow-x: auto; padding: 8px 16px 16px; }
.otm-lb-strip:not(#ob-scope) .otm-thumb { width: 64px; height: 64px; border-color: rgba(255, 255, 255, .2); }
.otm-lb-strip:not(#ob-scope) .otm-thumb[aria-pressed=true] { border-color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.otm-lb-btn:not(#ob-scope) { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; transition: background .15s; }
.otm-lb-btn:hover:not(#ob-scope) { background: rgba(255, 255, 255, .24); }
.otm-lb-btn:focus-visible:not(#ob-scope) { outline: 2px solid #fff; outline-offset: 2px; }
.otm-lb-btn:not(#ob-scope) svg { width: 24px; height: 24px; }
.otm-lb-close:not(#ob-scope) { top: 14px; right: 14px; }
.otm-lb-prev:not(#ob-scope), .otm-lb-next:not(#ob-scope) { top: 50%; margin-top: -24px; }
.otm-lb-prev:not(#ob-scope) { left: 14px; }
.otm-lb-prev:not(#ob-scope) svg { transform: rotate(180deg); }
.otm-lb-next:not(#ob-scope) { right: 14px; }
.otm-lightbox.is-single:not(#ob-scope) .otm-lb-prev, .otm-lightbox.is-single:not(#ob-scope) .otm-lb-next { display: none; }

@media (max-width: 640px) {
	.otm-lb-stage:not(#ob-scope) { padding: 58px 8px 8px; }
	.otm-lb-prev:not(#ob-scope), .otm-lb-next:not(#ob-scope) { top: auto; bottom: 86px; margin: 0; width: 42px; height: 42px; }
	.otm-lb-strip:not(#ob-scope) .otm-thumb { width: 52px; height: 52px; }
	.otm-play:not(#ob-scope) { width: 60px; height: 60px; }
	.otm-play:not(#ob-scope) svg { width: 28px; height: 28px; }
	.otm-player.is-portrait:not(#ob-scope) { height: min(70vh, 640px); }
}
@media (prefers-reduced-motion: reduce) {
	.otm-poster:not(#ob-scope) img, .otm-play:not(#ob-scope) { transition: none; }
}
