/* Case study layout: centred brief → media gallery with short story interludes → more projects.
   Structure modelled on lue.studio/works, styled to match the rest of the site (dark, Instrument Serif). */

:root {
  --cs-bg: #000;
  --cs-text: #fff;
  --cs-text-soft: #cccccc;
  --cs-text-muted: #868c98;
  --cs-text-faint: #525866;
  --cs-line: rgba(255, 255, 255, 0.08);
  --cs-tile: #f3f3f4;
  --cs-tile-dark: #111;
  --cs-radius: 0;
  --cs-gap: 8px;
  --cs-serif: "Instrument Serif", Georgia, serif;
  --cs-sans: Interdisplay, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.cs {
  background: var(--cs-bg);
  color: var(--cs-text);
  font-family: var(--cs-sans);
}

/* ---------- Brief ---------- */
.cs-brief {
  padding: 220px 24px 120px;
}
.cs-brief__inner {
  max-width: 596px;
  margin: 0 auto;
}
.cs-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--cs-text-muted);
  font-size: 14px;
  letter-spacing: 0.02em;
}
.cs-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.cs-title {
  margin: 0 0 20px;
  font-family: var(--cs-serif);
  font-size: clamp(3rem, 7vw, 4.5rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
.cs-title span {
  color: var(--cs-text-faint);
}
.cs-lede {
  margin: 0 0 40px;
  color: var(--cs-text-soft);
  font-size: 1.125rem;
  line-height: 1.6;
}
.cs-lede p {
  margin: 0 0 1em;
}
.cs-lede p:last-child {
  margin-bottom: 0;
}
.cs-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 64px;
  padding: 12px 18px 12px 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: var(--cs-text);
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.cs-button:hover {
  background: rgba(255, 255, 255, 0.18);
}
.cs-button:active {
  transform: scale(0.98);
}
.cs-button img {
  width: 18px;
  height: 18px;
}
.cs-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 16px;
  margin: 0;
  font-size: 1.0625rem;
}
.cs-meta div {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cs-meta dt {
  color: var(--cs-text-muted);
}
.cs-meta dd {
  margin: 0;
  color: var(--cs-text);
}

/* ---------- Gallery ---------- */
.cs-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--cs-gap);
  max-width: 1616px;
  margin: 0 auto;
  padding: 0 var(--cs-gap);
}
.cs-row {
  display: grid;
  gap: var(--cs-gap);
}
.cs-row--2 {
  grid-template-columns: 1fr 1fr;
}
.cs-row--3 {
  grid-template-columns: repeat(3, 1fr);
}

.cs-tile {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--cs-radius);
  background: var(--cs-tile);
}
/* hairline inner border, like the reference */
.cs-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}
.cs-tile img {
  display: block;
  width: 100%;
  height: auto;
}

/* Full-bleed hero image, cropped to a wide frame */
.cs-tile--cover {
  aspect-ratio: 16 / 9;
}
.cs-tile--cover img {
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
}
/* Image fills the tile at its natural proportions, no crop */
.cs-tile--full {
  background: #fff;
}

/* App screens sit inside the tile with breathing room */
.cs-tile--screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 88px);
}
.cs-tile--screen img {
  max-width: 1120px;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(10, 13, 20, 0.06), 0 12px 32px -8px rgba(10, 13, 20, 0.16);
}
.cs-row--2 .cs-tile--screen {
  padding: clamp(12px, 3.5vw, 56px);
}
.cs-row--3 .cs-tile--screen {
  padding: clamp(10px, 2vw, 32px);
}

.cs-caption {
  max-width: 596px;
  margin: 8px auto 0;
  padding: 0 16px;
  color: var(--cs-text-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- Story interludes ---------- */
.cs-story {
  max-width: 596px;
  margin: 0 auto;
  padding: 120px 24px;
}
.cs-story--tight {
  padding-bottom: 56px;
}
.cs-label {
  margin: 0 0 20px;
  color: var(--cs-text-muted);
  font-family: var(--cs-sans);
  font-size: 1rem;
  font-weight: 400;
}
.cs-story p {
  margin: 0 0 0.8em;
  color: var(--cs-text-soft);
  font-family: var(--cs-serif);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.2;
}
.cs-story p:last-child {
  margin-bottom: 0;
}
.cs-story--small p {
  font-family: var(--cs-sans);
  font-size: 1.125rem;
  line-height: 1.6;
}
.cs-story strong {
  color: var(--cs-text);
  font-weight: inherit;
}

.cs-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 120px;
}
.cs-methods h4 {
  margin: 0 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--cs-line);
  color: var(--cs-text);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}
