/* Case study pages. Type hierarchy and spacing from Figma Website Design > Google Ads_v2 (652:1213), Nov 16,
   used for every case study: everything left-aligned on the 1766 media column (x77), 100 between blocks,
   question 80 at x77 (1365 wide), section titles 80 and body copy 40 at x101 (1392 wide), intro row at x101
   with role 501 | tags 442 | copy 799, media corners 50. The previous version is tools/copy-archive/case-before-ga-v2.css.
   Built on the same 1920 artboard as Figma. --u is one Figma pixel at the current screen width,
   so every size below reads straight from the Figma file: calc(<figma px> * var(--u)).
   Shared type: Headline02 80/Medium, BodyCopy 40/Book, DetailText 26/Book, all -5% tracking. */
/* --u lives on the body so the page and its footer share it */
body[data-page="case"] { --u: calc(min(100vw, 1920px) / 1920); }
.cs {
  --gap: calc(100 * var(--u));      /* space between blocks */
  --gap-tight: calc(40 * var(--u)); /* a label or heading to its paragraph */
  --media: calc(1766 * var(--u));   /* full-width media */
  --col: calc(1392 * var(--u));     /* body copy width */
  --in: calc(24 * var(--u));        /* text inset from the media edge (x101) */
  --radius: calc(50 * var(--u));
  max-width: 1920px;
  margin: 0 auto;
  padding: calc(279 * var(--u)) 0 var(--gap);
}
.cs > * + * { margin-top: var(--gap); }
.cs > .sr-only + * { margin-top: 0; }   /* the hidden page title doesn't count as a block */
/* (Google Ads_v2: a section title is 100 above its copy too, like every other block) */

.cs p, .cs h1, .cs h2, .cs figure { margin-bottom: 0; }
.cs h1, .cs h2 { font-weight: 500; }

/* ---------- Type ---------- */
.cs-statement, .cs-h2 {
  font-weight: 500; font-size: calc(80 * var(--u)); letter-spacing: -0.05em; line-height: 1.4;
}
.cs-statement, .cs-h2, .cs-body, .cs-note {
  width: var(--media); margin-left: auto; margin-right: auto; box-sizing: border-box; text-align: left;
}
.cs-statement { padding-right: calc(var(--media) - 1365 * var(--u)); }   /* the question: x77, 1365 wide */
.cs-statement br { display: none; }                                      /* it wraps on its own now */
.cs-h2 { padding-left: var(--in); }
.cs-body {
  padding-left: var(--in); padding-right: calc(var(--media) - var(--in) - var(--col));
  font-weight: 300; font-size: calc(40 * var(--u)); letter-spacing: -0.05em; line-height: 1.4;
}
.cs-detail, .cs-role, .cs-caption {
  font-weight: 300; font-size: calc(26 * var(--u)); letter-spacing: -0.05em; line-height: 1.42;
}
.cs-role {
  width: var(--col); margin-left: auto; margin-right: auto;
  display: flex; justify-content: space-between; gap: 1em;
  color: var(--accent);
}
.cs-role span:last-child { text-align: right; }

/* First copy beat: role | type-of-work tags | project copy (Google Ads_v2: 501 | 442 | 799 from x101) */
.cs-intro {
  width: var(--media); margin-left: auto; margin-right: auto; box-sizing: border-box; padding-left: var(--in);
  display: grid; grid-template-columns: 501fr 442fr 799fr; align-items: baseline;   /* first lines share a baseline */
  font-weight: 300; font-size: calc(26 * var(--u)); letter-spacing: -0.05em; line-height: 1.42;
}
.cs-intro p { margin: 0; }
.cs-intro-role, .cs-intro-tags { color: var(--accent); }
.cs-intro-tags { padding-right: 1em; }
/* The copy is body copy: same size, line height and spacing as .cs-body (type system: 80 / 40 / 26).
   Role and tags stay detail size. */
.cs-intro-copy { font-size: calc(40 * var(--u)); line-height: 1.4; }
.cs-intro-copy p + p { margin-top: 1em; }

/* Captions: detail size, on the same x101 edge as the body copy, under their visual */
.cs-note { padding-left: var(--in); padding-right: calc(var(--media) - var(--in) - var(--col)); }
.cs-body, .cs-note, .cs-intro-copy p { text-wrap: pretty; }   /* no one-word last lines */
.cs > .cs-media + .cs-note, .cs > .cs-pair + .cs-note, .cs > .cs-row + .cs-note { margin-top: var(--gap-tight); }

/* ---------- Media ----------
   Placeholder stills for now; each <img> becomes a <video> with the same box when the files arrive. */
