/* Chad Rolinski portfolio: global styles and components (canvas Version 21).
   Every value comes from tokens.css. Vertical rhythm comes from spacer
   elements (.sp-*), never margins on content. */

/* ── Global ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; -webkit-text-size-adjust: 100%; }
[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote { margin: 0; }
h1, h2, h3, h4, h5 { font-weight: var(--fw-semibold); }
h1, h2, h3, h4, p, li, figcaption { text-wrap: pretty; }
img { max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
strong, b { font-weight: var(--fw-semibold); }

:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Layout ─────────────────────────────────────────────────────────── */
/* Tablet (768 to 1199) isn't designed: desktop structure, margins scaled to 48. */
@media (min-width: 768px) and (max-width: 1199px) {
  :root { --margin: var(--sp-48); --margin-case: var(--sp-48); }
}

.frame { width: 100%; max-width: var(--frame); margin-inline: auto; padding-inline: var(--margin); }
.frame-case { width: 100%; max-width: var(--frame); margin-inline: auto; padding-inline: var(--margin-case); }
.reading { width: 100%; max-width: var(--reading); margin-inline: auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
}

.stack { display: flex; flex-direction: column; }

/* Spacers: each size has one job (see HANDOFF spacing table) */
.sp { display: block; flex-shrink: 0; width: 100%; }
.grid > .sp { grid-column: 1 / -1; }
.sp-4 { height: var(--sp-4); }
.sp-8 { height: var(--sp-8); }
.sp-12 { height: var(--sp-12); }
.sp-16 { height: var(--sp-16); }
.sp-24 { height: var(--sp-24); }
.sp-32 { height: var(--sp-32); }
.sp-48 { height: var(--sp-48); }
.sp-64 { height: var(--sp-64); }
.sp-80 { height: var(--sp-80); }
.sp-96 { height: var(--sp-96); }
.sp-120 { height: var(--sp-120); }

@media (max-width: 767px) { .only-desktop { display: none !important; } }
@media (min-width: 768px) { .only-mobile { display: none !important; } }

/* ── Type ───────────────────────────────────────────────────────────── */
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: var(--fw-semibold); }
.t-section { font-size: var(--fs-section); line-height: var(--lh-section); letter-spacing: var(--ls-section); font-weight: var(--fw-semibold); }
.t-card-title { font-size: var(--fs-card-title); line-height: var(--lh-card-title); letter-spacing: var(--ls-card-title); font-weight: var(--fw-semibold); }
.t-subsection { font-size: var(--fs-subsection); line-height: var(--lh-subsection); letter-spacing: var(--ls-subsection); font-weight: var(--fw-semibold); }
.t-heading { font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); font-weight: var(--fw-semibold); }
.t-title { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); }
.t-lede { font-size: var(--fs-lede); line-height: var(--lh-lede); color: var(--c-body); }
.t-lede-lg { font-size: var(--fs-lede-lg); line-height: var(--lh-lede-lg); color: var(--c-body); }
.t-body { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--c-body); }
.t-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--c-body); }
.t-small { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-body); }
.t-meta { font-size: var(--fs-meta); color: var(--c-muted); }
.t-fine { font-size: var(--fs-fine); color: var(--c-muted); }
.t-accent { color: var(--c-accent); }

.eyebrow { font-size: var(--fs-label); font-weight: var(--fw-semibold); line-height: var(--lh-small); color: var(--c-accent); }

/* ══ Components ═════════════════════════════════════════════════════════ */

/* ── Header ──
   Name left; nav right (15/500 muted, active in ink, 32 apart); theme toggle.
   Mobile: nav hidden behind a menu button. */
.site-header { position: relative; z-index: 50; }
.site-header-inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: var(--fs-title); font-weight: var(--fw-semibold); letter-spacing: -0.01em; text-decoration: none; color: var(--c-ink); }
.site-nav { display: flex; align-items: center; gap: var(--sp-32); font-size: var(--fs-label); font-weight: var(--fw-medium); }
.site-nav a { color: var(--c-muted); text-decoration: none; transition: color .4s ease; }
.site-nav a:hover { color: var(--c-ink); }
.site-nav a[aria-current] {
  color: var(--c-ink); font-weight: var(--fw-semibold);
  text-decoration: underline; text-decoration-color: var(--c-accent-fill);
  text-decoration-thickness: 2px; text-underline-offset: 8px;
}

