/*
 * ============================================================
 *  Case Study V2 - 2-column layout styles
 * ============================================================
 *
 * Image spec reference:
 * ┌─────────────────────────┬────────────┬──────────┬────────┬───────────┐
 * │ Usage                   │ Ratio      │ Max W    │ Format │ Max size  │
 * ├─────────────────────────┼────────────┼──────────┼────────┼───────────┤
 * │ Project thumbnail       │ 3:2        │ 900px    │ WebP   │ 150KB     │
 * │ Hero/cover (full-bleed) │ 16:9       │ 1920px   │ WebP   │ 400KB     │
 * │ Full-width section img  │ 16:9       │ 1440px   │ WebP   │ 300KB     │
 * │ 2-col grid image        │ 3:2 / 16:9 │ 800px    │ WebP   │ 150KB     │
 * │ 3-col grid image        │ 4:3        │ 600px    │ WebP   │ 100KB     │
 * │ Mobile mockup (3-col)   │ 9:19.5     │ 400px    │ WebP   │ 80KB      │
 * │ Laptop/device mockup    │ native     │ 1200px   │ WebP   │ 200KB     │
 * └─────────────────────────┴────────────┴──────────┴────────┴───────────┘
 */

:root {
  /* Aliased to global heading tokens - case studies inherit any future global change. */
  --cs2-heading-text: var(--_theme---heading, var(--_primitives---colors--neutral-darkest));
  --cs2-subheading-text: var(--_theme---heading-secondary, var(--_primitives---colors--neutral-darker));
}

/* ---- Page wrapper ---- */

/* Page-level padding - 5% minimum margin on all screens */
.cs2-page {
  padding-left: 5%;
  padding-right: 5%;
}

/* Inner container - 1160px max-width */
.cs2-wrapper {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
}

/* ---- Section spacing ---- */

.cs2-section-spacing {
  padding-top: 8rem;
  padding-bottom: 8rem;
}

.cs2-section-spacing-sm {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

/* Collapse adjacent vertical spacing - the second section's top padding folds away
   so two stacked sections leave one gap, not two */
.cs2-section-spacing + .cs2-section-spacing,
.cs2-section-spacing + .cs2-section-spacing-sm,
.cs2-section-spacing-sm + .cs2-section-spacing,
.cs2-section-spacing-sm + .cs2-section-spacing-sm {
  padding-top: 0;
}

/* ---- 2-column section grid ---- */

.cs2-section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  align-items: start;
}

.cs2-section_left {
  /* position: sticky removed - titles stay inline */
}

.cs2-section_right {
  min-width: 0;
}

/* ---- Typography ---- */

.cs2-section h2 {
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  font-weight: 450;
  line-height: 130%;
  margin: 0;
  color: var(--cs2-subheading-text);
}

.cs2-section h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 400;
  line-height: 130%;
  margin: 0;
  color: var(--cs2-subheading-text);
}

/* Decision titles (Key decisions, right col). Richtext h3 sub-headings (e.g.
   the labelled blocks in "The challenge") reuse this exact rule so the two
   match - same size, weight and bottom margin - from a single definition. */
.cs2-section h3.cs2-decision-title,
.cs2-richtext h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.625rem);
  font-weight: 450;
  margin-bottom: 1rem;
}

/* Sticky "Key decisions" heading - stays in view while you scroll through the decisions */
.cs2-decisions-sticky {
  position: sticky;
  top: 6rem;
  align-self: start;
}

/* Each decision block stacked in the right column */
.cs2-decision-block {
  margin-bottom: 2.5rem;
}

.cs2-decision-block:last-child {
  margin-bottom: 0;
}

.cs2-decision-images {
  margin-top: 2rem;
}

/* DPK: inline decision images are full-width marketing-section screenshots,
   so stack them one per row in col 2 instead of the default 2-up grid. */
.cs2-theme-dpk .cs2-decision-images.cs2-grid-2col-inner {
  grid-template-columns: 1fr;
}

.cs2-section_right p,
.cs2-richtext p {
  font-size: clamp(1rem, 0.2vw + 0.95rem, 1.125rem);
  font-weight: 400;
  line-height: 145%;
  margin-bottom: 1.25rem;
  color: var(--_theme---text);
}

.cs2-section_right p:last-child,
.cs2-richtext p:last-child {
  margin-bottom: 0;
}

.cs2-richtext ul,
.cs2-richtext ol {
  font-size: clamp(1rem, 0.2vw + 0.95rem, 1.125rem);
  font-weight: 400;
  line-height: 145%;
  padding-left: 0;
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--_theme---text);
}

.cs2-richtext ul {
  list-style: none;
}

.cs2-richtext ul li {
  position: relative;
  padding-left: 1.75rem;
}

