/* ─── INTERACTIVE PROTOTYPE EMBED ───────────────────────────────── */

.cs-proto {
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 620px;
  background: #DFDFDF;
  position: relative;
  overflow: hidden;
}

.cs-proto iframe {
  position: absolute;
  top: 32px; left: 32px;
  width: calc(100% - 64px);
  height: calc(100% - 64px);
  border: none;
  display: block;
  box-shadow: 0 4px 32px rgba(0,0,0,0.12);
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
}

.cs-proto iframe::-webkit-scrollbar {
  display: none;                /* Chrome/Safari */
}

.cs-proto__caption {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cs-proto__caption::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
  animation: dot-pulse 1.8s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

@media (max-width: 600px) {
  .cs-proto {
    aspect-ratio: 9 / 16;
  }
  .cs-proto iframe {
    top: 16px; left: 16px;
    width: calc(100% - 32px);
    height: calc(100% - 32px);
  }
}


/* ─── NEXT LINK PREVIEW ─────────────────────────────────────────── */

.cs-next-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(80px, 9vw, 140px);
  aspect-ratio: 9 / 16;
  pointer-events: none;
  z-index: 50;
  border-radius: 3px;
  overflow: hidden;
  background: var(--color-border);
}

.cs-next-preview__media {
  width: 100%;
  height: 100%;
}

.cs-next-preview__media img,
.cs-next-preview__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 900px) {
  .cs-next-preview { display: none; }
}


/* ─── CASE STUDY — shared layout for all case study pages ─────── */

.cs {
  padding-top: var(--nav-height);
}


/* ─── HERO ─────────────────────────────────────────────────────── */

.cs-hero {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space-24) var(--space-6) var(--space-16);
}

.cs-hero__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.cs-hero__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-6);
}

.cs-hero__tagline {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: var(--leading-snug);
  max-width: 540px;
  margin-bottom: var(--space-8);
}

.cs-hero__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  padding: var(--space-1) var(--space-3);
  border-radius: 2px;
  text-decoration: none;
}
.cs-hero__stat svg {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .cs-hero {
    padding: var(--space-12) var(--space-6) var(--space-8);
  }
  .cs-hero__title { font-size: var(--text-2xl); }
  .cs-hero__tagline {
    font-size: var(--text-base);
    margin-bottom: var(--space-6);
  }
}


/* ─── MEDIA BLOCKS ─────────────────────────────────────────────── */

.cs-media {
  width: 100%;
  background: #DFDFDF;
  overflow: hidden;
}

.cs-media img,
.cs-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cs-media--full {
  aspect-ratio: 16 / 9;
  padding: 32px;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .cs-media--full {
    padding: 16px;
  }
}

/* Pair: landscape container split in 2 — phones sit small inside */
.cs-media--pair {
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: #c8c8c8;
}

.cs-media--pair > * {
  background: #DFDFDF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26%;
  box-sizing: border-box;
  overflow: hidden;
}

.cs-media--pair > * video,
.cs-media--pair > * img {
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

/* Loose pair/trio: for web/desktop screenshots that don't need phone framing */
.cs-media--pair.cs-media--loose > *,
.cs-media--trio.cs-media--loose > * {
  padding: 6%;
}

/* Flush pair/trio: images fill the cell edge to edge */
.cs-media--pair.cs-media--flush > *,
.cs-media--trio.cs-media--flush > * {
  padding: 0;
}

.cs-media--pair.cs-media--flush > * img,
.cs-media--pair.cs-media--flush > * video,
.cs-media--trio.cs-media--flush > * img,
.cs-media--trio.cs-media--flush > * video {
  border-radius: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* Trio: landscape container split in 3 */
.cs-media--trio {
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
  background: #c8c8c8;
}

.cs-media--trio > * {
  background: #DFDFDF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26%;
  box-sizing: border-box;
  overflow: hidden;
}

.cs-media--trio > * video,
.cs-media--trio > * img {
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

@media (max-width: 600px) {
  .cs-media--pair,
  .cs-media--trio {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }
  .cs-media--pair > *,
  .cs-media--trio > * {
    aspect-ratio: 16 / 9;
  }
}


/* ─── TEXT SECTIONS ─────────────────────────────────────────────── */

.cs-section {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: var(--space-16) var(--space-6);
  display: grid;
  grid-template-columns: 3rem 1fr;
  column-gap: var(--space-6);
  row-gap: 0;
}

.cs-section__num {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding-top: 5px;
  font-variant-numeric: tabular-nums;
}

.cs-section__heading {
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-6);
}

.cs-section__body {
  grid-column: 2;
}

.cs-section__body p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-4);
}