.icon-btn {
  position: relative;
  width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--c-ink);
  border: 1px solid var(--c-line-strong); border-radius: var(--radius-sm);
  cursor: pointer; transition: background-color .3s ease;
}
.icon-btn:hover { background: var(--c-surface); }
.icon-btn::before { content: ""; position: absolute; inset: -3px; } /* 44 tap target around the 40 box */
.icon-btn svg { width: 16px; height: 16px; }
.menu-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.menu-btn { display: none; }
.mobile-menu { display: none; }
@media (max-width: 767px) {
  .site-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .mobile-menu:not([hidden]) {
    display: flex; flex-direction: column;
    position: absolute; left: 0; right: 0; top: var(--header-h);
    padding: 0 var(--margin) var(--sp-16);
    background: var(--c-bg); border-bottom: 1px solid var(--c-line);
  }
  .mobile-menu a {
    min-height: var(--tap); display: flex; align-items: center;
    font-size: var(--fs-body); font-weight: var(--fw-medium);
    color: var(--c-muted); text-decoration: none; border-top: 1px solid var(--c-line);
  }
  .mobile-menu a[aria-current] { color: var(--c-ink); font-weight: var(--fw-semibold); box-shadow: inset 3px 0 0 var(--c-accent-fill); padding-left: var(--sp-12); }
  .mobile-menu .menu-theme { display: flex; align-items: center; min-height: var(--tap); border-top: 1px solid var(--c-line); }
}

/* ── Buttons and links ── */
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-8);
  height: 40px; padding: 0 var(--sp-16);
  background: var(--c-button-fill); color: var(--c-body);
  border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  font-size: var(--fs-label); font-weight: var(--fw-medium); text-decoration: none; cursor: pointer;
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.btn-outline:hover { border-color: var(--c-ink); color: var(--c-ink); }
.btn-outline.btn-linkedin:hover { background: var(--c-linkedin-hover-bg); border-color: var(--c-linkedin); color: var(--c-linkedin); }
.btn-outline svg { width: 16px; height: 16px; flex-shrink: 0; }
.li-logo rect { fill: var(--c-linkedin); }
.li-logo path { fill: white; }
@media (max-width: 767px) { .btn-outline { height: var(--tap); } }

.link-arrow { display: inline-flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-label); font-weight: var(--fw-medium); text-decoration: none; color: var(--c-ink); }
.link-arrow svg { width: 16px; height: 16px; }
.go { transition: transform .8s var(--ease-out); }
.link-arrow:hover .go { transform: translateX(6px); }

/* ── Plate ──
   Fixed-ratio box; image centered and scaled to fit, never cropped.
   16:10 in rows and galleries, 16:9 for full-width figures and prev/next cards. */
.plate {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  background: var(--plate-bg, var(--plate));
}
.plate-wide { aspect-ratio: 16 / 9; }
.plate-inner { position: absolute; inset: var(--plate-inset); display: flex; align-items: center; justify-content: center; }
.plate-full .plate-inner { inset: var(--plate-inset-lg); }
.plate img, .plate .video-facade {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-shot);
  transform: perspective(1400px) translate3d(var(--tx, 0px), var(--ty, 0px), 0) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--s, 1));
  transition: transform .45s var(--ease-out), box-shadow .6s var(--ease-out);
  will-change: transform;
}
.plate:hover img, .plate:hover .video-facade { box-shadow: var(--shadow-shot-hover); }
/* Dark mode: a hairline edge keeps dark screenshots from melting into the plate */
[data-theme="dark"] .plate img:not(.cutout), [data-theme="dark"] .plate .video-facade { box-shadow: 0 0 0 1px rgba(255,255,255,0.10), var(--shadow-shot); }
[data-theme="dark"] .plate:hover img:not(.cutout), [data-theme="dark"] .plate:hover .video-facade { box-shadow: 0 0 0 1px rgba(255,255,255,0.14), var(--shadow-shot-hover); }
/* Cut-out product shots (transparent PNG): shadow follows the shape, not the box */
.plate img.cutout, .plate:hover img.cutout { box-shadow: none; border-radius: 0; filter: drop-shadow(0 20px 22px rgba(8,10,16,0.24)); transition: transform .45s var(--ease-out), filter .6s var(--ease-out); }
.plate:hover img.cutout { filter: drop-shadow(0 30px 30px rgba(8,10,16,0.30)); }
.plate[data-zoom] img { cursor: zoom-in; }
@media (prefers-reduced-motion: reduce) { .plate img, .plate .video-facade { transform: none !important; } }

