/* ── cz-real-cases — homepage case studies ────────────────────────────────────
   One white card per case: location + title, the story (What happened / How it
   ended) and a coloured Impact panel. Layout per tier:
     < 768   head → impact band → story          (cards swipe, next card peeks)
     768     head → story (2 cols) → impact band
     992+    [head + story] | impact column (full card height; its label
             aligned with the story labels)
   The carousel is a native scroll-snap track (swipe / trackpad / keyboard); JS
   adds dots, counter and arrows. 22/09 14:53 */

/* ── Snapping outer wrapper ──────────────────────────────────────────────── */
.czrc-outer {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 20px 16px !important;
  width: 100%;
}
@media (min-width: 576px)  { .czrc-outer { max-width: 540px;  padding: 20px 16px !important; } }
@media (min-width: 768px)  { .czrc-outer { max-width: 720px;  padding: 20px 20px !important; } }
@media (min-width: 992px)  { .czrc-outer { max-width: 960px;  padding: 20px 24px !important; } }
@media (min-width: 1280px) { .czrc-outer { max-width: 1300px; padding: 20px 32px !important; } }

.czrc {
  --czrc-ink: #1D1D1B;
  --czrc-body: #52525A;
  --czrc-teal: #279a93;
  --czrc-coral: #E97677;
  --czrc-coral-text: #C24E51; /* brand coral is only 2.9:1 on white at text sizes */
  --czrc-impact-bg: var(--czrc-coral);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.czrc--impact-charcoal { --czrc-impact-bg: #1D1D1B; }
.czrc--impact-teal     { --czrc-impact-bg: #279a93; }

/* ── Intro (matches the homepage section header) ─────────────────────────── */
.czrc-intro { text-align: center; margin-bottom: 28px; }
.czrc .czrc-eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--czrc-teal);
  margin: 0 0 16px;
  text-align: center;
}
.czrc .czrc-heading {
  font-family: 'Recoleta', Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--czrc-ink);
  margin: 0 0 12px;
  text-align: center;
}
.czrc .czrc-subhead {
  font-size: 15px;
  line-height: 1.65;
  color: var(--czrc-body);
  margin: 0 auto;
  max-width: 600px;
  text-align: center;
}
.czrc .czrc-subhead strong { font-weight: 700; color: var(--czrc-ink); }
@media (min-width: 768px)  { .czrc .czrc-heading { font-size: 28px; } .czrc-intro { margin-bottom: 32px; } }
@media (min-width: 992px)  { .czrc .czrc-heading { font-size: 34px; } .czrc-intro { margin-bottom: 36px; } }
@media (min-width: 1280px) { .czrc .czrc-heading { font-size: 38px; } }

/* ── Track: native scroll-snap ───────────────────────────────────────────────
   Padding + matching negative margin gives the cards' shadows room inside the
   scroll box; the slide gap (≥ 2× side padding from 768px) keeps the next card
   out of view on desktop. On phones the next card deliberately peeks. */
.czrc-carousel { position: relative; }
.czrc-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 8px 16px 30px;
  margin: -8px -16px -30px;
}
.czrc-track::-webkit-scrollbar { display: none; }
.czrc-track:focus { outline: none; }
.czrc-track:focus-visible { outline: 2px solid var(--czrc-teal); outline-offset: -4px; border-radius: 18px; }

.czrc-slide {
  flex: 0 0 calc(100% - 20px);
  min-width: 0;
  scroll-snap-align: start;
}
.czrc--single .czrc-slide { flex-basis: 100%; }

@media (min-width: 768px) {
  .czrc-track { align-items: stretch; gap: 32px; }
  .czrc-slide { flex-basis: 100%; }
}

/* Peek: from 992px the current case narrows and the neighbours show at either
   side, dimmed, with the track's edges faded — so it reads as "there's more",
   not as clipped content. The side padding is half the leftover width, so the
   first and last cards centre with nothing peeking beyond them. */
