/* ==========================================================================
   CASE STUDIES — shared by every file in src/case-study/
   Hero · Cover · Facts · Sections · Gallery · Results · Quote · Next project
   Long-form case study (greenimpact.io)
   ========================================================================== */

.cs-hero { padding-block: clamp(40px, 6vw, 72px) clamp(28px, 4vw, 44px); display: flex; flex-direction: column; gap: 18px; }
.back-link { font-size: 14px; }
.cs-title { font-weight: 700; font-size: clamp(40px, 6.6vw, 92px); line-height: 0.96; letter-spacing: -0.035em; max-width: 22em; }
.cs-lead { font-family: var(--font-display); font-weight: 500; font-size: clamp(20px, 2.4vw, 28px); line-height: 1.35; color: var(--ink-700); max-width: 26em; text-wrap: pretty; }
.cs-link { font-size: 15px; }

.cs-cover { height: clamp(240px, 42vw, 520px); }
/* Image covers keep their own 2:1 shape so graphic text is never cropped */
.cs-cover--image { height: auto; aspect-ratio: 2 / 1; }
.cs-cover--16x9 { aspect-ratio: 16 / 9; }

.cs-facts {
  padding-top: clamp(36px, 5vw, 56px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: clamp(20px, 3vw, 32px);
}
.fact { border-top: 1px solid var(--line-warm); padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.fact-value { font-size: 16px; line-height: 1.55; color: var(--ink-600); }

.cs-section { padding-top: var(--section-y); }

/* Galleries: two per row; .gallery-wide takes the full row */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 700px) { .gallery { grid-template-columns: minmax(0, 1fr); } }
.gallery .well { height: clamp(220px, 30vw, 360px); }
.gallery-wide { grid-column: 1 / -1; }
.gallery-wide .well { height: clamp(240px, 38vw, 480px); }
/* Results: stat cards (the last one dark) and a quote panel */
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; }
.result-figure { font-family: var(--font-display); font-weight: 600; font-size: 46px; line-height: 1; color: var(--ink-900); }
.result p:not(.result-figure) { font-size: var(--size-body-sm); line-height: 1.6; color: var(--ink-600); }
.card--dark .result-figure { color: var(--violet-300); }
.card--dark.result p:not(.result-figure) { color: var(--ink-on-dark-strong); }
.quote-panel {
  margin-top: 20px; background: var(--surface-tint); border-radius: var(--radius-xl);
  padding: clamp(28px, 4vw, 48px); display: flex; flex-direction: column; gap: 24px;
}
.quote-panel > p { font-family: var(--font-display); font-weight: 500; font-size: clamp(21px, 2.4vw, 28px); line-height: 1.4; color: var(--ink-900); max-width: 34em; }
.quote-panel footer { display: flex; align-items: center; gap: 12px; }
.quote-panel .monogram { background: var(--surface-card); }

