/* Clinical cases: before/after comparison, gallery carousel and case page.
   Loaded once by components/case-comparison.blade.php. */

:root {
  --case-ink: #1e1e1e;
  --case-muted: #6b6259;
  --case-accent: #e8dbcf;
  --case-accent-strong: #7d6a58;   /* beige darkened for text on white */
  --case-surface: #ffffff;
  --case-shadow: 0 12px 35px rgba(30, 30, 30, 0.08);
  --case-ease: cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* ---------- Comparison slider ---------- */
.cmp {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f3efeb;
  cursor: ew-resize;
  touch-action: pan-y;          /* horizontal drag moves the handle, vertical drag scrolls */
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.cmp:focus-visible { box-shadow: 0 0 0 3px var(--case-ink); }

.cmp__pane { position: relative; overflow: hidden; }
.cmp__pane + .cmp__pane { border-top: 2px solid var(--case-surface); }

.cmp__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.cmp__img--after { clip-path: inset(0 0 0 var(--pos)); }

/* Card proportions: portrait face over a wide teeth shot */
.cmp--card .cmp__pane--face  { aspect-ratio: 3 / 4; }
.cmp--card .cmp__pane--teeth { aspect-ratio: 9 / 4; }
.cmp--card.cmp--single .cmp__pane { aspect-ratio: 9 / 16; }  /* one pair fills the card */

/* Case page proportions */
.cmp--large { border-radius: 20px; }
.cmp--large .cmp__pane--face  { aspect-ratio: 4 / 5; max-height: calc(100vh - 260px); min-height: 360px; } /* keeps the Face/Teeth switch on screen */
.cmp--large .cmp__pane--teeth { aspect-ratio: 4 / 3; }
.cmp--large .cmp__pane--photo { aspect-ratio: 11 / 9; }

.cmp__label {
  position: absolute;
  bottom: 12px;
  z-index: 2;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--case-ink);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.cmp__label--before { left: 12px; }
.cmp__label--after  { right: 12px; }
.cmp--large .cmp__label { background: var(--case-accent); }

.cmp__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  z-index: 3;
  width: 0;
  pointer-events: none;
}
.cmp__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}
.cmp__grip {
  position: absolute;
  top: var(--grip-top, 50%);
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: var(--case-ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%);
  transition: transform 0.2s var(--case-ease);
}
.cmp__grip svg { width: 13px; height: 13px; }
.cmp.is-dragging .cmp__grip,
.cmp:hover .cmp__grip { transform: translate(-50%, -50%) scale(1.08); }
/* In a card the grip sits on the face, like the reference layout */
.cmp--card { --grip-top: 38%; }
.cmp--large { --grip-top: 50%; }

/* ---------- Case card ---------- */
.case-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--case-surface);
  box-shadow: var(--case-shadow);
}
.case-card__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 18px 20px;
  text-align: center;
}
.case-card__title {
  margin: 0;
  font-family: var(--font_text, "Quicksand", sans-serif);  /* subtitle: Quicksand per the brand guide */
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  color: var(--case-ink);
}
.case-card__link {
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--case-accent-strong);
  text-decoration: none;
}
.case-card__link:hover,
.case-card__link:focus-visible { color: var(--case-ink); text-decoration: underline; }

/* ---------- Home gallery ---------- */
.cases-gallery {
  padding: 100px 0 90px;
  background: #fcf9f9;
  overflow: hidden;
}
.cases-gallery__header {
  max-width: 720px;
  margin: 0 auto 36px;
  padding: 0 16px;
  text-align: center;
}
.cases-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--case-accent-strong);
}
.cases-eyebrow::before {
  content: "";
  width: 32px;
  height: 1px;
  background: currentColor;
}
.cases-gallery__headline {
  margin: 0 0 14px;
  color: var(--case-ink);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.15;
}
.cases-gallery__sub {
  margin: 0;
  color: var(--case-muted);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 16px;
  line-height: 1.6;
}

.cases-carousel { position: relative; }
.cases-carousel__track {
  display: flex;
  gap: 20px;
  padding: 24px max(24px, calc(50% - 180px)) 32px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.cases-carousel__track::-webkit-scrollbar { display: none; }
.cases-carousel__track > .case-card {
  flex: 0 0 min(360px, 82vw);
  scroll-snap-align: center;
  opacity: 0.6;
  filter: grayscale(0.9) brightness(0.95);
  transform: scale(0.95);
  transition: opacity 0.5s var(--case-ease), filter 0.5s var(--case-ease), transform 0.5s var(--case-ease), box-shadow 0.5s var(--case-ease);
}
.cases-carousel__track > .case-card.is-active {
  opacity: 1;
  filter: none;
  transform: none;
  box-shadow: 0 20px 45px rgba(30, 30, 30, 0.14);
}

.cases-carousel__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 4px;
}
.cases-carousel__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(30, 30, 30, 0.2);
  border-radius: 50%;
  background: #fff;
  color: var(--case-ink);
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.cases-carousel__arrow:hover:not(:disabled) { background: var(--case-ink); color: #fff; }
.cases-carousel__arrow:disabled { opacity: 0.35; cursor: default; }
.cases-carousel__arrow svg { width: 18px; height: 18px; }
.cases-carousel__dots { display: flex; gap: 8px; }
.cases-carousel__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: rgba(30, 30, 30, 0.18);
  transition: width 0.3s var(--case-ease), background 0.3s;
}
.cases-carousel__dot.is-active { width: 26px; background: var(--case-ink); }

