/* Layout: sheets on an animator's light table. Home is an index of work; each project opens as its own
   sheet with a slate (category, role, duration, tools) and the work at full column width.
   Construction lines are non-photo blue; the one loud colour is a Col-Erase carmine. */
:root {
  --paper: #F5F8FA;
  --ink: #17212B;
  --ink-soft: #52606D;
  --blue: #6FBBD9;        /* non-photo blue: rules, frames, peg holes */
  --blue-wash: #E2F0F6;   /* behind images while they load */
  --line: #D3E2EA;
  --red: #C42A44;         /* Col-Erase carmine: links and the one button */
  --on-red: #FFFFFF;
  --artboard: #FFFFFF;    /* drawings are flattened onto white, so their ground stays white in both themes */
  --scrim: rgba(13, 19, 25, 0.94);
  --on-scrim: #E6EDF2;

  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Hanken Grotesk", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gap: clamp(12px, 1.6vw, 20px);
  --gutter: clamp(16px, 4vw, 44px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1319; --ink: #E6EDF2; --ink-soft: #9BA9B6;
    --blue: #4A97B5; --blue-wash: #15232C; --line: #213039; --red: #FF7388; --on-red: #1A0A0E;
    --artboard: #FFFFFF; --scrim: rgba(5, 8, 11, 0.95); --on-scrim: #E6EDF2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1319; --ink: #E6EDF2; --ink-soft: #9BA9B6;
  --blue: #4A97B5; --blue-wash: #15232C; --line: #213039; --red: #FF7388; --on-red: #1A0A0E;
  --artboard: #FFFFFF; --scrim: rgba(5, 8, 11, 0.95); --on-scrim: #E6EDF2;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(70px + env(safe-area-inset-top, 0px)); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
a:focus-visible, button:focus-visible, .pan:focus-visible, img[data-zoom]:focus-visible, video:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
img, video { display: block; width: 100%; height: auto; max-width: 100%; background: var(--blue-wash); }
img { color: var(--ink-soft); font: 400 0.75rem/1.4 var(--mono); }
img[data-zoom] { cursor: zoom-in; }

.wrap { max-width: 1180px; margin-inline: auto; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
main.wrap { display: flex; flex-direction: column; gap: clamp(56px, 8vw, 104px); padding-block: clamp(28px, 5vw, 60px) clamp(56px, 8vw, 96px); }
main.sheet { gap: clamp(24px, 3.5vw, 40px); }

.label, .eyebrow, .slate dt, figcaption, .card-meta, .cv time, .top nav a, .back, .pager a, .jump a {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.label { font-weight: 500; }

/* Peg bar: the three registration holes punched in animation paper */
.pegbar { display: flex; justify-content: center; align-items: center; gap: clamp(48px, 12vw, 120px); height: 34px; }
.pegbar i { display: block; border: 1.5px solid var(--blue); }
.pegbar .hole { width: 11px; height: 11px; border-radius: 50%; }
.pegbar .slot { width: 26px; height: 8px; border-radius: 2px; }

/* Header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-block: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; min-height: 54px; flex-wrap: wrap; }
.brand { font: 700 1.125rem/1 var(--display); letter-spacing: -0.01em; text-decoration: none; }
.top nav { display: flex; gap: clamp(12px, 3vw, 28px); }
.top nav a { text-decoration: none; padding-block: 8px; border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--red); }
.top nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--red); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hero h1 { font: 800 clamp(2.25rem, 5.4vw, 4.25rem)/1.02 var(--display); letter-spacing: -0.035em; text-wrap: balance; }
.lede { max-width: 46ch; color: var(--ink-soft); font-size: 1.125rem; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.btn { background: var(--red); color: var(--on-red); text-decoration: none; font-weight: 600; padding: 11px 20px; border-radius: 2px; }
.btn:hover { filter: brightness(1.08); }
.plain { text-decoration-color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 5px; font-weight: 500; }
.plain:hover { color: var(--red); text-decoration-color: currentColor; }
.hero-fig { margin: 9px; min-width: 0; }
.hero-fig video { outline: 1px solid var(--blue); outline-offset: 8px; aspect-ratio: 2 / 1; object-fit: cover; }
.hero-fig figcaption { margin-top: 18px; }

/* Work index */
.index { display: flex; flex-direction: column; gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.6vw, 32px) var(--gap); border-top: 1px solid var(--ink); padding-top: 20px; }
.card { display: flex; min-width: 0; }
.card a { display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; text-decoration: none; }
.card img { aspect-ratio: 3 / 2; object-fit: cover; transition: opacity 0.15s; }
.card.feat { grid-column: span 2; }
.card.feat img { aspect-ratio: auto; flex: 1 1 0; height: 0; min-height: 200px; }
.card a:hover img { opacity: 0.86; }
.card-text { display: flex; flex-direction: column; gap: 3px; }
.card-title { font: 700 clamp(1.0625rem, 1.7vw, 1.3125rem)/1.2 var(--display); letter-spacing: -0.015em; }
.card a:hover .card-title { color: var(--red); }
.card-meta { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }

/* Art shelf on the home page */
.shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); border-top: 1px solid var(--ink); padding-top: 20px; }
.shelf a { display: flex; flex-direction: column; gap: 8px; text-decoration: none; min-width: 0; }
.shelf img { aspect-ratio: 4 / 3; object-fit: cover; transition: opacity 0.15s; }
.shelf a:hover img { opacity: 0.86; }
.shelf span { font: 700 1.0625rem/1.2 var(--display); letter-spacing: -0.015em; }
.shelf a:hover span { color: var(--red); }

/* Reel */
.reel { display: flex; flex-direction: column; gap: 14px; }
.reel .grid { border-top: 1px solid var(--ink); padding-top: 20px; }

/* Project sheets */
.back { text-decoration: none; align-self: flex-start; padding-block: 4px; }
.back:hover, .pager a:hover, .jump a:hover { color: var(--red); }
.project-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px clamp(28px, 5vw, 64px); align-items: start; border-top: 1px solid var(--ink); padding-top: 22px; }
.project-text { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sheet h1 { font: 800 clamp(1.875rem, 4.2vw, 3.25rem)/1.04 var(--display); letter-spacing: -0.03em; text-wrap: balance; }
.project-text > p { max-width: 62ch; color: var(--ink-soft); }
.slate { display: grid; min-width: 0; }
.slate > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 12px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.slate > div:first-child { padding-top: 0; }
.slate dd { font-size: 0.9375rem; line-height: 1.45; }
.slate dt { padding-top: 3px; }

.media { display: flex; flex-direction: column; gap: clamp(36px, 5vw, 56px); }
.set { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.set > h2 { font: 700 clamp(1.25rem, 2.2vw, 1.625rem)/1.1 var(--display); letter-spacing: -0.02em; text-wrap: balance; }
.set h3 { font: 700 1.0625rem/1.25 var(--display); letter-spacing: -0.01em; }
.note { font-size: 0.9375rem; color: var(--ink-soft); max-width: 66ch; }
.prose { display: flex; flex-direction: column; gap: 10px; max-width: 66ch; }
.prose p { color: var(--ink-soft); }
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap) clamp(20px, 3vw, 36px); }
.pillars > li { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pillars p { font-size: 0.9375rem; color: var(--ink-soft); }
.credits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--gap); max-width: 820px; }
.credits div { display: flex; flex-direction: column; padding-block: 8px; border-bottom: 1px solid var(--line); }
.credits dt { font: 500 0.75rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.credits dd { font-size: 0.9375rem; }

figure { min-width: 0; }
figcaption { margin-top: 8px; }
.grid { display: grid; gap: var(--gap); align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--artboard); border: 1px solid var(--line); }
.tiles.sq img { aspect-ratio: 1 / 1; }
.tiles.tall img { aspect-ratio: 3 / 4; }
.fill img { object-fit: cover; }
.framed img { border: 1px solid var(--line); }
video.clip { aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.pan { overflow-x: auto; background: var(--blue-wash); border: 1px solid var(--line); }
.pan img { height: clamp(150px, 26vw, 300px); width: auto; max-width: none; }
.pan + figcaption, .pan-fig figcaption { margin-top: 8px; }

.pager { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; border-top: 1px solid var(--ink); padding-top: 16px; margin-top: clamp(16px, 3vw, 32px); }
.pager a { text-decoration: none; padding-block: 6px; }

/* Art sheet */
.art-head { display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--ink); padding-top: 22px; }
.jump { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.jump a { text-decoration: none; border: 1px solid var(--blue); border-radius: 2px; padding: 7px 11px; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px clamp(28px, 5vw, 64px); border-top: 1px solid var(--ink); padding-top: 22px; }
.about-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.about h2 { font: 800 clamp(1.75rem, 3.8vw, 2.875rem)/1.05 var(--display); letter-spacing: -0.03em; text-wrap: balance; }
.about-main p { max-width: 62ch; }
.about-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.about-side .label:not(:first-child) { margin-top: 18px; }
.cv li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 16px; padding-block: 9px; border-bottom: 1px solid var(--line); font-size: 0.9375rem; line-height: 1.4; }
.cv li:first-child { padding-top: 0; }
.cv b { font-weight: 600; }
.cv span { color: var(--ink-soft); }
.tools { font-size: 0.9375rem; color: var(--ink-soft); }