/* ---------- Long-form case study (greenimpact.io) ---------- */
/* Each project can bring its own accent: these tokens only apply inside the article */
.cs--green {
  --accent: #2A7354; --accent-hover: #1F5A41;
  --surface-tint: #E7EFEA; --cs-line: #D5E2D9;
}
.cs--petrol {
  --accent: #1E4A54; --accent-hover: #15363D;
  --surface-tint: #E6E2DB; --cs-line: #D9D4D2;
}
/* Tråd's page sits on a warm stone background; image frames turn lighter (Chalk) so they still read */
.page-trad { --surface-page: #E4E1DB; background: var(--surface-page); }
.page-trad .cs--petrol { --surface-tint: #F2EFEA; --cs-line: #D2CEC6; }
.page-trad .cs-subnav { background: rgba(228, 225, 219, 0.9); }
/* A soft lift on every image and video, so light edges never melt into the background */
.page-trad .cs-media { box-shadow: 0 0 0 1px rgba(23, 20, 31, 0.04), 0 2px 6px rgba(23, 20, 31, 0.06), 0 12px 32px rgba(23, 20, 31, 0.08); }
/* …except the hero video, whose laptop mockup already stands on its own */
.page-trad .cs-media:has(> video) { box-shadow: none; }
.cs--harmony {
  --accent: #014BAE; --accent-hover: #01377F;
  --surface-tint: #E6EEFA; --cs-line: #D3DEEE;
}
.cs-title--statement { font-size: clamp(38px, 5.6vw, 80px); line-height: 1; max-width: 15em; text-wrap: balance; }
.cs-hero-media { padding-top: clamp(40px, 6vw, 72px); }
.cs-media { aspect-ratio: 16 / 9; }
/* GIFs and animated WebPs are shown whole, never cropped */
.cs-media-img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Recordings keep their own proportions: the frame takes the image's shape */
.cs-media--natural { aspect-ratio: auto; }
.cs-media--natural .cs-media-img { height: auto; }
/* A little air around the laptop mockups on the most important visuals */
.cs-media--stage { padding: clamp(12px, 3vw, 40px); }

/* Section anchors — sticks under the header */
.cs-subnav {
  position: sticky; top: var(--nav-height); z-index: 40; margin-top: clamp(48px, 7vw, 96px);
  background: rgba(247, 245, 242, 0.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-block: 1px solid var(--line-warm);
}
.cs-subnav ul { display: flex; gap: clamp(20px, 4vw, 40px); overflow-x: auto; scrollbar-width: none; }
.cs-subnav ul::-webkit-scrollbar { display: none; }
.cs-subnav a {
  display: block; padding-block: 16px 13px; border-bottom: 2px solid transparent; white-space: nowrap;
  font-size: var(--size-nav); letter-spacing: var(--tracking-nav); text-transform: uppercase; color: var(--ink-600);
}
.cs-subnav a:hover, .cs-subnav a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
html:has(.cs-subnav) { scroll-padding-top: calc(var(--nav-height) + 80px); }
html:has(.cs-subnav) { scroll-behavior: smooth; }

/* Sections: label + headline on the left, text on the right (asymmetric) */
.cs-block {
  padding-top: clamp(80px, 11vw, 160px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(24px, 3vw, 40px) clamp(40px, 6vw, 96px);
}
@media (min-width: 900px) {
  .cs-block { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
  .cs-block > :not(.cs-block-head):not(.cs-block-body) { grid-column: 1 / -1; }
  .cs-block--wide { grid-template-columns: minmax(0, 1fr); }
  .cs-block--wide > .cs-block-body { max-width: 36em; }
}
.cs-block-head { display: flex; flex-direction: column; gap: 16px; }
.cs-block h2 { font-size: clamp(30px, 3.6vw, 52px); line-height: 1.05; letter-spacing: -0.025em; text-wrap: balance; }
.cs-num { font-size: 13px; font-weight: 600; letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--accent); }
.cs-block-body { font-size: 17.5px; max-width: 34em; }
@media (min-width: 900px) { .cs-block-body { padding-top: 34px; } }

.cs-block-lead { font-size: 17.5px; line-height: 1.68; color: var(--text-body); }
/* Simple numbered list of contributions */
.cs-list { counter-reset: cs-item; margin-top: 24px; border-top: 1px solid var(--cs-line, var(--line-warm)); }
.cs-list li {
  counter-increment: cs-item; display: flex; gap: 20px; align-items: baseline;
  padding-block: 14px; border-bottom: 1px solid var(--cs-line, var(--line-warm));
  font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink-900);
}
.cs-list li::before { content: counter(cs-item, decimal-leading-zero); flex: none; width: 2ch; font-family: var(--font-body, inherit); font-size: 13px; font-weight: 600; color: var(--accent); }

/* Two screens side by side (stacked on phones), each with a short caption */
.cs-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.cs-shot { display: flex; flex-direction: column; gap: 12px; }
.cs-shot figcaption { font-size: 13px; letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--ink-500); }

/* Research artifacts (greenimpact.io): a short intro, then the slides; each opens full size on click */
.cs-research { margin-top: clamp(56px, 7vw, 104px); display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 28px); }
.cs-research-head { max-width: 36em; display: flex; flex-direction: column; gap: 10px; }
.cs-research-head h3 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: -0.015em; }
.cs-research-head p { font-size: 17px; line-height: 1.6; color: var(--ink-700); }
.cs-zoom { display: block; cursor: zoom-in; }
.cs-zoom img { display: block; width: 100%; height: auto; }
.cs-scroll-hint { display: none; font-size: 13px; color: var(--ink-500); }
/* Phones: journey maps keep a readable size and scroll sideways instead of shrinking */
@media (max-width: 700px) {
  .cs-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cs-scroll img { width: 860px; max-width: none; }
  .cs-scroll-hint { display: block; }
}