.cs2-richtext ul li::before {
  content: "\2726"; /* ✦ four-pointed star, matches AccentStar */
  position: absolute;
  left: 0;
  top: 0;
  color: var(--_theme---accent, #A021B4);
  line-height: inherit;
}

/* Arrow-marker list (opt-in via class, e.g. the "Two main tasks" block in the
   challenge) - a right arrow instead of the default star. Geist/Mona Sans
   render U+2192 narrow and squashed, so draw the arrow in a font with a
   properly-proportioned glyph. */
.cs2-richtext ul.cs2-arrow-list li::before {
  content: "\2192"; /* → rightwards arrow */
  font-family: Arial, Helvetica, sans-serif;
}

.cs2-richtext li {
  margin-bottom: 0.5rem;
}

.cs2-richtext strong {
  font-weight: 600;
}

/* Block separation for richtext sub-headings (e.g. the labelled blocks in
   "The challenge"). .cs2-section h3 zeroes all margins, so add space above each
   heading to separate it from the previous block - matching the 2.5rem gap
   between Key-decisions blocks. The heading's own look + bottom margin come
   from the shared .cs2-decision-title rule above (single source of truth). The
   first block hugs the top so it aligns with the section title beside it. */
.cs2-richtext h2,
.cs2-richtext h3,
.cs2-richtext h4 {
  margin-top: 2.5rem;
}
.cs2-richtext > :first-child {
  margin-top: 0;
}

/* ---- Hero ---- */

.cs2-hero {
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.cs2-hero_grid {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.cs2-hero_title {
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 110%;
  letter-spacing: -0.02em;
  font-weight: 400;
  margin: 0 0 1.5rem;
  color: var(--cs2-heading-text);
}

.cs2-hero_tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cs2-hero_meta {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.cs2-hero_meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cs2-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.5;
}

.cs2-meta-value {
  font-size: clamp(0.875rem, 0.2vw + 0.825rem, 1rem);
  line-height: 133%;
}

.cs2-hero_meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.5rem;
  align-self: start;
}

.cs2-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cs2-hero_meta-grid .cs2-meta-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  font-stretch: 90%;
  opacity: 0.5;
  color: var(--_theme---text);
}

.cs2-hero_meta-grid .cs2-meta-value {
  font-size: clamp(0.875rem, 0.2vw + 0.825rem, 1rem);
  line-height: 133%;
  font-weight: 400;
  color: var(--_theme---text);
}

/* ---- Phase divider ---- */

.cs2-phase-divider {
  padding-top: 5rem;
  padding-bottom: 1rem;
}

.cs2-phase-divider .tag-wrap,
.cs2-phase-tag .tag-wrap {
  border-bottom: none;
}

/* No .tag-content overrides here - the phase eyebrow renders straight from the
   EyebrowTag component (accent star + accent label, text-size-medium) so it
   matches the homepage section eyebrows exactly. The label is already passed
   lowercase from the layout. */

.cs2-phase-tag {
  margin-bottom: 1.5rem;
}

/* ---- Featured image (constrained to section width, above hero) ---- */

.cs2-featured-image {
  width: 100%;
  margin: 0;
}

.cs2-featured-image img {
  width: 100%;
  /* Fixed banner height (responsive-bounded), cropped to fill - so the cover
     is a full-width strip, not a full-screen-tall image. */
  height: clamp(16rem, 38vw, 30rem);
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ---- Full-width images (inside wrapper) ---- */

.cs2-full-image {
  margin: 4rem 0;
}

.cs2-full-image img {
  width: 100%;
  height: auto;
  border-radius: var(--_ui-styles---radius--medium, 0.75rem);
  display: block;
}

/* ---- Image grids ---- */

.cs2-image-section {
  margin: 4rem 0;
}

.cs2-grid-inner {
  display: grid;
  gap: 1.25rem;
}

/* Compact designs gallery (designsPairsFirst): 2-col pairs row on top, the
   full-width image below, with even spacing - the vertical gap between the
   rows equals the horizontal gap between the two paired images (both 2rem). */
.cs2-designs--compact {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 4rem 0;
}
.cs2-designs--compact .cs2-full-image,
.cs2-designs--compact .cs2-image-section {
  margin: 0;
}
.cs2-designs--compact .cs2-grid-inner {
  gap: 2rem;
}

.cs2-grid-2col-inner {
  grid-template-columns: repeat(2, 1fr);
}

.cs2-grid-3col-inner {
  grid-template-columns: repeat(3, 1fr);
}

.cs2-grid-inner img {
  width: 100%;
  height: auto;
  border-radius: var(--_ui-styles---radius--medium, 0.75rem);
  display: block;
}

.cs2-grid-mobile-mockups img {
  border-radius: 0;
  aspect-ratio: 9 / 19.5;
  object-fit: cover;
}

.cs2-figure {
  margin: 0;
}

/* Figures embedded inline in a richtext column (e.g. the challenge "before"
   screenshots placed next to the relevant paragraph). Full column width with
   vertical breathing room. */
.cs2-richtext .cs2-figure {
  margin: 1.75rem 0;
}

.cs2-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--_ui-styles---radius--medium, 0.75rem);
  display: block;
}