.cs-media {
  width: var(--media); margin-left: auto; margin-right: auto;
  border-radius: var(--radius); overflow: hidden; background: #111;
}
.cs-media img, .cs-media video { display: block; width: 100%; height: auto; }
/* A fixed frame, filled and cropped (Google Ads_v2 tiles: 871x889) */
.cs-media.is-box video, .cs-media.is-box img { height: 100%; aspect-ratio: auto !important; object-fit: cover; }
/* Media inside a group sits flush at the top (the browser's default figure margin was adding 16px) */
.cs-pair > .cs-media, .cs-grid2 > .cs-media, .cs-row > .cs-media, .cs-beat > .cs-media { margin-top: 0; }

/* 2x2 grid (Google Ads_v2: 871 + 24 + 871) */
.cs-grid2 {
  width: var(--media); margin-left: auto; margin-right: auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: calc(24 * var(--u));
}
.cs-grid2 .cs-media { width: auto; }
/* 3-up grid (Spotify_v3 social rows: three across, 24 apart) */
.cs-grid3 {
  width: var(--media); margin-left: auto; margin-right: auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(24 * var(--u));
}
.cs-grid3 .cs-media { width: auto; margin-top: 0; }
/* a caption under copy (a source line) sits close to it */
.cs > .cs-body + .cs-note { margin-top: var(--gap-tight); }

/* Two media side by side, top-aligned and centred (Google Ads_v2: 1000 + 24 + 703, both 1250 tall) */
.cs-pair {
  width: var(--media); margin-left: auto; margin-right: auto;
  display: grid; grid-template-columns: calc(1000 * var(--u)) calc(703 * var(--u)); column-gap: calc(24 * var(--u));
  justify-content: center; align-items: start;
}
.cs-pair .cs-media { width: auto; }

/* A row of equal media (LISTEN): --n columns, --gx Figma px between them, top-aligned */
.cs-row {
  width: var(--media); margin-left: auto; margin-right: auto;
  display: grid; grid-template-columns: repeat(var(--n), 1fr); column-gap: calc(var(--gx) * var(--u)); align-items: start;
}
.cs-row .cs-media { width: auto; }
/* LISTEN: same spacing as every case study now (it was the one at 100 / 1392 before) */

/* Story beats (Composer): 1184-wide media alternating sides, caption beside it, vertically centred.
   Left beat: media x77, caption x1358. Right beat: caption x97, media x659. */
.cs-beat {
  width: var(--media); margin-left: auto; margin-right: auto;
  display: grid; align-items: center;
  grid-template-columns: calc(1184 * var(--u)) 1fr;
}
.cs-beat .cs-media { width: auto; }
/* Caption widths from Figma: 431 to 463 on the right of the media, 408 on the left */
.cs-beat .cs-caption { margin-left: calc(97 * var(--u)); max-width: calc(463 * var(--u)); }
.cs-beat.is-right { grid-template-columns: 1fr calc(1184 * var(--u)); }
.cs-beat.is-right .cs-caption { order: -1; margin-left: calc(20 * var(--u)); max-width: calc(408 * var(--u)); }

/* ---------- Footer: Previous / Next on the shared glass ----------
   Figma: footer 1920x207, top corners 50, two yellow pills 228x59 centred on 813 and 1108.
   Works like the header, mirrored: fixed to the bottom of the screen, hidden below it, and slides up
   when you reach the end of the page (js/case.js). The spacer keeps that last stretch of page clear. */
.cs-foot-space { height: calc(207 * var(--u)); }
.cs-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  height: calc(207 * var(--u));
  display: flex; align-items: center; justify-content: center; gap: calc(67 * var(--u));
  visibility: hidden;   /* JS shows it once it's placed below the screen */
}
.cs-foot-glass {
  position: absolute; inset: 0;
  border-radius: calc(50 * var(--u)) calc(50 * var(--u)) 0 0;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow:
    inset 0 1.5px 0 var(--glass-rim),
    inset 0 18px 30px -18px var(--glass-glow),
    inset 1.5px 0 0 var(--glass-rim-soft),
    inset -1.5px 0 0 var(--glass-rim-soft);
}
.cs-foot-glass.refract { backdrop-filter: var(--refract) var(--glass-filter); }   /* Chrome / Edge (js/case.js) */
.cs-foot a {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: calc(228 * var(--u)); height: calc(59 * var(--u));
  padding-bottom: calc(2 * var(--pill-lift));   /* centres the capitals (see --pill-lift in site.css) */
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent-rim);
  border-radius: calc(40.7 * var(--u));
  font-weight: 300; font-size: calc(26 * var(--u)); letter-spacing: -0.05em;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.cs-foot a:hover { background: var(--fg); color: var(--bg); }
.cs-foot a:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.cs-foot[hidden] { display: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cs-foot-glass { background: var(--glass-solid); }
}

/* ---------- Phones and narrow windows ----------
   The artboard scale would make text unreadably small, so switch to fixed sizes and a single column. */