/* Social posts: three per row, each keeps its own format (4:5 posts, 9:16 story) */
.cs-posts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: clamp(12px, 2vw, 24px); align-items: start; }
@media (min-width: 900px) { .cs-posts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Four per row for series of four (a 2×2 grid on tablets) */
@media (min-width: 600px) and (max-width: 899px) { .cs-posts--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .cs-posts--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* A five-step flow: three screens on the first row, two on the second (stacked on phones) */
.cs-flow { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(24px, 3vw, 40px) clamp(16px, 2.4vw, 32px); align-items: start; }
@media (min-width: 600px) { .cs-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) {
  .cs-flow { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cs-flow > * { grid-column: span 2; }
  .cs-flow > :nth-child(n+4) { grid-column: span 3; }
}

/* Logo files: each mark centred on its own colour tile */
.cs-marks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: clamp(12px, 2vw, 24px); }
@media (min-width: 900px) { .cs-marks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cs-mark { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 18%; border-radius: var(--radius-lg); background: var(--mark-bg, #F2EFEA); }
.cs-mark img { width: 100%; height: 100%; object-fit: contain; }
.cs-mark--icon img, .cs-mark--badge img { width: 70%; }

/* Presentation boards: full width, stacked */
.cs-boards { padding-top: clamp(64px, 9vw, 128px); display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 32px); }

/* Numbered points with a hairline on top — no cards */
.cs-points {
  counter-reset: cs-point; margin-top: clamp(8px, 2vw, 24px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: clamp(28px, 4vw, 48px);
}
.cs-points li { counter-increment: cs-point; border-top: 1px solid var(--cs-line, var(--line-warm)); padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.cs-points li::before { content: counter(cs-point, decimal-leading-zero); font-size: 13px; font-weight: 600; color: var(--accent); }
.cs-points h3 { font-size: 21px; line-height: 1.25; }
.cs-points p { font-size: var(--size-body-sm); line-height: 1.62; color: var(--ink-600); max-width: 26em; }
@media (min-width: 1100px) { .cs-points--four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cs-points .cs-response { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--cs-line, var(--line-warm)); color: var(--ink-900); }
.cs-response span { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--accent); }
.cs-aside { font-size: var(--size-body-sm); line-height: 1.62; color: var(--ink-600); max-width: 40em; }
.cs-block--wide > .cs-aside { margin-top: clamp(32px, 5vw, 64px); }

/* Concept evolution: three steps on one line */
.cs-evolution { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 28px 0; margin-top: clamp(8px, 2vw, 24px); }
.cs-evolution li {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 20px 28px 0 0; border-top: 2px solid var(--cs-line, var(--line-warm));
}
.cs-evolution li:last-child { border-top-color: var(--accent); }
.cs-evolution li::before {
  content: ""; position: absolute; top: -6px; left: 0; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface-page); border: 2px solid var(--accent);
}
.cs-evolution li:last-child::before { background: var(--accent); }
.cs-evolution-step { font-size: 12px; font-weight: 600; letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--ink-500); }
.cs-evolution-title { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.3; color: var(--ink-900); max-width: 16em; }

/* Double Diamond diagram */
.cs-diagram { margin-top: clamp(24px, 4vw, 48px); padding: clamp(24px, 4vw, 56px); border-radius: var(--radius-lg); background: var(--surface-tint); color: var(--accent); }
.cs-diagram svg { display: block; width: 100%; height: auto; max-width: 960px; margin-inline: auto; }
.cs-phases {
  max-width: 960px; margin: clamp(24px, 4vw, 40px) auto 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 24px;
}
.cs-phases li { display: flex; flex-direction: column; gap: 6px; }
.cs-phases h3 { font-size: 17px; color: var(--accent); }
.cs-phases p { font-size: 14.5px; line-height: 1.6; color: var(--ink-700); }
.cs-diagram-phase text { font-family: var(--font-display); font-size: 19px; font-weight: 600; fill: var(--ink-900); }
.cs-diagram-label text { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; fill: var(--accent); }
/* Phones: the diagram shrinks, so its labels grow in SVG units to stay readable */
@media (max-width: 600px) {
  .cs-diagram { padding: 20px 12px; }
  .cs-diagram-phase text { font-size: 32px; }
  .cs-diagram-label text { font-size: 24px; }
}

/* Solution flows: big media, short text beside it, sides alternate */
.cs-feature {
  margin-top: clamp(40px, 6vw, 88px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px clamp(32px, 4vw, 64px); align-items: center;
}
@media (min-width: 900px) {
  .cs-feature { grid-template-columns: minmax(0, 8fr) minmax(0, 3fr); }
  .cs-feature--flip { grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); }
  .cs-feature--flip .cs-media { order: 2; }
}
/* Tall boards (long pages, guidelines): text sticks beside the image while it scrolls past */
.cs-feature--tall { align-items: start; }
.cs-feature--tall + .cs-feature, .cs-block > .cs-feature--tall:first-child { margin-top: 0; }
@media (min-width: 900px) {
  .cs-feature--tall { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }
  .cs-feature--tall.cs-feature--flip { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); }
  .cs-feature--tall .cs-feature-text { position: sticky; top: calc(var(--nav-height) + 48px); }
}
.cs-feature-text p:not(.cs-num) + p { margin-top: 4px; }
/* Phones: read first, then scroll the board */
@media (max-width: 899px) { .cs-feature--tall .cs-feature-text, .cs--harmony .cs-feature-text { order: -1; } }

/* Supporting flows (Help Center, Green Profiles): smaller visual, more text room */
@media (min-width: 900px) {
  .cs-feature--compact { grid-template-columns: minmax(0, 6fr) minmax(0, 4fr); }
  .cs-feature--compact.cs-feature--flip { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
}
/* The core flow (Data Overview & Files): text on top, the recording full width */
.cs-feature--hero { grid-template-columns: minmax(0, 1fr) !important; margin-top: clamp(64px, 9vw, 128px); }
.cs-feature--hero .cs-feature-text { max-width: 36em; }
.cs-feature--hero .cs-feature-text h3 { font-size: clamp(30px, 3.6vw, 48px); }
.cs-feature-text { display: flex; flex-direction: column; gap: 12px; }
.cs-feature-text h3 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: -0.015em; }
.cs-feature-text p:not(.cs-num) { font-size: 17px; line-height: 1.6; color: var(--ink-700); }

/* Outcomes: big type, no boxes */
.cs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: clamp(32px, 4vw, 56px); }
.cs-stats > div { border-top: 1px solid var(--cs-line, var(--line-warm)); padding-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.cs-stats dt { font-family: var(--font-display); font-weight: 800; font-size: clamp(64px, 8vw, 120px); line-height: 0.9; letter-spacing: -0.04em; color: var(--ink-900); }
.cs-stats dt.cs-stats-word { font-size: clamp(40px, 4.4vw, 64px); line-height: 1; padding-top: 0.2em; }
.cs-stats dd { font-size: var(--size-body-sm); line-height: 1.62; color: var(--ink-600); max-width: 24em; }
.cs-stats dd strong { display: block; margin-bottom: 4px; font-size: 17px; font-weight: 600; color: var(--ink-900); }

/* Phones: recordings run edge to edge for every extra pixel of legibility */
@media (max-width: 600px) {
  .cs-feature .cs-media--natural, .cs-hero-media .cs-media, .cs-boards .cs-media { margin-inline: calc(var(--gutter) * -1); border-radius: 0; }
  .cs-media--stage { padding: 8px 0; }
}

/* Scroll reveal (case-study.js adds .has-reveal; without JS everything is simply visible) */
.has-reveal .reveal { opacity: 0; transform: translateY(28px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
.has-reveal .reveal.is-visible { opacity: 1; transform: none; }

/* Next project card */
.cs-next { padding-top: var(--section-y); }
.next-card {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 24px; align-items: center;
  background: var(--surface-card); border: 1px solid var(--line-warm); border-radius: var(--radius-lg); padding: 22px;
  color: var(--ink-900); transition: border-color var(--dur-fast) var(--ease);
}
.next-card:hover { border-color: var(--accent); color: var(--ink-900); }
.next-media { height: clamp(180px, 22vw, 260px); border-radius: var(--radius-md); }
.next-text { display: flex; flex-direction: column; gap: 8px; }
.next-text h2 { font-size: clamp(24px, 2.6vw, 34px); }
.read-more { color: var(--accent); margin-top: 8px; }
