/* justincarrig.com — single stylesheet, no build step */

:root {
  /* bone paper, near-black ink, cobalt accent (the --red name is kept so every rule below still works) */
  --paper: #efece6;
  --ink: #14151a;
  --grey: #6b6c73;
  --rule: #cfccc4;
  --red: #2846e6;
  --gut: clamp(16px, 3vw, 40px);
  --f: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --frame-w: min(56vw, 1000px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--f);
  -webkit-font-smoothing: antialiased;
}
/* paper grain */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .18; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .42 0 0 0 0 .44 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
img, video { display: block; width: 100%; height: 100%; object-fit: cover; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: var(--red); color: var(--paper); }

/* ── Nav ───────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--gut);
  pointer-events: none;
}
.nav a { pointer-events: auto; }
.nav__jc {
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
  opacity: 0; transition: opacity .3s;
}
body.scrolled .nav__jc { opacity: 1; }
.nav__links { display: flex; gap: 24px; font-size: 14px; }
.nav__links a { text-decoration: none; }
.nav__links a:hover { color: var(--red); }

/* ── Index: project list (left) + pinned frame (right) ── */
.index {
  display: grid; grid-template-columns: minmax(0, 36fr) minmax(0, 64fr);
  gap: var(--gut); padding: 0 var(--gut);
}
.titles { grid-column: 1; grid-row: 1; }
.stage { grid-column: 2; grid-row: 1; pointer-events: none; }
.stage__inner {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: grid; align-content: center;
}
.stage__frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: var(--ink); overflow: hidden;
}
.stage__still, .stage__video { position: absolute; inset: 0; }
.stage__still { transition: opacity .35s; }
.stage__still.is-swapping { opacity: .35; }
.stage__video { opacity: 0; transition: opacity .4s; }
.stage__video.is-on { opacity: 1; }
.stage__cap {
  display: flex; gap: 16px; align-items: baseline;
  margin: 12px 0 0; font-size: 14px; line-height: 1.35;
}
.stage__cap b { font-weight: 600; }
.stage__line { color: var(--grey); }
.stage__count { margin-left: auto; color: var(--red); font-variant-numeric: tabular-nums; font-size: 13px; }

.titles { list-style: none; margin: 0; padding: 0 0 30vh; counter-reset: n -1; }
.titles li {
  counter-increment: n;
  min-height: 46vh; display: flex; flex-direction: column; justify-content: center;
}
.titles li:not(.titles__name)::before {
  content: counter(n, decimal-leading-zero);
  font-size: 13px; color: var(--red); margin-bottom: 6px; font-variant-numeric: tabular-nums;
}
.titles a {
  text-decoration: none; align-self: flex-start;
  font-weight: 600; letter-spacing: -.02em; line-height: 1;
  font-size: clamp(30px, 3.4vw, 56px);
  color: #b8b1a4; transition: color .25s;
}
.titles__meta { margin-top: 8px; font-size: 14px; color: var(--grey); opacity: .6; transition: opacity .25s; }
.titles li.is-active a, .titles a:hover { color: var(--ink); }
.titles li.is-active .titles__meta { opacity: 1; }

.titles__name { min-height: 100vh !important; min-height: 100svh !important; }
.titles__name a {
  color: transparent !important; -webkit-text-stroke: 1px var(--red);
  font-weight: 500; letter-spacing: -.03em; line-height: .95;
  font-size: clamp(48px, 6vw, 104px);
}
.titles__intro { margin: 20px 0 0; font-size: clamp(15px, 1.25vw, 18px); max-width: 30ch; }
.titles__hint { margin: 28px 0 0; font-size: 13px; color: var(--grey); }