@media (max-width: 820px) {
  .cs {
    --gap: 48px; --gap-tight: 20px;
    --media: calc(100vw - 32px); --col: calc(100vw - 32px);
    --radius: 14px;
    padding-top: calc(207 * var(--hs, 0.2) * 1px + 24px);
  }
  .cs-statement, .cs-h2 { font-size: 30px; }
  .cs-statement br { display: none; }
  .cs-body { font-size: 18px; }
  .cs-statement, .cs-h2, .cs-body, .cs-note, .cs-intro { padding-left: 0; padding-right: 0; }
  .cs-grid2, .cs-grid3 { gap: 8px; }
  .cs-detail, .cs-role, .cs-caption { font-size: 14px; }
  /* role and tags share a row, the copy sits under them */
  .cs-intro { grid-template-columns: 1fr 1fr; row-gap: 20px; font-size: 14px; }
  .cs-intro-tags { text-align: right; }
  .cs-intro-copy { grid-column: 1 / -1; max-width: none; font-size: 18px; line-height: 1.4; }
  .cs-pair { grid-template-columns: 1fr; row-gap: 16px; }
  .cs-row { grid-template-columns: 1fr; row-gap: 16px; }
  /* Swipeable rows (Sam, Nov 29: case studies for thumbs). Grids of 3 (and LISTEN's rows of 3) become
     one sideways row that snaps item by item, edge to edge, with the next item peeking in so it reads
     as swipeable. Twos stay side by side. */
  .cs-grid3, .cs-row[style*="--n:3"] {
    display: flex; gap: 10px; width: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .cs-grid3::-webkit-scrollbar, .cs-row[style*="--n:3"]::-webkit-scrollbar { display: none; }
  .cs-grid3 > .cs-media, .cs-row[style*="--n:3"] > .cs-media { flex: 0 0 78%; scroll-snap-align: start; }
  .cs-row[style*="--n:3"] > .cs-media { flex-basis: 64%; }   /* tall posts and reels: narrower, so more peeks in */
  /* Media eases in as it scrolls into view (js/case.js adds .is-in; only once the script runs) */
  html.cs-reveal .cs-media { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease-out, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
  html.cs-reveal .cs-media.is-in { opacity: 1; transform: none; }
  .cs-beat, .cs-beat.is-right { grid-template-columns: 1fr; row-gap: 12px; }
  .cs-beat .cs-caption, .cs-beat.is-right .cs-caption { order: 0; margin-left: 0; max-width: none; }
  .cs-foot-space { height: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .cs-foot { height: calc(96px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); gap: 16px; }
  .cs-foot-glass { border-radius: 22px 22px 0 0; }
  .cs-foot a { width: 132px; height: 40px; font-size: 15px; border-radius: 20px; }
}

/* ---------- Contact (Figma: Contact_page, 1920x1174) ----------
   Three big links at x644, from y185, Headline01 (150 Medium, -5%). The footer takes the last 207. */
.ct {
  max-width: 1920px; margin: 0 auto;
  min-height: max(calc(967 * var(--u)), calc(100svh - 207 * var(--u)));
  padding: calc(185 * var(--u)) 0 0 calc(644 * var(--u));
}
.ct-links { list-style: none; margin: 0; padding: 0; }
.ct-links a {
  display: inline-block;
  font-weight: 500; font-size: calc(150 * var(--u)); letter-spacing: -0.05em; line-height: 1.4;
  color: var(--fg); text-decoration: none;
  transition: color 0.15s;
}
.ct-links a:hover, .ct-links a:focus-visible { color: var(--accent); }
.ct-links a:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; border-radius: 8px; }
/* The Home button on Contact: same outline as every other accent button now (--accent-rim) */
.cs-foot a.is-dark-rim { border-color: var(--pill-rim); }

@media (max-width: 820px) {
  .ct { padding: calc(207 * var(--hs, 0.2) * 1px + 48px) 16px 0; min-height: calc(100svh - 96px); }
  .ct-links a { font-size: 56px; }
}

/* Light theme: white-background media would merge into the white page; a hairline keeps the edge.
   (Not in Figma; flagged for Sam to confirm.) */
html[data-theme="light"] .cs-media { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }

/* ---------- Media viewer (js/media-viewer.js) ---------- */
.cs-media { position: relative; }
/* "View larger" trigger: covers the media; a small glass badge in the corner shows on hover and focus */
.cs-zoom {
  position: absolute; inset: 0; z-index: 1;
  margin: 0; padding: 0; border: 0; background: transparent;
  cursor: zoom-in; color: #fff;
}
/* The badge sits on the media, not the page, so it keeps one dark glass look in both themes:
   a white icon on a dark tint reads over white and black media alike. */
.cs-zoom svg {
  position: absolute; top: max(12px, calc(24 * var(--u))); right: max(12px, calc(24 * var(--u)));
  width: 40px; height: 40px; padding: 10px; box-sizing: border-box;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.38); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  opacity: 0; transition: opacity 0.15s ease;
}
.cs-zoom:hover svg, .cs-zoom:focus-visible svg { opacity: 1; }
.cs-zoom:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; border-radius: inherit; }
/* Video showing its own controls: only the corner badge is the button, so the controls stay usable */
.cs-zoom.is-corner { inset: auto; top: 0; right: 0; width: 72px; height: 72px; }
.cs-zoom.is-corner svg { opacity: 1; }
@media (hover: none) { .cs-zoom svg { opacity: 1; } }   /* no hover on touch: always show the badge */

