/**
 * Case Study Component
 * Reusable sections for case study pages
 *
 * Sections:
 * - cs-hero: Hero banner with colored background, title, subtitle, image
 * - cs-meta: Row of project metadata (role, team, tools, etc.)
 * - cs-section: Standard content section wrapper
 * - cs-text: Heading + body text block
 * - cs-media: Full-width image/video with optional caption
 * - cs-split: Side-by-side text + media layout
 * - cs-divider: Visual separator between sections
 */

/* ==================== HERO ==================== */

.cs-hero {
  padding: 2rem 0 0;
}

.cs-hero-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.cs-hero h1 {
  font-size: var(--text-5xl);
  margin-bottom: 0.5rem;
}

.cs-hero .subtitle {
  font-size: var(--text-xl);
  color: var(--role-text-primary);
  margin-bottom: 1.5rem;
}

.cs-hero-image {
  width: 100%;
  margin-top: 2rem;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cs-hero-image img {
  width: 100%;
  display: block;
  border-radius: 8px 8px 0 0;
  filter: var(--shadow-drop-sm);
  animation: fadeInUp 0.8s ease-out;
}

/* Split hero variant: text left, image right */
.cs-hero--split .cs-hero-split {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.cs-hero--split .cs-hero-text {
  flex: 1;
}

.cs-hero--split .cs-hero-image {
  flex: 0 0 auto;
  width: 60%;
  margin-top: 0;
}

.cs-hero--split .cs-hero-image img {
  width: 100%;
  display: block;
  border-radius: 8px;
  filter: var(--shadow-drop-sm);
  animation: fadeInUp 0.8s ease-out;
}

/* ==================== METADATA ==================== */

.cs-meta {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--role-border);
}

.cs-meta-container {
  max-width: 1008px;
  margin: 0 auto;
  padding: 0 2rem;
}

.cs-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
}

.cs-meta-item {
  flex: 0 0 auto;
}

.cs-meta-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--role-text-primary);
  margin-bottom: 0.25rem;
}

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

/* ==================== SECTION WRAPPER ==================== */

.cs-section {
  padding: 2rem 0;
}

.cs-section-container {
  max-width: 1008px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Section label (e.g., "The Challenge", "My Approach and Contributions") */
.cs-section-label {
  font-family: var(--font-label);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--role-text-secondary);
  margin-bottom: 0.75rem;
}

/* ==================== TEXT BLOCK ==================== */

.cs-text h2 {
  font-family: var(--font-heading-sm-family);
  font-size: var(--font-heading-sm-size);
  font-weight: var(--font-heading-sm-weight);
  line-height: var(--font-heading-sm-line-height);
  margin-bottom: 1.25rem;
}

.cs-text p {
  font-size: var(--text-base);
  color: var(--role-text-primary);
  line-height: var(--leading-relaxed);
}

.cs-text ul {
  padding-left: 1.5rem;
  margin-top: 0.75rem;
}

.cs-text li {
  font-size: var(--text-base);
  color: var(--role-text-primary);
  line-height: var(--leading-relaxed);
  margin-bottom: 0.5rem;
}

/* ==================== MEDIA BLOCK ==================== */

.cs-media {
  margin-top: 2.5rem;
  text-align: center;
}

.cs-media img,
.cs-media video {
  max-width: 100%;
  display: inline-block;
  border-radius: 8px;
  filter: var(--shadow-drop-sm);
  animation: fadeInUp 0.8s ease-out;
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

.cs-media img:hover {
  transform: scale(1.05);
}

.cs-media:not(.cs-video) video {
  max-width: 49%;
  border-radius: 60px;
}

.cs-media .caption {
  margin-bottom: 0.75rem;
  font-family: var(--font-microcopy-family);
  font-size: var(--font-microcopy-size);
  font-weight: var(--font-microcopy-weight);
  line-height: var(--font-microcopy-line-height);
  color: var(--role-text-secondary);
}

/* Video embed (responsive) */
.cs-video {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--role-border);
  background: #000;
}

.cs-video video {
  width: 100%;
  display: block;
  border-radius: 12px;
}

/* Full-bleed variant (edge to edge within container) */
.cs-media--full {
  margin-left: 0;
  margin-right: 0;
}

/* Side-by-side variant (two images, each 50%) */
.cs-media--side-by-side {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  align-items: start;
}