.plate-dev-portal { --plate-bg: var(--plate-dev-portal); }
.plate-ps-partners { --plate-bg: var(--plate-ps-partners); }
.plate-resilience-hub { --plate-bg: var(--plate-resilience-hub); }
.plate-ai-workflow { --plate-bg: var(--plate-ai-workflow); }
.plate-console-studio { --plate-bg: var(--plate-console-studio); }
.plate-collab-app { --plate-bg: var(--plate-collab-app); }

/* ── Label rail ── 24/600 accent label in columns 1 to 3, content from column 4 */
.rail > .rail-label { grid-column: 1 / span 3; }
.rail > .rail-body { grid-column: 4 / span 8; }
@media (min-width: 768px) {
  .rail > .rail-label { align-self: stretch; }
  .chapter .rail-label h2 { position: sticky; top: var(--sp-24); }
}
.rail-label h2, .rail-label .rail-title { font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); font-weight: var(--fw-semibold); color: var(--c-accent); }
@media (max-width: 767px) {
  .rail { display: flex; flex-direction: column; }
  .rail > .rail-label::after { content: ""; display: block; height: var(--sp-16); } /* label above content */
}

/* ── Highlight box ── */
.highlight {
  padding: var(--sp-24); border-radius: var(--radius-lg); background: var(--c-highlight);
  display: flex; flex-direction: column;
}
.highlight-title { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); color: var(--c-highlight-ink); }
.highlight-text { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--c-body); }
/* Leadership: How I lead and Leading with curiosity reuse the box in their own colors */
.highlight-violet { background: var(--c-highlight-violet); }
.highlight-violet .highlight-title { color: var(--c-highlight-violet-ink); }
.highlight-amber { background: var(--c-highlight-amber); }
.highlight-amber .highlight-title { color: var(--c-highlight-amber-ink); }

/* ── Company marker and career timeline ── */
.company-marker { width: 12px; height: 12px; border-radius: 2px; background: var(--marker); flex-shrink: 0; }
.career-bar { display: flex; height: 32px; gap: 3px; border-radius: 2px; overflow: hidden; }
.career-bar > span { flex-basis: 0; background: var(--marker); }
.career-labels { display: flex; gap: 3px; }
.career-labels > span { flex-basis: 0; min-width: 0; display: flex; flex-direction: column; padding-right: var(--sp-8); }
.career-labels b { font-size: var(--fs-meta); font-weight: var(--fw-semibold); white-space: nowrap; }
.career-labels small { font-size: var(--fs-fine); color: var(--c-muted); white-space: nowrap; }
.tl-kyocera { --marker: var(--tl-kyocera); }
.tl-qualcomm { --marker: var(--tl-qualcomm); }
.tl-studio { --marker: var(--tl-studio); }
.tl-lowes { --marker: var(--tl-lowes); }
.tl-playstation { --marker: var(--tl-playstation); }
.tl-aws { --marker: var(--tl-aws); }

