/* ============================================================
   Case study pages — layered on top of style.css
   Values from Portfolio 2/figma-export/case-study.css
   ============================================================ */

/* ---------- hero ---------- */
/* the comp runs the hero image off the right edge and insets the copy to
   128, so there is no gutter to the right of the image */
.cs-hero {
  display: flex; align-items: center; gap: 40px;
  padding: 40px 0 40px max(var(--pad), calc((100% - var(--maxw)) / 2 + 128px));
  margin: 0 auto;
}
.cs-hero__content { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.cs-hero__title { font-family: var(--serif); font-weight: 500; font-size: 76px; line-height: 1.1; letter-spacing: -0.02em; }
.cs-hero__desc { font-size: 1.125rem; line-height: 1.45; letter-spacing: -0.005em; }
/* 525px at 1280 and above, as the comp has it, but a share of the viewport
   below that — a fixed width squeezes the copy column and breaks the title
   onto four lines around 1040 */
.cs-hero__image { flex: 0 0 min(525px, 41%); max-height: 513px; overflow: hidden; }
.cs-hero__image img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- meta bar ---------- */
.cs-meta { background: var(--surface); padding: 48px 208px; }
.cs-meta__items { display: flex; justify-content: center; max-width: var(--maxw); margin: 0 auto; gap: 64px; flex-wrap: wrap; }
.cs-meta__item { display: flex; flex-direction: column; gap: 4px; }
.cs-meta__label { font-size: 0.875rem; line-height: 1.45; color: #6e7c87; }
.cs-meta__value { font-weight: 500; font-size: 1.125rem; line-height: 1.45; }

/* ---------- three-column overview ---------- */
/* no bottom padding: the following section owns the gap under the box */
.cs-overview { padding: 60px var(--pad) 0; max-width: var(--maxw); margin: 0 auto; }
.cs-overview__grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
  background: #fff; border-radius: 30px; padding: 60px;
  /* the comp outlines this box rather than floating it on a shadow */
  border: 1px solid var(--line);
}
.cs-overview__col h3 {
  font-family: var(--sans); font-weight: 700; font-size: 1.125rem; line-height: 1.45;
  letter-spacing: -0.005em; text-transform: uppercase; margin-bottom: 8px;
  background: var(--kicker-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .cs-overview__col h3 { color: var(--purple); -webkit-text-fill-color: currentColor; }
}
.cs-overview__col p { font-size: 1rem; line-height: 1.45; }

/* ---------- body sections ---------- */
/* full width: the grey sections paint edge to edge, and each section caps
   its own content instead (see the padding below) */
.cs-body { margin: 0 auto; }
/* body sections sit in an indented column, not hard against the gutter */
/* 80px between components, measured off the comp. The side padding grows
   past --maxw so the background bleeds to the window edge while the content
   stays capped at --maxw and centred. */
.cs-section { padding: 80px max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad))); }
.cs-section--gray { background: var(--surface); padding: 80px max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad))); }
/* except the first, which the comp keeps tighter under the summary box */
.cs-body > .cs-section:first-child { padding-top: 62px; }
/* two white sections in a row would otherwise stack 80 + 80; the comp reads
   as one continuous column there, so the preceding padding carries the gap */
.cs-section:not(.cs-section--gray) + .cs-section:not(.cs-section--gray) { padding-top: 0; }
/* 544px measure, off the comp: heading and body share one column at x=368.
   Grey sections use the same column unless they opt into --center. */
.cs-section > .cs-section__heading,
.cs-section > .cs-section__text,
.cs-section--gray > .cs-section__heading,
.cs-section--gray > .cs-section__text { margin-left: auto; margin-right: auto; max-width: 544px; }
/* balance keeps a long heading from dropping its last word onto a line of
   its own — "…was built on" orphans "on" at most widths otherwise.
   Browsers without it just fall back to normal wrapping. */
.cs-section__heading { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.3; letter-spacing: -0.005em; margin-bottom: 20px; text-wrap: balance; }
.cs-section__text { font-size: 1rem; line-height: 1.45; letter-spacing: -0.005em; max-width: 544px; }
/* grey sections read in the same left column as the white ones by default;
   only the ones the comp centres opt in */
.cs-section--center > .cs-section__heading,
.cs-section--center > .cs-section__text { text-align: center; margin-left: auto; margin-right: auto; max-width: 720px; }
.cs-section__text p { margin-bottom: 16px; }
.cs-section__text p:last-child { margin-bottom: 0; }
.cs-section__text strong { font-weight: 600; }
/* the single bold line the comp sets apart mid-section */
.cs-statement { font-weight: 700; font-size: 1.5rem; line-height: 1.45; margin: 24px 0 24px; }
.cs-section__text ul,
.cs-section__text ol { padding-left: 20px; margin-bottom: 16px; }
.cs-section__text li { margin-bottom: 10px; }
/* trailing list margins would otherwise add to the 80px between components */
.cs-section__text > :last-child { margin-bottom: 0; }
.cs-section__text li:last-child { margin-bottom: 0; }

/* sits in the text column by default, as the comps have it; --wide opts out */
.cs-section__image { margin: 40px auto 0; max-width: 544px; border-radius: 8px; overflow: hidden; }
.cs-section__image img { width: 100%; height: auto; }
.cs-section__image figcaption { padding-top: 16px; font-size: 0.875rem; color: var(--muted); text-align: center; }

/* wide variant for full-bleed diagrams */
.cs-section__image--wide { max-width: none; }