.cs-media--side-by-side > div {
  flex: 1 1 300px;
  min-width: 0;
  max-width: 100%;
}

.cs-media--side-by-side img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter: none;
}

/* ==================== SPLIT IMAGE + TEXT ==================== */

.cs-split-image-text__label {
  font-family: var(--font-label);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--role-text-secondary);
  margin-bottom: 0.5rem;
}

.cs-split-image-text__heading {
  font-family: var(--font-heading-sm-family);
  font-size: var(--font-heading-sm-size);
  font-weight: var(--font-heading-sm-weight);
  line-height: var(--font-heading-sm-line-height);
  margin-bottom: 1.5rem;
}

.cs-split-image-text__images {
  display: flex;
  gap: 2rem;
  align-items: stretch;
  margin-bottom: 2rem;
}

.cs-split-image-text__images img {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  height: 389px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  cursor: zoom-in;
  filter: var(--shadow-drop-sm);
  transition: transform 0.3s ease;
}

.cs-split-image-text__images img:hover {
  transform: scale(1.05);
}

.cs-split-image-text__body p {
  font-size: var(--text-base);
  color: var(--role-text-primary);
  line-height: var(--leading-relaxed);
}

/* ==================== SPLIT LAYOUT ==================== */

.cs-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.cs-split-text h2 {
  font-family: var(--font-heading-sm-family);
  font-size: var(--font-heading-sm-size);
  font-weight: var(--font-heading-sm-weight);
  line-height: var(--font-heading-sm-line-height);
  margin-bottom: 1.25rem;
}

.cs-split-text {
  padding: 1.5rem 0;
}

.cs-split-text p {
  font-size: var(--text-base);
  color: var(--role-text-primary);
  line-height: var(--leading-relaxed);
}

.cs-split-media img {
  width: 100%;
  display: block;
  border-radius: 8px;
  filter: var(--shadow-drop-sm);
  animation: fadeInUp 0.8s ease-out;
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

.cs-split-media img:hover {
  transform: scale(1.05);
}

/* Reverse variant: image on left, text on right */
.cs-split--reverse {
  direction: rtl;
}

.cs-split--reverse > * {
  direction: ltr;
}

/* ==================== DIVIDER ==================== */

.cs-divider {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.cs-divider hr {
  border: none;
  border-top: 1px solid var(--role-border);
}

/* ==================== BACK LINK ==================== */

.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--weight-regular, 400);
  color: var(--role-text-primary);
  text-decoration: none;
  margin-right: auto;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease;
}

.cs-back:hover {
  color: var(--role-text-primary);
  font-weight: var(--weight-semibold, 600);
  border-bottom: 2px solid var(--role-text-primary);
  text-decoration: none;
}

/* ==================== HEADER + CAROUSEL ==================== */

.cs-header-carousel .cs-carousel {
  margin-top: 2.5rem;
}

/* ==================== STAT COMPARISON ==================== */

.cs-stat-compare {
  display: flex;
  gap: 2rem;
  margin-top: 2.5rem;
}

.cs-stat-compare__item {
  flex: 1;
  text-align: center;
  padding: 1.5rem;
  background: var(--blue-50);
  border-radius: 8px;
}

.cs-stat-compare__item--low {
  background: var(--yellow-50);
}

.cs-stat-compare__value {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  color: var(--role-text-primary);
  line-height: var(--leading-tight);
}

.cs-stat-compare__label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--role-text-secondary);
  margin-top: 0.25rem;
}

.cs-stat-compare__source {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--role-text-secondary);
  margin-top: 0.75rem;
  text-align: right;
}

/* ==================== USER QUOTE ==================== */

.cs-quote {
  margin-top: 2rem;
  padding: 1.5rem 2rem;
  border-left: 3px solid var(--role-text-primary);
  background: var(--neutral-50);
  border-radius: 0 8px 8px 0;
}

.cs-quote__text {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--role-text-primary);
  line-height: var(--leading-relaxed);
}

.cs-quote__source {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--role-text-secondary);
  margin-top: 0.75rem;
}

/* ==================== RESPONSIVE: TABLET ==================== */

@media (max-width: 1024px) {
  .cs-hero-container,
  .cs-meta-container,
  .cs-section-container,
  .cs-divider {
    padding: 0 1.5rem;
  }

  .cs-hero h1 {
    font-size: var(--text-4xl);
  }

  .cs-split {
    gap: 2rem;
  }
}

