/* case-study.css — case study page styles */

/* ── Layout: text left, images right ── */
.cs-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: start;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + var(--space-16)) var(--page-margin) var(--space-32);
}

/* ── Left column ── */
.cs-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.cs-heading {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cs-heading em {
  font-size: var(--text-h1);
  font-style: italic;
  display: block;
}

.cs-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cs-body p {
  font-size: var(--text-body-lg);
  font-weight: 300;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* ── Outcomes / context strip ── */
.cs-outcomes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-6);
  padding-top: var(--space-6);
  border-top: var(--border-default) solid var(--color-border);
}

.cs-outcome dt {
  font-size: var(--text-eyebrow);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.cs-outcome dd {
  font-family: var(--font-display);
  font-size: var(--text-body-lg);
  font-weight: 400;
  color: var(--color-text);
}

/* ── Next project link ── */
.cs-next-project {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-spring);
}

.cs-next-project:hover {
  transform: translateX(6px);
}

/* Desktop: fixed strip at the bottom of the viewport */
@media (min-width: 768px) {
  .cs-next-project {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-5) var(--page-margin);
    padding-left: max(var(--page-margin), calc((100% - var(--max-width)) / 2 + var(--page-margin)));
    background: var(--color-bg);
    border-top: var(--border-subtle) solid var(--color-border);
    z-index: 50;
  }
}

.cs-next-label {
  font-size: var(--text-eyebrow);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.cs-next-title {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 400;
  color: var(--color-text);
  transition: color var(--duration-fast) var(--ease-out);
}

.cs-next-project:hover .cs-next-title {
  color: var(--color-ruby);
}

/* ── Right column: stacked images ── */
.cs-images {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.cs-img-tile {
  position: relative;
  background: var(--color-surface);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(28, 26, 24, 0.10);
}

.cs-img-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-ruby);
  mix-blend-mode: multiply;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.cs-img-tile:hover::after {
  opacity: 1;
}

.cs-img-tile img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Lightbox ── */
/* Ruby tint — direct child of body so multiply blends with the page */
.lightbox-bg {
  position: fixed;
  inset: 0;
  background: var(--color-ruby);
  mix-blend-mode: multiply;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.lightbox-bg.is-open {
  opacity: 1;
}

/* Image container — sits above the tint, no background */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 301;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
  transform: scale(0.96);
  transition: transform var(--duration-base) var(--ease-out);
}

.lightbox.is-open .lightbox-img {
  transform: scale(1);
}

.lightbox-lottie {
  display: none;
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
  transform: scale(0.96);
  transition: transform var(--duration-base) var(--ease-out);
}

.lightbox-lottie.is-active {
  display: block;
}

.lightbox.is-open .lightbox-lottie {
  transform: scale(1);
}

.lightbox-close {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: #fff;
  z-index: 302;
  opacity: 0;
  pointer-events: none;
  transition:
    background var(--duration-fast) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

.lightbox-close.is-open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.65);
}

.lightbox-close::before,
.lightbox-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  /* start parallel, rotate into X when lightbox opens */
  transition: transform var(--duration-base) var(--ease-out);
}

.lightbox-close::before {
  transform: translate(-50%, -50%) rotate(0deg);
}

.lightbox-close::after {
  transform: translate(-50%, -50%) rotate(0deg);
}

.lightbox-close.is-open::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lightbox-close.is-open::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

body.lightbox-open {
  overflow: hidden;
}

/* ── Desktop: room for fixed next-project bar ── */
@media (min-width: 768px) {
  body {
    padding-bottom: 72px;
  }
}

/* ── Mobile ── */
@media (max-width: 767px) {
  .cs-layout {
    grid-template-columns: 1fr;
    padding: calc(var(--nav-height) + var(--space-8)) var(--space-6) var(--space-10);
    gap: var(--space-10);
  }

  .cs-heading {
    font-size: 36px;
  }

  /* Next project sits inline after images on mobile */
  .cs-next-project {
    padding: var(--space-8) var(--space-6) var(--space-16);
    border-top: var(--border-default) solid var(--color-border);
    margin-top: var(--space-4);
  }
}
