/* ══════════════════════════════════════════════════════════════
   SNAP — BEFORE / RENDER / AFTER SLIDER
   Used on the homepage hero and the portfolio case studies (/work).
   Markup: <div class="ba" data-ba data-placeholder> … </div>
   - data-placeholder shows the "placeholder photo" note.
     Delete the attribute once real project photos are in.
   - Photos live in /images/ba/ — replace the files, keep the names.
   ══════════════════════════════════════════════════════════════ */

.ba {
  --pos: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #1A2E1F;
  font-family: 'DM Sans', sans-serif;
}

.ba-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  overflow: hidden;
  background: #E9E2D6;
}

.ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, center 55%); /* set --focus on .ba to steer the crop per project */
  user-select: none;
  -webkit-user-drag: none;
}
.ba-img[hidden] { display: none; }

/* Visually hidden label for the range input */
.ba .ba-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ba-left {
  position: absolute;
  inset: 0;
  z-index: 1;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.ba-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  z-index: 2;
  width: 2px;
  margin-left: -1px;
  background: #FDFAF6;
  pointer-events: none;
}

.ba-knob {
  position: absolute;
  top: 50%;
  left: var(--pos);
  z-index: 2;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: #FDFAF6;
  color: #1A2E1F;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(26, 46, 31, 0.28);
  pointer-events: none;
}

/* The real control: an invisible range input over the photo.
   Extends half a thumb past each edge so the thumb centre maps to --pos. */
.ba .ba-range {
  position: absolute;
  top: 0;
  left: -26px;
  z-index: 3;
  width: calc(100% + 52px);
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  touch-action: pan-y;
}
.ba .ba-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 52px; height: 52px; }
.ba .ba-range::-moz-range-thumb { width: 52px; height: 52px; border: 0; }
.ba .ba-range:focus-visible { outline: none; }
.ba .ba-range:focus-visible ~ .ba-knob { box-shadow: 0 0 0 3px #FDFAF6, 0 0 0 6px #A65A39; }

.ba-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #FDFAF6;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(26, 46, 31, 0.18);
}
.ba-toggle button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1A2E1F;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.ba-toggle button[aria-pressed="true"] { background: #1A2E1F; color: #FDFAF6; }

.ba-tag {
  position: absolute;
  top: 26px;
  right: 16px;
  z-index: 2;
  height: 32px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(253, 250, 246, 0.94);
  color: #1A2E1F;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Placeholder note — only while data-placeholder is on the slider */
.ba-note {
  display: none;
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: min(250px, calc(50% - 32px));
  padding: 8px 12px;
  background: rgba(253, 250, 246, 0.94);
  color: #1A2E1F;
  font-size: 12px;
  line-height: 1.45;
}
.ba[data-placeholder] .ba-note { display: block; }
.ba-note-render { display: none; }
.ba[data-stage="render"] .ba-note-before { display: none; }
.ba[data-stage="render"] .ba-note-render { display: inline; }

/* Caption band: the project facts under the photo */
.ba-caption {
  background: #1A2E1F;
  color: #F7F3EE;
  padding: 24px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}
.ba-cap-text { min-width: 0; }
.ba-cap-eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #E8956D;
}
.ba-cap-title {
  margin-top: 6px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
}
.ba-cap-facts {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: #D9D3C8;
}
/* Gold = a fact still to fill in from the real project */
.ba-fill { color: #E8D5A3; }
.ba-cap-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #F7F3EE;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
}
.ba-cap-link:hover { color: #E8D5A3; }

@media (max-width: 600px) {
  .ba-toggle { top: 12px; left: 12px; gap: 2px; padding: 3px; }
  .ba-toggle button { padding: 0 14px; font-size: 11px; letter-spacing: 0.12em; }
  .ba-tag { top: 22px; right: 12px; height: 28px; padding: 0 12px; font-size: 11px; }
  .ba-knob { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .ba-note { left: 12px; bottom: 12px; max-width: calc(50% - 24px); padding: 6px 10px; font-size: 11px; }
  .ba-caption { flex-wrap: nowrap; align-items: center; padding: 12px 8px 12px 20px; gap: 12px; }
  .ba-cap-eyebrow, .ba-fact-extra { display: none; }
  .ba-cap-title { margin-top: 0; font-size: 22px; }
  .ba-cap-facts { margin-top: 3px; font-size: 13px; }
  .ba-cap-link { width: 44px; justify-content: center; flex-shrink: 0; }
  .ba-cap-link-text {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
