.case-study {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px var(--gutter) 96px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.back-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  width: fit-content;
  transition: color 0.2s var(--ease);
}

.back-link:hover {
  color: var(--dark);
}

/* ---------- Title block ---------- */
.cs-title-block {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cs-title-block h1 {
  font-size: 34px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.2;
}

.cs-summary {
  font-size: 17px;
  line-height: 1.5;
  color: #535353;
  max-width: 900px;
}

.cs-meta-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cs-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-meta .cs-meta-label {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.cs-meta .cs-meta-value {
  font-size: 14px;
  color: var(--dark);
}

/* ---------- Overview ---------- */
.cs-overview {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cs-overview h2,
.cs-problems > h2,
.cs-learned h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--dark);
}

.cs-overview p,
.cs-learned p {
  font-size: 16px;
  line-height: 1.6;
  color: #535353;
}

/* ---------- Problems ---------- */
.cs-problems {
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.cs-problem {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  padding: 16px 0 32px;
}

/* Shaded problem blocks break out to full viewport width for a true
   full-bleed band, while .cs-problem-inner keeps the content aligned
   to the same 1200px column as everything else on the page. */
.cs-problem.shaded {
  background: var(--surface-muted);
  padding: 32px 0;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
}

.cs-problem.shaded .cs-problem-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.cs-problem-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-problem-text h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--dark);
}

.cs-problem-text p {
  font-size: 15px;
  line-height: 1.55;
  color: #535353;
}

.cs-problem-visual {
  flex-shrink: 0;
  width: 600px;
  max-width: 100%;
}

.cs-problem-visual img {
  width: 100%;
  display: block;
}

