/* ==========================================================================
   Case Study Detail Pages — Unified Portfolio Grid & Kargul Studio Design System
   ========================================================================== */

/* Main Container & Page Scaffolding */
.cs-kargul-main {
  padding-top: 110px;
  padding-bottom: 90px;
  background: #ffffff;
  color: var(--color-text-primary);
  min-height: 100vh;
}

/* Standardized Portfolio Grid Container (Matches index.html exactly) */
.cs-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-left: 80px;
  padding-right: 80px;
}

@media (max-width: 1280px) {
  .cs-container {
    padding-left: 50px;
    padding-right: 50px;
  }
}

@media (max-width: 768px) {
  .cs-container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* Site Header Consistency on Case Study Pages */
.site-header {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.site-header.scrolled {
  background: #ffffff;
  border-bottom-color: var(--color-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Global Headings — Consistent Medium Weight (500) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500;
}

/* Back Link & Breadcrumb */
.cs-back-bar {
  margin-bottom: 24px;
}

.cs-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.cs-back-link:hover {
  color: var(--color-accent-brand);
  transform: translateX(-3px);
}

/* Motion Split Text Reveal System (motion.dev) */
.motion-split-line {
  display: block;
  overflow: hidden;
  padding-top: 0.16em;
  padding-bottom: 0.16em;
  margin-top: -0.16em;
  margin-bottom: -0.16em;
}

.motion-split-word {
  display: inline-block;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .motion-split-line {
    overflow: visible !important;
  }
  .motion-split-word {
    transform: none !important;
    opacity: 1 !important;
  }
}

/* Page Title & Pitch */
.cs-header-wrap {
  margin-bottom: 40px;
}

.cs-kargul-title {
  font-family: var(--font-heading);
  font-size: clamp(36px, 4.5vw, 64px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
  margin: 0 0 16px;
  max-width: 980px;
}

.cs-kargul-pitch {
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.6;
  color: var(--color-text-secondary);
  max-width: 860px;
  margin: 0;
}

/* Hero Showcase Card & Badges */
.cs-hero-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 64px;
  width: 100%;
}

.cs-badge-row-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: -1px;
  z-index: 2;
}

.cs-badge-top {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  background: #f4f4f5;
  color: #18181b;
  border-radius: 12px 12px 0 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: none;
}

.cs-hero-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 740px;
  background: #fbfbfa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.02);
}

.cs-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cs-badge-row-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: -1px;
  z-index: 2;
}

.cs-badge-bottom {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  background: #f4f4f5;
  color: #18181b;
  border-radius: 0 0 12px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top: none;
}

/* Editorial Story Sections */
.cs-section {
  padding: 56px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.cs-section-heading {
  font-family: var(--font-heading);
  font-size: clamp(24px, 2.5vw, 30px);
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0 0 20px;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   2-Column Unified Story & Metadata Grid
   ========================================================================== */
.cs-story-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 64px;
  align-items: start;
}

.cs-story-main {
  display: flex;
  flex-direction: column;
}

.cs-story-block {
  padding-bottom: 48px;
}

.cs-story-block + .cs-story-block {
  padding-top: 48px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.cs-story-block:last-child {
  padding-bottom: 0;
}

.cs-story-sidebar {
  position: sticky;
  top: 110px;
}

.cs-prose {
  font-size: 17.5px;
  line-height: 1.75;
  color: #3f3f46;
}

.cs-prose p {
  margin: 0 0 20px;
}

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

/* Metadata Card */
.cs-meta-card {
  background: #fafaf9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.cs-meta-live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  background: #fe370b;
  color: #ffffff !important;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 6px;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(254, 55, 11, 0.25);
}

.cs-meta-live-btn:hover {
  background: #e02f08;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 55, 11, 0.35);
}

.cs-meta-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 18px;
}

.cs-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.cs-meta-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.cs-meta-value {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: right;
}

.cs-meta-value.highlight-green {
  color: #10b981;
}

/* ==========================================================================
   2-Column Opposing Scroll Gallery
   ========================================================================== */
.cs-gallery-section {
  padding: 64px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.cs-gallery-header {
  margin-bottom: 36px;
}

.cs-dual-stream-wrapper {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  overflow: hidden;
  user-select: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
  padding: 12px 0;
}

.cs-gallery-row {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  width: max-content;
  will-change: transform;
}

.cs-gallery-row:last-child {
  margin-bottom: 0;
}

.cs-gallery-card {
  position: relative;
  width: 480px;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  background: #f4f4f5;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  cursor: zoom-in;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  flex-shrink: 0;
}

.cs-gallery-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(254, 55, 11, 0.35);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
}

.cs-gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* ==========================================================================
   Testimonial Section (Kargul Studio Inspired)
   ========================================================================== */
.cs-testimonial-box {
  background: #fafaf9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 48px 56px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

.cs-testimonial-box::before {
  content: '“';
  position: absolute;
  top: 10px;
  right: 36px;
  font-family: var(--font-heading);
  font-size: 140px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.04);
  pointer-events: none;
  font-weight: 800;
}

.cs-testimonial-quote {
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.55;
  font-weight: 500;
  color: #18181b;
  margin: 0 0 32px;
  position: relative;
  z-index: 1;
  max-width: 1100px;
}

.cs-testimonial-quote strong {
  font-weight: 700;
  color: #09090b;
}

.cs-testimonial-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.cs-testimonial-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(254, 55, 11, 0.35);
  padding: 2px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.cs-testimonial-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.cs-testimonial-author-name {
  font-family: var(--font-heading);
  font-size: 17.5px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0 0 3px;
}

.cs-testimonial-author-role {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0;
}

/* Tools Cloud */
.cs-tools-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.cs-tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f4f4f5;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #27272a;
}

/* More Recent Work Grid */
.cs-more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 24px;
}

.cs-more-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.cs-more-card:hover {
  transform: translateY(-4px);
  border-color: rgba(254, 55, 11, 0.35);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
}

.cs-more-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #f4f4f5;
  overflow: hidden;
}

.cs-more-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.cs-more-card:hover .cs-more-thumb img {
  transform: scale(1.04);
}

.cs-more-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-more-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-accent-brand);
}

.cs-more-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.35;
  margin: 0;
}

/* Lightbox Modal */
.cs-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cs-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.cs-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-lightbox.open .cs-lightbox-img {
  transform: scale(1);
}

.cs-lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.cs-lightbox-close:hover {
  background: #fe370b;
  transform: scale(1.08);
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .cs-story-layout {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .cs-story-sidebar {
    position: static;
    max-width: 520px;
  }
  .cs-more-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cs-gallery-card {
    width: 380px;
  }
}

@media (max-width: 768px) {
  .cs-kargul-main {
    padding-top: 88px;
  }
  .cs-testimonial-box {
    padding: 32px 24px;
  }
  .cs-gallery-card {
    width: 300px;
  }
  .cs-more-grid {
    grid-template-columns: 1fr;
  }
}