/* Contact */
.contact { display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--ink); padding-top: 22px; }
.mail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
#email { font: 800 clamp(1.375rem, 4.6vw, 3.25rem)/1.1 var(--display); letter-spacing: -0.03em; user-select: all; min-width: 0; overflow-wrap: anywhere; text-decoration: none; }
#email:hover { color: var(--red); }
#copy-email, #lightbox-close { font: 500 0.75rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; border-radius: 2px; padding: 9px 12px; cursor: pointer; }
#copy-email { color: var(--ink); background: transparent; border: 1px solid var(--blue); }
#copy-email:hover { border-color: var(--red); color: var(--red); }
.phone { font-size: 1.0625rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.foot { padding-block: 20px 36px; border-top: 1px solid var(--line); }
.foot p { font: 400 0.75rem/1.4 var(--mono); color: var(--ink-soft); }

/* Lightbox */
#lightbox { border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: var(--scrim); color: var(--on-scrim); }
#lightbox::backdrop { background: var(--scrim); }
#lightbox[open] { display: flex; align-items: center; justify-content: center; }
#lightbox img { width: auto; height: auto; max-width: 96%; max-height: 92%; object-fit: contain; background: transparent; cursor: zoom-out; }
#lightbox img.on-white { background: #FFFFFF; }
#lightbox-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); color: var(--on-scrim); background: transparent; border: 1px solid var(--on-scrim); }

@media (max-width: 860px) {
  .hero, .project-head, .about { grid-template-columns: minmax(0, 1fr); }
  .hero-fig { order: -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pillars, .credits { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card.feat { grid-column: auto; }
  .card.feat img { aspect-ratio: 3 / 2; flex: none; height: auto; min-height: 0; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slate > div { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .card-meta { flex-direction: column; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { .card img, .shelf img { transition: none; } }
.cv .cv-when { font: 400 0.75rem/1.4 var(--mono); letter-spacing: 0.04em; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cv li span:not(.cv-when) { margin-top: 2px; }
