/* Inner pages (Work, About, case studies, 404): re-skins portfolio.css components to the
   reference template's project page. Loaded after portfolio.css and max.css; `body.m-page`
   raises specificity over portfolio.css. Breakpoint tokens (--hero, --card-h, …) come from max.css. */

:root {
  --col: none;
  --gut: var(--pad);
  --paper: #fff;
  --muted: #767773;
  --accent: #000;
  --accent-text: #000;
  --accent-soft: #ececef;
  --btn-bg: #000;
  --btn-fg: #fff;
  --next-hed: 80px;
}
/* "You might also like" stays 80px at every width in the reference */
::selection { background: rgba(20, 20, 21, .12); }
* { scrollbar-color: rgba(20, 20, 21, .3) transparent; }
::-webkit-scrollbar-thumb { background: rgba(20, 20, 21, .25); }

body.m-page { font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.6; }
body.m-page .wrap { max-width: calc(var(--maxw) + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }

/* Back link (case studies) */
.m-back { display: inline-flex; align-items: center; gap: 16px; font-size: 16px; line-height: 25.6px; color: var(--body); margin-top: -1px; }
.m-back svg { width: 24px; height: 24px; }
.m-back:hover { color: var(--ink); }

/* ── Hero ─────────────────────────────────────────── */
/* Every inner-page hero starts where the homepage's does: --hero-top below the header
   (64px on phone), --hero-gap from title to intro. Case studies then run 64px to the
   meta row and 16px from meta to the hero image. */
body.m-page .cs-proof-hero { padding: var(--hero-top) 0 0; }
@media (max-width: 809px) {
  body.m-page .cs-proof-hero { padding-top: 64px; }
}
body.m-page .cs-proof-hero h1 {
  font: 700 var(--hero)/var(--hero-lh) var(--sans);
  letter-spacing: var(--hero-ls);
  max-width: none;
  margin: 0 0 var(--hero-gap);
  color: var(--ink);
}
body.m-page .cs-proof-hero h1 em { font-style: normal; color: inherit; }
/* Case study titles: same Inter Bold, set at 40/48 */
body.m-case .cs-proof-hero h1 { font-size: 40px; line-height: 48px; }
body.m-page .cs-proof-hero__sub {
  font-size: 24px; line-height: 36px; letter-spacing: .24px;
  color: var(--body); /* grey intro on every page, same as the homepage .m-lede */
  max-width: 1060px; /* same measure as the homepage intro (.m-lede) */
  margin: 0;
}
body.m-page .cs-proof-hero__sub + .cs-proof-hero__sub { margin-top: 16px; color: var(--body); }
body.m-page .cs-proof-hero__sub a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
body.m-page .cs-proof-hero__kicker {
  font: 400 14px/15px var(--mono); letter-spacing: 0; text-transform: none; color: var(--mute); margin-top: 16px;
}
body.m-page .cs-proof-hero__kicker a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
body.m-page .cs-proof-hero .cta-resume { margin-top: 32px; }

/* Meta: right-aligned 16px row separated by dots, as in the reference */
body.m-page .cs-proof-meta {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center;
  gap: 8px 0; margin: 0; padding-top: 64px;
}
body.m-page .cs-proof-meta__item {
  display: inline-flex; align-items: center;
  font: 500 16px/25.6px var(--sans); letter-spacing: 0; text-transform: none;
  color: var(--ink); background: none; border: 0; padding: 0; height: auto; border-radius: 0;
}
body.m-page .cs-proof-meta__item::first-letter { text-transform: uppercase; }
body.m-page .cs-proof-meta__item + .cs-proof-meta__item::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); margin: 0 16px;
}
@media (max-width: 1199px) {
  body.m-page .cs-proof-meta { justify-content: flex-start; }
}


