/* ==========================================================================
   Nathan Santi — portfolio
   Desktop (>= 900px) reproduces the original Readymag layout: a 1024-unit
   canvas that scales with the window (capped at 1600px). Below 900px the
   layout switches to a stacked mobile version.
   ========================================================================== */

:root {
  --gray: #d8d8d8;
  --gray-2: #e1e1e1;
  --page: #e7e7e7;
  --black: #000;
  --ink: #202020;
  --blue: #0110db;
  --orange: #ef5a15;
  --orange-hover: #c80000;
  --white: #fff;

  --font: "Kanit", system-ui, sans-serif;
  /* Pacaembu (Adobe Fonts) — falls back to Kanit if the kit is not loaded */
  --display: "pacaembu", "Kanit", system-ui, sans-serif;

  /* 1 design unit of the original 1024px canvas */
  --u: calc(min(100vw, 1600px) / 1024);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--page);
  color: var(--black);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.45;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }

/* ---------- stage: absolute positioning in design units ---------- */
.band { position: relative; overflow: hidden; }
.stage {
  position: relative;
  width: calc(1024 * var(--u));
  height: calc(var(--h) * var(--u));
  margin: 0 auto;
}
.abs {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
}
.abs[style*="--hh"] { height: calc(var(--hh) * var(--u)); }

/* ---------- nav ---------- */
.nav {
  position: absolute; z-index: 20;
  top: calc(16 * var(--u)); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: calc(14 * var(--u));
  font-size: max(12px, calc(12 * var(--u)));
  text-transform: uppercase;
}
.nav a { text-decoration: none; padding: 2px calc(10 * var(--u)); }
.nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn {
  display: inline-block;
  background: var(--orange); color: var(--white);
  border-radius: 5px; text-decoration: none;
  transition: background .2s;
}
.btn:hover { background: var(--orange-hover); text-decoration: none !important; }
.nav .btn { padding: 2px calc(30 * var(--u)); }

/* ---------- hero ---------- */
.hero { background: var(--gray); }
.hero .stage { --h: 520; }
.portrait {
  position: absolute; z-index: 5;
  left: calc(372 * var(--u)); top: calc(64 * var(--u));
  width: calc(266 * var(--u)); height: calc(336 * var(--u));
}
.portrait img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; visibility: hidden;
}
.portrait img.on { visibility: visible; }
.name {
  position: absolute; z-index: 6; margin: 0;
  font-family: var(--display); font-weight: 700;
  font-size: calc(51 * var(--u)); line-height: 1;
  letter-spacing: -0.01em; text-transform: uppercase;
}
.name--first { left: calc(222 * var(--u)); top: calc(250 * var(--u)); }
.name--last  { left: calc(577 * var(--u)); top: calc(186 * var(--u)); }
.roles {
  position: absolute; z-index: 6; margin: 0;
  right: calc((1024 - 739) * var(--u)); top: calc(247 * var(--u));
  text-align: right; text-transform: uppercase;
  font-family: var(--display); font-weight: 400;
  font-size: max(9px, calc(8 * var(--u))); letter-spacing: .18em; line-height: 1.85;
}
.roles span { display: block; }

