/* =============================================================================
   dcCMS — Achilles :: Before / After (przed i po)
   Wymaga tokens.css (kolory, fonty, radiusy, cienie).
   ============================================================================= */

.dc-beforeafter { --dc-ba-handle: 44px; --dc-ba-thumb-w: 250px; max-width: 1000px; margin-inline: auto; }

/* ---- Nagłówek sekcji -------------------------------------------------- */
.dc-ba__head { text-align: center; margin-bottom: 40px; }
.dc-ba__eyebrow { margin: 0 0 12px; font-family: var(--font-body); font-size: 0.75rem; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--ls-wider); color: var(--teal); }
.dc-ba__title { margin: 0; font-family: var(--font-heading); font-size: var(--fs-h2); line-height: var(--lh-heading); letter-spacing: var(--ls-tight); color: var(--navy); }
.dc-ba__subtitle { margin: 16px auto 0; max-width: 640px; font-family: var(--font-body); font-size: var(--fs-body-lg); line-height: var(--lh-relaxed); color: var(--color-text-secondary); }

/* ---- Scena / przypadki ------------------------------------------------ */
.dc-ba__stage { position: relative; }
.dc-ba__case { display: none; }
.dc-ba__case.is-active { display: block; }

/* ---- Kadr porównania -------------------------------------------------- */
.dc-ba__frame { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-lg);
    touch-action: none; user-select: none; cursor: ew-resize; background: var(--ink-100); } /* touch-action: pełna obsługa przeciągania na dotyku */
.dc-ba__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.dc-ba__img--before { clip-path: inset(0 calc(100% - var(--dc-ba-pos, 50%)) 0 0); } /* PRZED przycinane do pozycji suwaka (od lewej) */

/* ---- Etykiety PRZED / PO ---------------------------------------------- */
.dc-ba__label { position: absolute; top: 16px; z-index: 3; padding: 6px 14px; border-radius: var(--radius-pill); font-family: var(--font-body); font-size: 0.7rem;
    font-weight: var(--fw-bold); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; pointer-events: none; }
.dc-ba__label--before { left: 16px; background: var(--navy); }
.dc-ba__label--after { right: 16px; background: var(--teal); }

/* ---- Uchwyt suwaka ---------------------------------------------------- */
.dc-ba__handle { position: absolute; top: 0; left: 50%; z-index: 4; height: 100%; width: 3px; margin-left: -1.5px; background: rgba(255, 255, 255, 0.9); pointer-events: none; }
.dc-ba__handle-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: var(--dc-ba-handle); height: var(--dc-ba-handle); display: flex; align-items: center;
    justify-content: center; border-radius: 50%; background: #fff; color: var(--teal); font-size: 1.1rem; box-shadow: var(--shadow-md); }
.dc-ba__frame.is-dragging .dc-ba__handle-btn { transform: translate(-50%, -50%) scale(1.08); }

/* ---- Natywny <input range> — niewidoczny, ale chwyta cały kadr -------- */
.dc-ba__range { position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; background: transparent; }
.dc-ba__range:focus-visible { outline: none; }
.dc-ba__range:focus-visible ~ .dc-ba__handle .dc-ba__handle-btn { outline: 3px solid var(--teal); outline-offset: 2px; }
.dc-ba__range::-webkit-slider-thumb { -webkit-appearance: none; width: var(--dc-ba-handle); height: 100%; cursor: ew-resize; }
.dc-ba__range::-moz-range-thumb { width: var(--dc-ba-handle); height: 100%; border: 0; background: transparent; cursor: ew-resize; }

/* ---- Podpis przypadku ------------------------------------------------- */
.dc-ba__caption { margin: 20px 0 0; text-align: center; font-family: var(--font-body); font-size: var(--fs-body); color: var(--color-text-secondary); }

/* ---- Nawigacja miniaturkami ------------------------------------------ */
/* Pasek przewijany w poziomie (palec / trackpad / shift+kółko), ze snapem.
   Centrowanie przez auto-marginesy skrajnych miniatur zamiast justify-content:center —
   przy przepełnieniu nie ucina pierwszej miniatury z lewej. */
.dc-ba__nav { position: relative; display: flex; gap: 12px; margin-top: 32px; padding: 6px 4px 10px; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--ink-100) transparent; }
.dc-ba__nav::-webkit-scrollbar { height: 6px; }
.dc-ba__nav::-webkit-scrollbar-thumb { background: var(--ink-100); border-radius: 3px; }
.dc-ba__navbtn { position: relative; flex: 0 0 var(--dc-ba-thumb-w); width: var(--dc-ba-thumb-w); aspect-ratio: 25 / 17; padding: 0; overflow: hidden; scroll-snap-align: center;
    border-radius: var(--radius-md); border: 3px solid transparent; background: var(--ink-50); cursor: pointer; opacity: 0.6;
    transition: opacity var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.dc-ba__navbtn:first-child { margin-left: auto; }
.dc-ba__navbtn:last-child { margin-right: auto; }
.dc-ba__navbtn:hover { opacity: 0.9; }
.dc-ba__navbtn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.dc-ba__navbtn.is-active { opacity: 1; border-color: var(--teal); box-shadow: var(--shadow-sm); }
.dc-ba__thumb { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }

/* ---- Responsywnie ----------------------------------------------------- */
@media (max-width: 575px) {
    .dc-beforeafter { --dc-ba-handle: 38px; --dc-ba-thumb-w: 150px; }
    .dc-ba__frame { aspect-ratio: 4 / 5; }
    .dc-ba__nav { gap: 10px; margin-top: 24px; }
}