@media (min-width: 992px) {
  .czrc--peek { --czrc-cardw: 80%; }
  .czrc--peek .czrc-track {
    padding-inline: calc((100% - var(--czrc-cardw)) / 2);
    /* no negative side margin here: it would widen the scroll area beyond the
       container, so the current card sat left of centre with a lopsided peek */
    margin-inline: 0;
    scroll-padding-inline: calc((100% - var(--czrc-cardw)) / 2);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 11%, #000 89%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 11%, #000 89%, transparent 100%);
  }
  /* The side padding is half the leftover width, so the track's own content box
     is exactly the card width — hence 100% here, not the percentage, which would
     resolve against that already-narrowed box and pull the card off centre. */
  .czrc--peek .czrc-slide { flex-basis: 100%; opacity: 0.6; transition: opacity 0.35s ease; }
  .czrc--peek .czrc-slide.is-current { opacity: 1; }
  /* line the dots and controls up with the edges of the centred card */
  .czrc--peek .czrc-nav { padding-inline: calc((100% - var(--czrc-cardw)) / 2); }
}
@media (min-width: 1280px) { .czrc--peek { --czrc-cardw: 74%; } }
@media (prefers-reduced-motion: reduce) { .czrc--peek .czrc-slide { transition: none; } }

/* ── The card ─────────────────────────────────────────────────────────────── */
.czrc-card {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "head" "impact" "story";
  background: #ffffff;
  border: 1px solid rgba(29, 29, 27, 0.12);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin: 0;
}
.czrc-head   { grid-area: head;   padding: 22px 20px 0; }
.czrc-impact { grid-area: impact; }
.czrc-storywrap { grid-area: story; position: relative; min-height: 0; display: flex; flex-direction: column; }
.czrc-story  { padding: 18px 20px 24px; }

.czrc .czrc-loc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--czrc-teal);
  margin: 0 0 8px;
}
.czrc-pin { width: 14px; height: 14px; flex: 0 0 auto; fill: currentColor; }

.czrc .czrc-title {
  font-family: 'Recoleta', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--czrc-ink);
  margin: 0;
  text-wrap: balance;
}

/* Impact — a coloured band on small screens; from 992px a full-height column
   whose label sits on the same line as the story labels (see LG below). */
.czrc-impact {
  margin: 16px 20px 0;
  border-radius: 10px;
  background: var(--czrc-impact-bg);
  color: #ffffff;
}
.czrc-impact-inner { padding: 14px 18px 16px; }
.czrc .czrc-impact-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.4;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 4px;
}
/* Long impact lines (> 60 characters, flagged in HubL) step down a size */
.czrc .czrc-impact-text {
  font-family: 'Recoleta', Georgia, serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.28;
  color: #ffffff;
  margin: 0;
}

/* Story */
.czrc-story { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.czrc .czrc-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--czrc-ink);
  margin: 0 0 6px;
}
.czrc .czrc-text {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--czrc-body);
  margin: 0;
}

/* Rich text (HubDB RICHTEXT columns) — sanitised in module.html, then held to
   this module's typography so pasted formatting can't drift: fonts, sizes and
   alignment all inherit, and one emphasis colour is allowed (any colour but
   black renders as the brand coral). */
.czrc .czrc-rich * {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  letter-spacing: normal !important;
  background: transparent !important;
  text-align: left !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.czrc .czrc-rich p { margin: 0 0 0.8em; }
.czrc .czrc-rich p:last-child,
.czrc .czrc-rich ul:last-child,
.czrc .czrc-rich ol:last-child { margin-bottom: 0; }
.czrc .czrc-rich strong, .czrc .czrc-rich b { font-weight: 600; color: var(--czrc-ink); }
.czrc .czrc-rich em, .czrc .czrc-rich i { font-style: italic; }
.czrc .czrc-rich .cz-em,
.czrc .czrc-rich [style*="color"]:not([style*="rgb(0, 0, 0)"]):not([style*="#000"]) {
  color: var(--czrc-coral-text) !important;
  font-weight: 600;
}
.czrc .czrc-rich ul { list-style: none !important; margin: 0 0 0.8em; padding: 0; }
.czrc .czrc-rich ul > li { list-style: none !important; }
.czrc .czrc-rich ul > li { position: relative; margin: 0 0 7px; padding-left: 16px; }
.czrc .czrc-rich ul > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--czrc-ink);
}
.czrc .czrc-rich li:has(> .cz-em:first-child)::before,
.czrc .czrc-rich li:has(> strong:first-child > .cz-em:first-child)::before,
.czrc .czrc-rich li:has(> b:first-child > .cz-em:first-child)::before { background: var(--czrc-coral-text); }
.czrc .czrc-rich ol { margin: 0 0 0.8em; padding-left: 1.3em; }
.czrc .czrc-rich ol > li { margin: 0 0 7px; }
.czrc .czrc-rich li:last-child { margin-bottom: 0; }