/* ── Contact band (every page) ── */
.contact-band {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-32);
  padding: var(--sp-24); border-radius: var(--radius-md); background: var(--c-surface);
}
.contact-id { display: flex; align-items: center; gap: var(--sp-16); flex: 1 1 auto; min-width: 0; }
.contact-photo { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; object-position: center top; display: block; flex-shrink: 0; }
.contact-title { font-size: var(--fs-title-lg); line-height: 1.2; letter-spacing: -0.01em; font-weight: var(--fw-semibold); }
.contact-text { font-size: var(--fs-small); line-height: 1.45; color: var(--c-body); }
.contact-actions { display: flex; align-items: center; gap: var(--sp-32); flex-shrink: 0; }
.email-btn {
  display: inline-flex; align-items: center; gap: var(--sp-8);
  height: 40px; padding: 0; background: transparent; border: 0;
  font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--c-ink); cursor: pointer;
}
.email-btn .copy-icon { display: flex; color: var(--c-muted); transition: color .3s ease; }
.email-btn:hover .copy-icon { color: var(--c-ink); }
.email-btn .copy-icon svg { width: 16px; height: 16px; }
.email-btn .i-check { display: none; }
.email-btn.is-copied .copy-icon { color: var(--c-accent); }
.email-btn.is-copied .i-copy { display: none; }
.email-btn.is-copied .i-check { display: block; }
@media (max-width: 999px) {
  .contact-band { flex-direction: column; align-items: stretch; gap: var(--sp-24); }
}
@media (max-width: 767px) {
  .contact-actions { flex-direction: column; align-items: stretch; gap: var(--sp-12); }
  .email-btn {
    justify-content: space-between; height: var(--tap); padding: 0 var(--sp-16);
    background: var(--c-button-fill); border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  }
}

/* ── Footer ── */
.site-footer { display: flex; flex-direction: column; font-size: var(--fs-fine); line-height: var(--lh-small); color: var(--c-muted); }
.site-footer p { max-width: var(--reading); }

/* ── Back to top ── */
.to-top {
  position: fixed; right: calc(var(--sp-48) + var(--sp-24)); bottom: var(--sp-48); z-index: 90;
  width: var(--tap); height: var(--tap); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-bg); color: var(--c-muted); border: 1px solid var(--c-line-strong); cursor: pointer;
  opacity: 0; transform: translateY(var(--sp-8)); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background-color .2s ease, color .2s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--c-surface); color: var(--c-ink); }
.to-top svg { width: 16px; height: 16px; }
@media (max-width: 767px) { .to-top { right: var(--sp-16); bottom: var(--sp-16); } }

/* ══ Home ════════════════════════════════════════════════════════════════ */
.hero { align-items: center; }
.hero-text { grid-column: 1 / span 7; display: flex; flex-direction: column; }
.hero-title { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: var(--fw-semibold); max-width: 690px; text-wrap: balance; }
.hero-lede { max-width: 580px; }
.hero-photo { grid-column: 10 / span 3; justify-self: end; width: 100%; max-width: 232px; aspect-ratio: 4 / 5; object-fit: cover; object-position: center top; border-radius: var(--radius-md); display: block; }
@media (max-width: 767px) {
  .hero { display: flex; flex-direction: column; }
  .hero-photo { display: none; }
}

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-24); }

/* Case rows (first four) and "More work" rows share one list, so a variant's
   tile order still works: every tile after the More work heading is a row. */
.tiles { display: flex; flex-direction: column; }
.tile-link {
  display: grid; grid-template-columns: 7fr 5fr; column-gap: calc(var(--sp-48) + var(--sp-8));
  align-items: center; text-decoration: none; color: inherit;
}
.tile-text { display: flex; flex-direction: column; }
.tile-product { font-size: var(--fs-label); font-weight: var(--fw-semibold); color: var(--c-accent); }
.tile-desc { font-size: var(--fs-body); line-height: 1.65; color: var(--c-body); }
.tile-desc strong { display: block; font-size: var(--fs-card-title); line-height: var(--lh-card-title); letter-spacing: var(--ls-card-title); font-weight: var(--fw-semibold); color: var(--c-ink); }
.tile-desc strong::after { content: ""; display: block; height: var(--sp-16); } /* title to its text */
.tile-meta { font-size: var(--fs-meta); color: var(--c-muted); }
.tile-cta { display: flex; align-items: center; gap: var(--sp-8); font-size: var(--fs-small); font-weight: var(--fw-semibold); color: var(--c-ink); }
.tile-cta svg { width: 20px; height: 20px; }
.tile-link:hover .go { transform: translateX(6px); }
.tile-go { display: none; }
.tile .only-more, .tile .only-more-m { display: none; }
@media (max-width: 1199px) {
  .tile-link { grid-template-columns: minmax(0, 1fr); row-gap: var(--sp-24); }
}