.cases-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: 1px solid var(--case-ink);
  border-radius: 100px;
  color: var(--case-ink);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.25s, color 0.25s;
}
.cases-btn:hover,
.cases-btn:focus-visible { background: var(--case-ink); color: #fff; }
.cases-btn svg { width: 18px; height: 18px; }
.cases-btn--accent { border-color: var(--case-accent); background: var(--case-accent); color: var(--case-ink); }
.cases-btn--accent:hover,
.cases-btn--accent:focus-visible { background: #fff; border-color: #fff; color: var(--case-ink); }
.cases-gallery__cta { margin-top: 36px; text-align: center; }

/* ---------- Cases list (grid) ---------- */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
}

/* ---------- Case page ---------- */
.case-page {
  padding: 160px 0 90px;
  background: #121212;
  color: #f4f1ee;
}
.case-page__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 64px;
  align-items: start;
}
.case-page__media { position: sticky; top: 120px; }
.case-page__tabs {
  display: inline-flex;
  gap: 4px;
  margin: 18px auto 0;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}
.case-page__tabs-wrap { text-align: center; }
.case-page__tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 76px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(244, 241, 238, 0.6);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}
.case-page__tab i { font-size: 16px; }
.case-page__tab[aria-selected="true"] { background: rgba(232, 219, 207, 0.14); color: var(--case-accent); }
.case-page__tab:focus-visible { outline: 2px solid var(--case-accent); outline-offset: 2px; }

.case-page__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.case-tag {
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid rgba(232, 219, 207, 0.4);
  color: var(--case-accent);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.case-tag--filled { background: var(--case-accent); border-color: var(--case-accent); color: var(--case-ink); }

.case-page__title {
  margin: 0 0 28px;
  color: #fff;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.1;
}
.case-page__section + .case-page__section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.case-page__label {
  margin: 0 0 12px;
  color: var(--case-accent);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.case-page__text,
.case-page__text p,
.case-page__text li {
  color: rgba(244, 241, 238, 0.82);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 16px;
  line-height: 1.75;
}
.case-page__text :is(h1, h2, h3, h4, strong) { color: #fff; }
.case-page__text img { max-width: 100%; height: auto; border-radius: 12px; }
.case-page__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 36px; }
.case-page__back {
  color: rgba(244, 241, 238, 0.75);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 14px;
  text-decoration: none;
}
.case-page__back:hover { color: #fff; text-decoration: underline; }

.case-page__gallery { margin-top: 64px; }
.case-page__gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.case-page__gallery-grid a { display: block; overflow: hidden; border-radius: 14px; }
.case-page__gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.5s var(--case-ease);
}
.case-page__gallery-grid a:hover img { transform: scale(1.04); }

.case-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.case-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 48%;
  color: #fff;
  text-decoration: none;
}
.case-pager a:last-child { margin-left: auto; text-align: right; }
.case-pager small {
  color: var(--case-accent);
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.case-pager span { font-family: var(--font_title, serif); font-size: 18px; }
.case-pager a:hover span { text-decoration: underline; }

.case-related { padding: 90px 0; background: #fcf9f9; }
.case-related__head { margin-bottom: 36px; text-align: center; }

.case-cta {
  padding: 80px 16px;
  background: var(--case-accent);
  text-align: center;
}
.case-cta__title { margin: 0 0 12px; color: var(--case-ink); font-size: clamp(26px, 3.4vw, 40px); }
.case-cta__text {
  margin: 0 auto 28px;
  max-width: 560px;
  color: #3b342e;
  font-family: var(--font_text, "Quicksand", sans-serif);
  font-size: 16px;
}

@media (max-width: 991px) {
  .case-page { padding-top: 130px; }
  .case-page__layout { grid-template-columns: 1fr; gap: 40px; }
  .case-page__media { position: static; }
  .cmp--large { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 575px) {
  .cases-gallery { padding: 70px 0 60px; }
  .case-pager { flex-direction: column; }
  .case-pager a { max-width: 100%; }
  .case-pager a:last-child { margin-left: 0; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .cases-carousel__track { scroll-behavior: auto; }
  .cases-carousel__track > .case-card,
  .cmp__grip,
  .case-page__gallery-grid img { transition: none; }
}
