/* ═══════════════════════════════════════════════════════════
   PAGE: Case Study — Hero, overview, process sections
   ═══════════════════════════════════════════════════════════ */

/* ── Case Study Header ───────────────────────────────────── */
.case-study-header {
  padding-top: calc(var(--nav-h) + var(--ruler-h) + 72px);
  padding-bottom: 72px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.case-study-header .dot-grid-subtle {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.case-study-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 30% 50%, transparent 40%, rgba(14, 26, 35, 0.8) 100%);
  z-index: 1;
  pointer-events: none;
}
.case-study-header::before {
  content: '';
  position: absolute;
  top: calc(var(--nav-h) + var(--ruler-h) + 16px);
  left: 20px;
  width: 16px; height: 16px;
  border-top: 1.5px solid var(--primary);
  border-left: 1.5px solid var(--primary);
  opacity: 0.4;
  z-index: 3;
}
.case-study-header .container { position: relative; z-index: 2; }

.case-study-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--primary);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-5);
  opacity: 0.7;
}
.case-study-title {
  font-family: var(--font-display);
  font-weight: var(--weight-extrabold);
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: var(--space-5);
  max-width: 820px;
}
.case-study-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.65;
  margin-bottom: var(--space-8);
}

/* ── Overview Grid ───────────────────────────────────────── */
.case-study-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--space-8);
  max-width: 820px;
}
.case-study-meta-item {
  background: var(--surface);
  padding: 16px 20px;
}
.case-study-meta-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.case-study-meta-value {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  font-weight: var(--weight-medium);
}

/* ── Hero Image ──────────────────────────────────────────── */
.case-study-hero-image {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  max-height: 560px;
}
.case-study-hero-image img,
.case-study-hero-image picture img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.9);
}

/* ── Case Study Body ─────────────────────────────────────── */
.case-study-body {
  padding: var(--space-20) 0 var(--space-24);
}
.case-study-prose {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.75;
}

/* Constrain only text to the readable prose width; images & grids are full-width */
.case-study-prose p,
.case-study-prose h2,
.case-study-prose h3,
.case-study-prose h4,
.case-study-prose ul,
.case-study-prose ol,
.case-study-prose blockquote,
.case-study-prose pre,
.case-study-prose hr {
  max-width: var(--prose-max);
}

/* Markdown wraps images in <p> — remove the prose width cap for those */
.case-study-prose p:has(img) {
  max-width: none;
}

.case-study-prose img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin: var(--space-6) 0;
}

.case-study-prose h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: clamp(22px, 2.5vw, 28px);
  letter-spacing: -0.015em;
  color: var(--text);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  line-height: 1.2;
}
.case-study-prose h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: -0.01em;
  color: var(--text);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.case-study-prose p { margin-bottom: var(--space-4); }
.case-study-prose p:last-child { margin-bottom: 0; }
.case-study-prose strong { color: var(--text); font-weight: var(--weight-medium); }

.case-study-prose ul,
.case-study-prose ol {
  padding-left: 24px;
  margin-bottom: var(--space-4);
}
.case-study-prose li {
  margin-bottom: var(--space-2);
  line-height: 1.65;
}

.case-study-prose blockquote {
  border-left: 3px solid var(--primary);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
  background: rgba(1, 158, 219, 0.05);
  border-radius: 0 3px 3px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.case-study-prose hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: var(--space-12) 0;
}

/* ── Next Project / Footer Nav ───────────────────────────── */
.case-study-footer {
  padding: var(--space-8) 0 var(--space-12);
  border-top: 1px dashed var(--border);
  margin-top: var(--space-8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.case-study-back-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
}
.case-study-back-link:hover { color: var(--primary); }
.case-study-back-link::before { content: '←'; }

/* ── Video Grid (3-up thumbnails) ────────────────────────── */
.cs-video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: var(--space-8) 0;
}

.cs-video-thumb {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  text-decoration: none;
  transition: background 0.2s;
}
.cs-video-thumb:hover { background: var(--surface-raised); }

.cs-video-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border: none;
  border-radius: 0;
  margin: 0;
  filter: saturate(0.85) brightness(0.85);
  transition: filter 0.25s;
}
.cs-video-thumb:hover img { filter: saturate(1) brightness(1); }

.cs-video-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary);
  letter-spacing: 0.05em;
  padding: 10px 14px;
}

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

/* ── More Projects ───────────────────────────────────────── */
.more-projects {
  border-top: 1px solid var(--border);
  padding: var(--space-16) 0 var(--space-20);
}

.more-projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--space-8);
}

.mini-card {
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: background 0.2s;
}
.mini-card:hover { background: var(--surface-raised); }

.mini-card-image {
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  aspect-ratio: 16 / 9;
}
.mini-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.8) brightness(0.85);
  transition: filter 0.3s ease, transform 0.3s ease;
}
.mini-card:hover .mini-card-image img {
  filter: saturate(1) brightness(1);
  transform: scale(1.04);
}

.mini-card-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.mini-card-client {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.mini-card-title {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.01em;
  transition: color 0.2s;
}
.mini-card:hover .mini-card-title { color: var(--primary); }

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 16, 22, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-img {
  max-width: min(90vw, 1280px);
  max-height: 88vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 3px;
  border: 1px solid var(--border-bright);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.lightbox-close:hover {
  background: var(--border);
  border-color: var(--border-bright);
}
.lightbox-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .case-study-meta { grid-template-columns: repeat(2, 1fr); }
  .more-projects-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .case-study-meta { grid-template-columns: 1fr; }
  .more-projects-grid { grid-template-columns: 1fr; }
}
