/* ==========================================================================
   Denty — Cases intro (dark band)
   Full-bleed dark section with a curved top edge: the boundary dips down
   into a wide, shallow valley at the center and rises back up at the
   edges, with a small tooth graphic hanging from the bottom of that dip —
   half in the light section above, half in the dark one below. The curve
   is a real filled SVG shape (not a background image or clip-path), so it
   scales fluidly to any width without recalculating anything in JS.
   Below the tooth: "Кейсы" (matches the other section titles' type scale,
   just recolored white for the dark background), a hairline rule, then a
   label/description row ("До и после" + the slider instructions) that the
   before/after case cards will sit under once those are built.
   Sits right after .about's gallery — this section's own top margin is
   the entire gap (see about.css: .about no longer carries a margin-bottom
   of its own, so there's nothing to collapse against).
   ========================================================================== */

.cases {
  position: relative;
  width: 100%;
  /* ~7.4cm below the About gallery. */
  margin-top: 280px;
}

/* preserveAspectRatio="none" on the element itself stretches the curve
   non-uniformly to fill whatever width/height this box ends up with —
   the dip stays proportional to the section's own width at every
   breakpoint instead of needing separate paths per breakpoint. */
.cases-divider {
  display: block;
  width: 100%;
  height: 140px;
}

.cases-divider-path {
  fill: var(--color-dark);
}

.cases-tooth {
  position: absolute;
  /* Hangs from the bottom of the dip: mostly sitting in the dark area
     below the curve's boundary (which lands at 140px, the divider's own
     height — see .cases-divider), only its very top crossing back up
     into the light section above. */
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 144px;
  height: auto;
  z-index: 1;
}

.cases-body {
  background: var(--color-dark);
  padding-inline: var(--container-padding);
  padding-top: 90px;
  padding-bottom: 140px;
}

.cases-inner {
  max-width: var(--container-width);
  margin-inline: auto;
}

.cases-title {
  font-family: var(--font-heading);
  font-size: clamp(46px, 5.6vw, 84px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--color-white);
}

.cases-divider-line {
  margin-top: 64px;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
}

.cases-meta {
  margin-top: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.cases-meta-label {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--color-white);
}

.cases-meta-text {
  max-width: 380px;
  text-align: right;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
}

/* -------------------------------------------------------- Case cards -- */

.cases-grid {
  margin-top: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.case-card {
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Before/after comparison slider — one filled div per state, the "before"
   one clipped from the left edge up to --case-slider-pos so only its right
   portion ever renders; the "after" layer underneath is unclipped and
   simply shows through wherever "before" doesn't cover it. Dragging the
   handle right shrinks that clipped-away region (more "после" revealed),
   dragging left grows it (more "до") — see js/case-slider.js. */
.case-slider {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  /* Default so the layout is correct even before case-slider.js runs —
     starts fully "до", matching the JS default. */
  --case-slider-pos: 0%;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.case-slider-image {
  position: absolute;
  inset: 0;
}

.case-slider-image--before {
  clip-path: inset(0 0 0 var(--case-slider-pos));
}

.case-slider-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-slider-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}

.case-slider-placeholder--after {
  background: linear-gradient(135deg, #223258 0%, #172443 55%, #0f1a30 100%);
}

.case-slider-placeholder--before {
  background: linear-gradient(135deg, #1b2540 0%, #141d34 55%, #0c1426 100%);
}

.case-badge {
  position: absolute;
  top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  pointer-events: none;
}

.case-badge--before {
  left: 14px;
  background: rgba(15, 20, 32, 0.6);
  color: var(--color-white);
}

.case-badge--after {
  right: 14px;
  background: var(--color-white);
  color: var(--color-dark);
}

.case-slider-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--case-slider-pos);
  width: 2px;
  background: var(--color-white);
  transform: translateX(-50%);
  pointer-events: none;
}

.case-slider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  color: var(--color-dark);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: ew-resize;
  pointer-events: auto;
}

.case-slider-handle svg {
  width: 18px;
  height: 18px;
}

.case-slider-handle:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 3px;
}

.case-card-body {
  padding: 24px 24px 28px;
}

.case-card-category {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* var(--color-primary) itself reads a little heavy/saturated against
     this dark navy — a lighter tint of the same blue keeps it the site's
     one accent color instead of introducing a second (gold, per the
     reference this section's layout was based on) that appears nowhere
     else on the site. */
  color: #5b9bff;
}

.case-card-title {
  margin-top: 10px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--color-white);
}

.case-card-text {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.5);
}

/* ================================================================== */
/* Responsive                                                          */
/* ================================================================== */

@media (max-width: 1240px) {
  .cases {
    margin-top: 220px;
  }

  .cases-divider {
    height: 110px;
  }

  .cases-tooth {
    top: 56px;
    width: 122px;
  }

  .cases-body {
    padding-top: 72px;
    padding-bottom: 110px;
  }

  .cases-divider-line,
  .cases-meta {
    margin-top: 52px;
  }

  .cases-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 860px) {
  .cases {
    margin-top: 160px;
  }

  .cases-divider {
    height: 84px;
  }

  .cases-tooth {
    top: 42px;
    width: 96px;
  }

  .cases-body {
    padding-top: 56px;
    padding-bottom: 90px;
  }

  .cases-divider-line,
  .cases-meta {
    margin-top: 40px;
  }

  .cases-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .cases-meta-text {
    max-width: none;
    text-align: left;
  }

  .cases-grid {
    margin-top: 48px;
  }
}

@media (max-width: 560px) {
  .cases {
    margin-top: 120px;
  }

  .cases-divider {
    height: 64px;
  }

  .cases-tooth {
    top: 32px;
    width: 76px;
  }

  .cases-body {
    padding-top: 44px;
    padding-bottom: 72px;
  }

  .cases-divider-line,
  .cases-meta {
    margin-top: 32px;
  }

  .cases-grid {
    margin-top: 36px;
    grid-template-columns: 1fr;
  }

  .case-card-body {
    padding: 20px 20px 24px;
  }
}
