/* ---------- Case study pages (from Figma "notion") ----------
   Builds on the fonts and tokens in styles.css. */
:root {
  --cs-bg: #fffefb;
  --cs-label: #5c5c5c;
  --cs-body: #676565;
  --cs-toc: #88867f;
  --cs-header-bg: #f8f7f3;
  --cs-callout-bg: #fdfcf7;
  --cs-callout-border: #d6d2d2;
  --cs-award-bg: #faf9f6;
  --cs-award-border: #d4d4d0;

  --cs-page-pad: 72px 64px 120px;
  --cs-sidebar-gap: 48px;
  --cs-body-width: 893px;     /* header + hero */
  --cs-text-width: 597px;     /* sections */
  --cs-intro-gap: 120px;      /* hero → first section */
  --cs-section-gap: 148px;
}

body.case-study-page { background: var(--bg); }  /* same paper as the homepage */
h1, h2, figure, dl, dd { margin: 0; }

.cs-page { position: relative; display: flex; gap: var(--cs-sidebar-gap); align-items: flex-start; padding: var(--cs-page-pad); } /* index pinned where the main nav sits (64px in, 72px down) at every width */

/* ---------- Sidebar: back link + section menu (follows you down the page) ---------- */
.cs-sidebar { position: sticky; top: 72px; flex: none; width: max-content; display: flex; flex-direction: column; gap: 48px; }
.cs-back { font: 300 12px/normal var(--font-serif); }
.cs-toc a { font: 300 14px/normal var(--font-mono); text-transform: uppercase; white-space: nowrap; }
.cs-back { color: var(--ink); white-space: nowrap; }
.cs-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.cs-toc { display: flex; flex-direction: column; gap: 8px; }
.cs-toc a { position: relative; color: #2a2a2a; transition: color .2s, padding-left .2s; }
.cs-toc a:hover { color: var(--ink); }
.cs-toc a.is-active { padding-left: 12px; color: var(--ink); }
.cs-toc a::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 0;
  background: url("assets/notion/dot.svg") center / contain no-repeat;
  opacity: 0; transition: opacity .2s;
}
.cs-toc a.is-active::before { opacity: 1; }

/* ---------- Main column ---------- */
.cs-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--cs-intro-gap); }
.cs-intro, .cs-sections { width: 100%; max-width: var(--cs-body-width); }
.cs-sections { display: flex; flex-direction: column; align-items: center; gap: var(--cs-section-gap); }
.cs-group { width: 100%; max-width: var(--cs-text-width); display: flex; flex-direction: column; gap: var(--cs-section-gap); scroll-margin-top: 88px; }
.cs-intro { scroll-margin-top: 88px; }

