/* Site-wide Maxfolio-style base: soft grey canvas, rounded panels, Inter + DM Mono.
   Used on its own by the homepage; inner pages load it after portfolio.css, then max-pages.css.

   Sizes are measured from the reference template and switch at the same three breakpoints:
     phone   < 810px   gutter 16, hero 64px, cards 1-up 360px tall
     tablet  810–1199  gutter 24, hero 96px, cards 2-up 362px tall, panels stacked
     desktop ≥ 1200    gutter 24, hero 132px, cards 2-up 725px tall, portrait + panels side by side
   Content stops growing at 1890px and centres beyond that. */
:root {
  --bg: #f9f9fa;
  --panel: #f4f4f6;
  --card: #fff;
  --line: #e6e6ea;
  --ink: #141415;
  --body: #656572;
  --mute: #858593;
  --live: #3ccf6a;
  --r: 20px;
  --pad: 24px;
  --gap: 16px;
  --maxw: 1890px;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --display: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* breakpoint-driven sizes (desktop values; overridden below) */
  /* Page headline: Inter Bold, shared by every page title. Scales with the window:
     128px at 1440px wide and up, shrinking smoothly to 40px on phones; line height stays 144/128 */
  --hero: clamp(40px, calc(100vw * 128 / 1440), 128px);
  --hero-lh: 1.125;
  --hero-ls: -.3px;
  --hero-top: 96px;
  --hero-gap: 36px;
  --card-h: 725px;
  --card-label: 24px;
  --card-label-lh: 32px;
  --big: 48px;
  --big-lh: 57.6px;
  --big-ls: -1.44px;
  --panel-pad: 64px;
}
@media (max-width: 1199px) {
  :root { --card-h: 362px; --hero-top: 76px; --card-label: 18px; --card-label-lh: 25.2px; --big: 26px; --big-lh: 31.2px; --big-ls: -.78px; }
}
@media (max-width: 809px) {
  :root { --pad: 16px;  --hero-top: 180px; --card-h: 360px; --panel-pad: 64px 24px; --big: 20px; --big-lh: 24px; --big-ls: -.6px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
p, h1, h2, h3 { margin: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.mono { font-family: var(--mono); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: var(--pad); top: var(--pad); background: var(--card); padding: 6px 10px; z-index: 10; }

.m-wrap { max-width: calc(var(--maxw) + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }

/* Header: avatar + name on the left, four text links on the right */
.m-hd { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 25px; }
.m-id { display: flex; align-items: center; gap: 14px; }
.m-id:hover .m-name { color: var(--ink); }
.m-avatar { position: relative; width: 48px; height: 48px; flex: none; }
.m-avatar img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--line); }
.m-name { font-size: 14px; line-height: 17px; letter-spacing: .56px; color: var(--body); transition: color .2s; }
.m-nav { display: flex; gap: 32px; }
.m-nav a { font-size: 16px; line-height: 25.6px; color: var(--body); transition: color .2s; }
.m-nav a:hover, .m-nav a[aria-current="page"], .m-nav a.is-current { color: var(--ink); }
.m-nav a[aria-current="page"], .m-nav a.is-current { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

/* Mobile menu: below 810px the links fold into a two-line hamburger that opens a full-screen panel
   (avatar + name and the button stay on top; links are large and left-aligned) */
.m-menu-btn { display: none; }
@media (max-width: 809px) {
  .m-hd { position: relative; z-index: 50; }
  .m-id { position: relative; z-index: 2; }
  .m-menu-btn {
    position: relative; z-index: 2;
    display: grid; place-content: center; gap: 6px;
    width: 48px; height: 48px; margin-right: -12px; padding: 0;
    background: none; border: 0; color: var(--ink); cursor: pointer;
  }
  .m-menu-btn span { display: block; width: 22px; height: 1.5px; border-radius: 1px; background: currentColor; transition: transform .3s cubic-bezier(.2,.7,.2,1); }
  .m-hd.is-open .m-menu-btn span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .m-hd.is-open .m-menu-btn span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

  .m-nav {
    position: fixed; inset: 0; z-index: 1;
    flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 128px var(--pad) 40px;
    background: var(--bg);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
  }
  .m-hd.is-open .m-nav { opacity: 1; visibility: visible; transition: opacity .25s ease; }
  .m-nav a { font: 700 40px/52px var(--sans); letter-spacing: -.3px; color: var(--mute); }
  .m-nav a:hover, .m-nav a[aria-current="page"], .m-nav a.is-current { color: var(--ink); text-decoration: none; }
  html.m-menu-open, html.m-menu-open body { overflow: hidden; }
  /* While open, pin the header (name + close button) to the top wherever the page is scrolled;
     nav.js holds its spot with body padding so nothing underneath jumps */
  .m-hd.is-open { position: fixed; top: 0; left: 0; right: 0; margin: 0; padding: 25px var(--pad) 0; }
}

/* Hero */
.m-hero { padding: var(--hero-top) 0 60px; }
.m-hed {
  font: 700 var(--hero)/var(--hero-lh) var(--sans);
  letter-spacing: var(--hero-ls);
  color: var(--ink);
  margin-bottom: var(--hero-gap);
}
.m-hed .wd { display: inline-block; white-space: nowrap; }
.m-hed .ch { display: inline-block; }
.js .m-hed .ch { opacity: 0; filter: blur(12px); transform: translateY(6px); animation: m-blur .9s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--i) * 45ms + 150ms); }
@keyframes m-blur { to { opacity: 1; filter: blur(0); transform: none; } }
.js.anim-done .m-hed .ch { animation: none; opacity: 1; filter: none; transform: none; }
.m-lede { max-width: 1060px; font-size: 24px; line-height: 36px; letter-spacing: .24px; color: var(--body); }

/* Project cards — measured from the reference:
   the card clips everything to 20px corners; the image fills the whole card (never rounded itself);
   a grey caption bar overlays the bottom with the title, and grows upward on hover to show a description. */
.m-work { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.m-card {
  position: relative;
  display: block;
  height: var(--card-h);
  border-radius: var(--r);
  overflow: hidden;
  isolation: isolate;
  background: var(--panel);
}
.m-card--wide { grid-column: 1 / -1; }
.m-media { position: absolute; inset: 0; background: #e9e9ec; }
.m-media img, .m-media video { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transform: scale(1.02); transition: transform .9s cubic-bezier(.2,.7,.2,1); }
.m-card:hover .m-media img, .m-card:focus-visible .m-media img { transform: scale(1.06); }
.m-cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; background: var(--panel); padding: 16px 24px; }
.m-cap-name { font-size: var(--card-label); line-height: var(--card-label-lh); color: var(--ink); margin: 0; }
.m-cap-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2,.7,.2,1); }
.m-cap-more > p { min-height: 0; overflow: hidden; }
.m-cap-desc { font-size: 16px; line-height: 25.6px; color: var(--body); margin: 0; }
.m-card:hover .m-cap-more, .m-card:focus-visible .m-cap-more { grid-template-rows: 1fr; }
@media (hover: none) { .m-cap-more { grid-template-rows: 1fr; } }

