/* ==========================================================================
   Case study detail pages (HAA / AI HealthLink / CAVW)

   Measured against the 1920x8703 CAVW frame exported from the Figma
   "Portfolio Design" file. Every value below traces to that export:
     content column   x 106 -> 1822  (1716 wide)
     page title       64px Inter Semi Bold, single line
     section heading  48px Inter Semi Bold, #000
     body copy        24px Inter Regular, #404040, 29px line height,
                      justified, running the full 1716 column
   ========================================================================== */

.case {
  --case-ink: #000000;
  --case-body: #404040;
  --case-label: #979797;
  --case-value: #202020;
  --case-card: #f5f4f4;

  /* 24px body on a 29px line box */
  --case-body-size: clamp(15px, 1.25vw, 24px);
  --case-body-leading: 1.21;

  padding-bottom: clamp(64px, 9.5vw, 183px);
}

.case-head {
  padding-top: clamp(18px, 5.2vw, 100px); /* header block -> title, Figma y=296 */
}

.case-eyebrow {
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--case-label);
  margin: 0 0 clamp(14px, 2vw, 22px);
}

/* Figma: 64px Semi Bold in a 1316px text box, which is what decides where
   the longer two titles break */
.case-title {
  margin: 0;
  max-width: 1316px;
  font-weight: 600;
  font-size: clamp(1.9rem, 3.33vw, 4rem);
  line-height: 1.21;
  letter-spacing: -0.01em;
  color: var(--case-ink);
}

/* Figma: same 24px body style as the rest of the page, full column, justified */
.case-kicker {
  margin: clamp(8px, 1.1vw, 21px) 0 0;
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
  text-align: justify;
  text-justify: inter-word;
}

/* Figma: five columns across the full column, hand-set widths */
.case-meta {
  /* The frames pin this row at y=604 whatever the title and lede do above
     it, so each page passes its own gap and column widths. */
  --meta-gap: clamp(36px, 7.9vw, 152px);
  --meta-cols: 420fr 292fr 362fr 394fr 248fr;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(20px, 2vw, 32px) clamp(20px, 3vw, 48px);
  margin: var(--meta-gap) 0 clamp(20px, 2.1vw, 40px);
}

.case-meta dt {
  /* Figma: same 24px as the value, set in #979797 */
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-label);
  margin-bottom: clamp(6px, 0.73vw, 14px);
}

.case-meta dd {
  margin: 0;
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  font-weight: 400;
  color: var(--case-value);
}

@media (min-width: 720px) {
  .case-meta {
    grid-template-columns: var(--meta-cols);
    gap: 0;
  }
}

/* Banner, flush with the content column. Each frame sets its own height
   (CAVW 700, HAA 740, AI HealthLink 725), so the image drives the ratio. */
.case-hero {
  display: block;
  background: #f2f2f2;
  margin-top: var(--hero-gap, 0);
  margin-bottom: clamp(12px, 1.3vw, 25px);
}

.case-hero img { width: 100%; height: auto; display: block; }

/* ---------- The four summary cards under the banner ---------- */
/* Figma: four 403 x 328 cards filled #F5F4F4, 34px apart, 24px copy
   inset 32px from the sides and 83px from the top. */

.case-cards {
  /* CAVW and HAA sit the copy 83px down inside the card; the AI HealthLink
     frame pulls the card box down instead and leaves only 18px */
  --card-pad-top: clamp(28px, 4.3vw, 83px);
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.8vw, 35px);
  margin: 0 0 clamp(28px, 1.9vw, 36px);
}

@media (min-width: 640px) {
  .case-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1000px) {
  .case-cards { grid-template-columns: repeat(4, 1fr); }
}

.case-cards p {
  margin: 0;
  background: var(--case-card);
  min-height: clamp(150px, 13.4vw, 258px);
  padding: var(--card-pad-top) clamp(20px, 1.7vw, 32px) clamp(24px, 3.7vw, 71px);
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
}

/* Carried over for the HAA and AI HealthLink pages, which still use the
   earlier markup. Same card treatment, four across. */
.case-highlights {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.8vw, 35px);
  margin: 0 0 clamp(28px, 1.9vw, 36px);
}

@media (min-width: 640px) {
  .case-highlights { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1000px) {
  .case-highlights { grid-template-columns: repeat(3, 1fr); }
}

.case-highlights p {
  margin: 0;
  background: var(--case-card);
  min-height: clamp(150px, 13.4vw, 258px);
  padding: clamp(28px, 4.3vw, 83px) clamp(20px, 1.7vw, 32px) clamp(24px, 3.7vw, 71px);
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
}

/* ---------- Body sections ---------- */

.case-section {
  margin: 0 0 clamp(32px, 3.75vw, 72px);
}

.case-section:last-of-type { margin-bottom: 0; }

/* Figma: 48px Semi Bold, sitting directly on top of its paragraph.
   Sub-headings inside a section are set at the same 48px in the HAA and
   AI HealthLink frames, so h2 and h3 share one size here. */
.case-section h2,
.case-section h3 {
  font-weight: 600;
  font-size: clamp(1.4rem, 2.5vw, 3rem);
  line-height: 1.21;
  letter-spacing: -0.01em;
  color: var(--case-ink);
  margin: 0;
}

/* A plain 24px line used to label a group of screens ("Digital intake") */
.case-label {
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-ink);
  margin: clamp(28px, 3.5vw, 67px) 0 clamp(10px, 1.5vw, 29px);
}

/* Figma: the sub-headings inside "What I did" are set as plain body lines,
   not as a separate type size. Kept as headings for document structure,
   styled to match the file. */
.case-section h3.case-lead {
  font-weight: 400;
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  letter-spacing: 0;
  color: var(--case-body);
  margin: 0;
}