/* Bullet lists — for HubDB fields written as "- one - two" (see module.html) */
.czrc .czrc-bullets { list-style: none; margin: 0; padding: 0; }
.czrc .czrc-bullets li {
  position: relative;
  margin: 0 0 7px;
  padding-left: 15px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--czrc-body);
}
.czrc .czrc-bullets li:last-child { margin-bottom: 0; }
.czrc .czrc-bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--czrc-ink);
}
.czrc-text + .czrc-bullets { margin-top: 8px; }

/* Single-block cases (only one story field filled): one full-width column, no label */
@media (min-width: 768px) { .czrc .czrc-story--single { grid-template-columns: minmax(0, 1fr); } }

/* SM */
@media (min-width: 576px) {
  .czrc-head   { padding: 26px 26px 0; }
  .czrc-impact { margin: 18px 26px 0; }
  .czrc-story  { padding: 20px 26px 28px; }
  .czrc .czrc-title { font-size: 24px; }
}

/* MD — story in two columns, impact band at the foot */
@media (min-width: 768px) {
  .czrc-card { grid-template-rows: auto 1fr auto; grid-template-areas: "head" "story" "impact"; }
  .czrc-head   { padding: 30px 30px 0; }
  .czrc-story  { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding: 20px 30px 24px; }
  .czrc-impact { margin: 0 30px 30px; }
  .czrc-impact-inner { padding: 16px 22px 18px; display: flex; align-items: baseline; gap: 18px; }
  .czrc .czrc-impact-label { margin: 0; flex: 0 0 auto; }
  .czrc .czrc-title { font-size: 26px; }
  .czrc .czrc-text  { font-size: 15px; }
  .czrc .czrc-bullets li { font-size: 15px; }
}

/* LG — story left, impact as a full-height coral column on the right.
   The column spans both card rows and inherits them (subgrid), so its content
   starts on the story row: with the same top padding and label metrics,
   THE IMPACT lines up exactly with WHAT HAPPENED / HOW IT ENDED. */
@media (min-width: 992px) {
  .czrc-card {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: auto 1fr;
    grid-template-areas: "head impact" "story impact";
  }
  .czrc-head  { padding: 40px 40px 0; }
  .czrc-story { gap: 32px; padding: 22px 40px 40px; }

  .czrc-impact { margin: 0; border-radius: 0; display: grid; grid-template-rows: subgrid; }
  .czrc-impact-inner { grid-row: 2; display: block; padding: 22px 36px 40px; }
  .czrc .czrc-impact-label { font-size: 11.5px; letter-spacing: 0.1em; margin: 0 0 10px; }
  .czrc .czrc-impact-text  { font-size: 24px; line-height: 1.24; }
  .czrc .czrc-impact--long .czrc-impact-text { font-size: 20px; line-height: 1.3; }
  .czrc .czrc-title { font-size: 28px; }
}
/* Browsers without subgrid: content simply starts at the top of the column */
@supports not (grid-template-rows: subgrid) {
  @media (min-width: 992px) { .czrc-impact-inner { grid-row: auto; padding-top: 40px; } }
}

/* XL */
@media (min-width: 1280px) {
  .czrc-card  { grid-template-columns: minmax(0, 1fr) 380px; }
  .czrc-head  { padding: 48px 52px 0; }
  .czrc-story { gap: 44px; padding: 24px 52px 48px; }
  .czrc-impact-inner { padding: 24px 48px 48px; }
  .czrc .czrc-impact-text { font-size: 28px; }
  .czrc .czrc-impact--long .czrc-impact-text { font-size: 22px; }
  .czrc .czrc-title { font-size: 32px; }
  .czrc .czrc-text  { font-size: 15.5px; }
  .czrc .czrc-bullets li { font-size: 15.5px; }
}
@supports not (grid-template-rows: subgrid) {
  @media (min-width: 1280px) { .czrc-impact-inner { padding-top: 48px; } }
}

/* No impact recorded for this case — drop the side column entirely and let the
   story fill the card. Higher specificity than the tier blocks above, which
   re-declare the card's columns. */
@media (min-width: 992px) {
  .czrc .czrc-card--noimpact { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "story"; }
}

