/* Case study pages — portfolio narrative + imagery */

.case-study {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.5rem) clamp(1.5rem, 5vw, 4rem)
    clamp(3.5rem, 10vw, 6rem);
}

.case-study__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
  font-size: 0.9375rem;
  font-weight: 500;
  color: #a0a0a0;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.case-study__back:hover {
  color: #ffffff;
}

.case-study__back:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

.case-study__intro {
  max-width: 42rem;
}

.case-study__title {
  margin: 0 0 clamp(0.75rem, 2vw, 1rem);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #ffffff;
}

.case-study__lead {
  margin: 0 0 clamp(1.25rem, 3vw, 1.75rem);
  font-size: clamp(1rem, 1.35vw, 1.125rem);
  color: #a0a0a0;
  line-height: 1.6;
}

.case-study__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  padding: clamp(1.25rem, 3vw, 1.75rem) 0 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.case-study__meta-item {
  margin: 0;
}

.case-study__meta-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #707070;
  margin-bottom: 0.25rem;
}

.case-study__meta-value {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.45;
}

.case-study__hero {
  margin: 0 0 clamp(2.5rem, 6vw, 3.5rem);
  border-radius: 0;
  overflow: hidden;
  background: #1a1a1a;
}

.case-study__hero img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center;
}

.case-study__content {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 6vw, 3.5rem);
}

.case-study__section {
  max-width: 42rem;
}

.case-study__section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.case-study__section h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.case-study__section h3:first-child {
  margin-top: 0;
}

.case-study__section p {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #c8c8c8;
  line-height: 1.65;
}

.case-study__section p:last-child {
  margin-bottom: 0;
}

.case-study__section ul,
.case-study__section ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: #c8c8c8;
  line-height: 1.65;
}

.case-study__section li + li {
  margin-top: 0.35rem;
}

.case-study__section a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease;
}

.case-study__section a:hover {
  color: #a0a0a0;
}

.case-study__section a:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.case-study__figure {
  margin: 0;
  background: #1a1a1a;
  overflow: hidden;
}

.case-study__figure img {
  width: 100%;
  height: auto;
  display: block;
}

.case-study__caption {
  margin: 0;
  padding: 0.75rem clamp(1rem, 3vw, 1.25rem) 1rem;
  font-size: 0.875rem;
  color: #a0a0a0;
  line-height: 1.5;
}

.case-study__gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 2.5vw, 1.25rem);
}

@media (min-width: 768px) {
  .case-study__gallery--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Below 768px: three-up grids + height caps so imagery reads smaller */

@media (max-width: 767px) {
  .case-study__gallery.case-study__gallery--two {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem 0.4rem;
  }

  .case-study__gallery.case-study__gallery--two .case-study__caption {
    font-size: 0.6875rem;
    line-height: 1.35;
    padding: 0.35rem 0.3rem 0.45rem;
  }

  .case-study__gif-grid.case-study__gif-grid--three .case-study__caption,
  .case-study__gif-grid.case-study__gif-grid--four .case-study__caption {
    font-size: 0.6875rem;
    line-height: 1.35;
    padding: 0.35rem 0.3rem 0.45rem;
  }

  .case-study__hero img {
    max-height: min(38vh, 360px);
    width: auto;
    max-width: 100%;
    margin-inline: auto;
  }

  .case-study__content > .case-study__figure > img {
    max-height: min(48vh, 420px);
    width: auto;
    max-width: 100%;
    margin-inline: auto;
  }

  /* Tall phone screenshots in multi-column galleries */
  .case-study__gallery .case-study__figure img {
    max-height: min(34vh, 280px);
    width: auto;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    object-fit: contain;
    object-position: center;
  }

  .case-study__gif img {
    max-height: min(36vh, 300px);
    width: auto;
    max-width: 100%;
    margin-inline: auto;
  }
}

/* Two-up gallery from tablet up: same height cap at all wide viewports */
@media (min-width: 768px) {
  .case-study__gallery .case-study__figure img {
    max-height: min(48vh, 460px);
    width: auto;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    object-fit: contain;
    object-position: center;
  }
}

/* Before / after GIF strips (Agoda Flights and similar) */

.case-study__gif-strip {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  width: 100%;
}

.case-study__gif-strip__intro {
  max-width: 42rem;
  margin: 0;
  font-size: 0.9375rem;
  color: #a0a0a0;
  line-height: 1.55;
}

.case-study__gif-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 2.5vw, 1.25rem);
  width: 100%;
}

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

.case-study__gif-grid.case-study__gif-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.35rem, 1.2vw, 1.25rem);
}

.case-study__gif {
  margin: 0;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.case-study__gif img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #0d0d0d;
}

.case-study__gif .case-study__caption {
  flex-shrink: 0;
}

.case-study__gallery .case-study__figure {
  min-height: 0;
  height: auto;
  align-self: start;
}

.case-study__gallery .case-study__figure img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center;
}

.case-study__callout {
  max-width: 42rem;
  padding: clamp(1.25rem, 3vw, 1.5rem);
  border-left: 3px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.case-study__callout p {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.55;
}

@media (max-width: 480px) {
  .case-study__hero {
    margin-left: calc(-1 * clamp(1.5rem, 5vw, 4rem));
    margin-right: calc(-1 * clamp(1.5rem, 5vw, 4rem));
    width: calc(100% + 2 * clamp(1.5rem, 5vw, 4rem));
    max-width: none;
  }
}