.more-heading { font-size: var(--fs-subsection); line-height: var(--lh-subsection); letter-spacing: var(--ls-subsection); font-weight: var(--fw-semibold); }
.more-heading ~ .tile { border-top: 1px solid var(--c-line); }
.more-heading ~ .tile::before, .more-heading ~ .tile::after { content: ""; display: block; height: var(--sp-8); }
.more-heading ~ .tile .tile-link {
  position: relative;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 0;
  grid-template-rows: 1fr auto auto auto 1fr; align-items: start;
  margin-inline: calc(-1 * var(--sp-16)); padding: var(--sp-16); border-radius: var(--radius-md);
  transition: background-color .45s ease;
}
.more-heading ~ .tile .tile-link:hover { background: var(--c-surface); }
.more-heading ~ .tile .plate,
.more-heading ~ .tile .tile-cta,
.more-heading ~ .tile .only-row { display: none; }
.more-heading ~ .tile .tile-text { display: contents; }
.more-heading ~ .tile .only-more { display: block; }
.more-heading ~ .tile .tile-product { grid-column: 1 / span 4; grid-row: 2; font-size: var(--fs-title-lg); letter-spacing: -0.01em; color: var(--c-ink); }
.more-heading ~ .tile .sp-4.only-more { grid-column: 1 / span 4; grid-row: 3; }
.more-heading ~ .tile .tile-meta { grid-column: 1 / span 4; grid-row: 4; }
.more-heading ~ .tile .tile-desc { grid-column: 6 / span 5; grid-row: 1 / -1; align-self: center; max-width: 460px; line-height: var(--lh-small); }
.more-heading ~ .tile .tile-desc strong { display: inline; font-size: inherit; line-height: inherit; letter-spacing: normal; }
.more-heading ~ .tile .tile-desc strong::after { content: none; }
.more-heading ~ .tile .tile-go { display: flex; grid-column: 12 / span 1; grid-row: 1 / -1; align-self: center; justify-self: end; }
.tile-go svg { width: 28px; height: 28px; transition: transform .6s var(--ease-out); }
.more-heading ~ .tile .tile-link:hover .tile-go svg { transform: translateX(5px); }
@media (min-width: 768px) and (max-width: 1199px) {
  .more-heading ~ .tile .tile-product, .more-heading ~ .tile .sp-4.only-more, .more-heading ~ .tile .tile-meta { grid-column: 1 / span 5; }
  .more-heading ~ .tile .tile-desc { grid-column: 6 / span 6; }
}
@media (max-width: 767px) {
  .more-heading ~ .tile .tile-link { display: flex; flex-direction: column; }
  .more-heading ~ .tile .tile-text { display: flex; flex-direction: column; }
  .more-heading ~ .tile .tile-product { order: 1; padding-right: var(--sp-48); }
  .more-heading ~ .tile .sp-4.only-more { order: 2; }
  .more-heading ~ .tile .tile-meta { order: 3; padding-right: var(--sp-48); }
  .more-heading ~ .tile .only-more-m { display: block; order: 4; }
  .more-heading ~ .tile .tile-desc { order: 5; padding-right: var(--sp-48); max-width: none; }
  .more-heading ~ .tile .tile-go { position: absolute; right: var(--sp-16); top: var(--sp-16); }
}

/* ══ Experience ══════════════════════════════════════════════════════════ */
.role { border-top: 1px solid var(--c-line); }
.role-grid { row-gap: 0; }
.role-head { grid-column: 1 / span 3; display: flex; flex-direction: column; }
.role-body { grid-column: 5 / span 7; display: flex; flex-direction: column; }
.role-company { font-size: var(--fs-heading); line-height: 1.25; letter-spacing: var(--ls-heading); }
.role-name { display: flex; align-items: center; gap: var(--sp-12); }
.role-name .company-marker { width: 16px; height: 16px; border-radius: 3px; }
.role-indent { padding-left: calc(16px + var(--sp-12)); }
.role-years { font-size: var(--fs-label); color: var(--c-muted); }
.pa-cols { grid-column: 5 / span 7; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-32); }
.plain-list { padding-left: var(--sp-24); display: flex; flex-direction: column; row-gap: var(--sp-12); }
.plain-list li { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--c-body); }
.plain-list strong { color: var(--c-ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-12); }
@media (max-width: 767px) {
  .role-grid, .pa-grid { display: flex; flex-direction: column; }
  .pa-cols { display: flex; flex-direction: column; }
  .role-head + .role-body::before, .pa-cols > * + *::before { content: ""; display: block; height: var(--sp-24); }
}