/* three-up principle cards inside a section */
/* 1035px centred, off the comp: 325px cards with 30px gaps, inset from the
   1152 content width rather than filling it */
.cs-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin: 40px auto 0; max-width: 1035px; }
.cs-card { background: #fff; border-radius: 30px; padding: 40px; display: flex; flex-direction: column; gap: 12px; }
/* some cards lead with a coloured phrase inline rather than a heading */
.cs-accent,
.cs-card__lead { color: var(--purple-vivid); font-weight: 600; }
.cs-section:not(.cs-section--gray) .cs-card { background: var(--surface); }
/* outlined variant: white card with a hairline, for a group sitting on a white
   band where a filled card would read as a second background */
.cs-section:not(.cs-section--gray) .cs-cards--outline .cs-card { background: #fff; border: 1px solid var(--line-soft); }
.cs-card h4 { font-family: var(--sans); font-weight: 600; font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.005em; }
.cs-card p { font-size: 1rem; line-height: 1.45; margin: 0; }
/* the global reset zeroes list padding, so bulleted cards restore it exactly
   as .cs-section__text ul does, keeping both lists on the same indent */
.cs-card ul { padding-left: 20px; }
.cs-card li { font-size: 1rem; line-height: 1.45; }

/* role chips */
.cs-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 32px; }
.cs-role { background: #fff; border: 1px solid var(--line-soft); border-radius: 30px; padding: 24px; }
.cs-role h4 { font-family: var(--sans); font-weight: 600; font-size: 1.125rem; margin-bottom: 6px; }
.cs-role p { font-size: 0.9375rem; color: var(--muted); margin: 0; line-height: 1.45; }

/* stat tiles */
.cs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 32px; }
/* the one exception to the 30px corner: the comp draws the KPI tiles as
   small-radius outlined boxes, white on white, rather than filled cards */
.cs-stat { background: #fff; border: 1px solid var(--card-line); border-radius: 8px; padding: 40px 30px; text-align: center; }
.cs-stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 52px; line-height: 1; }
.cs-stat span { font-size: 0.875rem; color: var(--muted); }

/* pull quote */
/* the comp sets the quote in a white card on the grey band, not loose */
.cs-quote {
  max-width: 684px; margin: 40px auto 0; text-align: center;
  background: #fff; border-radius: 30px; padding: 66px;
}
.cs-quote blockquote { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.25rem; line-height: 1.45; }
.cs-quote blockquote strong { font-weight: 700; }
.cs-quote cite { display: block; margin-top: 24px; font-style: normal; font-size: 0.9375rem; color: var(--muted); }

/* prev / next */
.cs-next { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; padding: 40px var(--pad) 0; max-width: var(--maxw); margin: 0 auto; }
.cs-next a { display: flex; flex-direction: column; gap: 6px; }
.cs-next span { font-size: 0.875rem; color: var(--muted); }
.cs-next b { font-family: var(--sans); font-size: 1.25rem; font-weight: 600; transition: opacity .2s; }
.cs-next a:hover b { opacity: .7; }
.cs-next .next { text-align: right; margin-left: auto; }

/* ============================================================
   Tablet
   ============================================================ */
@media (max-width: 1024px) {
  /* same side-by-side layout as desktop, image still bleeding off the right.
     Its width is a share of the viewport so the copy keeps a usable column,
     and there is no height cap — that is what clipped the laptop before. */
  .cs-hero { padding: 40px 0 40px var(--pad); gap: 32px; }
  .cs-hero__content { min-width: 0; }
  .cs-hero__image { flex: 0 0 44%; max-height: none; }
  .cs-hero__image img { width: 100%; height: auto; }
  .cs-hero__title { font-size: clamp(36px, 5.5vw, 56px); }
  .cs-meta { padding: 48px var(--pad); }
  .cs-meta__items { flex-wrap: wrap; gap: 24px; }
  .cs-overview__grid { grid-template-columns: 1fr; padding: 40px; }
  .cs-cards, .cs-roles, .cs-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 640px) {
  /* stacks here, where side-by-side leaves no usable column. No right
     padding, so the image still runs to the edge as it does above. */
  .cs-hero { flex-direction: column; align-items: flex-start; padding: 24px 0 24px 24px; gap: 24px; }
  .cs-hero__content { padding-right: 24px; }
  .cs-hero__image { flex: none; width: 100%; }
  .cs-hero__title { font-size: 40px; }
  .cs-meta { padding: 32px var(--pad); }
  /* four items in a 2x2 grid rather than a single tall column */
  .cs-meta__items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 20px; }
  /* the following section owns the gap under the summary box, as on desktop */
  .cs-overview { padding: 40px var(--pad) 0; }
  .cs-overview__grid { padding: 24px; border-radius: 16px; gap: 28px; }
  .cs-section, .cs-section--gray { padding: 56px var(--pad); }
  /* and the first section sits closer under the box than the rest */
  .cs-body > .cs-section:first-child { padding-top: 44px; }
  .cs-section__heading { font-size: 28px; }
  /* centred headings read as left-aligned here, like every other section */
  .cs-section--center > .cs-section__heading,
  .cs-section--center > .cs-section__text { text-align: left; }
  .cs-cards, .cs-stats { grid-template-columns: 1fr; }
  /* the role chips are short enough to pair up */
  .cs-roles { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .cs-role { padding: 20px; }
  .cs-quote blockquote { font-size: 1.25rem; }
  .cs-next { padding: 32px var(--pad) 0; }
}
