/*==============================================================================
  theme/09-before-after.css
  BEFORE & AFTER — Filters, cards, disclaimer, multi-image lightbox
  Linked from templates/base.html in numbered order with the other theme modules.
==============================================================================*/

/* --------------------------------------------------------------------------
   BEFORE & AFTER — Filter chips, result cards, medical disclaimer modal
   -------------------------------------------------------------------------- */
.ba-page {
  background: var(--bg);
}

.ba-page__bar-wrap {
  padding-top: 12px;
  padding-bottom: 8px;
  overflow: visible;
  visibility: visible !important;
}

.ba-page__bar-wrap .spec-detail__bar {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 0;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  visibility: visible !important;
}

.ba-page__bar-wrap .spec-detail__bar::-webkit-scrollbar {
  display: none;
}

.ba-page__bar-wrap .spec-detail__chip,
.ba-page__bar-wrap .ba-filter,
.spec-detail__chip.ba-filter {
  display: inline-flex !important;
  flex: 1 1 auto;
  flex-shrink: 0;
  min-width: max-content;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  filter: none !important;
  color: #fff !important;
  background: var(--primary);
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.ba-page__bar-wrap .spec-detail__chip:hover,
.ba-page__bar-wrap .ba-filter:hover,
.spec-detail__chip.ba-filter:hover {
  background: var(--primary-hover);
  transform: none !important;
  box-shadow: none;
}

.ba-page__bar-wrap .spec-detail__chip:active,
.ba-page__bar-wrap .ba-filter:active,
.spec-detail__chip.ba-filter:active,
.ba-page__bar-wrap .spec-detail__chip.is-active,
.ba-page__bar-wrap .ba-filter.is-active,
.spec-detail__chip.ba-filter.is-active {
  background: #0a2540 !important;
  color: #fff !important;
  box-shadow: none;
  filter: none !important;
  transform: none !important;
}

.ba-page__bar-wrap .spec-detail__chip:focus,
.ba-page__bar-wrap .ba-filter:focus,
.spec-detail__chip.ba-filter:focus {
  outline: none;
  box-shadow: none;
}

.ba-page__bar-wrap .spec-detail__chip:focus-visible,
.ba-page__bar-wrap .ba-filter:focus-visible,
.spec-detail__chip.ba-filter:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.ba-page__content {
  padding-top: 12px !important;
}

.ba-page__header {
  max-width: 640px;
  margin-bottom: 28px;
}

.ba-page__header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #0a2540;
  margin: 0;
}

.ba-page.is-blurred {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

body.ba-disclaimer-open {
  overflow: hidden;
}

.ba-disclaimer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
  box-sizing: border-box;
}

.ba-disclaimer.is-open {
  display: flex;
}

.ba-disclaimer__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ba-disclaimer__dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  margin: auto;
  background: var(--bg);
  border: 0;
  border-radius: 0;
  padding: 28px 28px 24px;
  box-shadow: 0 24px 64px rgba(10, 37, 64, 0.22);
  max-height: min(90vh, 720px);
  overflow-y: auto;
}

.ba-disclaimer__dialog h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0a2540;
  margin: 0 0 16px;
}

.ba-disclaimer__body p {
  margin: 0 0 14px !important;
  font-size: 15px !important;
  line-height: 1.55 !important;
  color: var(--body) !important;
}

.ba-disclaimer__body p:last-child {
  margin-bottom: 0 !important;
}

.ba-disclaimer__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 22px 0 18px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: #0a2540;
  line-height: 1.4;
}

.ba-disclaimer__check input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--primary);
  border-radius: 0;
}

.ba-disclaimer__btn {
  width: 100%;
  cursor: pointer;
  border: none;
}

.ba-disclaimer__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.ba-page__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.ba-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 0;
}

.ba-card__media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--bg);
  aspect-ratio: auto;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.ba-card__media:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.ba-card__shot {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #f1f5f9;
  aspect-ratio: 1 / 1;
}

.ba-card__shot img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ba-card__media:hover .ba-card__shot img {
  transform: scale(1.03);
}

.ba-card__label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(10, 37, 64, 0.72);
  color: #fff;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  line-height: 1;
}

.ba-card__body {
  flex: 1;
  padding: 16px 16px 18px;
  background: #f3efe8;
}