/* ══ Leadership ══════════════════════════════════════════════════════════ */
.lead-item { border-top: 1px solid var(--c-line); display: flex; flex-direction: column; }

/* ══ Case study ══════════════════════════════════════════════════════════ */
.case-intro { position: relative; display: flex; flex-direction: column; }
.case-intro h1 { max-width: 940px; }
.case-lede { max-width: var(--reading); }
.case-lede strong { color: var(--c-ink); }
.cs-tags { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.cs-tag {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--sp-12);
  font-size: var(--fs-fine); font-weight: var(--fw-medium); color: var(--c-bg);
  background: var(--c-ink); border-radius: 4px;
}

.side-arrow {
  position: absolute; top: 50%; margin-top: -20px;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--c-line); color: var(--c-muted); text-decoration: none;
  transition: background-color .3s ease, color .3s ease;
}
.side-arrow svg { width: 18px; height: 18px; }
.side-arrow:hover { background: var(--c-surface); color: var(--c-ink); }
/* Hover hint: the arrow keys work too */
.key-hint {
  position: absolute; top: calc(100% + var(--sp-12)); left: 50%;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); white-space: nowrap;
  font-size: var(--fs-fine); color: var(--c-muted);
  opacity: 0; transform: translate(-50%, -4px); pointer-events: none;
  transition: opacity .25s ease, transform .35s var(--ease-out);
}
.key-hint kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px;
  font: inherit; font-weight: var(--fw-semibold); color: var(--c-ink);
  background: var(--c-bg); border: 1px solid var(--c-line-strong); border-bottom-width: 3px; border-radius: var(--radius-sm);
}
.side-arrow:hover .key-hint, .side-arrow:focus-visible .key-hint,
.pager-card:hover .key-hint, .pager-card:focus-visible .key-hint { opacity: 1; transform: translate(-50%, 0); }
.side-arrow:hover .key-hint kbd, .pager-card:hover .key-hint kbd { animation: key-tap 1.2s var(--ease-out) .2s infinite; }
@keyframes key-tap { 0%, 60%, 100% { transform: none; border-bottom-width: 3px; } 30% { transform: translateY(2px); border-bottom-width: 1px; } }
@media (prefers-reduced-motion: reduce) { .side-arrow:hover .key-hint kbd, .pager-card:hover .key-hint kbd { animation: none; } }
.side-arrow.prev { left: calc((var(--margin-case) + 40px) / -2); }
.side-arrow.next { right: calc((var(--margin-case) + 40px) / -2); }
@media (max-width: 1199px) { .side-arrow { display: none; } }

.case-meta { border-top: 1px solid var(--c-line); display: flex; flex-direction: column; }
.case-meta-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: var(--gutter); }
.case-meta-grid > div { display: flex; flex-direction: column; }
.cs-sidebar-label { font-size: var(--fs-meta); color: var(--c-muted); }
.cs-sidebar-value { font-size: var(--fs-small); line-height: 1.5; color: var(--c-ink); }
@media (max-width: 767px) {
  .case-meta-grid { display: flex; flex-direction: column; }
  .case-meta-grid > div + div::before { content: ""; display: block; height: var(--sp-24); }
}

/* Stats band: the existing stat callouts */
.stat-callout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); }
.stat-callout-item { border-top: 2px solid var(--c-accent-fill); display: flex; flex-direction: column; }
.stat-callout-item::before { content: ""; display: block; height: var(--sp-24); }
.stat-callout-num { font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); font-weight: var(--fw-semibold); }
.stat-callout-num + .stat-callout-label::before { content: ""; display: block; height: var(--sp-8); }
.stat-callout-label { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-body); }
@media (max-width: 767px) {
  .stat-callout { display: flex; flex-direction: column; }
  .stat-callout-item + .stat-callout-item { margin-top: var(--sp-24); }
}

