/* =========================================================================
   Trim pages: "Preview right-hand drive" on the interior photo (UST\Rhd_Preview, rhd-preview.js).
   The mirror is a copy of the photo flipped with transform: scaleX(-1), shown from the handle (--rhd, its position
   from the left; 100% = the original) to the right edge. Theme tokens from site.css; the section is dark (carbon).
   Selectors are specific enough not to depend on the order this file and site.css load in.
   ========================================================================= */

.ust-inside__media .ust-rhd { --rhd: 100%; position: relative; overflow: hidden; cursor: ew-resize; touch-action: pan-y pinch-zoom; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.ust-inside__media .ust-rhd img { -webkit-user-drag: none; }
.ust-inside__media .ust-rhd__mirror { position: absolute; inset: 0; z-index: 1; clip-path: inset(0 0 0 var(--rhd)); pointer-events: none; }
.ust-inside__media .ust-rhd__mirror .ust-rhd__copy { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; transform: scaleX(-1); }

/* The handle: a hairline at the edge of the mirror and a square grip, kept fully on the photo at either end. */
.ust-inside__media .ust-rhd__line { position: absolute; top: 0; bottom: 0; left: var(--rhd); z-index: 2; width: 2px; margin-left: -1px; background: var(--bone); box-shadow: 0 0 0 1px rgba(10, 11, 12, 0.35); pointer-events: none; }
.ust-inside__media .ust-rhd__grip {
  position: absolute; top: 50%; left: clamp(1.5rem, var(--rhd), calc(100% - 1.5rem)); z-index: 3;
  display: grid; place-items: center; width: 3rem; height: 3rem; transform: translate(-50%, -50%);
  background: var(--ink); color: var(--bone); border: 1px solid var(--bone); pointer-events: none;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ust-inside__media .ust-rhd:hover .ust-rhd__grip { background: var(--red); border-color: var(--red); color: var(--white); }
/* The range input is invisible and sits exactly under the grip, so when it takes focus (Tab or Shift+Tab) the browser
   scrolls the grip, and its focus ring, into view. Pointer input goes to the photo (rhd-preview.js). */
.ust-inside__media .ust-rhd__input { position: absolute; top: 50%; left: clamp(1.5rem, var(--rhd), calc(100% - 1.5rem)); z-index: 0; width: 3rem; height: 3rem; margin: 0; padding: 0; border: 0; background: none; opacity: 0; transform: translate(-50%, -50%); pointer-events: none; -webkit-appearance: none; appearance: none; }
.ust-inside__media .ust-rhd__input:focus-visible ~ .ust-rhd__grip { box-shadow: var(--focus); background: var(--red); border-color: var(--red); color: var(--white); }

/* Which side is which, on the photo (decorative: the note and the slider's value say it in words). */
.ust-inside__media .ust-rhd__tag { position: absolute; top: var(--space-3); padding: 0.35em 0.6em; background: rgba(10, 11, 12, 0.82); color: var(--bone); font-family: var(--font-mono); font-size: var(--step--2); font-weight: 500; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.12em; pointer-events: none; white-space: nowrap; }
.ust-inside__media .ust-rhd__tag--original { left: var(--space-3); }
.ust-inside__media .ust-rhd__tag--mirror { right: var(--space-3); }

/* Under the photo: the control's label, and the hint or the mirror-view note. */
.ust-inside__media .ust-rhd__bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-5); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.ust-inside__media .ust-rhd__label { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-mono); font-size: var(--step--2); font-weight: 500; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text); cursor: pointer; }
.ust-inside__media .ust-rhd__label svg { flex: none; width: 1.1rem; height: 1.1rem; color: var(--accent); }
.ust-inside__media .ust-rhd__note { flex: 1 1 22rem; margin: 0; font-size: var(--step--1); line-height: 1.5; color: var(--text-muted); }
.ust-inside__media .ust-rhd__bar.is-mirrored .ust-rhd__note { color: var(--text); }

/* Keyboard steps glide; dragging follows the pointer directly. */
@media (prefers-reduced-motion: no-preference) {
  .ust-inside__media .ust-rhd.is-keyed .ust-rhd__mirror { transition: clip-path 160ms var(--ease); }
  .ust-inside__media .ust-rhd.is-keyed .ust-rhd__line, .ust-inside__media .ust-rhd.is-keyed .ust-rhd__grip { transition: left 160ms var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
}

/* Printed pages show the photo as published. */
@media print {
  .ust-inside__media .ust-rhd__mirror, .ust-inside__media .ust-rhd__line, .ust-inside__media .ust-rhd__grip, .ust-inside__media .ust-rhd__tag, .ust-inside__media .ust-rhd__bar { display: none !important; }
}