.ba-card__body h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.3;
}

.ba-card__desc {
  margin: 0 0 12px !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}

.ba-card__meta {
  margin: 0 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--primary) !important;
  line-height: 1.3 !important;
}

.ba-page__empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--body);
}

.ba-filter {
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}

/* Lightbox — both before & after together */
.ba-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2100;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.ba-lightbox.is-open {
  display: flex;
}

.ba-lightbox__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.ba-lightbox__dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  margin: auto;
  background: var(--bg);
  padding: 10px 10px 8px;
  box-sizing: border-box;
  border: 0;
  overflow: hidden;
  outline: none;
}

.ba-lightbox__close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

.ba-lightbox__close:hover {
  color: var(--primary-hover);
}

.ba-lightbox__close:focus,
.ba-lightbox__close:focus-visible,
.ba-lightbox__close:active {
  color: var(--text);
  outline: none !important;
  box-shadow: none !important;
  border: 0;
}

.ba-lightbox__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0a2540;
  margin: 0 32px 8px 0;
  line-height: 1.25;
}

.ba-lightbox__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ba-lightbox__shot {
  margin: 0;
  min-width: 0;
}

.ba-lightbox__frame,
.ba-lightbox__after-frame {
  position: relative;
  overflow: hidden;
  background: #ece7df;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 360px;
  max-height: 360px;
  margin-inline: auto;
}

.ba-lightbox__shot img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 360px;
  max-height: min(360px, 52vh);
  object-fit: cover;
  object-position: center;
  background: #ece7df;
  transition: none;
}

.ba-lightbox__frame img,
.ba-lightbox__after-frame img {
  background: transparent;
  max-height: none;
}

.ba-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 64px;
  height: 64px;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  color: #c9a227;
  font-size: 68px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: color 80ms ease, transform 80ms ease;
  text-shadow: 0 1px 8px rgba(10, 37, 64, 0.35);
  box-shadow: none;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

.ba-lightbox__nav--prev {
  left: 0;
}

.ba-lightbox__nav--next {
  right: 0;
}

.ba-lightbox__shot.has-multi .ba-lightbox__nav,
.ba-lightbox__shot.has-multi:hover .ba-lightbox__nav,
.ba-lightbox__shot.has-multi:focus-within .ba-lightbox__nav,
.ba-lightbox__nav:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.ba-lightbox__nav:hover,
.ba-lightbox__nav:focus,
.ba-lightbox__nav:focus-visible {
  background: transparent;
  color: #e0c04a;
  outline: none !important;
  box-shadow: none !important;
  transform: translateY(-50%) scale(1.08);
}

.ba-lightbox__count {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  margin: 0;
  padding: 0;
  background: transparent;
  color: #c9a227 !important;
  font-family: var(--font);
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 80ms ease;
  text-shadow: 0 1px 8px rgba(10, 37, 64, 0.35);
  box-shadow: none;
}

.ba-lightbox__shot.has-multi .ba-lightbox__count,
.ba-lightbox__shot.has-multi:hover .ba-lightbox__count,
.ba-lightbox__shot.has-multi:focus-within .ba-lightbox__count {
  opacity: 1;
}

@media (hover: none) {
  .ba-lightbox__shot.has-multi .ba-lightbox__nav,
  .ba-lightbox__shot.has-multi .ba-lightbox__count {
    opacity: 1;
    pointer-events: auto;
  }
}

.ba-lightbox__shot figcaption {
  margin-top: 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

body.ba-lightbox-open {
  overflow: hidden;
}

@media (max-width: 991px) {
  .ba-page__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .ba-lightbox__pair {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .ba-lightbox__frame,
  .ba-lightbox__after-frame {
    max-width: min(360px, 100%);
    max-height: min(360px, 68vw);
  }

  .ba-lightbox__shot img {
    max-height: none;
  }
}

@media (max-width: 575px) {
  .ba-page__grid {
    grid-template-columns: 1fr;
  }

  .ba-page__header h1 {
    font-size: 28px;
  }

  .ba-lightbox__dialog {
    padding: 8px 8px 6px;
  }

  .ba-lightbox__title {
    font-size: 16px;
    margin-right: 28px;
    margin-bottom: 6px;
  }
}