/* Chapters: label rail + prose */
.prose { display: flex; flex-direction: column; min-width: 0; }
.prose p, .prose li { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--c-body); }
.prose ul, .prose ol { padding-left: var(--sp-24); display: flex; flex-direction: column; row-gap: var(--sp-12); }
.prose li { line-height: var(--lh-body-sm); }
.prose strong { color: var(--c-ink); }
.prose a, .cs-gallery a { color: var(--c-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.cs-subhead, .cs-gallery-label { font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); font-weight: var(--fw-semibold); color: var(--c-ink); }
/* Gallery headings are figure titles: smaller than chapter subheads so sections read apart */
.cs-gallery .cs-subhead, .cs-gallery .cs-gallery-label { font-size: var(--fs-body); line-height: var(--lh-small); letter-spacing: 0; }
.chapter-rule { border-top: 1px solid var(--c-line); }
.cs-gallery-intro { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--c-body); }
.cs-gallery-note { font-size: var(--fs-label); line-height: var(--lh-small); color: var(--c-muted); }
.gallery-item-label { font-size: var(--fs-meta); color: var(--c-muted); }

.cs-pull-quote { border-left: 2px solid var(--c-accent-fill); padding-left: var(--sp-24); }
.cs-pull-quote p { font-size: var(--fs-lede-lg); line-height: var(--lh-lede); font-weight: var(--fw-medium); color: var(--c-ink); }

.process-timeline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-32); row-gap: var(--sp-32); }
.process-step { border-top: 2px solid var(--c-accent-fill); display: flex; flex-direction: column; }
.process-step::before { content: ""; display: block; height: var(--sp-16); }
.process-step-label { font-size: var(--fs-label); font-weight: var(--fw-semibold); color: var(--c-ink); }
.process-step-label + .process-step-text::before { content: ""; display: block; height: var(--sp-8); }
.process-step-text { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-body); }
.process-step-text a { color: var(--c-accent); }
@media (max-width: 767px) {
  .process-timeline { display: flex; flex-direction: column; }
  .process-step + .process-step { margin-top: var(--sp-24); }
}

.impact-box { padding: var(--sp-24); border-radius: var(--radius-lg); background: var(--c-highlight); display: flex; flex-direction: column; }
.impact-box-label { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: var(--fw-semibold); color: var(--c-highlight-ink); }
.impact-box-label::after { content: ""; display: block; height: var(--sp-16); }
.impact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-32); row-gap: var(--sp-16); }
.impact-item-text { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--c-body); }
.impact-item-text strong { color: var(--c-highlight-ink); }
@media (max-width: 767px) { .impact-grid { grid-template-columns: minmax(0, 1fr); } }

/* Impact boxes run the full content width */
.rail > .rail-body:has(> .impact-box) { grid-column: 1 / -1; }

/* Screenshot figure: caption row above the plate, on the page grid */
.shot { display: flex; flex-direction: column; gap: 20px; }
.shot-cap { border-top: 1px solid var(--c-line); padding-top: 20px; align-items: start; }
.shot-name {
  grid-column: 1 / span 3; display: flex; align-items: flex-start; gap: var(--sp-8);
  font-size: var(--fs-title); font-weight: var(--fw-semibold); letter-spacing: -0.01em; line-height: 1.35; color: var(--c-ink);
}
.shot-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--c-muted); margin-top: calc((1.35em - 18px) / 2); }
.shot-desc { grid-column: 4 / span 8; padding-top: 2px; font-size: var(--fs-small); line-height: 1.6; color: var(--c-muted); }
/* Half-width figures (two side by side) stack their caption */
.shot-cap-stacked { display: flex; flex-direction: column; gap: var(--sp-8); }
.shot-cap-stacked .shot-desc { padding-top: 0; }
.shot .stack > .gallery-grid .gallery-item-label + .sp { display: block; }
@media (max-width: 767px) {
  .shot { gap: var(--sp-16); }
  .shot-cap { display: flex; flex-direction: column; gap: var(--sp-8); }
}