.cs-intro { display: flex; flex-direction: column; gap: 24px; }
.cs-header { display: flex; flex-direction: column; gap: 32px; }
.cs-icon { width: 16px; height: 16px; opacity: .7; }
.cs-title { font: 500 24px/normal var(--font-body); text-transform: capitalize; color: var(--ink); }
.cs-facts { display: flex; gap: 16px; }
.cs-facts div { display: flex; flex-direction: column; gap: 8px; }
.cs-facts dt { font: 300 14px/normal var(--font-mono); text-transform: uppercase; color: #2a2a2a; }
.cs-facts dd { font: 16px/normal var(--font-body); color: var(--ink); text-transform: capitalize; }

.cs-hero { display: flex; justify-content: center; background: #000; }
.cs-hero img { width: 671px; height: auto; aspect-ratio: 671 / 375; object-fit: cover; border-radius: var(--radius); }

/* ---------- Text blocks ---------- */
.cs-block { display: flex; flex-direction: column; gap: 16px; }
.cs-block--tight { gap: 12px; }
.cs-email { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(103 101 101 / .4); }
.cs-email:hover { color: var(--ink); }
.cs-block--spaced { gap: 48px; }
.cs-block--loose { gap: 32px; }
.cs-label { font: 300 14px/normal var(--font-mono); color: #2a2a2a; text-transform: uppercase; }
.cs-lead { font: 22px/normal var(--font-body); color: var(--ink); }
.cs-body { font: 16px/normal var(--font-body); color: var(--cs-body); }

/* Solution features */
.cs-features { display: flex; flex-direction: column; gap: 48px; }
.cs-feature { display: flex; flex-direction: column; gap: 16px; }
.cs-feature figcaption { display: flex; flex-direction: column; gap: 4px; }
.cs-media { overflow: hidden; border-radius: var(--radius); }
.cs-media img { width: 100%; height: 100%; object-fit: cover; }
.cs-media--people { aspect-ratio: 1206 / 679; }
.cs-media--draw { aspect-ratio: 1028 / 720; border: 1px solid #ccc; }

/* Breaking down the scope */
.cs-questions { display: flex; gap: 48px; font: 400 16px/normal var(--font-serif); color: var(--cs-body); text-align: center; }
.cs-questions p { flex: 1 1 0; }

/* Survey */
.cs-callout { padding: 24px; background: var(--cs-callout-bg); border: 1px solid var(--cs-callout-border); border-radius: var(--radius); font: 300 14px/normal var(--font-mono); text-transform: uppercase; color: #2a2a2a; }
.cs-callout-title { display: block; margin-bottom: 1.2em; }
.cs-callout ol { margin: 0; padding-left: 21px; }
.cs-survey { width: 100%; aspect-ratio: 2336 / 2182; object-fit: cover; }

/* Cropped figures (crop values from Figma) */
.cs-crop { position: relative; overflow: hidden; }
.cs-crop img { position: absolute; max-width: none; }
.cs-crop--ideation { width: 100%; aspect-ratio: 998 / 495; }
.cs-crop--ideation img { width: 101.62%; height: 111.5%; left: -1.22%; top: -9.76%; }

/* Information architecture flows */
.cs-flow { display: flex; gap: 24px; align-items: flex-start; }
.cs-flow .cs-body { flex: 1 1 0; }
.cs-flow-figure { flex: none; display: flex; flex-direction: column; gap: 25px; }
.cs-flow-figure--tight { gap: 8px; }
.cs-flow-title { font: 16px/normal var(--font-body); color: var(--ink); }
.cs-crop--people-flow, .cs-crop--notes-flow { width: 243px; border: 1px solid #f2f2f2; border-radius: var(--radius); }
.cs-crop--people-flow { height: 301px; }
.cs-crop--people-flow img { width: 230.05%; height: 174.93%; left: -130.05%; top: -23.08%; }
.cs-crop--notes-flow { height: 462px; }
.cs-crop--notes-flow img { width: 219.76%; height: 112.15%; left: 0; top: -12.13%; }

/* Award */
.cs-award { display: flex; flex-direction: column; gap: 24px; padding: 48px 64px; background: var(--cs-award-bg); border: 1px solid var(--cs-award-border); border-radius: var(--radius); }
.cs-award-photo { position: relative; aspect-ratio: 463 / 338.22; }
.cs-award-photo > img:first-child { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.cs-award-sticker { position: absolute; right: 3%; bottom: 4%; width: 39.7%; height: auto; rotate: .29deg; } /* on the photo's bottom-right corner, so it stays inside the box */
.cs-award-caption { font: 400 14px/normal var(--font-serif); color: var(--ink); text-transform: capitalize; }
.cs-award-caption span { color: #5b5b5b; }

/* Learnings */
.cs-learnings { display: flex; flex-wrap: wrap; gap: 16px 72px; }
.cs-learnings > .cs-block { flex: 1 1 0; min-width: 332px; }

/* ---------- Motion ----------
   Classes are added by case-study.js, so the page still reads fine without JavaScript. */


/* Title words (sprung in by motion.js) */
.cs-title .word { display: inline-block; overflow: hidden; vertical-align: top; }
.cs-title .word > span { display: inline-block; }

/* Parallax: images drift inside their frames (offset set by case-study.js) */
.cs-hero { overflow: hidden; border-radius: var(--radius); }


@media (prefers-reduced-motion: reduce) {
}

/* ---------- Page-to-page fade (supported browsers) ---------- */
@view-transition { navigation: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) { /* same breakpoint as the main nav */
  :root { --cs-page-pad: 24px 16px 80px; --cs-intro-gap: 64px; --cs-section-gap: 88px; }
  .cs-page { flex-direction: column; gap: 24px; }
  .cs-sidebar { position: static; width: auto; }
  .cs-toc { display: none; }
  .cs-facts { flex-wrap: wrap; }
  .cs-hero img { width: 100%; }
  .cs-questions { flex-direction: column; gap: 16px; }
  .cs-learnings { gap: 40px; }
  .cs-learnings > .cs-block { min-width: 100%; }
  .cs-award { padding: 24px; }
}
@media (max-width: 560px) {
  .cs-flow { flex-direction: column; }
  .cs-award-sticker { position: static; width: 60%; margin: 16px 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- Apartments.com case study ---------- */
.cs-hero--lime { background: #f5ff63; border-radius: var(--radius); }
.cs-hero--lime img { border-radius: var(--radius); }
.cs-body p + p, .cs-lead p + p { margin-top: 1.2em; }
.cs-lead strong { font-weight: 500; }

.cs-media--contain img { object-fit: contain; }
.cs-media--pain { aspect-ratio: 864 / 1080; }
.cs-media--wide { aspect-ratio: 1920 / 1080; border-radius: var(--radius); }
.cs-media--square { border-radius: var(--radius); }

/* White bordered panels for charts and screenshots */
.cs-panel { margin: 0; background: #fff; border: 1px solid #d9d9d9; border-radius: var(--radius); }

/* Pain points: tap through them; the open one shows its detail */
.cs-pains { display: flex; flex-direction: column; gap: 24px; font: 400 16px/normal var(--font-body); }
.cs-pain { display: flex; flex-direction: column; gap: 4px; }
.cs-pain-title { color: var(--ink); text-transform: capitalize; }
.cs-pain-text { color: #737373; }

/* Findings: donut chart and legend */
.cs-findings { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 24px 88px; }
.cs-donut { width: min(353px, 100%); height: auto; }
.cs-legend { width: 100%; display: flex; flex-direction: column; gap: 24px; margin: 0; }
.cs-legend > div { display: flex; gap: 24px; align-items: flex-start; }
.cs-legend dt { display: flex; flex-direction: column; min-width: 90px; }
.cs-legend dt > span:first-child { display: flex; align-items: center; gap: 8px; font: 400 16px/normal var(--font-body); color: var(--ink); }
.cs-legend dt img { width: 8px; height: 8px; }
.cs-pct { align-self: flex-end; font: 400 14px/normal var(--font-body); color: #9b9b9b; }
.cs-legend dd { flex: 1 1 0; margin: 0; font: 400 16px/normal var(--font-body); color: #737373; }

/* A/B test comparison */
.cs-ab { display: flex; flex-direction: column; gap: 24px; }
.cs-ab-card { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 64px 24px; }
.cs-ab-shot { position: relative; width: min(352px, 100%); aspect-ratio: 352 / 283; overflow: hidden; border: 1px solid #e6e6e6; border-radius: var(--radius); box-shadow: 0 0 20px rgb(0 0 0 / .1); }
.cs-ab-shot img { width: 100%; height: 100%; object-fit: cover; }
.cs-ab-shot--line img { position: absolute; left: 0; top: -.11%; height: 101.05%; }
.cs-ab-card figcaption { font: 400 14px/normal var(--font-body); color: #c20d0d; }

/* Feature screenshots inside panels (crops from Figma) */
.cs-feature-shot { display: flex; justify-content: center; }
.cs-feature-shot--toast { padding: 24px; }
.cs-feature-shot--lists { padding: 64px 24px; }
.cs-crop--toast { width: min(375px, 100%); aspect-ratio: 375 / 120; }
.cs-crop--toast img { width: 100%; height: 130.83%; left: -.4%; top: -.31%; }
.cs-crop--lists { width: min(375px, 100%); aspect-ratio: 375 / 200; box-shadow: 0 4px 20px rgb(0 0 0 / .25); }
.cs-crop--lists img { width: 100%; height: 142%; left: 0; top: -.13%; }

/* Team photo (mirrored, as in Figma) */
.cs-team-photo { aspect-ratio: 340 / 234; overflow: hidden; border-radius: var(--radius); }
.cs-team-photo img { width: 100%; height: 100%; object-fit: cover; object-position: bottom; scale: -1 1; }

.cs-block--reflection { gap: 24px; }
.cs-learnings--wide { gap: 24px 72px; }

@media (max-width: 860px) {
  .cs-findings { padding: 24px; }
  .cs-feature-shot--toast, .cs-feature-shot--lists { padding: 16px; }
  .cs-ab-card { padding: 32px 16px 20px; }
}

/* ---------- IBM case study ---------- */
.cs-facts--wide { gap: 48px; }
.cs-media--ibm-hero { aspect-ratio: 1156 / 647; border-radius: var(--radius); }
.cs-block--demo { gap: 8px; padding-top: 12px; }

/* Getting up to speed: three illustrated steps (tile art reassembled from Figma) */
.cs-speed { display: flex; flex-direction: column; gap: 24px; }
.cs-steps { width: min(467px, 100%); margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 24px; }
.cs-steps li { display: flex; gap: 16px; align-items: flex-start; }
.cs-step-text { display: flex; flex-direction: column; gap: 8px; font: 400 16px/normal var(--font-body); color: var(--cs-body); }
.cs-step-text strong { font-weight: 400; color: var(--ink); }
.cs-tile { position: relative; flex: none; width: 120px; height: 120px; overflow: hidden; border-radius: 2px; }
.cs-tile img { position: absolute; display: block; max-width: none; }
.cs-tile--folder { background: #a8d8f0; }
.cs-tile--folder .t-a { inset: 38.1% 23.59% -1.39% 15.47%; width: auto; height: auto; }
.cs-tile--folder .t-b { left: 19.25%; right: 19.53%; top: 26.18%; bottom: 0; width: 61.22%; height: 73.82%; }
.cs-tile--ai { background: #d6cbf2; height: 116px; }
.cs-tile--ai .t-b { left: 21px; top: 22px; width: 78.3px; height: 72.17px; }
.cs-tile--ai .t-a { left: 37.44px; top: 44.06px; width: 46.98px; height: 54.87px; }
.cs-tile--people { background: #b9e4c9; height: 124px; }
.cs-tile--people .t-a { left: 25.39%; right: 17.58%; top: 33.98%; bottom: -4.69%; width: 57.03%; height: 70.71%; }
.cs-tile--people .t-b { left: 19.25%; right: 21.48%; top: 25.39%; bottom: 0; width: 59.27%; height: 74.61%; }

/* Expandable photo cards: the open card takes most of the row; springs handled in motion.js */
.x-gallery { display: flex; gap: 8px; height: clamp(260px, 42vw, 440px); transition: gap .45s cubic-bezier(.22, 1, .36, 1); }
.x-gallery.is-full { gap: 0; } /* one photo fills the box */
.x-card {
  position: relative; flex: 1 1 0; min-width: 0; padding: 0; border: 0; overflow: hidden; cursor: pointer;
  border-radius: var(--radius); background: #cfd0bb;
}
.x-card.is-open { flex-grow: 3.4; cursor: zoom-in; }
.x-card.is-full { cursor: zoom-out; }
.x-gallery.is-full .x-card:not(.is-full) { opacity: 0; transition: opacity .3s ease; }
.x-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50% !important; scale: 1.06; transition: scale .6s ease; } /* every photo centred */
.x-card.is-open img { scale: 1; }
.x-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (max-width: 600px) {
  .x-gallery { flex-direction: column; height: 520px; }
}

/* ---------- Full-screen viewer for solution artifacts and diagrams (see case-study.js) ---------- */
.cs-zoomable { position: relative; cursor: zoom-in; }
.cs-zoom-frame { display: block; }
.cs-still { position: absolute; display: block; pointer-events: none; }
/* Round icon buttons in the top-right corner: shown on hover or focus (always on touch screens, and while paused) */
.cs-proto-btns { position: absolute; right: 10px; top: 10px; z-index: 2; display: flex; gap: 6px; opacity: 0; translate: 0 -4px; transition: opacity .2s ease, translate .2s ease; }
.cs-zoomable:hover .cs-proto-btns, .cs-zoomable:focus-within .cs-proto-btns, .cs-zoomable.is-paused .cs-proto-btns { opacity: 1; translate: 0 0; }
@media (pointer: coarse) { .cs-proto-btns { opacity: 1; translate: 0 0; } }
.cs-proto-btn {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .72); color: #fff; cursor: pointer; transition: background .2s ease;
}
.cs-proto-btn:hover { background: rgb(0 0 0 / .88); }
.cs-proto-btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.cs-proto-btn svg { width: 16px; height: 16px; }
@media (pointer: coarse) { .cs-proto-btn { width: 40px; height: 40px; } }

.cs-viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(20 19 17 / .92); overscroll-behavior: contain;
}
.cs-viewer[open] { display: grid; place-items: center; animation: cs-viewer-in .25s ease; }
.cs-viewer::backdrop { background: transparent; }
@keyframes cs-viewer-in { from { opacity: 0; } }
.cs-viewer figure { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0; padding: 56px 24px 24px; }
/* Fill the screen, but never beyond the file's own size, so it stays sharp */
.cs-viewer img { display: block; max-width: min(100%, 1600px); max-height: calc(100dvh - 130px); width: auto; height: auto; border-radius: var(--radius); cursor: default; animation: cs-viewer-pop .35s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes cs-viewer-pop { from { scale: .94; opacity: 0; } }
.cs-viewer-shot { position: relative; display: flex; max-width: 100%; }
.cs-viewer .cs-pause { position: absolute; right: 10px; top: 10px; }
.cs-viewer figcaption { max-width: 60ch; font: 400 14px/1.4 var(--font-body); color: #cfc8bb; text-align: center; }
.cs-viewer-close {
  position: fixed; right: 18px; top: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgb(255 255 255 / .1); color: #eae2d6; font: 300 26px/1 var(--font-body);
}
.cs-viewer-close:hover { background: rgb(255 255 255 / .2); }
html.is-viewing { overflow: hidden; }
html.is-viewing .cursor-dot, html.is-viewing .cursor-smoke { display: none; }

/* ---------- Highlights on subheadings, like Notion's text highlights, in soft lime (see case-study.js) ----------
   Each one sweeps in left to right like a highlighter when it scrolls into view, then a faint shine glides across it once. */
.hl {
  position: relative; color: inherit; padding: 0 .1em; margin: 0 -.05em; border-radius: 3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background:
    linear-gradient(105deg, transparent 40%, rgb(255 255 255 / .55) 50%, transparent 60%) -150% 0 / 250% 100% no-repeat,
    linear-gradient(#e1f3b1, #e1f3b1) 0 0 / 0% 100% no-repeat;
  transition: background-size .9s cubic-bezier(.65, 0, .35, 1);
}
.hl.is-lit { background-size: 250% 100%, 100% 100%; animation: hl-shine 1.6s ease-in-out .9s 1 both; }
.hl.is-lit:hover { animation: hl-shine-again 1.2s ease-in-out 1; }
@keyframes hl-shine { from { background-position: -150% 0, 0 0; } to { background-position: 250% 0, 0 0; } }
@keyframes hl-shine-again { from { background-position: -150% 0, 0 0; } to { background-position: 250% 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .hl, .hl.is-lit { transition: none; animation: none; background-size: 250% 100%, 100% 100%; } }

/* Key insight numbers ("3 hours") turn dark lime green once the reader reaches them (5:1 on white) */
.cs-stat { color: inherit; transition: color 1s ease .2s; }
.cs-stat.is-lit { color: #3f7a08; }
.cs-viewer.is-photo .cs-pause { display: none; }