/* ---------- thumbnails ---------- */
.thumb {
  position: absolute; z-index: 4; display: block;
  left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u)); aspect-ratio: 16 / 9;
  background: #111 center / cover no-repeat;
  text-decoration: none;
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .label {
  position: absolute; left: 0; top: 100%; margin-top: 6px;
  font-size: max(11px, calc(10 * var(--u))); letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.thumb:hover, .thumb:focus-visible { transform: scale(1.06); z-index: 9; }
.thumb.swing:hover { animation: swing 1.2s ease-in-out infinite alternate; }
@keyframes swing { from { transform: scale(1); } to { transform: scale(.9); } }
.thumb:hover .label, .thumb:focus-visible .label { opacity: 1; transform: none; }
.on-dark .thumb .label { color: var(--white); }

/* ---------- reel ---------- */
.reel { background: var(--black); color: var(--white); }
.reel .stage { --h: 440; }
.player {
  position: relative; overflow: hidden; background: #000;
  aspect-ratio: 16 / 9;
}
.player button {
  all: unset; cursor: pointer; position: absolute; inset: 0;
}
.player img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s, filter .3s; }
.player button:hover img { transform: scale(1.03); filter: brightness(.85); }
.player .play {
  position: absolute; left: 50%; top: 50%;
  width: 72px; height: 72px; margin: -36px 0 0 -36px;
  border-radius: 50%; background: var(--orange);
  display: grid; place-items: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  transition: transform .2s;
}
.player button:hover .play { transform: scale(1.1); }
.player .play::before {
  content: ""; margin-left: 6px;
  border-left: 22px solid #fff; border-top: 14px solid transparent; border-bottom: 14px solid transparent;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel .player { position: absolute; left: calc(32 * var(--u)); top: calc(56 * var(--u)); width: calc(544 * var(--u)); }
.big {
  margin: 0; font-weight: 900; text-transform: uppercase;
  font-size: calc(62 * var(--u)); line-height: 1; letter-spacing: .02em;
}
.reel .big { position: absolute; left: calc(604 * var(--u)); top: calc(140 * var(--u)); }
.reel .big span { display: block; margin-bottom: calc(-2 * var(--u)); }
.reel .note {
  position: absolute; left: calc(609 * var(--u)); top: calc(272 * var(--u));
  width: calc(337 * var(--u)); margin: 0;
  font-weight: 300; font-size: max(12px, calc(11 * var(--u))); opacity: .85;
}

/* ---------- service sections ---------- */
.svc .stage { --h: 416; }
.svc--blue  { background: var(--blue); color: var(--white); }
.svc--gray  { background: var(--gray); color: var(--black); }
.svc--black { background: var(--black); color: var(--white); }
.svc h2 {
  margin: 0; font-weight: 900; text-transform: uppercase;
  font-size: calc(32 * var(--u)); line-height: 1.05; letter-spacing: .02em;
}
.svc p, .about p, .contact p {
  margin: calc(14 * var(--u)) 0 0;
  font-size: max(13px, calc(12 * var(--u)));
}
.svc .copy { position: absolute; top: calc(104 * var(--u)); width: calc(352 * var(--u)); }
.svc .copy--left  { left: calc(96 * var(--u)); }
.svc .copy--right { left: calc(608 * var(--u)); top: calc(96 * var(--u)); }

/* ---------- about ---------- */
.about { color: var(--white); clip-path: inset(0); background: #111; }
.about .stage { --h: 432; }
.about .bgvideo {
  position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover;
  z-index: 0;
}
.about::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 1; }
.about .stage { z-index: 2; }
.about .photo { position: absolute; left: calc(192 * var(--u)); top: calc(80 * var(--u)); width: calc(256 * var(--u)); height: calc(288 * var(--u)); object-fit: cover; }
.about .copy { position: absolute; left: calc(514 * var(--u)); top: calc(80 * var(--u)); width: calc(352 * var(--u)); }
.about .kicker { margin: 0; font-weight: 300; font-size: max(13px, calc(12 * var(--u))); }
.about h2 { margin: calc(4 * var(--u)) 0 0; font-weight: 900; text-transform: uppercase; font-size: calc(32 * var(--u)); line-height: 1.05; letter-spacing: .02em; }
.about p { font-weight: 300; }
.awards { display: flex; align-items: center; gap: calc(22 * var(--u)); margin-top: calc(18 * var(--u)); }
.awards img { height: calc(44 * var(--u)); width: auto; }
.awards img.wide { height: calc(26 * var(--u)); }

/* ---------- contact ---------- */
.contact { background: var(--gray-2); }
.contact .stage { --h: 549; }
.contact .photo {
  position: absolute; left: calc(448 * var(--u)); top: 0;
  width: calc(584 * var(--u)); height: 100%; object-fit: cover;
}
.contact .copy { position: absolute; left: calc(142 * var(--u)); top: calc(188 * var(--u)); width: calc(300 * var(--u)); }
.contact h2 {
  margin: 0; font-family: var(--display); font-weight: 700;
  font-size: calc(32 * var(--u)); letter-spacing: .03em; color: #202020;
}
.links {
  display: inline-flex; flex-wrap: wrap; gap: 0;
  margin-top: calc(18 * var(--u)); background: var(--orange);
}
.links a {
  color: var(--white); text-decoration: none; font-weight: 300;
  font-size: max(13px, calc(12 * var(--u)));
  padding: calc(4 * var(--u)) calc(14 * var(--u));
}
.links a:hover { background: var(--orange-hover); }

.footer {
  background: var(--black); color: #9a9a9a; text-align: center;
  font-size: 12px; padding: 18px 16px;
}
.footer a { color: #cfcfcf; }

/* ==========================================================================
   Project pages
   ========================================================================== */
.page-project { background: var(--ink); color: #eee; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 22px 24px;
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
}
.topbar a { text-decoration: none; }
.topbar .home { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .04em; }
.topbar .back:hover { color: var(--orange); }
.project { max-width: 880px; margin: 0 auto; padding: 24px 24px 64px; }
.project .eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.project h1 { margin: 0; font-weight: 900; text-transform: uppercase; font-size: clamp(34px, 6vw, 60px); line-height: 1; letter-spacing: .01em; color: #fff; }
.project .lead { margin: 18px 0 28px; max-width: 680px; font-size: 17px; font-weight: 300; color: #d6d6d6; }
.project .player { border-radius: 4px; }
.meta { display: grid; grid-template-columns: 220px 1fr; gap: 28px; margin-top: 32px; padding-top: 28px; border-top: 1px solid #3a3a3a; }
.role h2, .credits h2 { margin: 0 0 8px; font-size: 12px; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: #8d8d8d; }
.role p { margin: 0; font-size: 18px; font-weight: 600; color: #fff; line-height: 1.3; }
.credits dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; font-size: 14px; }
.credits dt { color: #8d8d8d; font-weight: 300; }
.credits dd { margin: 0; }
.credits dd.me { color: var(--orange); font-weight: 600; }
.ai-item + .ai-item { margin-top: 72px; }
.ai-item h2.item-title { margin: 0 0 6px; font-size: 28px; font-weight: 900; text-transform: uppercase; color: #fff; }
.ai-item .lead { margin-top: 6px; }
.pager {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 56px; padding-top: 24px; border-top: 1px solid #3a3a3a;
}
.pager a { text-decoration: none; display: block; max-width: 48%; }
.pager small { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #8d8d8d; }
.pager strong { font-size: 20px; font-weight: 900; text-transform: uppercase; color: #fff; transition: color .2s; }
.pager a:hover strong { color: var(--orange); }
.pager .next { text-align: right; margin-left: auto; }
.cta {
  background: var(--orange); color: #fff; text-align: center;
  padding: 56px 24px;
}
.cta h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(26px, 4vw, 40px); }
.cta p { margin: 8px 0 18px; font-weight: 300; }
.cta .links { background: #fff; }
.cta .links a { color: var(--orange); font-weight: 400; padding: 8px 16px; }
.cta .links a:hover { background: #ffe5d8; }

/* ==========================================================================
   Mobile / tablet (< 900px): stacked layout
   ========================================================================== */
@media (max-width: 899px) {
  :root { --m: calc(100vw / 375); }
  .stage { width: 100%; height: auto; padding: 0 20px; }
  .abs, .svc .copy, .about .copy, .contact .copy,
  .reel .big, .reel .note, .about .photo, .contact .photo {
    position: static; width: auto; height: auto; left: auto; top: auto;
  }
  .reel .player { position: relative; left: auto; top: auto; width: auto; }

  /* hero: keeps the collage, re-arranged for a narrow screen */
  .hero .stage { height: calc(640 * var(--m)); padding: 0; }
  .nav { top: 14px; gap: 6px; font-size: 13px; }
  .nav a { padding: 4px 8px; }
  .nav .btn { padding: 4px 18px; }
  .portrait { left: calc(87 * var(--m)); top: calc(96 * var(--m)); width: calc(200 * var(--m)); height: calc(250 * var(--m)); }
  .name { font-size: calc(64 * var(--m)); left: 0; right: 0; text-align: center; }
  .name--first { top: calc(368 * var(--m)); }
  .name--last  { top: calc(428 * var(--m)); }
  .roles { right: 0; left: 0; text-align: center; top: calc(500 * var(--m)); font-size: 11px; }
  .roles span { display: inline; }
  .roles span + span::before { content: " · "; }
  .hero .thumb {
    left: calc(var(--mx) * var(--m)); top: calc(var(--my) * var(--m));
    width: calc(var(--mw) * var(--m));
  }
  .hero .thumb .label { display: none; }

  /* reel */
  .reel .stage { padding: 40px 20px 48px; display: flex; flex-direction: column; gap: 22px; }
  .reel .big { order: -1; font-size: 52px; }
  .reel .big span { display: inline; }
  .reel .note { margin-top: -6px; font-size: 14px; }

  /* services: text first, then a grid of labelled thumbnails */
  .svc .stage { padding: 48px 20px 56px; }
  .svc h2 { font-size: 34px; }
  .svc p, .about p, .contact p { font-size: 16px; margin-top: 12px; }
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 14px; margin-top: 28px; }
  .grid .thumb { position: relative; left: auto; top: auto; width: 100%; }
  .grid .thumb .label { opacity: 1; transform: none; font-size: 12px; white-space: normal; right: 0; line-height: 1.25; }
  .grid { row-gap: 40px; }
  .thumb:hover { transform: none; animation: none !important; }

  /* about */
  .about .stage { padding: 56px 20px; display: flex; flex-direction: column; gap: 28px; }
  .about .photo { width: 70%; max-width: 300px; aspect-ratio: 256 / 288; }
  .about h2 { font-size: 34px; }
  .about .kicker { font-size: 14px; }
  .awards { gap: 20px; margin-top: 22px; flex-wrap: wrap; }
  .awards img { height: 40px; }
  .awards img.wide { height: 24px; }

  /* contact */
  .contact .stage { padding: 0; display: flex; flex-direction: column; }
  .contact .copy { padding: 56px 20px; }
  .contact h2 { font-size: 40px; }
  .contact .photo { width: 100%; aspect-ratio: 584 / 544; }
  .links { margin-top: 20px; }
  .links a { font-size: 16px; padding: 10px 16px; }

  /* project pages */
  .meta { grid-template-columns: 1fr; gap: 24px; }
  .credits dl { grid-template-columns: 1fr; gap: 0; }
  .credits dt { margin-top: 10px; font-size: 12px; }
  .pager strong { font-size: 16px; }
}

/* desktop-only: thumbnails in service sections use stage coordinates */
@media (min-width: 900px) {
  .grid { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  .thumb, .thumb:hover { transition: none; animation: none !important; transform: none; }
}