.cs-problem-single {
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.cs-problem-single .cs-problem-text {
  align-items: flex-start;
  max-width: 780px;
}

.cs-problem-single .cs-problem-text h3 {
  text-align: left;
}

.cs-problem-single .cs-problem-text p {
  text-align: left;
}

.cs-problem-single .cs-problem-visual {
  width: 700px;
  margin-top: 16px;
  margin-left: 0;
}

/* Stacked problem blocks: full-width text on top, large image centered below.
   Used for the hero and features/how-it-works before-after blocks, since a
   150%-enlarged screenshot no longer fits beside a text column. */
.cs-problem-stacked {
  flex-direction: column;
  align-items: stretch;
}

.cs-problem-stacked .cs-problem-text {
  max-width: none;
}

.cs-problem-stacked.shaded .cs-problem-inner {
  flex-direction: column;
  align-items: stretch;
}

.cs-problem-visual-large {
  width: auto;
  align-self: center;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The before-after wrapper centers the toggle below the image */
.cs-problem-visual-large .before-after {
  align-items: center;
}

.cs-problem-visual-large .cs-figure,
.cs-problem-visual-large .cs-figure-stack {
  width: 900px;
  max-width: 100%;
}

.cs-problem-visual-large .ba-toggle {
  margin-bottom: 4px;
}

/* Vertical/portrait visuals (phone mockups): toggle goes ABOVE the screen
   instead of below — more intuitive when scrolling down a tall block, since
   you see the Before/After choice before the content itself. */
.cs-problem-visual-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cs-problem-visual-vertical .before-after {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cs-problem-visual-vertical .ba-toggle {
  order: -1;
}

.cs-phone-frame {
  width: 280px;
  aspect-ratio: 592 / 1280;
  border-radius: 36px;
  border: 8px solid #1a1a1a;
  background: #000;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.cs-phone-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 18px;
  background: #1a1a1a;
  border-radius: 0 0 12px 12px;
  z-index: 2;
}

.cs-phone-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Overlap the two stacked images (features + how-it-works) for the layered-
   card effect. The new source images carry generous internal padding, so
   this overlap lands entirely in that whitespace, never cropping content. */
.cs-figure-overlap {
  margin-top: -72px;
}

/* The stacked pair's own images already fade to white at their edges — a
   hard border/box around them fights that softness, so they get no visible
   frame at rest. A shadow appears only on hover instead of a boxed-in card. */
.cs-figure-stack .cs-figure img {
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-radius 0.4s var(--ease);
}

/* Enlarged, hover-zoomable case study screenshots.
   150% base size comes from the wider .cs-problem-visual-large width (900px,
   vs. the original 600px); this adds another +15% on hover for closer reading.
   No border/frame at rest anywhere on the page — a soft shadow + slight
   corner rounding appears only on hover, consistently across every image. */
.cs-problem-visual-large img {
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-radius 0.4s var(--ease);
}

/* Single-image blocks (hero): hover the whole figure */
.cs-problem-visual-large > .before-after > .cs-figure:hover img {
  transform: scale(1.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}

/* Stacked pair (features + how-it-works): each image enlarges and comes to
   the front independently, so hovering one lifts it over its neighbor —
   whichever you hover overlaps the other, not just the fixed -24px stack order. */
.cs-figure-stack {
  position: relative;
}

.cs-figure-stack .cs-figure {
  position: relative;
  z-index: 1;
  transition: transform 0.4s var(--ease), z-index 0s linear 0.2s;
}

.cs-figure-stack .cs-figure:hover {
  z-index: 3;
  transition: transform 0.4s var(--ease), z-index 0s linear 0s;
}

.cs-figure-stack .cs-figure:hover img {
  transform: scale(1.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}

.cs-note {
  font-size: 13px;
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* ---------- Before/After (stacked variant for combined blocks) ---------- */
.cs-figure-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.before-after {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ba-toggle {
  display: inline-flex;
  gap: 4px;
  background: #ededed;
  border-radius: 20px;
  padding: 4px;
  width: fit-content;
}

.ba-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #404040;
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.ba-btn.is-active {
  background: #141414;
  color: #fff;
}

/* ---------- What I learned ---------- */
.cs-learned {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Live site link (separate from the footer-style nav) ---------- */
.cs-livesite {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
  margin: 8px 0;
}

.btn-large {
  font-size: 20px;
  padding: 16px 24px;
}

/* ---------- Case navigation ---------- */
.cs-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-end;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.cs-nav.align-start {
  align-items: flex-start;
}

.cs-nav-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: inherit;
  text-align: right;
}

.cs-nav.align-start .cs-nav-block {
  text-align: left;
}

.cs-nav-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-tertiary);
}

.cs-nav-link {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark);
  transition: opacity 0.2s var(--ease);
}

.cs-nav-link:hover {
  opacity: 0.65;
}

@media (max-width: 900px) {
  .cs-problem { flex-direction: column; }
  .cs-problem.shaded .cs-problem-inner { flex-direction: column; }
  .cs-problem-visual { width: 100%; }
  .cs-problem-single .cs-problem-visual { width: 100%; }
  .cs-problem-visual-large .cs-figure,
  .cs-problem-visual-large .cs-figure-stack { width: 100%; }
}

@media (max-width: 600px) {
  .case-study { padding-top: 40px; gap: 40px; }
  .cs-title-block h1 { font-size: 28px; }
}

/* ---------- Pillar cards (Nebula) ---------- */
.pillar-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pillar-card {
  background: #fafafa;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pillar-card h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
}

.pillar-traits {
  font-size: 14px;
  color: var(--color-text-tertiary);
  margin-top: -4px;
}

.pillar-line {
  font-size: 15px;
  line-height: 1.5;
  color: #535353;
  padding-left: 24px;
  position: relative;
}

.pillar-line::before {
  position: absolute;
  left: 0;
  top: 0;
}

.pillar-yes::before {
  content: '✅';
}

.pillar-no::before {
  content: '❌';
}

.pillar-avoid {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.pillar-avoid p {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  margin-bottom: 12px;
}

.tags-large li {
  font-size: 14px;
  padding: 8px 16px;
}