@keyframes m-tick { to { transform: translateX(-50%); } }

/* Next-case-study card sits alone at half width */
.m-next { margin-top: 24px; }
.m-next .m-card { grid-column: 1; }

.m-all { display: flex; justify-content: center; padding: 32px 0 16px; }

/* Pill button */
.m-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 20px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 16px; line-height: 25.6px; color: var(--ink);
  transition: box-shadow .3s, transform .3s;
}
.m-pill:hover { box-shadow: 0 8px 24px -12px rgba(20,20,21,.3); transform: translateY(-1px); }
.m-pill svg { width: 16px; height: 16px; color: var(--mute); }

/* Panels */
.m-panel {
  margin-top: var(--gap);
  background: var(--panel);
  border-radius: var(--r);
  padding: var(--panel-pad);
  text-align: center;
}
.m-tag {
  display: inline-block;
  font: 400 14px/15px var(--mono);
  color: var(--mute);
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  margin: 0 0 64px;
}
.m-h2 { font-size: 18px; line-height: 25.2px; font-weight: 400; color: var(--ink); margin-bottom: 20px; }
.m-copy { max-width: 316px; margin: 0 auto; color: var(--body); font-size: 16px; line-height: 25.6px; }
.m-rule { width: 1px; height: 40px; background: var(--line); margin: 64px auto; }
.m-facts { list-style: none; padding: 0; margin: 0; font: 400 14px/15px var(--mono); color: var(--mute); display: grid; gap: 8px; }