html.mv-open { overflow: hidden; }
.mv {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; border: 0; background: transparent; color: var(--fg);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing: border-box;
}
.mv[open] { display: grid; place-items: center; }
.mv::backdrop { background: rgba(0, 0, 0, 0.97); }
html[data-theme="light"] .mv::backdrop { background: rgba(255, 255, 255, 0.97); }
.mv-stage { display: grid; place-items: center; width: 100%; height: 100%; }
.mv-media { display: block; object-fit: contain; background: #111; border-radius: 14px; }
.mv-close {
  position: fixed; top: max(16px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  width: 44px; height: 44px; padding: 11px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--glass-rim); background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  color: var(--fg); cursor: pointer;
}
.mv-close svg { width: 100%; height: 100%; }
.mv-close:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .cs-zoom svg { transition: none; } }

/* Reading progress line (js/case.js): fills left to right as you scroll the case study */
.cs-progress {
  position: fixed; left: 0; top: 0; z-index: 102; width: 100%; height: 3px; pointer-events: none;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0));
}
/* artwork on transparent: no panel behind it (Spotify stickers) */
.cs-media.is-clear { background: none; border-radius: 0; }
@media (prefers-reduced-motion: reduce) { html.cs-reveal .cs-media { opacity: 1; transform: none; transition: none; } }

/* Next project card (js/next-card.js), phones only: the next project's object turning slowly at the end
   of the case study, its name and pills under it. The whole card is the link. */
.cs-next { display: none; }
@media (max-width: 820px) {
  .cs-next { display: block; width: var(--col); margin: 72px auto 0; padding-top: 28px; border-top: 1px solid color-mix(in srgb, var(--fg) 25%, transparent); }
  .cs-next-link { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--fg); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .cs-next-label { align-self: center; font-weight: 300; font-size: 14px; letter-spacing: -0.03em; color: var(--accent); }
  .cs-next-obj { position: relative; width: min(78vw, 340px); aspect-ratio: 1; }
  .cs-next-obj img, .cs-next-obj canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
  .cs-next-obj canvas { opacity: 0; transition: opacity 0.3s; }
  .cs-next-obj.is-turning canvas { opacity: 1; }
  .cs-next-obj.is-turning img { opacity: 0; transition: opacity 0.3s; }
  .cs-next-name { font-weight: 500; font-size: 44px; letter-spacing: -0.05em; line-height: 1.05; text-align: center; }
  .cs-next-tags { display: flex; gap: 8px; }
  .cs-next-tags span {
    display: flex; align-items: center; height: 32px; padding: 0 16px calc(2 * var(--pill-lift)); border-radius: 16px;
    background: var(--accent); color: var(--on-accent); border: 1px solid var(--pill-rim);
    font-weight: 300; font-size: 14px; letter-spacing: -0.03em;
  }
  .cs-next-obj { touch-action: pan-y; }   /* sideways = turn the object, up/down still scrolls the page */
  /* "Drag to turn" over the object, the same glass pill as the home carousel */
  .cs-next-hint {
    position: absolute; z-index: 2; left: 50%; bottom: 6%; translate: -50% 8px;
    display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 9px; border-radius: 16px; pointer-events: none;
    background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.2); color: var(--fg);
    -webkit-backdrop-filter: blur(8px) saturate(1.5); backdrop-filter: blur(8px) saturate(1.5);
    font-weight: 300; font-size: 13px; letter-spacing: -0.03em; white-space: nowrap;
    opacity: 0; transition: opacity 0.35s ease-out, translate 0.35s ease-out;
  }
  html[data-theme="light"] .cs-next-hint { background: rgba(255, 255, 255, 0.55); border-color: rgba(0, 0, 0, 0.14); }
  .cs-next-hint.is-on { opacity: 1; translate: -50% 0; }
  .cs-next-hint svg { width: 16px; height: 16px; flex: none; animation: cs-next-nudge 1.6s ease-in-out infinite; }
  @keyframes cs-next-nudge { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-2px); } 60% { transform: translateX(2px); } }
  @media (prefers-reduced-motion: reduce) { .cs-next-hint svg { animation: none; } }
}