/* Galleries: every image on a plate, identical plates in a row */
.cs-gallery { display: flex; flex-direction: column; min-width: 0; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--sp-24); }
.gallery-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-grid.one-col { grid-template-columns: minmax(0, 1fr); }
.gallery-item { display: flex; flex-direction: column; min-width: 0; }
/* Rows of 2 and 3: squarer plates and a tighter inset so each screenshot is larger */
.gallery-grid:not(.one-col) .plate-inner { inset: var(--sp-16); }
.gallery-grid:not(.one-col):not(.two-col) .plate-inner { inset: var(--sp-12); }
.gallery-grid:not(.one-col) .plate { aspect-ratio: 4 / 3; }
@media (max-width: 767px) {
  .gallery-grid, .gallery-grid.two-col { grid-template-columns: minmax(0, 1fr); }
}

/* Video facade (plays inline on click) */
.video-facade { position: relative; cursor: pointer; overflow: hidden; background: var(--c-ink); }
.plate .video-facade { height: 100%; width: auto; aspect-ratio: 16 / 9; }
.plate .video-facade img { width: 100%; height: 100%; max-height: none; object-fit: cover; box-shadow: none; border-radius: 0; transform: none; }
.video-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.video-play-btn {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c-ink) 72%, transparent); color: var(--c-bg);
  transition: background-color .2s ease, transform .2s ease;
}
.video-facade:hover .video-play-btn { background: var(--c-accent); transform: scale(1.06); }
.video-play-btn svg { margin-left: var(--sp-4); }

/* Previous / next cards */
.case-pager { display: flex; flex-direction: column; }
.case-pager-rule { border-top: 1px solid var(--c-line); }
.pager-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gutter); }
.pager-card { display: flex; align-items: center; gap: var(--sp-16); text-decoration: none; color: inherit; }
.pager-card.next { grid-column: 2; justify-self: end; text-align: right; }
.pager-arrow {
  position: relative;
  width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--c-line); color: var(--c-muted);
  transition: background-color .3s ease, color .3s ease, transform .5s var(--ease-out);
}
.pager-arrow svg { width: 18px; height: 18px; }
.pager-card:hover .pager-arrow { background: var(--c-surface); color: var(--c-ink); }
.pager-card.prev:hover .pager-arrow { transform: translateX(-4px); }
.pager-card.next:hover .pager-arrow { transform: translateX(4px); }
.pager-text { display: flex; flex-direction: column; gap: var(--sp-4); }
.pager-name { font-size: var(--fs-label); font-weight: var(--fw-semibold); color: var(--c-ink); }
@media (max-width: 767px) {
  .pager-grid { display: flex; flex-direction: column; gap: var(--sp-24); }
  .pager-card.next { align-self: flex-end; }
}

/* Lightbox */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: var(--sp-64);
  background: color-mix(in srgb, var(--c-bg) 94%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lightbox-overlay.open { display: flex; cursor: zoom-out; }
/* Tall screenshots open at reading width and scroll (PlayStation Partners) */
.lightbox-overlay.open.zoomed { display: block; overflow-y: auto; padding: var(--sp-48) var(--sp-16); text-align: center; cursor: default; }
.lightbox-img.zoomed { max-width: min(1100px, 100%); max-height: none; cursor: zoom-out; }
.lightbox-overlay.zoomed .lightbox-close, .lightbox-overlay.zoomed .lightbox-nav { position: fixed; }
.lightbox-img { max-width: 100%; max-height: 100%; cursor: zoom-in; border-radius: var(--radius-sm); box-shadow: var(--shadow-shot); background: var(--c-bg); }
.lightbox-close, .lightbox-nav {
  position: absolute; width: var(--tap); height: var(--tap); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-bg); color: var(--c-ink); border: 1px solid var(--c-line-strong);
  font-size: var(--fs-title); line-height: 1; cursor: pointer;
}
.lightbox-close:hover, .lightbox-nav:hover { background: var(--c-surface); }
.lightbox-close { top: var(--sp-24); right: var(--sp-24); }
.lightbox-nav { top: 50%; margin-top: calc(var(--tap) / -2); }
.lightbox-nav.prev { left: var(--sp-24); }
.lightbox-nav.next { right: var(--sp-24); }
.lightbox-nav[hidden] { display: none; }
@media (max-width: 767px) { .lightbox-overlay { padding: var(--sp-16); } }