.cs-methods p {
  margin: 0;
  color: var(--cs-text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* ---------- More projects ---------- */
.cs-more {
  padding: 200px 12px 140px;
}
.cs-more__head {
  margin: 0 0 56px;
  font-family: var(--cs-serif);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
  text-align: center;
}
.cs-more__head span {
  color: var(--cs-text-faint);
}
.cs-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 16px;
  max-width: 1208px;
  margin: 0 auto;
  padding: 0 8px;
}
.cs-card {
  color: inherit;
  text-decoration: none;
}
.cs-card__media {
  position: relative;
  aspect-ratio: 596 / 520;
  overflow: hidden;
  background: var(--cs-tile);
}
.cs-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cs-card:hover .cs-card__media img {
  transform: scale(1.02);
}
.cs-card__body {
  padding: 20px 12px 0;
}
.cs-card__title {
  margin: 0 0 4px;
  color: var(--cs-text);
  font-size: 18px;
  font-weight: 500;
  line-height: 24px;
}
.cs-card__tags {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cs-text-muted);
  font-size: 14px;
}
.cs-card__tags span + span::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .cs-brief { padding-top: 180px; padding-bottom: 96px; }
  .cs-story { padding-top: 96px; padding-bottom: 96px; }
  .cs-methods { padding-bottom: 96px; }
}
@media (max-width: 767px) {
  :root { --cs-radius: 0; }
  .cs-brief { padding: 140px 16px 72px; }
  .cs-row--2,
  .cs-cards { grid-template-columns: 1fr; }
  .cs-tile--cover { aspect-ratio: 4 / 3; }
  .cs-story { padding: 72px 16px; }
  .cs-story--tight { padding-bottom: 40px; }
  .cs-methods { grid-template-columns: 1fr; gap: 24px; padding: 0 16px 72px; }
  .cs-more { padding: 120px 8px 96px; }
}
@media (max-width: 479px) {
  .cs-row--3 { grid-template-columns: 1fr; }
  .cs-meta { gap: 28px 16px; font-size: 1rem; }
}

/* ---------- Interactive demo ---------- */
.cs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 64px;
}
.cs-actions .cs-button { margin-bottom: 0; }
.cs-button--primary {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  background: #0a0d14;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  color: #fff;
}
.cs-button--primary:hover { background: #20232d; }

.cs-demo {
  display: block;
  width: 100%;
  padding: clamp(16px, 5vw, 88px);
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.cs-demo img {
  max-width: 1120px;
  margin: 0 auto;
  box-shadow: 0 1px 2px rgba(10, 13, 20, 0.06), 0 12px 32px -8px rgba(10, 13, 20, 0.16);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.4s ease;
}
.cs-demo__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10, 13, 20, 0.28);
  transition: background-color 0.3s ease;
}
.cs-demo__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  background: #fff;
  color: #0a0d14;
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 16px 40px -8px rgba(10, 13, 20, 0.35);
  transition: transform 0.2s ease;
}
.cs-demo__hint {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.6);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
}
.cs-demo:hover img { transform: scale(1.01); filter: blur(1px); }
.cs-demo:hover .cs-demo__overlay { background: rgba(10, 13, 20, 0.4); }
.cs-demo:hover .cs-demo__cta { transform: scale(1.03); }
.cs-demo:focus-visible { outline: 2px solid #375dfb; outline-offset: 4px; }
.cs-demo__mobile { display: none; }

.demo-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10, 13, 20, 0.72);
  backdrop-filter: blur(6px);
  animation: demo-fade 0.2s ease-out;
}
@keyframes demo-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes demo-pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.demo-modal__window {
  display: flex;
  flex-direction: column;
  width: 95vw;
  height: calc(95vh - 56px);
  height: calc(95dvh - 56px);
  border-radius: 16px;
  overflow: hidden;
  background: #0a0d14;
  box-shadow: 0 32px 80px -12px rgba(0, 0, 0, 0.5);
  animation: demo-pop 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.demo-modal__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 20px;
  background: #0a0d14;
  color: #fff;
  font-family: Interdisplay, Inter, system-ui, sans-serif;
  font-size: 14px;
}
.demo-modal__title { flex: 1; font-weight: 500; }
.demo-modal__link { color: #cdd0d5; text-decoration: none; }
.demo-modal__link:hover { color: #fff; }
.demo-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}
.demo-modal__close:hover { background: rgba(255, 255, 255, 0.22); }
.demo-modal__close:focus-visible { outline: 2px solid #375dfb; outline-offset: 2px; }
.demo-modal__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: #20232d;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5);
  color: #cdd0d5;
  font-family: Interdisplay, Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  animation: demo-pop 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.demo-modal__controls strong { color: #fff; font-weight: 500; }
.demo-modal__controls button {
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.demo-modal__controls button:hover { background: rgba(255, 255, 255, 0.22); }
.demo-modal__controls button:focus-visible { outline: 2px solid #375dfb; outline-offset: 2px; }
/* The demo sits inset in the dark window with its own rounded corners */
.demo-modal__frame { position: relative; flex: 1; margin: 0 6px 6px; border-radius: 12px; overflow: hidden; background: #fff; isolation: isolate; }
.demo-modal__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 0.25s ease; }
.demo-modal.is-loaded iframe { opacity: 1; }
.demo-modal__loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #868c98; font-size: 14px; }

/* Desktop-only demos are hidden on small screens; demos marked data-demo-min-width="0" stay usable */
@media (max-width: 899px) {
  .cs-actions .cs-button--primary[data-demo-open]:not([data-demo-min-width="0"]) { display: none; }
  .cs-demo:not([data-demo-min-width="0"]) { cursor: default; }
  .cs-demo:not([data-demo-min-width="0"]) .cs-demo__overlay { display: none; }
  .cs-demo:not([data-demo-min-width="0"]):hover img { transform: none; filter: none; }
  .demo-modal__controls { padding-left: 6px; }
  .demo-modal__controls > span { display: none; }
  .cs-demo__mobile {
    display: block;
    margin-top: 12px;
    color: #525866;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
  }
}
