:root {
  --paper: #f8f3e7;
  --ink: #222126;
  --red: #f05a24;
  --accent: #2d2b2e;
  --grid: rgba(58, 182, 206, .18);
  --line: rgba(34, 33, 38, .24);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: var(--sans);
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 80;
  height: 3px;
  background: var(--red);
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: left;
  pointer-events: none;
}
a { color: inherit; }
img { display: block; width: 100%; }
button { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px clamp(20px, 3vw, 52px);
  background: rgba(248, 243, 231, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(240, 90, 36, .18);
}
.wordmark {
  color: var(--red);
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  text-decoration: none;
}
nav { display: flex; gap: 10px; }
nav a, .filters button {
  border: 1.5px solid var(--red);
  border-radius: 100px;
  padding: 10px 24px;
  color: var(--red);
  background: var(--paper);
  text-decoration: none;
  transition: .2s ease;
}
nav a:hover, nav a:focus-visible, .filters button:hover, .filters button.active {
  color: var(--paper);
  background: var(--red);
}

.hero {
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8vh clamp(20px, 4vw, 72px) 5vh;
}
.section-index {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 600;
}
.hero h1 {
  margin: 4vh auto;
  max-width: 1500px;
  color: var(--red);
  font-family: var(--serif);
  font-size: clamp(4rem, 8.2vw, 9.3rem);
  line-height: .86;
  font-weight: 400;
  letter-spacing: -.035em;
  text-align: center;
}
.hero h1 em { font-weight: 400; }
.hero-line {
  display: block;
  will-change: transform;
}
.hero-line-top { transform: translate3d(var(--hero-x-top, 0), var(--hero-y-top, 0), 0); }
.hero-line-bottom { transform: translate3d(var(--hero-x-bottom, 0), var(--hero-y-bottom, 0), 0); }
.inline-frame {
  display: inline-block;
  width: .9em;
  height: .62em;
  overflow: hidden;
  border-radius: .08em;
  vertical-align: .08em;
  transform: rotate(2deg);
}
.inline-frame img { height: 100%; object-fit: cover; object-position: 45% 35%; }
.hero-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}
.hero-foot p { max-width: 430px; font-size: 1.05rem; line-height: 1.5; }
.round-link {
  display: grid;
  place-content: center;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 1.5px solid var(--red);
  color: var(--red);
  text-decoration: none;
  text-align: center;
  transition: transform .2s, background .2s, color .2s;
}
.round-link:hover { transform: rotate(5deg); background: var(--red); color: var(--paper); }
.clients-line { margin: 58px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 1rem; line-height: 1.5; }

.work-section, .about-section, .contact-section { padding: 110px clamp(20px, 4vw, 72px); }
.section-head { display: grid; grid-template-columns: 80px 1fr auto; align-items: end; gap: 25px; margin-bottom: 70px; }
.section-head h2, .contact-section h2 {
  margin: 0;
  color: var(--red);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(4rem, 8vw, 8rem);
  line-height: .9;
}
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 650px; }
.filters button { cursor: pointer; padding: 8px 17px; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(48px, 6vw, 96px) clamp(28px, 4vw, 64px);
}
.project-card { min-width: 0; width: 100%; will-change: transform, opacity; }
.project-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.project-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #d8cfbd;
}
.project-media img { height: 100%; object-fit: cover; transition: transform .45s ease, filter .3s; }
.preview-player {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
}
.preview-player.active { opacity: 1; }
.preview-player iframe { width: 100%; height: 100%; border: 0; }
.project-button:hover img { transform: scale(1.035); filter: saturate(1.08); }
.project-media::after {
  content: "Play ↗";
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 18px;
  padding: 9px 14px;
  color: var(--paper);
  background: var(--accent);
  border-radius: 100px;
  font-size: .85rem;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s;
}
.project-button:hover .project-media::after, .project-button:focus-visible .project-media::after { opacity: 1; transform: none; }
.project-info { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; margin-top: 14px; }
.project-info h3 { margin: 0; color: var(--red); font-family: var(--serif); font-size: clamp(1.65rem, 2.5vw, 2.4rem); font-weight: 400; }
.project-info p { margin: 0; color: var(--accent); font-size: .92rem; text-align: right; }
.project-card[hidden] { display: none; }

