.case-page {
  padding: var(--page-top) 0 var(--page-bottom);
}

.case-page__container {
  width: 100%;
  max-width: var(--site-max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Outline look from core/ui.css */
.case-page__back {
  margin-bottom: 40px;
}

/* Left text / right photo stack */

.case-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px 48px;
  align-items: start;
}

.case-split__copy {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.case-page__head {
  margin: 0 0 48px;
}

.case-page__meta {
  margin: 0 0 24px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-page__title {
  margin: 0 0 20px;
  font-size: clamp(36px, 4.2vw, 56px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.case-page__headline {
  margin: 0 0 24px;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.case-page__lead {
  display: grid;
  gap: 14px;
}

.case-page__p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-lead);
  line-height: 1.6;
  text-wrap: pretty;
}

.case-page__sections {
  display: grid;
  gap: 40px;
}

.case-section__title {
  margin: 0 0 14px;
  font-size: clamp(20px, 1.8vw, 24px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.case-section__body {
  display: grid;
  gap: 12px;
}

.case-section__text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.65;
  text-wrap: pretty;
}

.case-split__photos {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* height:0 + min-height:100% — column doesn't stretch the row; row = text height */
  height: 0;
  min-height: 100%;
  overflow: hidden;
}

.case-split__photos .case-photo {
  flex: 1 1 0;
  min-height: 0;
}

.case-photo {
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}

.case-photo button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

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

.case-mosaic .case-photo {
  aspect-ratio: 4 / 3;
}

.case-mosaic .case-photo img {
  height: 100%;
  object-fit: cover;
}

/* After the text column ends — full-width mosaic */

.case-mosaic {
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.case-mosaic--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.case-mosaic--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.case-mosaic--1 {
  grid-template-columns: 1fr;
}

.case-lightbox {
  width: min(1100px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-main);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.case-lightbox::backdrop {
  background: rgba(18, 18, 20, .72);
}

.case-lightbox__bar {
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-lightbox__title {
  margin: 0;
  font-size: var(--fs-ui);
  font-weight: 500;
}

.case-lightbox__close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: opacity .2s ease;
}

.case-lightbox__close:hover {
  opacity: .65;
}

.case-lightbox__body {
  max-height: calc(100svh - 84px);
  overflow: auto;
  padding: 16px;
}

.case-lightbox__body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

@media (max-width: 1023px) {
  .case-split {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .case-split__photos {
    grid-column: 1;
    grid-row: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .case-split__photos .case-photo {
    aspect-ratio: 4 / 3;
    flex: none;
  }

  .case-mosaic {
    margin-top: 28px;
  }

  .case-mosaic--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .case-page__back {
    margin-bottom: 28px;
  }

  .case-page__head {
    margin-bottom: 36px;
  }

  .case-split__photos,
  .case-mosaic--2,
  .case-mosaic--3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .case-page__sections {
    gap: 32px;
  }
}
