/* ══════════════════════════════════════════════
   CASE STUDY PAGE STYLES
   ══════════════════════════════════════════════ */

.case-hero {
  padding-top: calc(var(--space-4xl) * 1.5);
  padding-bottom: var(--space-2xl);
  text-align: center;
}

.case-hero-eyebrow {
  font-family: var(--font-ui);
  font-weight: var(--fw-600);
  font-size: var(--text-14px);
  letter-spacing: var(--ls-0-2em);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.case-hero-title {
  font-family: var(--font-serif);
  font-size: var(--text-64px);
  font-weight: var(--fw-600);
  font-variation-settings: 'opsz' 120, 'SOFT' 0;
  letter-spacing: var(--ls-neg-0-02em);
  line-height: var(--lh-1-1);
  text-wrap: balance;
  color: var(--color-text);
  margin-bottom: var(--space-md);
  margin-top: 0px;
  margin-inline: auto;
  max-width: 800px;
}

.case-hero-meta {
  font-family: var(--font-ui);
  font-size: var(--text-16px);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.case-hero-meta a {
  transition: color 0.3s;
}

.case-hero-meta a:hover {
  color: var(--color-accent);
}

.case-meta-sep {
  width: 1px;
  height: 14px;
  background: var(--color-border);
}

/* mobile: the service name is too long to share a line with the year and the
   link, so it takes a row of its own and reads as a label above them */
@media (max-width: 600px) {
  .case-hero-meta {
    flex-wrap: wrap;
    row-gap: var(--space-xs);
  }

  .case-hero-meta > span:first-child {
    flex: 0 0 100%;
    font-size: var(--text-14px);
    font-weight: var(--fw-600);
    letter-spacing: var(--ls-0-2em);
    text-transform: uppercase;
  }

  /* its separator would otherwise open the second row with a stray rule */
  .case-hero-meta > span:first-child + .case-meta-sep {
    display: none;
  }
}

/* Overview & Challenges Grid */
.case-section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

@media (min-width: 1201px) {
  .case-section-grid {
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--space-4xl) * 1.5);
  }
}

/* every case-study section carries its own vertical rhythm via padding, so
   a section title never needs a margin-top on top of it */
.case-text-block {
  padding-block: calc(var(--space-3xl) / 2);
}

.case-text-block h2 {
  font-family: var(--font-serif);
  font-size: var(--text-40px);
  font-weight: var(--fw-600);
  font-variation-settings: 'opsz' 120, 'SOFT' 0;
  letter-spacing: var(--ls-neg-0-02em);
  line-height: var(--lh-1-2);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.case-text-block h3 {
  font-family: var(--font-serif-small);
  font-size: var(--text-24px);
  font-weight: var(--fw-600);
  letter-spacing: var(--ls-neg-0-01em);
  line-height: var(--lh-1-2);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.case-text-block p {
  color: var(--color-text-muted);
  font-size: var(--text-18px);
  line-height: var(--lh-1-75);
}

.color-snippet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.85em;
  font-weight: var(--fw-500);
  line-height: 1;
  vertical-align: baseline;
  color: var(--color-text);
  margin-inline: 2px;
}

.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.case-text-block ul,
.case-text-block ol {
  padding-left: var(--space-xl);
  margin-block: var(--space-lg);
  color: var(--color-text-muted);
  font-size: var(--text-18px);
  line-height: var(--lh-1-75);
}

.case-text-block ul {
  list-style-type: disc;
}

.case-text-block ol {
  list-style-type: decimal;
}

.case-text-block ul li,
.case-text-block ol li {
  margin-bottom: var(--space-sm);
}

.case-text-block ul li::marker,
.case-text-block ol li::marker {
  color: var(--color-text);
}

.case-text-block ul li strong,
.case-text-block ol li strong {
  color: var(--color-text);
  display: block;
  margin-bottom: var(--space-xs);
}

/* Feature Image */
.case-feature {
  padding-block: calc(var(--space-3xl) / 2);
}

.case-feature-image {
  width: 100%;
  overflow: hidden;
}

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

/* Design System Showcase */
.case-design-system {
  background: var(--color-bg-subtle);
  padding-block: calc(var(--space-3xl) / 2);
}

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

/* Bento Grid */
.case-bento-section {
  padding-block: var(--space-4xl);
  background: var(--color-bg-subtle);
  margin-top: var(--space-lg);
}

.case-bento-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  align-items: start;
}

