/* ─────────────────────────────────────────
   MITCH McKAIN — CASE STUDY STYLES
   ───────────────────────────────────────── */

/* ─── PROGRESS BAR ───────────────────────── */

.cs-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 200;
  background: linear-gradient(
    90deg,
    #7B6FFF 0%,
    #5BF5FF 50%,
    #9B5BFF 100%
  );
  box-shadow:
    0 0 8px rgba(91, 245, 255, 0.6),
    0 0 20px rgba(123, 111, 255, 0.35);
  transition: width 0.08s linear;
  border-radius: 0 2px 2px 0;
}

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

.cs-hero {
  padding: calc(var(--space-32) + 80px) var(--gutter) var(--space-16);
  max-width: var(--max-width);
  margin: 0 auto;
}

.cs-hero-inner {
  max-width: 760px;
}

.cs-back {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: var(--space-8);
  transition: color var(--duration-fast) ease;
}

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

.cs-category {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.cs-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
}

.cs-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-12);
  max-width: 620px;
}

/* Meta row */
.cs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

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

.cs-meta-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.cs-meta-value {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

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

.cs-hero-visual {
  width: 100%;
  max-height: 600px;
  overflow: hidden;
  margin-bottom: var(--space-24);
}

.cs-hero-visual-inner {
  position: relative;
  width: 100%;
  height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── BODY LAYOUT ────────────────────────── */

.cs-body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter) var(--space-32);
}

.cs-body-inner {
  max-width: 760px;
  margin: 0 auto;
}

/* ─── OVERVIEW ───────────────────────────── */

.cs-overview {
  padding: var(--space-16) 0;
}

.cs-overview-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-16);
  align-items: start;
}

.cs-overview p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-4);
}

.cs-overview-heading {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-6);
}

/* Stats */
.cs-outcomes-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

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

.cs-stat-number {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}

.cs-stat-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ─── DIVIDER ────────────────────────────── */

.cs-divider {
  height: 1px;
  background-color: var(--border);
  margin: var(--space-16) 0;
}

/* ─── SECTION ────────────────────────────── */

.cs-section {
  padding: var(--space-4) 0 var(--space-12);
}

.cs-section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.cs-section-number {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.cs-section-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.cs-section-body {
  margin-bottom: var(--space-10);
}

.cs-section-body p {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-4);
  max-width: 640px;
}

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

/* ─── VISUALS ────────────────────────────── */

.cs-visual {
  margin: var(--space-8) 0;
}

.cs-visual--dark {
  margin-left: calc(-1 * var(--gutter));
  margin-right: calc(-1 * var(--gutter));
}

.cs-visual-placeholder {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}

/* Real asset image — fills container, hides placeholder bg when loaded */
.cs-asset-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: inherit;
}

/* Hero asset image — same but for the hero visual container */
.cs-hero-asset-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.cs-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Mobile: hide video, show fallback image */
.cs-hero-mobile-fallback { display: none; }

@media (max-width: 768px) {
  .cs-hero-video { display: none; }
  .cs-hero-mobile-fallback { display: block; }
}

/* Visual themes */
.cs-visual--app {
  background-color: var(--app-bg);
  background-image:
    radial-gradient(ellipse at 70% 40%, rgba(91, 245, 255, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(147, 91, 255, 0.10) 0%, transparent 50%);
}

.cs-visual--map {
  background-color: var(--map-bg);
  background-image:
    radial-gradient(ellipse at 40% 40%, rgba(91, 245, 255, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(91, 120, 255, 0.08) 0%, transparent 50%);
}

.cs-visual--cms {
  background-color: var(--cms-bg);
  background-image:
    radial-gradient(ellipse at 60% 30%, rgba(160, 100, 255, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 70%, rgba(91, 245, 255, 0.05) 0%, transparent 50%);
}

.cs-visual--bude {
  background-color: #16101e;
  background-image:
    radial-gradient(ellipse at 65% 35%, rgba(255, 120, 80, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 25% 75%, rgba(160, 80, 255, 0.12) 0%, transparent 50%);
}

.cs-visual-label {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cs-caption {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}

/* Two-up grid */
.cs-visual-grid {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

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

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

/* ─── CALLOUT (key decision) ─────────────── */

.cs-callout {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: var(--space-6) var(--space-8);
  margin: var(--space-8) 0;
}

.cs-callout-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.cs-callout-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.75;
  font-style: italic;
}

/* ─── FAILURE CARDS ──────────────────────── */

.cs-failures {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-8) 0;
}

.cs-failure-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-6) var(--space-8);
}

.cs-failure-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.cs-failure-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.75;
}

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

.cs-next {
  border-top: 1px solid var(--border);
  background-color: var(--bg-elevated);
}

.cs-next-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-16) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cs-next-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.cs-next-link {
  color: var(--text-primary);
  transition: opacity var(--duration-fast) ease;
}

