/* beforeafter.css: before/after comparison (js/beforeafter.js). Felix, 12/3.

   Replaces the theme's twentytwenty plugin and keeps its look. The values below are the theme's
   (frontend.css), so this file still works once the theme CSS is gone. Per-module settings (bar colour
   and width, arrow colour and size, arrow spacing) stay in each page's CSS, which targets
   [data-ba-direction="horizontal"] .ba-bar, .ba-arrow svg path and [data-ba-arrow-direction="left"].

   Markup after the script runs:
     <div class="is-content beforeafter fc-ba" data-ba-direction="horizontal" data-start="65">
       <img class="fc-ba-before">  first image, in the flow (gives the box its height), clipped at the handle
       <img class="fc-ba-after">   second image, underneath
       <div class="ba-handle" role="slider">  arrow, bar, arrow
*/

.fc-ba { position: relative; z-index: 0; overflow: hidden; box-sizing: content-box; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.fc-ba[data-ba-direction="vertical"] { touch-action: pan-x; }
.fc-ba * { box-sizing: content-box; }
.fc-ba > img { display: block; max-width: 100%; -webkit-user-drag: none; }
.fc-ba > .fc-ba-before { position: relative; z-index: 20; }
.fc-ba > .fc-ba-after { position: absolute; top: 0; left: 0; z-index: 10; }

/* handle: arrow, bar, arrow, centred on the dividing line */
.fc-ba .ba-handle { position: absolute; top: 0; left: 50%; height: 100%; display: flex; transform: translateX(-50%); cursor: pointer; z-index: 40; touch-action: none; outline: 0; }
.fc-ba .ba-handle .ba-bar { width: 3px; height: 100%; background-color: #fff; }
.fc-ba .ba-handle .ba-arrow { width: 16px; height: 100%; display: flex; align-items: center; }
.fc-ba .ba-handle .ba-arrow svg { width: 16px; height: auto; }
.fc-ba .ba-handle .ba-arrow svg path { stroke: #fff; }
.fc-ba .ba-handle [data-ba-arrow-direction="left"] { margin-right: 15px; }
.fc-ba .ba-handle [data-ba-arrow-direction="left"] svg { transform: rotate(180deg); }
.fc-ba .ba-handle [data-ba-arrow-direction="right"] { margin-left: 15px; }
.fc-ba .ba-handle:focus-visible .ba-bar { outline: 2px solid var(--fc-acc, #ffd300); outline-offset: 2px; }

.fc-ba[data-ba-direction="vertical"] > img { width: 100% !important; }
.fc-ba[data-ba-direction="vertical"] .ba-handle { top: 50%; left: 0; width: 100%; height: auto; flex-direction: column; transform: translateY(-50%); }
.fc-ba[data-ba-direction="vertical"] .ba-handle .ba-bar { width: 100%; height: 3px; }
.fc-ba[data-ba-direction="vertical"] .ba-handle .ba-arrow { width: 16px; height: auto; margin: 0 auto; justify-content: center; }
.fc-ba[data-ba-direction="vertical"] .ba-handle [data-ba-arrow-direction="up"] svg { transform: rotate(90deg); }
.fc-ba[data-ba-direction="vertical"] .ba-handle [data-ba-arrow-direction="down"] svg { transform: rotate(-90deg); }