.case-section p {
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
  margin: 0 0 1.21em; /* Figma separates paragraphs by one blank line */
  text-align: justify;
  text-justify: inter-word;
}

.case-section p:last-child { margin-bottom: 0; }

.case-section ol,
.case-section ul {
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
  padding-left: clamp(22px, 2vw, 38px);
  margin: 1.21em 0;
  text-align: justify;
  text-justify: inter-word;
}

.case-section li { margin-bottom: 0; }

.case-lede {
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
  text-align: justify;
  margin: 0 0 clamp(40px, 6vw, 72px);
}

/* ---------- Visuals ---------- */
/* Figma places these at their own measured sizes inside the 1716 column,
   so each one keeps the width and ratio it has in the file. */

/* Each visual keeps the width and left offset it has in its Figma frame.
   Both are set per figure as percentages of the 1716px content column via
   the --vw / --vx custom properties, so they scale with the layout. */
.case-visual {
  margin: clamp(24px, 3.75vw, 72px) 0;
}

.case-visual img {
  width: 100%;
  max-width: var(--vw, 100%);
  margin-left: var(--vx, 0);
  display: block;
  background: #f2f2f2;
}

/* Figma gives the CAVW board visual roughly 245px of air above and below */
.case-visual--board {
  margin: clamp(40px, 13vw, 251px) 0 clamp(40px, 12.4vw, 238px);
}

@media (max-width: 720px) {
  /* Offsets that read as composition at 1920 just waste width on a phone */
  .case-visual img { max-width: 100%; margin-left: 0; }
}

.case-visual figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--case-label);
}

/* Paired visuals and the CSS-built component diagram, both still used by the
   HAA and AI HealthLink pages */
.case-visual-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 1.8vw, 35px);
  margin: clamp(28px, 5.1vw, 98px) 0 clamp(24px, 2.7vw, 52px);
}

@media (min-width: 640px) {
  .case-visual-pair { grid-template-columns: 1fr 1fr; }
}

.case-visual-pair figure { margin: 0; }
.case-visual-pair img { width: 100%; display: block; background: #f2f2f2; }
.case-visual-pair figcaption {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--case-label);
}

.case-diagram {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: clamp(20px, 3vw, 28px) 0 clamp(28px, 4vw, 40px);
}

.case-diagram span {
  font-size: clamp(13px, 0.94vw, 18px);
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--case-card);
  color: var(--case-ink);
}

/* Full-bleed dark band holding the review room screen (Figma: 1920 x 1244) */
.case-band {
  margin: clamp(24px, 2.5vw, 48px) 0 clamp(24px, 2.3vw, 45px);
  background: #3a3c3a;
}

.case-band img {
  width: 100%;
  display: block;
}

/* Embedded motion piece. Figma leaves a 1711 x 1109 placeholder here; the
   real piece is 16:9, so it runs the full column at its own ratio. */
.case-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #3a3a3a;
  display: block;
  margin: clamp(14px, 1vw, 20px) 0 clamp(32px, 4.5vw, 86px);
}

/* Live Figma prototype. The frame draws this as a 1717 x 451 block, which is
   too short to click through a phone prototype in, so it runs at 16:9. */
.case-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #2b2b2b;
  border: 0;
  display: block;
  margin: clamp(20px, 2.3vw, 44px) 0 0;
}

/* Fallback for a viewer whose browser blocks the embed */
.case-embed-link {
  margin: clamp(10px, 1.2vw, 22px) 0 clamp(28px, 3.7vw, 71px);
  font-size: clamp(13px, 0.94vw, 18px);
  color: var(--case-label);
}

.case-embed-link a {
  color: var(--case-body);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Results / pull-quote. Figma sets this as plain body copy rather than an
   indented rule, so it is styled to match the paragraphs around it. */
.case-quote {
  font-size: var(--case-body-size);
  line-height: var(--case-body-leading);
  color: var(--case-body);
  margin: clamp(24px, 2.5vw, 48px) 0;
  padding: 0;
  border: 0;
}

.case-quote cite {
  display: block;
  font-size: inherit;
  font-style: normal;
  color: inherit;
}

.case-credit {
  margin: clamp(56px, 8vw, 96px) 0 0;
  padding-top: clamp(24px, 3vw, 32px);
  border-top: 1px solid var(--edge);
  font-size: 15px;
  line-height: 1.6;
  color: var(--case-label);
}

.case-credit strong { color: var(--case-ink); }

/* ---------- Next case study ---------- */

.case-next {
  margin: clamp(40px, 6vw, 88px) 0 0;
}

.case-next-link {
  display: block;
  border: 1.5px solid var(--case-ink);
  border-radius: clamp(16px, 2vw, 28px);
  padding: clamp(24px, 3.5vw, 48px) clamp(24px, 3.5vw, 48px);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.case-next-link:hover,
.case-next-link:focus-visible {
  background-color: var(--case-card);
}

.case-next-label {
  display: block;
  font-size: clamp(12px, 0.85vw, 15px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--case-label);
  margin-bottom: clamp(8px, 1vw, 14px);
}

.case-next-title {
  display: block;
  font-weight: 600;
  /* Matches the site's standard section-heading size (case-section h2/h3). */
  font-size: clamp(1.4rem, 2.5vw, 3rem);
  line-height: 1.21;
  letter-spacing: -0.01em;
  color: var(--case-ink);
}

/* Justified copy opens rivers on narrow screens, so it goes ragged there */
@media (max-width: 720px) {
  .case-kicker,
  .case-lede,
  .case-section p,
  .case-section ol,
  .case-section ul {
    text-align: left;
  }
}