/* ── Vertical rhythm: every block stacks with a 16px gap ── */
body.m-page main > section { padding-block: 0; margin-block: 0; }
body.m-page main > section + section { margin-top: var(--gap); }
body.m-page .cs-proof-image { margin-top: 16px !important; padding-top: 0 !important; }

/* ── Media: rounded tiles ─────────────────────────── */
body.m-page .cs-proof-image .wrap > img,
body.m-page .cs-proof-image .wrap > video,
body.m-page .cs-wide img,
body.m-page .cs-wide video,
body.m-page .cs-bleed img,
body.m-page .cs-bleed video,
body.m-page main figure img,
body.m-page main figure video,
body.m-page .cs-inset img,
body.m-page .cs-inset video,
body.m-page .cs-ia-embed iframe,
body.m-page .cs-mobile-trio__shell {
  border-radius: var(--r);
  overflow: hidden;
}
/* Only the media is rounded: figures stay unclipped so captions never get cut */
body.m-page main figure { overflow: visible; border-radius: 0; }
body.m-page main figure figcaption,
body.m-page [class*="cs-"] figcaption {
  font: 400 14px/20px var(--mono); letter-spacing: 0; text-transform: none;
  color: var(--mute); margin: 12px 0 0; padding: 0; text-align: left;
}
body.m-page main figure figcaption::first-letter { text-transform: uppercase; }
body.m-page .cs-mobile-trio figcaption { text-align: center; }
body.m-page .cs-proof-image .wrap > img { width: 100%; }
body.m-page .cs-bleed { max-width: calc(var(--maxw) + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }
body.m-page .cs-proof-pair-grid, body.m-page .cs-proof-gallery-grid { gap: var(--gap); }
body.m-page .cs-inset__in { overflow: visible; }
body.m-page .cs-note, body.m-page main p.cs-note { font: 400 14px/20px var(--mono); color: var(--mute); margin-top: 16px; letter-spacing: 0; text-align: center; }

/* ── Text sections → centred grey panels ──────────── */
body.m-page .cs-proof-section .wrap > .cs-proof-section-grid,
body.m-page .cs-proof-section.ab-books > .wrap {
  display: block;
  background: var(--panel);
  border-radius: var(--r);
  padding: var(--panel-pad);
  text-align: center;
}
body.m-page .cs-proof-section-grid h2,
body.m-page .cs-mobile-trio__label,
body.m-page .cs-proof-gallery-head h2,
body.m-page .ab-books__head h2 {
  display: inline-block; width: fit-content; height: auto;
  font: 400 14px/20px var(--mono); letter-spacing: 0; text-transform: none;
  color: var(--body); background: var(--btn);
  border: 0; border-radius: 2px;
  padding: 4px 8px; margin: 0 0 64px;
}
body.m-page .cs-proof-section-grid h2::first-letter,
body.m-page .cs-mobile-trio__label::first-letter { text-transform: uppercase; }
/* Text column: 316px inside image + text rows (as on the reference project page);
   full-width text-only panels use a 600px centred column, like the reference's full-width Contact panel,
   so long paragraphs don't become narrow towers */
body.m-page .cs-proof-section-grid > div { max-width: 600px; margin: 0 auto; }
body.m-page .m-cs-text > div { max-width: 316px; }
body.m-page .cs-proof-section-grid > div p { text-wrap: pretty; hyphens: manual; }
body.m-page .cs-proof-section-grid > div p {
  font-size: 16px; line-height: 25.6px; color: var(--body); max-width: none; margin: 0 0 16px;
}
body.m-page .cs-proof-section-grid > div p:last-child { margin-bottom: 0; }
/* Bold text inside case-study paragraphs stays inline */
body.m-page .cs-proof-section-grid > div p strong { font-weight: 500; color: var(--ink); }

/* About page lists (.m-leadlist): bold lead-in on its own line, spaced like the reference's
   Experience list — 18px title, 4px to its 16px text, 16px + 40px rule + 16px between items,
   64px after the intro line */
body.m-page .m-leadlist p strong { display: block; font-size: 18px; line-height: 25.2px; font-weight: 400; margin: 0 0 4px; }
body.m-page .m-leadlist p:has(> strong) { margin: 0; }
body.m-page .m-leadlist p:has(> strong) + p:has(> strong)::before { content: ""; display: block; width: 1px; height: 40px; background: var(--line); margin: 16px auto; }
body.m-page .m-leadlist p:not(:has(> strong)) + p:has(> strong) { margin-top: 64px; }
body.m-page .cs-proof-section-grid > div p a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
body.m-page .cs-proof-section-grid .cta-resume { margin-top: 64px; }

/* Mobile trio + IA embed */
body.m-page .cs-mobile-trio > .wrap { background: var(--panel); border-radius: var(--r); padding: var(--panel-pad); }
body.m-page .cs-mobile-trio__copy { font-size: 16px; line-height: 25.6px; color: var(--body); }
body.m-page .cs-mobile-trio figcaption,
body.m-page .cs-proof-marquee__caption { font: 400 14px/15px var(--mono); color: var(--mute); text-transform: none; letter-spacing: 0; }

/* ── Quote ───────────────────────────────────────── */
body.m-page .cs-proof-quote > .wrap { background: var(--panel); border-radius: var(--r); padding: var(--panel-pad); text-align: center; }
body.m-page .cs-proof-quote blockquote { font: 400 var(--big)/var(--big-lh) var(--sans); letter-spacing: var(--big-ls); color: var(--ink); max-width: 768px; margin: 0 auto; }
body.m-page .cs-proof-quote cite { font: 400 14px/15px var(--mono); color: var(--mute); text-transform: none; letter-spacing: 0; }

/* ── Next case study: an 80px heading that scrolls sideways with ✦ separators, as the
   reference's "You might also like" does; 31px above (incl. 16px section gap), 30px below ── */
body.m-page .cs-proof-next { padding-top: 15px !important; }
body.m-page .cs-proof-next .m-next { margin-top: 30px; }
.m-marquee { margin: 0; overflow: hidden; font: 500 80px/96px var(--display); letter-spacing: 0; color: var(--ink); white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.m-marquee-track { display: inline-flex; align-items: center; animation: m-tick 40s linear infinite; }
.m-marquee-track span { margin-right: 40px; }
.m-marquee-track i { font-style: normal; font-size: 40px; color: #d5d5dd; margin-right: 40px; }
@media (prefers-reduced-motion: reduce) { .m-marquee-track { animation: none; } }

/* ── Action links: same plain grey text link as .m-pill in max.css (no box) ── */
body.m-page .cta-resume {
  display: inline-flex; align-items: center; gap: 8px;
  height: auto; padding: 0; border: 0; border-radius: 0; background: none;
  color: var(--body);
  font-family: var(--sans); font-size: 16px; line-height: 22px; font-weight: 500; letter-spacing: -.1px; text-transform: none;
  box-shadow: none; transform: none;
  transition: color .2s;
}
body.m-page .cta-resume:hover, body.m-page .cta-resume:focus-visible {
  background: none; color: var(--ink); box-shadow: none; transform: none;
}

/* ── Work page: a listing page, so its hero spaces like the homepage's
   (title at --hero-top, 36px to the intro, 60px to the cards) ── */
body.m-page main > .add-section { margin-top: 60px; padding-top: 0 !important; }

/* ── Case-study results: a grey panel of stats at the foot of the page ── */
body.m-page main > .cs-proof-results { padding: 0; margin-top: var(--gap); }
body.m-page .cs-results-panel { background: var(--panel); border-radius: var(--r); padding: var(--panel-pad); text-align: center; }
body.m-page .cs-results-panel > h2 {
  display: inline-block; width: fit-content; height: auto; position: static;
  font: 400 14px/20px var(--mono); letter-spacing: 0; text-transform: none;
  color: var(--body); background: var(--btn);
  border: 0; border-radius: 2px;
  padding: 4px 8px; margin: 0 0 64px;
}
body.m-page .cs-results-panel > h2::first-letter { text-transform: uppercase; }
body.m-page .cs-proof-results-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px 32px; max-width: 1000px; margin: 0 auto; padding: 0; border: 0;
}
body.m-page .cs-proof-result { padding: 0; border: 0; background: none; text-align: center; }
body.m-page .cs-proof-result h3 {
  font: 500 64px/1 var(--display); letter-spacing: -1.5px; color: var(--ink);
  margin: 0 0 16px; padding: 0; border: 0;
}
body.m-page .cs-proof-result p {
  font-size: 16px; line-height: 25.6px; color: var(--body);
  max-width: 260px; margin: 0 auto; text-wrap: pretty;
}
@media (max-width: 809px) {
  body.m-page .cs-proof-results-grid { grid-template-columns: 1fr; gap: 40px; }
  body.m-page .cs-proof-result h3 { font-size: 48px; }
}

/* ── About page ──────────────────────────────────── */
/* Same split as the homepage: sticky portrait + logos left, panels right */
body.m-page main > .m-about { margin-top: 60px; padding-top: 0; }
body.m-page .m-about .m-split { margin-top: 0; }
body.m-page main .m-about .m-portrait { overflow: hidden; border-radius: var(--r); isolation: isolate; }
body.m-page main .m-about .m-portrait img { border-radius: 0; display: block; }
.m-copy--link { margin-top: 16px; }
.m-copy--link a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.m-xp-note { font-size: 16px; line-height: 25.6px; color: var(--mute); margin-top: 8px; } /* body size, same as .m-xp-co */

/* Contact panel at the foot of inner pages */
.m-contact { margin-top: var(--gap); }

@media (max-width: 809px) {
  body.m-page .cs-proof-section.ab-books > .wrap { padding: 32px 12px; }
  body.m-page .bk__seg { max-width: 100%; }
}

/* Image heights measured from the reference project page:
   hero image 800 / 600 / 256px; image pairs 725px on desktop.
   Pairs keep their natural shape below desktop so tall UI shots are never cut. */
body.m-page .cs-proof-image .wrap > img,
body.m-page .cs-proof-image .wrap > video { height: 800px; object-fit: cover; }
@media (max-width: 1199px) {
  body.m-page .cs-proof-image .wrap > img,
  body.m-page .cs-proof-image .wrap > video { height: 600px; }
}
@media (max-width: 809px) {
  body.m-page .cs-proof-image .wrap > img,
  body.m-page .cs-proof-image .wrap > video { height: 256px; }
}
/* Opening images that must not crop (UI screens): show the whole frame at its own ratio */
body.m-page .cs-proof-image--full .wrap > img,
body.m-page .cs-proof-image--full .wrap > video { height: auto; aspect-ratio: auto; object-fit: initial; }

@media (min-width: 1200px) {
  body.m-page .cs-proof-pair figure img,
  body.m-page .cs-proof-pair figure video { height: 725px; width: 100%; object-fit: cover; }
}

/* ── Image + text rows, as on the reference project page ───────────────
   desktop and tablet: image ⅔ left, grey text panel ⅓ right, 16px apart;
   panel padding 64px (desktop) / 40px 16px (tablet); text column 316px max;
   the image keeps its own shape (capped at 1000px tall) and fills the row if the text runs longer.
   phone: stacked, text panel first, then the image at its natural shape. */
body.m-page .m-cs-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: stretch; }
body.m-page .m-cs-media { position: relative; align-self: stretch; width: 100%; min-width: 0; max-height: 1000px; border-radius: var(--r); overflow: hidden; background: var(--panel); }
body.m-page .m-cs-media img, body.m-page .m-cs-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
body.m-page .m-cs-text { display: block; background: var(--panel); border-radius: var(--r); padding: 64px; text-align: center; }
body.m-page .m-cs-text .cs-note { margin-top: 24px; }
@media (max-width: 1199px) {
  body.m-page .m-cs-text { padding: 40px 16px; }
  body.m-page .m-cs-text > div { max-width: none; }
}
@media (max-width: 809px) {
  body.m-page .m-cs-row { grid-template-columns: minmax(0, 1fr); }
  body.m-page .m-cs-text { order: -1; padding: 64px 24px; }
  body.m-page .m-cs-media { max-height: none; }
}

/* Case-study subtitle and Work intro wrap balanced, as in the reference */
body.m-page .cs-proof-hero__sub { text-wrap: balance; }

/* ── Case studies on phones (< 810px) ─────────────────────────────────
   Hero: 40px title, 16px to a 20/30 intro, then the meta as a two-column list (no dots).
   Text panels: left-aligned for long reading, 40px 24px padding, 24px from label to text.
   Captions and notes: left-aligned, 20px line height so wrapped lines don't crowd. */
@media (max-width: 809px) {
  body.m-case .cs-proof-hero h1 { margin-bottom: 16px; }
  body.m-case .cs-proof-hero__sub { font-size: 20px; line-height: 30px; letter-spacing: 0; text-wrap: pretty; }

  body.m-case .cs-proof-meta {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px; padding-top: 40px;
  }
  body.m-case .cs-proof-meta__item { font-size: 15px; line-height: 22px; }
  body.m-case .cs-proof-meta__item + .cs-proof-meta__item::before { content: none; }

  body.m-case .cs-proof-section .wrap > .cs-proof-section-grid,
  body.m-case .m-cs-text,
  body.m-case .cs-mobile-trio > .wrap,
  body.m-case .cs-proof-quote > .wrap { padding: 40px 24px; text-align: left; }
  body.m-case .cs-proof-section-grid > div,
  body.m-case .m-cs-text > div { max-width: none; margin: 0; }
  body.m-case .cs-proof-section-grid h2,
  body.m-case .cs-mobile-trio__label,
  body.m-case .cs-proof-gallery-head h2 { line-height: 20px; margin-bottom: 24px; }
  body.m-case .m-leadlist p:has(> strong) + p:has(> strong)::before { margin: 16px 0; }

  body.m-case main figure figcaption,
  body.m-case [class*="cs-"] figcaption,
  body.m-case .cs-note,
  body.m-case .cs-proof-marquee__caption { text-align: left; font-size: 13px; line-height: 20px; }
}

/* Dark mode: portfolio.css's own tokens, re-pointed for the dark palette in max.css */
:root[data-theme="dark"] {
  --paper: #19191b;
  --muted: #767773;
  --accent: #fff;
  --accent-text: #fff;
  --accent-soft: #26262a;
  --btn-bg: #fff;
  --btn-fg: #000;
  --line-2: #242428;
}
[data-theme="dark"] ::selection { background: rgba(242, 242, 243, .2); color: inherit; }
[data-theme="dark"] * { scrollbar-color: rgba(242, 242, 243, .25) transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(242, 242, 243, .2); }
[data-theme="dark"] .m-marquee-track i { color: #3a3a40; }

/* ── Lightbox: the close control uses the site's one button shape (2px corner, no outline),
   and the enlarged image keeps the same 4px corner as every image card ── */
body.m-page .cs-lightbox__close {
  border-radius: 2px; border: 0;
  background: rgba(205, 205, 205, .16); color: #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  font-size: 22px; line-height: 1;
}
body.m-page .cs-lightbox__close:hover { background: rgba(205, 205, 205, .26); }
body.m-page .cs-lightbox img, body.m-page .cs-lightbox video { border-radius: var(--r); }

/* Notes under case-study text use the same 14px mono as captions, even inside text panels */
body.m-page main p.cs-note.cs-note { font: 400 14px/20px var(--mono); letter-spacing: 0; }