.cs-next-link:hover {
  opacity: 0.6;
}

.cs-next-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ─── RESPONSIVE ─────────────────────────── */

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

  .cs-outcomes-preview {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .cs-stat {
    flex: 1;
    min-width: 120px;
  }

  .cs-visual-grid--2,
  .cs-visual-grid--3 {
    grid-template-columns: 1fr;
  }

  .cs-next-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
}

@media (max-width: 600px) {
  .cs-meta {
    gap: var(--space-6);
  }

  .cs-hero-visual-inner {
    height: 320px;
  }
}

/* ─── TOC SIDEBAR ────────────────────────── */

.cs-toc {
  display: none;
  position: fixed;
  top: 50%;
  left: 32px;
  transform: translateY(-50%);
  z-index: 50;
}

@media (min-width: 1300px) {
  .cs-toc {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
  }

  .cs-toc.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* White pill container */
.cs-toc-inner {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(216, 223, 233, 0.7);
  border-radius: 16px;
  padding: 16px 14px;
  box-shadow:
    0 2px 8px rgba(14, 17, 23, 0.06),
    0 1px 2px rgba(14, 17, 23, 0.04);
}

/* Vertical track with connecting line */
.cs-toc-track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-toc-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background-color: var(--border);
}

/* Each chapter link */
.cs-toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  text-decoration: none;
  cursor: pointer;
}

/* Dot indicator */
.cs-toc-dot {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  transition:
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) ease;
}

/* Chapter label */
.cs-toc-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text-tertiary);
  transition: color var(--duration-fast) ease;
}

/* Hover state */
.cs-toc-item:hover .cs-toc-dot {
  border-color: var(--text-secondary);
}

.cs-toc-item:hover .cs-toc-label {
  color: var(--text-secondary);
}

/* Active state — dot fills with gradient + soft glow */
.cs-toc-item.is-active .cs-toc-dot {
  background: linear-gradient(135deg, #7B6FFF 0%, #5BF5FF 100%);
  border-color: transparent;
  box-shadow:
    0 0 6px rgba(91, 245, 255, 0.55),
    0 0 14px rgba(123, 111, 255, 0.3);
  transform: scale(1.2);
}

.cs-toc-item.is-active .cs-toc-label {
  color: var(--text-primary);
  font-weight: 600;
}

/* ─── BRAND EXPLORATION GALLERY ──────────── */

.cs-brand-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin: var(--space-8) 0;
}

.cs-brand-gallery-item {
  display: block;
}

.cs-brand-gallery-item img {
  width: 100%;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg-elevated);
}

.cs-brand-gallery-row {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

.cs-brand-gallery-row--2up {
  grid-template-columns: 1fr 1fr;
}

.cs-brand-gallery-row--3up {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 640px) {
  .cs-brand-gallery-row--2up,
  .cs-brand-gallery-row--3up {
    grid-template-columns: 1fr;
  }
}

/* ─── HIGHLIGHTER ────────────────────────── */

.cs-highlight {
  background: linear-gradient(
    104deg,
    rgba(61, 90, 254, 0) 0.5%,
    rgba(61, 90, 254, 0.18) 2%,
    rgba(61, 90, 254, 0.13) 96%,
    rgba(61, 90, 254, 0) 99.5%
  );
  border-radius: 4px 2px 6px 3px / 5px 3px 4px 2px;
  padding: 0.08em 3px;
  margin: 0 -1px;
  font-weight: 500;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ─── VIDEO EMBED ────────────────────────── */

.cs-video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.cs-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ─── PDF BUTTON ─────────────────────────── */

.cs-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--accent);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease;
}

.cs-pdf-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ─── LINKS ──────────────────────────────── */

.cs-section-body a,
.cs-overview a,
.cs-callout-text a {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

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

/* ─── LIGHTBOX ───────────────────────────── */

.cs-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.cs-lightbox.is-open {
  display: flex;
}

.cs-lightbox-img {
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: lb-in 0.2s ease;
}

@keyframes lb-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.cs-lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cs-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Gallery images — show clickable cursor */
.cs-brand-gallery-item img {
  cursor: zoom-in;
}

/* ─── SCROLL ANIMATIONS ──────────────────── */

.cs-section,
.cs-overview,
.cs-visual,
.cs-visual-grid,
.cs-brand-gallery,
.cs-callout,
.cs-failures {
  opacity: 0;
  transform: translateY(24px);
}