/* Portrait + client logos beside About / Experience / Approach */
.m-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); margin-top: var(--gap); }
.m-right .m-panel:first-child { margin-top: 0; }
.m-sticky { display: flex; flex-direction: column; gap: var(--gap); }
.m-portrait { margin: 0; border-radius: var(--r); overflow: hidden; background: #d9d9dc; height: 623px; }
@media (max-width: 809px) { .m-portrait { height: 630px; } }
.m-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 55% 45%; }
.m-logos {
  height: 96px; display: flex; align-items: center; overflow: hidden;
  background: var(--panel); border-radius: var(--r);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.m-logos-track { display: flex; align-items: center; gap: 64px; width: max-content; padding-right: 64px; animation: m-tick 40s linear infinite; }
.m-logos:hover .m-logos-track { animation-play-state: paused; }
.m-logos img { width: auto; height: 24px; filter: brightness(0); opacity: .78; flex: none; }
.m-logos .l-ms { height: 58px; margin: 0 -14px; }
.m-logos .l-forr { height: 42px; }
.m-logos .l-aetna, .m-logos .l-jj { height: 17px; }
.m-logos .l-cognex { height: 16px; }
.m-logos .l-osu { height: 22px; }
.m-logos .l-celeb { height: 28px; }
.m-logos .l-dfh { height: 38px; }
.m-logos .l-cdm { height: 36px; }

@media (min-width: 1200px) {
  .m-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .m-sticky { position: sticky; top: var(--gap); }
  .m-portrait { height: calc(100vh - 2 * var(--gap) - 96px - var(--gap)); min-height: 520px; }
}

/* Experience timeline */
.m-xp { list-style: none; padding: 0; margin: 0 auto; max-width: 316px; }
.m-xp li + li::before { content: ""; display: block; width: 1px; height: 40px; background: var(--line); margin: 16px auto; }
.m-tag + .m-xp { margin-top: 8px; } /* reference: 72px from the Experience tag to the first year */
.m-xp-yr { font: 400 14px/15px var(--mono); color: var(--mute); }
.m-xp-yr i { font-style: normal; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--line); margin: 0 12px; vertical-align: middle; font-size: 0; }
.m-xp-role { font-size: 18px; line-height: 25.2px; color: var(--ink); margin-top: 12px; }
.m-xp-co { font-size: 16px; line-height: 25.6px; color: var(--body); margin-top: 4px; }
/* In-panel links (Download resume) are plain text + icon in the reference, 72px below the list */
.m-panel > .m-pill { margin-top: 72px; padding: 0; border: 0; background: none; box-shadow: none; }
.m-panel > .m-pill:hover { box-shadow: none; transform: none; color: var(--body); }

/* Approach (quote-style) */
.m-quotes { list-style: none; margin: 0 auto; padding: 0; max-width: 316px; display: grid; gap: 64px; }
.m-quote { font-size: 18px; line-height: 25.2px; color: var(--ink); }
.m-quote-sub { font: 400 14px/15px var(--mono); color: var(--mute); margin-top: 24px; }

/* Contact */
.m-big { font-size: var(--big); line-height: var(--big-lh); letter-spacing: var(--big-ls); font-weight: 400; max-width: 768px; margin: 0 auto 25px; }
.m-panel .m-big + .m-copy { max-width: 452px; font-size: 18px; line-height: 27px; letter-spacing: .18px; }
.m-cta { position: relative; display: inline-block; margin-top: 66px; }
.m-cta::before {
  content: ""; position: absolute; left: 50%; bottom: -14px; width: 70%; height: 30px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 92, 56, .45), transparent);
  filter: blur(8px);
  transition: opacity .3s;
}
.m-cta .m-pill { position: relative; margin: 0; padding: 19px 64px; }
/* Contact panel: reference has 72px above the tag and 73px below the button */
.m-panel.m-contact { padding: 72px 64px 73px; }
@media (max-width: 809px) { .m-panel.m-contact { padding: 72px 24px 73px; } }