/* ==================== FRAMED MEDIA ==================== */

.cs-framed-media {
  margin-top: 2rem;
  background-color: var(--turquoise-500);
  border-radius: 27px;
  padding: 2.5rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

.cs-framed-media img {
  max-width: 62%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  margin: -1.5rem -1rem;
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

.cs-framed-media img:hover {
  transform: scale(1.05);
}

.cs-framed-media img:first-child {
  border-radius: 0;
  box-shadow: none;
}

.cs-framed-media--yellow {
  background-color: var(--yellow-500);
  gap: 2.25rem;
}

.cs-framed-media--yellow img,
.cs-framed-media--yellow img:first-child {
  margin: 0;
}

.cs-framed-media__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.cs-framed-media--stacked {
  flex-direction: column;
}

.cs-framed-media__caption {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--role-text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.cs-framed-media--yellow img,
.cs-framed-media--yellow img:first-child {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.cs-framed-media--hero {
  margin-top: 0;
}

.cs-framed-media--hero img {
  border-radius: 0;
  box-shadow: none;
}

.cs-framed-media--hero img:first-child {
  max-width: 86%;
}

.cs-framed-media--hero img:last-child {
  max-width: 25%;
  margin-left: -12rem;
}

@media (max-width: 767px) {
  .cs-framed-media {
    flex-direction: column;
    padding: 1.5rem;
  }

  .cs-framed-media img {
    max-width: 100%;
  }
}

/* ==================== BEFORE / AFTER ==================== */

.cs-before-after {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.cs-before-after__group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cs-before-after__label {
  font-family: var(--font-microcopy-family);
  font-size: var(--font-microcopy-size);
  font-weight: var(--font-microcopy-weight);
  line-height: var(--font-microcopy-line-height);
  color: var(--role-text-secondary);
}

.cs-before-after__images {
  background-color: var(--turquoise-500);
  border-radius: 27px;
  padding: 2.5rem;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

.cs-before-after__images img {
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

.cs-before-after__images img:hover {
  transform: scale(1.05);
}

.cs-before-after__images--three img {
  max-width: 30%;
}

.cs-before-after__images--one img {
  max-width: 60%;
}

@media (max-width: 767px) {
  .cs-before-after__images {
    flex-direction: column;
    padding: 1.5rem;
  }

  .cs-before-after__images--three img,
  .cs-before-after__images--one img {
    max-width: 100%;
  }
}

/* ==================== SKETCH NOTES ==================== */

.sketch-notes {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  width: 100%;
}

.sketch-notes > img {
  max-width: 50%;
  flex-shrink: 0;
}

.sketch-notes__left,
.sketch-notes__right {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  flex: 1;
}

.sketch-notes__left {
  align-items: flex-start;
  text-align: left;
}

.sketch-notes__right {
  align-items: flex-start;
  text-align: left;
}

.sketch-note {
  font-family: 'Kalam', cursive;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--neutral-900);
  line-height: 1.3;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.4rem;
  max-width: 400px;
}

.sketch-note__arrow {
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.sketch-note__copy {
  flex: 1;
}

/* Hide sketch notes on mobile, show image only */
@media (max-width: 767px) {
  .sketch-notes__left,
  .sketch-notes__right {
    display: none;
  }

  .sketch-notes > img {
    max-width: 100%;
  }
}

/* ==================== RESPONSIVE: MOBILE ==================== */

@media (max-width: 767px) {
  .cs-hero {
    padding: 1.5rem 0 0;
  }

  .cs-hero .subtitle {
    font-size: var(--text-lg);
  }

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

  .cs-section {
    padding: 1.5rem 0;
  }

  .cs-text h2,
  .cs-split-text h2 {
    font-size: var(--text-3xl);
  }

  .cs-media--side-by-side {
    flex-direction: column;
  }

  .cs-media--side-by-side img {
    width: 100%;
  }

  .cs-split-image-text__images {
    flex-direction: column;
  }

  .cs-split-image-text__images img {
    max-width: 100%;
  }

  .cs-split {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .cs-split--reverse {
    direction: ltr;
  }

  .cs-stat-compare {
    flex-direction: column;
  }

  .cs-hero--split .cs-hero-split {
    flex-direction: column;
  }

  .cs-hero--split .cs-hero-image {
    width: 60%;
  }
}