/* ── Section heads ─────────────────────────────── */
.head {
  margin: 0 0 28px;
  font-weight: 500; text-transform: none;
  font-size: clamp(44px, 6.5vw, 104px); line-height: .85; letter-spacing: -.01em;
  color: transparent; -webkit-text-stroke: 1px var(--ink);
}
.credits, .info, .contact { padding: 0 var(--gut) clamp(72px, 10vw, 140px); position: relative; }
.credits { border-top: 1px solid var(--ink); padding-top: clamp(48px, 7vw, 96px); }

/* ── Credits ───────────────────────────────────── */
.credits table { width: 100%; border-collapse: collapse; font-size: 16px; }
.credits th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--grey);
  padding: 0 12px 8px 0; border-bottom: 1px solid var(--ink);
}
.credits td { padding: 13px 12px 13px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.credits td:first-child { width: 9ch; color: var(--grey); font-variant-numeric: tabular-nums; }
.credits td:nth-child(2) { font-weight: 600; }
.credits td em { font-style: normal; font-weight: 400; color: var(--grey); }
.credits tr:hover td { color: var(--red); }

/* ── Info ──────────────────────────────────────── */
.info__body { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gut); max-width: 1400px; }
.info__lead { margin: 0; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.2; font-weight: 500; letter-spacing: -.01em; }
.info__body p:not(.info__lead) { margin: 0; color: #3a3833; max-width: 56ch; }
.info__cols {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gut);
  margin: clamp(40px, 6vw, 72px) 0 0; padding-top: 14px; border-top: 1px solid var(--ink);
}
.info__cols dt { font-weight: 700; margin-bottom: 6px; }
.info__cols dd { margin: 0; color: #3a3833; max-width: 36ch; }
.info__clients { margin: clamp(40px, 6vw, 72px) 0 0; max-width: 80ch; color: #3a3833; }
.info__clients span { color: var(--grey); margin-right: 8px; }

/* ── Contact ───────────────────────────────────── */
.contact__mail {
  display: inline-block; text-decoration: none;
  font-weight: 500; letter-spacing: -.02em;
  font-size: clamp(28px, 4.5vw, 68px); line-height: 1.1; color: var(--red);
  border-bottom: 1px solid currentColor;
  overflow-wrap: anywhere;
}
.contact__mail:hover { color: var(--ink); }
.contact__links { list-style: none; display: flex; gap: 28px; padding: 0; margin: 28px 0 0; font-size: 17px; font-weight: 500; }
.contact__links a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.contact__links a:hover { color: var(--red); border-color: var(--red); }

/* ── Footer ────────────────────────────────────── */
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px var(--gut); border-top: 1px solid var(--ink);
  font-size: 13px; color: var(--grey);
}

/* ── Small screens: frame pinned under the nav, titles pass beneath it ── */
@media (max-width: 760px) {
  :root { --frame-w: calc(100vw - 2 * var(--gut)); }
  .nav { background: var(--paper); padding-top: 12px; padding-bottom: 12px; pointer-events: auto; }
  .nav__jc { opacity: 1; }
  .nav__links { gap: 14px; }
  .nav__links a[href="#credits"] { display: none; }
  .index { display: block; padding: 50px 0 0; }
  .stage__cap { font-size: 13px; }
  .stage__role { display: none; }
  .stage { position: sticky; top: 50px; z-index: 3; }
  .stage__inner {
    position: static; height: auto; padding: 8px var(--gut) 12px; background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .titles { padding: 0 var(--gut) 40vh; }
  .titles li { min-height: 34vh; }
  .titles__name { min-height: 0 !important; padding: 32px 0 12vh; }
  .titles__name a { font-size: 15vw; }
  .head { -webkit-text-stroke-width: 1px; }
  .credits thead { display: none; }
  .credits tr { display: grid; grid-template-columns: 8ch 1fr; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .credits td { border: 0; padding: 0; }
  .credits td:first-child { grid-row: span 3; width: auto; }
  .credits td:nth-child(3), .credits td:nth-child(4) { color: var(--grey); font-size: 14px; }
  .info__body, .info__cols { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .stage__video { display: none; }
}