@media (min-width: 1201px) {
  .case-bento-grid {
    grid-template-columns: minmax(200px, 1fr) minmax(300px, 2fr);
  }
}

.case-bento-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.case-bento-item {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

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

.bento-tall {
  height: 100%;
}

.case-stats-box {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  text-align: center;
}

@media (min-width: 1201px) {
  .case-stats-box {
    flex-direction: row;
    justify-content: space-around;
  }
}

.case-stat h3 {
  font-family: var(--font-ui);
  font-size: var(--text-34px);
  font-weight: var(--fw-600);
  letter-spacing: var(--ls-neg-0-02em);
  margin: 0;
  margin-bottom: var(--space-xs);
}

.case-stat p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-16px);
  color: var(--color-text-muted);
}

/* Device Grids */
.case-devices {
  padding-block: var(--space-lg);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 1201px) {
  .case-devices {
    grid-template-columns: repeat(3, 1fr);
  }
}

.device-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
}

.device-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* Gallery Grid */
.case-gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

@media (min-width: 1201px) {
  .case-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.case-gallery-item {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
}

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

/* a case with just one real screenshot shouldn't leave two empty tracks
   beside it */
@media (min-width: 1201px) {
  .case-gallery-grid .case-gallery-item:only-child {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 7;
  }
}

/* Other Works */
.case-other-works {
  padding-top: calc(var(--space-3xl) / 2);
  padding-bottom: calc(var(--space-3xl) / 2);
  background: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border-subtle);
}

.case-other-works h2 {
  font-family: var(--font-serif);
  font-size: var(--text-40px);
  font-weight: var(--fw-600);
  font-variation-settings: 'opsz' 120, 'SOFT' 0;
  letter-spacing: var(--ls-neg-0-02em);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

.works-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 1201px) {
  .works-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.work-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.work-card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--color-bg);
}

.work-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out-expo);
}

.work-card:hover .work-card-img img {
  transform: scale(1.05);
}

.work-card-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: var(--text-12px);
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: var(--space-xs);
}

.work-card-title {
  font-family: var(--font-serif);
  font-size: var(--text-24px);
  font-weight: var(--fw-600);
  font-variation-settings: 'opsz' 120, 'SOFT' 0;
  letter-spacing: var(--ls-neg-0-02em);
  line-height: var(--lh-1-4);
  margin: 0;
}

/* Gallery lightbox */
.case-gallery-item img {
  cursor: zoom-in;
  transition: transform .35s var(--ease-out-expo);
}

.case-gallery-item:hover img {
  transform: scale(1.03);
}

body.lightbox-locked {
  overflow: hidden;
}

.lightbox-veil {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(var(--color-espresso-rgb), .92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .28s var(--ease-out-expo);
}

.lightbox-veil[hidden] {
  display: none;
}

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

.lightbox-stage {
  position: relative;
  width: min(92vw, 1400px);
  height: min(82vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform .2s var(--ease-out-expo);
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.lightbox-img.is-zoomed {
  cursor: grab;
}

.lightbox-img.is-dragging {
  transition: none;
  cursor: grabbing;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  z-index: 10001;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: background-color .25s var(--ease-out-expo), opacity .25s var(--ease-out-expo);
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, .2);
}

.lightbox-close {
  top: 24px;
  right: 24px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav[hidden] {
  display: none;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-14px);
  color: rgba(255, 255, 255, .7);
}

/* small overview of the full image with a highlighted window onto the
   zoomed-in viewport — only worth showing once the image no longer fits */
.lightbox-minimap {
  position: fixed;
  z-index: 10001;
  bottom: 24px;
  right: 24px;
  width: 150px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .5);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, .5);
}

.lightbox-minimap[hidden] {
  display: none;
}

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

.lightbox-minimap-view {
  position: absolute;
  border: 1.5px solid var(--color-accent);
  /* the huge outset gets clipped to the minimap's own bounds, dimming
     everything outside the current viewport window */
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .55);
  pointer-events: none;
}

@media (max-width: 1200px) {
  .lightbox-stage {
    width: 96vw;
    height: 74vh;
  }

  .lightbox-close,
  .lightbox-nav {
    width: 38px;
    height: 38px;
  }

  .lightbox-close {
    top: 14px;
    right: 14px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-minimap {
    width: 96px;
    bottom: 14px;
    right: 14px;
  }
}