/* Optional fixed height (Card height = "Fixed height, story scrolls"): the card
   holds the shortest case's height, the head (and impact) stay put and the story
   scrolls with a soft fade while there's more to read. Phones keep natural
   heights either way. */
.czrc-fade { display: none; }
@media (min-width: 768px) {
  .czrc--h-scroll .czrc-card { height: var(--czrc-h, auto); }
  .czrc--h-scroll .czrc-story {
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 29, 27, 0.2) transparent;
  }
  .czrc--h-scroll .czrc-story::-webkit-scrollbar { width: 6px; }
  .czrc--h-scroll .czrc-story::-webkit-scrollbar-thumb { background: rgba(29, 29, 27, 0.2); border-radius: 3px; }
  .czrc--h-scroll .czrc-story:focus-visible { outline: 2px solid var(--czrc-teal); outline-offset: -2px; }
  .czrc--h-scroll .czrc-fade {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff 88%);
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .czrc--h-scroll .czrc-storywrap.has-more .czrc-fade { opacity: 1; }
}

/* One text block: headline in a third, text in two-thirds, divider between.
   Placed after the tier and no-impact rules so it wins. */
@media (min-width: 768px) {
  .czrc .czrc-card--single {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    grid-template-rows: 1fr auto;
    grid-template-areas: "head story" "head impact";
  }
  .czrc .czrc-card--single .czrc-head { padding: 34px 26px 34px 32px; border-right: 1px solid rgba(29, 29, 27, 0.1); }
  .czrc .czrc-card--single .czrc-story { padding: 34px 32px 34px 26px; }
}
@media (min-width: 992px) {
  .czrc .czrc-card--single .czrc-head { padding: 40px 30px 40px 40px; }
  .czrc .czrc-card--single .czrc-story { padding: 40px 40px 40px 30px; }
}
@media (min-width: 1280px) {
  .czrc .czrc-card--single .czrc-head { padding: 46px 34px 46px 46px; }
  .czrc .czrc-card--single .czrc-story { padding: 46px 46px 46px 34px; }
}

/* Height measuring (module.js adds .is-measuring for one synchronous read) */
.czrc.is-measuring .czrc-card { height: auto !important; align-self: flex-start; }
.czrc.is-measuring .czrc-story { overflow: visible !important; }

/* ── Nav: dots left · counter + arrows right ─────────────────────────────── */
.czrc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}
.czrc-nav[hidden] { display: none; }

.czrc-dots { display: flex; align-items: center; flex-wrap: wrap; }
.czrc .czrc-dot {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  box-shadow: none;
  margin: 0;
  padding: 10px 4px;
  cursor: pointer;
  line-height: 0;
}
.czrc-dot::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(29, 29, 27, 0.2);
  transition: width 0.3s ease, background-color 0.3s ease;
}
.czrc-dot:hover::before { background: rgba(29, 29, 27, 0.4); }
.czrc-dot.is-active::before { width: 26px; background: var(--czrc-coral); }
.czrc .czrc-dot:focus { outline: none; }
.czrc .czrc-dot:focus-visible { outline: 2px solid var(--czrc-teal); outline-offset: 0; border-radius: 6px; }

.czrc-controls { display: none; align-items: center; gap: 10px; }
@media (min-width: 576px) { .czrc-controls { display: flex; } }

.czrc-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--czrc-body);
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
  white-space: nowrap;
}

.czrc .czrc-arrow {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(29, 29, 27, 0.14);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  color: var(--czrc-ink);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.czrc-arrow svg { width: 20px; height: 20px; display: block; }
.czrc .czrc-arrow:hover { border-color: rgba(29, 29, 27, 0.3); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1); transform: translateY(-1px); }
.czrc .czrc-arrow:active { transform: translateY(0) scale(0.96); }
.czrc .czrc-arrow:focus { outline: none; }
.czrc .czrc-arrow:focus-visible { outline: 2px solid var(--czrc-teal); outline-offset: 2px; }

/* ── CTA ─────────────────────────────────────────────────────────────────── */
.czrc-cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}
.czrc-secondary-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--czrc-body);
  text-decoration: none;
  transition: color 0.2s ease;
}
.czrc-secondary-link:hover { color: var(--czrc-ink); }

@media (prefers-reduced-motion: reduce) {
  .czrc-dot::before, .czrc .czrc-arrow { transition: none; }
}