/* Footer */
.m-ft { display: flex; justify-content: space-between; gap: 16px; padding: 25px 0 24px; font: 400 14px/15px var(--mono); color: var(--mute); }
.m-ft a:hover { color: var(--ink); }

/* Reveal on scroll */
.js .rv { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.js .rv.in { opacity: 1; transform: none; }

@media (max-width: 809px) {
  .m-work { grid-template-columns: 1fr; }
  .m-next .m-card { grid-column: auto; }
  /* Phone: the hero sits right under the header (64px, like inner pages); 40px to the cards */
  .m-hero { padding: 64px 0 40px; }
  .m-ft { flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-bottom: 25px; }
}
@media (max-width: 480px) {
}
@media (prefers-reduced-motion: reduce) {
  .js .m-hed .ch, .js .rv { animation: none; opacity: 1; filter: none; transform: none; transition: none; }
  .m-logos-track { animation: none; }
  html { scroll-behavior: auto; }
}

/* Line wrapping: the reference balances its intro and contact lines (text-wrap: balance),
   so a two-line intro breaks near the middle instead of filling the full 896px box. */
.m-lede, .m-big, .m-contact .m-copy { text-wrap: balance; }

/* ── Theme toggle + dark mode ────────────────────────
   theme.js sets data-theme on <html> before paint: the system setting on a first visit,
   then whatever the visitor last picked with the header toggle. */
.m-hd { justify-content: flex-start; }
.m-id { margin-right: auto; }
.m-theme {
  /* Pill switch (after portorocha.com): grey track, white knob that slides right for dark */
  position: relative; flex: none;
  width: 52px; height: 30px; padding: 0;
  background: var(--chip); border: 0; border-radius: 999px;
  cursor: pointer; transition: background-color .3s;
}
.m-theme:hover { background: color-mix(in srgb, var(--chip) 85%, var(--ink)); }
.m-theme-knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 .5px rgba(0,0,0,.06);
  transition: transform .35s cubic-bezier(.3,.7,.2,1.15);
}
[data-theme="dark"] .m-theme-knob { transform: translateX(22px); background: #f2f2f3; }
@media (max-width: 809px) {
  .m-theme { z-index: 2; margin-right: 4px; }
  .m-menu-btn { order: 1; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f10;
  --panel: #19191b;
  --card: #222225;
  --line: #2e2e33;
  --ink: #f2f2f3;
  --body: #a6a6b0;
  --mute: #85858f;
}
[data-theme="dark"] .m-media { background: #1d1d20; }
[data-theme="dark"] .m-portrait { background: #1d1d20; }
[data-theme="dark"] .m-logos img { filter: brightness(0) invert(1); opacity: .72; }
[data-theme="dark"] .m-pill:hover { box-shadow: 0 8px 24px -12px rgba(0,0,0,.8); }

/* ── Header layout (after mouthwash.studio) ──────────
   Name on the left, the page links as a group starting a fifth of the way across,
   Contact alone at the far right, then the theme toggle. Links are ink-coloured medium
   text; hover and the current page sit on a soft rounded chip. */
@media (min-width: 810px) {
  .m-hd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 4fr) auto; gap: 16px; }
  .m-id { margin-right: 0; }
  .m-name { font-size: 16px; line-height: 20px; letter-spacing: -.2px; font-weight: 700; color: var(--ink); }
  .m-nav { gap: 4px; align-items: center; }
  .m-nav .m-nav-end { margin-left: auto; }
  .m-nav a {
    padding: 5px 10px; border-radius: 6px;
    font-size: 16px; line-height: 22px; font-weight: 500; letter-spacing: -.1px;
    color: var(--ink); transition: background-color .2s;
  }
  .m-nav a:hover, .m-nav a[aria-current="page"], .m-nav a.is-current { background: var(--chip); text-decoration: none; }
}
:root { --chip: #ececee; }
:root[data-theme="dark"] { --chip: #26262a; }