.cs2-figure figcaption {
  font-size: clamp(0.75rem, 0.15vw + 0.71rem, 0.875rem);
  line-height: 133%;
  color: var(--_theme---text-secondary);
  margin-top: 0.75rem;
}

/* DPK: image captions read too thin/low-contrast in secondary grey - use the
   primary text colour and a touch more weight so they're clearly legible. */
.cs2-theme-dpk .cs2-figure figcaption {
  color: var(--_theme---text);
  font-weight: 500;
}

/* ---- Pull quote ---- */

.cs2-pull-quote {
  margin: 5rem 0;
}

.cs2-pull-quote blockquote {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 140%;
  font-weight: 400;
  font-style: italic;
  padding-left: 2rem;
  border-left: 3px solid var(--_theme---accent, #A021B4);
  margin: 0;
  color: var(--_theme---text);
}

/* ---- Impact ---- */

.cs2-impact {
  padding: 5rem 0;
}

.cs2-impact_inner {
  text-align: center;
}

.cs2-impact_label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
  color: var(--_theme---text);
}

.cs2-impact_text {
  font-size: clamp(1.125rem, 1.5vw, 1.375rem);
  line-height: 150%;
  font-weight: 400;
  margin: 0;
  color: var(--_theme---text);
}

.cs2-impact_text p:first-child {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  line-height: 140%;
  font-weight: 450;
  margin-bottom: 1.25rem;
}

/* Hero-level results - full viewport, vertically centered, 2x size */
.cs2-impact--hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 4rem 0;
}

.cs2-impact--hero .cs2-impact_text {
  text-align: left;
}

.cs2-impact--hero .cs2-impact_text p:first-child {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 130%;
  font-weight: 400;
  margin-bottom: 0;
}

/* ---- Inline stats (inside results right column) ---- */

.cs2-inline-stats {
  margin-top: 2rem;
}

.cs2-inline-stat {
  /* Star box width + the star-to-number gap. The label is indented by their
     sum (below) so it lines up under the number, not the star. */
  --stat-star-size: 1rem;
  --stat-gap: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin-bottom: 2rem;
}

/* Star + number in one row so they align vertically (star centred on the
   number). */
.cs2-inline-stat-value-row {
  display: flex;
  align-items: center;
  gap: var(--stat-gap);
}

.cs2-inline-stat .accent-star {
  flex: none;
  width: var(--stat-star-size);
  font-size: var(--stat-star-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cs2-inline-stat-value {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 120%;
  color: var(--_theme---accent, #A021B4);
}

.cs2-inline-stat-label {
  font-size: clamp(0.8125rem, 0.15vw + 0.77rem, 0.9375rem);
  line-height: 133%;
  color: var(--_theme---text-secondary);
  /* Line up under the number: star box + the star-to-number gap. */
  margin-left: calc(var(--stat-star-size) + var(--stat-gap));
}

.cs2-impact_text ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.cs2-impact_text li {
  margin-bottom: 0.5rem;
}

/* ---- Stats ---- */

.cs2-stats-section {
  padding: 3rem 0 5rem;
}

.cs2-stats {
  display: flex;
  justify-content: center;
  gap: 4rem;
  flex-wrap: wrap;
}

.cs2-stats_item {
  text-align: center;
}

.cs2-stats_value {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 120%;
  color: var(--_theme---accent, #A021B4);
}

.cs2-stats_label {
  font-size: clamp(0.8125rem, 0.15vw + 0.77rem, 0.9375rem);
  line-height: 133%;
  color: var(--_theme---text-secondary);
  margin-top: 0.5rem;
  max-width: 14rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 991px) {
  .cs2-hero {
    padding-top: 3rem;
    padding-bottom: 2rem;
  }

  .cs2-section {
    gap: 4rem;
  }

  .cs2-grid-3col-inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .cs2-stats {
    gap: 2.5rem;
  }

  .cs2-phase-divider {
    padding-top: 3.5rem;
  }

}

@media (max-width: 767px) {
  .cs2-hero {
    padding-top: 2rem;
    padding-bottom: 1.5rem;
  }

  .cs2-section {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Disable sticky "Key decisions" heading on mobile - single-column layout means it would cover content */
  .cs2-decisions-sticky {
    position: static;
    top: auto;
  }

  .cs2-hero_grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }


  .cs2-grid-2col-inner,
  .cs2-grid-3col-inner {
    grid-template-columns: 1fr;
  }

  .cs2-section-spacing {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }

  .cs2-section-spacing-sm {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .cs2-full-image,
  .cs2-image-section {
    margin: 2.5rem 0;
  }

  .cs2-pull-quote {
    margin: 3rem 0;
  }

  .cs2-stats {
    gap: 2rem;
  }
}

@media (max-width: 479px) {
  .cs2-hero_tags {
    flex-wrap: wrap;
  }

  .cs2-hero_meta {
    grid-template-columns: 1fr 1fr;
  }
}