.cs-section__body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .cs-section {
    grid-template-columns: 1fr;
    padding: 2.5rem var(--space-6);
  }
  .cs-section__body {
    grid-column: 1;
  }
}


/* ─── METRICS ───────────────────────────────────────────────────── */

.cs-metrics {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
}

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

.cs-metric__value {
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
}

.cs-metric__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

@media (max-width: 600px) {
  .cs-metrics { grid-column: 1; }
}


/* ─── NEXT PROJECT NAV ──────────────────────────────────────────── */

.cs-next {
  margin-top: var(--space-16);
}

.cs-next__link {
  display: block;
  padding: calc(var(--space-16) + 200px) var(--space-6);
  text-decoration: none;
  transition: opacity var(--duration) var(--ease-out);
}

@media (max-width: 600px) {
  .cs-next__link {
    padding: var(--space-12) var(--space-6);
  }
}

.cs-next__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-6);
  padding-inline-start: 0;
}

.cs-next__body {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  max-width: var(--max-width);
  margin-inline: auto;
  gap: var(--space-6);
}

.cs-next__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  color: var(--color-text);
  transition: color 0.25s var(--ease-out);
}

.cs-next__link:hover .cs-next__title {
  color: var(--color-accent);
}

.cs-next__arrow {
  flex-shrink: 0;
  color: var(--color-text-muted);
  overflow: hidden;
  width: 32px;
  height: 32px;
  position: relative;
  transition: color 0.25s var(--ease-out);
}

.cs-next__link:hover .cs-next__arrow {
  color: var(--color-accent);
}

.cs-next__arrow svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  stroke-width: 1.5;
  display: block;
  position: absolute;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
}

.cs-next__arrow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E") center/contain no-repeat;
  transform: translate(-8px, 8px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
}

.cs-next__link:hover .cs-next__arrow svg {
  transform: translate(8px, -8px);
  opacity: 0;
}

.cs-next__link:hover .cs-next__arrow::after {
  transform: translate(0, 0);
  opacity: 1;
}


/* ─── WHITE BACKGROUND PAIR ─────────────────────────────────── */

.cs-media--white {
  background: #fff;
}

.cs-media--white > * {
  background: #fff;
  padding: 50%;
}


/* ─── WEB CELL — no phone framing, transparent bg ────────────── */
/* Apply class to individual cells inside .cs-media--pair/.trio   */

.cs-media--pair > .cs-cell--web {
  padding: 0;
  background: #fff;
}

.cs-media--pair > .cs-cell--web video,
.cs-media--pair > .cs-cell--web img {
  border-radius: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
}


/* ─── IMAGE PLACEHOLDERS ─────────────────────────────────────── */

.cs-media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.cs-media__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: #999;
  border: 1px dashed #bbb;
  padding: 8px 16px;
  border-radius: 2px;
}

/* Pair placeholder — two cells side by side */
.cs-media--placeholder-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: #c8c8c8;
  aspect-ratio: 16 / 9;
}

.cs-media__placeholder-cell {
  background: #DFDFDF;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 600px) {
  .cs-media--placeholder-pair {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }
  .cs-media__placeholder-cell {
    aspect-ratio: 16 / 9;
  }
}