.motion-ready .reveal {
  opacity: 0;
  filter: blur(5px);
  transform: translate3d(0, 52px, 0) scale(.985);
  transition: opacity .85s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1), filter .75s ease;
  transition-delay: var(--reveal-delay, 0ms);
}
.motion-ready .reveal.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, var(--float-y, 0), 0) scale(1);
}
.motion-ready .project-media {
  clip-path: inset(7% 0 7% 0 round 12px);
  transition: clip-path 1s cubic-bezier(.2, .7, .2, 1);
}
.motion-ready .project-card.is-visible .project-media { clip-path: inset(0 round 12px); }
.motion-ready .bio p { transform-origin: left center; }

.about-grid { display: grid; grid-template-columns: minmax(280px, .85fr) 1.25fr; gap: clamp(50px, 8vw, 140px); align-items: start; }
.portrait-wrap { margin: 0; position: sticky; top: 120px; }
.portrait-wrap img { border-radius: 14px; aspect-ratio: 4 / 5; object-fit: cover; }
.bio { color: var(--ink); font-family: var(--serif); font-size: clamp(1.8rem, 3.4vw, 3.9rem); line-height: 1.04; }
.bio p { margin: 0 0 .8em; }
.bio .bio-lead { color: var(--red); font-style: italic; }

.contact-section { min-height: 75vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.contact-section h2 { max-width: 1000px; }
.contact-section > p:not(.section-index) { max-width: 600px; margin: 30px 0; font-size: 1.2rem; line-height: 1.5; }
.contact-link { color: var(--red); font-family: var(--serif); font-size: clamp(2rem, 5vw, 5rem); text-underline-offset: 8px; }
.contact-form { width: min(780px, 100%); margin-top: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.contact-form label { display: grid; gap: 9px; margin-bottom: 22px; font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.contact-form input, .contact-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--ink); background: rgba(248, 243, 231, .8); font: 1rem var(--sans); }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--red); outline-offset: 2px; }
.contact-form button { border: 0; border-radius: 100px; padding: 14px 24px; color: var(--paper); background: var(--red); font: 600 1rem var(--sans); cursor: pointer; }
footer { display: flex; justify-content: space-between; padding: 28px clamp(20px, 4vw, 72px); border-top: 1px solid var(--line); font-size: .9rem; }

dialog {
  width: min(1060px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  border: 0;
  border-radius: 14px;
  padding: clamp(20px, 3vw, 38px);
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop { background: rgba(18, 18, 22, .82); backdrop-filter: blur(5px); }
.close-dialog { float: right; border: 1px solid var(--ink); border-radius: 100px; padding: 8px 14px; background: transparent; cursor: pointer; }
.dialog-copy p { margin: 0 0 4px; color: var(--accent); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.dialog-copy h2 { margin: 0 0 22px; color: var(--red); font-family: var(--serif); font-size: clamp(2.4rem, 5vw, 5rem); font-weight: 400; line-height: 1; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #111; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.external-link { display: inline-block; margin-top: 18px; color: var(--red); }

@media (max-width: 900px) {
  .section-head { grid-template-columns: 55px 1fr; }
  .filters { grid-column: 1 / -1; justify-content: flex-start; }
  .bio { font-size: clamp(1.65rem, 4vw, 2.6rem); }
}

@media (max-width: 640px) {
  .site-header { align-items: flex-start; }
  nav a { padding: 7px 13px; font-size: .83rem; }
  nav a:nth-child(2) { display: none; }
  .hero { min-height: 82vh; padding-top: 10vh; }
  .hero h1 { text-align: left; font-size: clamp(3.6rem, 18vw, 6rem); line-height: .89; }
  .hero-foot { align-items: center; }
  .round-link { width: 100px; height: 100px; flex: 0 0 auto; }
  .work-section, .about-section, .contact-section { padding-top: 80px; padding-bottom: 80px; }
  .section-head { margin-bottom: 45px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { margin-bottom: 42px; }
  .about-grid { grid-template-columns: 1fr; }
  .portrait-wrap { position: static; }
  .bio { font-size: 2rem; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  footer { flex-direction: column; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  body::before { display: none; }
  .hero-line, .motion-ready .reveal, .motion-ready .reveal.is-visible { transform: none; opacity: 1; filter: none; }
  .motion-ready .project-media { clip-path: none; }
}
