/* ========== Case Study Layout ========== */

.cs-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--leaf), var(--gold));
  z-index: 1001;
  transition: width 0.1s linear;
}

/* Hero */
.cs-hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  padding: 8rem 0 4rem;
  width: 100%;
  overflow: hidden;
}

.cs-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.cs-hero__bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 30% 40%, rgba(121, 197, 106, 0.2), transparent 55%),
    radial-gradient(ellipse 50% 40% at 80% 60%, rgba(232, 197, 71, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
}

.cs-hero__inner {
  width: var(--container);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.cs-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.cs-hero__tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(121, 197, 106, 0.15);
  color: var(--leaf);
  border: 1px solid rgba(121, 197, 106, 0.25);
}

.cs-hero__label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.cs-hero__title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text-primary) 50%, var(--sage));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cs-hero__subtitle {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  color: var(--text-secondary);
  max-width: 36rem;
  margin-bottom: 2rem;
}

.cs-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Layout with sticky TOC */
.cs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  width: var(--container);
  margin: 0 auto;
  padding: 4rem 0 6rem;
  align-items: start;
}

.cs-toc {
  position: sticky;
  top: 6rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
}

.cs-toc__title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.cs-toc__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cs-toc__link {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color 0.25s, background 0.25s, border-color 0.25s;
}

.cs-toc__link:hover,
.cs-toc__link.active {
  color: var(--leaf);
  background: rgba(121, 197, 106, 0.08);
  border-left-color: var(--leaf);
}

/* Content */
.cs-content {
  min-width: 0;
}

.cs-section {
  margin-bottom: 4rem;
  scroll-margin-top: 6rem;
}

.cs-section__label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--leaf);
  margin-bottom: 0.75rem;
}

.cs-section__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 1.25rem;
}

.cs-section p {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
  max-width: 42rem;
}

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

/* Meta grid (role, typefaces, etc.) */
.cs-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cs-meta-item__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.cs-meta-item ul {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cs-meta-item li,
.cs-meta-item p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Insight cards */
.cs-insights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.cs-insight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.cs-insight:hover {
  border-color: var(--border-hover);
  box-shadow: var(--glow);
}

.cs-insight__title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.cs-insight p {
  font-size: 0.875rem;
  margin: 0;
}

/* Quote */
.cs-quote {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  border-left: 3px solid var(--gold);
  background: rgba(232, 197, 71, 0.06);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.cs-quote p {
  font-size: 1.0625rem;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0;
  max-width: none;
}

/* Media placeholders */
.cs-media {
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}

.cs-media--tall {
  aspect-ratio: 4 / 5;
  max-width: 360px;
}

.cs-media--wide {
  aspect-ratio: 21 / 9;
}

.cs-media__placeholder {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  padding: 1rem;
}

.cs-media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.cs-media-grid .cs-media {
  margin: 0;
  aspect-ratio: 4 / 3;
}

/* Feature blocks */
.cs-feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin: 2.5rem 0;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cs-feature:nth-child(even) {
  direction: rtl;
}

.cs-feature:nth-child(even) > * {
  direction: ltr;
}

.cs-feature__title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.cs-feature p {
  margin-bottom: 0;
}

/* Next project */
.cs-next {
  margin-top: 4rem;
  padding: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.cs-next:hover {
  border-color: var(--border-hover);
  box-shadow: var(--glow);
}

.cs-next__label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.cs-next__title {
  font-size: 1.5rem;
}

.cs-next__arrow {
  font-size: 1.5rem;
  color: var(--leaf);
}

/* Back link */
.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  transition: color 0.25s;
}

.cs-back:hover {
  color: var(--leaf);
}

@media (max-width: 900px) {
  .cs-layout {
    grid-template-columns: 1fr;
  }

  .cs-toc {
    position: static;
    display: none; /* hide on mobile for simplicity; could make horizontal */
  }

  .cs-feature {
    grid-template-columns: 1fr;
  }

  .cs-feature:nth-child(even) {
    direction: ltr;
  }

  .cs-media-grid {
    grid-template-columns: 1fr;
  }
}


/* Preserve original image aspect ratio in case studies */
.cs-media {
  aspect-ratio: auto !important;
  height: auto;
  min-height: 0;
}
.cs-media img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}
