/* ---------- Base ---------- */
:root {
  --ink: #000;
  --paper: #fff;
  --muted: #555;
  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --gap: clamp(20px, 3.5vw, 44px);
}

* { box-sizing: border-box; margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.035em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* No orphans or awkward breaks (site.js covers older browsers) */
h1, h2, h3, .card-title, .more-info strong { text-wrap: balance; }
p, dd, li, figcaption { text-wrap: pretty; }
img, video, svg { display: block; max-width: 100%; }

.site-header,
main,
.site-footer {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 28px;
}

.logo img { height: 40px; width: auto; }

/* Logo hover animation: the video sits exactly over the logo while it plays */
.logo { position: relative; display: block; }
.logo-hover-video {
  position: absolute;
  max-width: none;
  height: auto;
  pointer-events: none;
  mix-blend-mode: multiply; /* white background disappears, only the black logo shows */
  visibility: hidden;
}
.logo.is-animating .logo-hover-video { visibility: visible; }
.logo.is-animating img { visibility: hidden; }

.nav { display: flex; gap: clamp(18px, 3vw, 36px); }

.nav a {
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 4px;
}

.nav a:hover,
.nav a[aria-current="page"] { text-decoration: underline; }

/* ---------- Work grid ---------- */
.work { display: grid; gap: 32px; }

.work-row {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}

/* Each card grows by its aspect ratio, so thumbnails in a row share one height. */
.card {
  flex: var(--grow) 1 0;
  min-width: 0;
  text-decoration: none;
}

.card-media {
  aspect-ratio: var(--ratio);
  overflow: hidden;
  background: #111;
  border: 4px solid var(--ink);
}

.card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card:hover .card-media video,
.card:focus-visible .card-media video { transform: scale(1.03); }

.card:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

.card-title {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
}

.card-type {
  font-style: italic;
  font-weight: 500;
  line-height: 22px;
}

/* ---------- Reel ---------- */
.reel { margin-top: clamp(72px, 10vw, 128px); }

/* Videos fill the width but never get taller than ~82% of the screen. */
.video-embed {
  position: relative;
  aspect-ratio: var(--ar, 16 / 9);
  width: min(100%, calc(82vh * var(--ar-n, 1.7778)));
  margin-inline: auto;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
  padding-top: clamp(16px, 4vw, 48px);
}

.about-photo img {
  width: 100%;
  height: auto;
  border: 4px solid var(--ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.about-text > p {
  font-size: 18px;
  line-height: 1.55;
  max-width: 62ch;
}

.about-text > p + p { margin-top: 16px; }

.about-links {
  list-style: none;
  padding: 0;
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
}

.about-links a {
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.about-links a:hover { opacity: 0.6; }

@media (max-width: 700px) {
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 420px; }
  .about-text > p { font-size: 17px; }
}

/* ---------- Project pages ---------- */
.project-intro {
  display: grid;
  /* title takes the free space; the info column is only as wide as its longest line */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px clamp(32px, 6vw, 88px);
  align-items: end;
  padding-top: clamp(16px, 4vw, 40px);
  margin-bottom: clamp(24px, 4vw, 40px);
}

.project-title {
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.project-type {
  margin-top: 8px;
  font-size: 18px;
  font-style: italic;
  font-weight: 500;
}

.project-meta {
  /* the block sits against the right margin (under "Contact"); its text stays left-aligned.
     It only wraps on narrower screens, so on desktop its longest line ends exactly at the margin. */
  justify-self: end;
  width: max-content;
  max-width: min(36rem, 56vw);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 20px;
  font-size: 15px;
  line-height: 1.4;
}

.project-meta dt { font-weight: 700; }
.project-meta dd { margin: 0; }

.project-section { margin-top: clamp(40px, 6vw, 72px); }

.project-text {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 12px clamp(32px, 6vw, 88px);
  margin-top: clamp(40px, 6vw, 72px);
}

.project-text h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.project-text p {
  font-size: 18px;
  line-height: 1.55;
  max-width: 64ch;
}

.project-text p + p { margin-top: 14px; }
/* Script: the poem inside a framed box (like the slides), margin to margin,
   three columns (one per act) centered in the box, credit underneath */
.script-box {
  display: flex;
  justify-content: center;
  padding: clamp(36px, 6vw, 88px) clamp(20px, 5vw, 72px);
}

.script {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 28px clamp(32px, 7vw, 120px);
}

.script p { font-size: 18px; line-height: 1.7; white-space: nowrap; }
.script p + p { margin-top: 1.4em; }

.script-box + .note { margin-top: 12px; }

.note {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

/* Media blocks */
.media-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  align-items: start;
}

.media-grid > * { min-width: 0; }

/* In two-column grids, an odd last image sits centered under the others */
.media-grid[style*="--cols: 2"] > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - var(--gap)) / 2);
}

.media-grid img,
.media-grid video,
.media-full img {
  width: 100%;
  height: auto;
}

.framed { border: 4px solid var(--ink); }

.media-full + .media-grid,
.media-grid + .media-grid,
.media-grid + .media-full,
.media-full + .media-full,
.media-full + .equal-row,
.equal-row + .media-full { margin-top: var(--gap); }

/* Images of different shapes in one row, all the same height */
.equal-row { display: flex; gap: var(--gap); }
.equal-row > img { flex: var(--r) 1 0; min-width: 0; width: 100%; height: auto; }

/* Award badge under the project title */
.award {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.35;
}
.award img { height: 64px; width: auto; }

.media-caption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--gap);
  align-items: center;
}

.hero-split .brand-stack {
  display: grid;
  gap: clamp(24px, 5vw, 64px);
  justify-items: center;
}

.hero-split .brand-stack img { width: 100%; height: auto; }
.hero-split .brand-stack img:first-child { width: 70%; }

@media (max-width: 600px) {
  .hero-split { grid-template-columns: 1fr; }
}

/* Storyboard: small hand-drawn sheet + clean frames in sequence */
.sketch-thumb { margin: 0 0 0 auto; max-width: 340px; text-align: right; }
.sketch-thumb img { width: 100%; height: auto; transition: opacity 0.2s; }
.sketch-thumb a:hover img { opacity: 0.8; }

.storyboard-frames {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.storyboard-frames img {
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
}

@media (max-width: 600px) {
  .storyboard-frames { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* Process divider */
/* Sections are separated by generous space, not rules */
.process { margin-top: clamp(120px, 16vw, 200px); }

.process-label {
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 700;
  letter-spacing: -0.05em;
  margin-bottom: clamp(24px, 3vw, 36px);
}

/* Every process step has the same shape on every page:
   label (left) + optional text (right), then the media full width below. */
.process-step + .process-step { margin-top: clamp(56px, 7vw, 88px); }

.step-head {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 12px clamp(32px, 6vw, 88px);
}

.step-head h3 { font-size: 18px; font-weight: 700; line-height: 1.3; }
.step-head p { font-size: 18px; line-height: 1.55; max-width: 64ch; }
.step-head p + p { margin-top: 14px; }

.step-media { margin-top: 24px; }

.text-link {
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.text-link:hover { opacity: 0.6; }

/* End of project pages: other projects + footer sit on a white panel
   whose soft upward shadow marks the new section (no rules). */
.page-end {
  margin-top: clamp(120px, 16vw, 200px);
  padding-top: clamp(48px, 6vw, 80px);
  background: var(--paper);
  box-shadow: 0 -16px 48px -8px rgba(0, 0, 0, 0.28);
}

.page-end .site-footer { margin-top: clamp(56px, 7vw, 96px); }

/* More projects: the other three thumbnails glide right-to-left in an endless loop.
   The track holds the set twice; sliding it by exactly half makes the loop seamless. */
.more-projects {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.more-projects > .marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}

/* the visible window: content width, clipped at the margins */
.more-projects { overflow: hidden; clip-path: inset(0 var(--gutter)); }

/* stop while someone is pointing at it, so a card is easy to click */
.more-projects:hover > .marquee-track,
.more-projects:focus-within > .marquee-track { animation-play-state: paused; }

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .more-projects > .marquee-track { animation: none; }
}

.more-card {
  position: relative;
  display: block;
  flex: none;
  width: clamp(240px, 30vw, 376px);
  margin-right: var(--gap);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
  border: 4px solid var(--ink);
  color: #fff;
  text-decoration: none;
}

/* Title + type fade in over the thumbnail on hover */
.more-info {
  position: absolute;
  inset: auto 0 0 0;
  padding: 40px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}

.more-info strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.25; }
.more-info em { display: block; font-size: 14px; font-weight: 500; line-height: 1.35; }

.more-card:hover .more-info,
.more-card:focus-visible .more-info { opacity: 1; transform: none; }

/* Phones have no hover, so the text is always shown there */
@media (hover: none) {
  .more-info { opacity: 1; transform: none; }
}

.more-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.more-card:hover video,
.more-card:focus-visible video { transform: scale(1.04); }
.more-card:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

@media (max-width: 800px) {
  .project-text { grid-template-columns: 1fr; }
  .step-head { grid-template-columns: 1fr; }
}

/* When three columns get too narrow for a full poem line, stack the acts instead */
@media (max-width: 880px) {
  .script { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  /* only on phones does the info block drop under the title */
  .project-intro { grid-template-columns: 1fr; align-items: start; }
  .project-meta { justify-self: stretch; width: auto; max-width: none; }
  .media-grid { grid-template-columns: repeat(var(--cols-sm, 1), minmax(0, 1fr)); }
  .media-grid[style*="--cols: 2"][style*="--cols-sm: 1"] > :last-child:nth-child(odd) { width: 100%; }
  .project-text p,
  .step-head p { font-size: 17px; }
  .more-card { width: 72vw; }
}

/* ---------- Page entrance ---------- */
/* Every page's content fades in with a slight upward lift when it opens.
   (About has its own typewriter entrance; the home intro reveals with the same lift.) */
@keyframes page-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

html:not(.about-anim):not(.intro):not(.intro-done) main,
html:not(.about-anim):not(.intro):not(.intro-done) .page-end,
html:not(.about-anim):not(.intro):not(.intro-done) body > .site-footer,
html:not(.about-anim):not(.intro):not(.intro-done) .contact-copyright {
  animation: page-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

@media (prefers-reduced-motion: reduce) {
  main, .page-end, .site-footer, .contact-copyright { animation: none !important; }
}

/* ---------- About entrance ---------- */
/* "Hello!" types itself (with a blinking caret), then the photo and text
   fade in with a slight upward lift. Blocks lift with transform; the rest of
   the first sentence is inline, so it lifts with relative positioning. */
html.about-anim .about .reveal {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), top 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.about-anim .about figure.reveal,
html.about-anim .about p.reveal,
html.about-anim .about ul.reveal { transform: translateY(18px); }
html.about-anim .about span.reveal { position: relative; top: 10px; }

html.about-anim .about .reveal.is-in { opacity: 1; transform: none; top: 0; }

.hello.typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: currentColor;
  animation: caret 0.8s steps(1) infinite;
}

@keyframes caret { 50% { opacity: 0; } }

/* ---------- Home intro ---------- */
/* While the intro runs, the page waits underneath (hidden) and the header logo
   is left empty so the flying logo can land in its place. */
html.intro .site-header .logo img { visibility: hidden; }
html.intro .nav { opacity: 0; }
html.intro main,
html.intro .site-footer { opacity: 0; transform: translateY(18px); }

/* as the logo lands, the menu fades in and the content rises into place (same lift as every page) */
html.intro-reveal .nav,
html.intro-reveal main,
html.intro-reveal .site-footer {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  cursor: pointer;
}

/* white only behind the video; it fades away as the page comes in */
.intro-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
}
html.intro-reveal .intro-overlay::before { opacity: 0; transition: opacity 0.8s ease; }

.intro-video,
.intro-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  max-width: none;
}

.intro-mark { visibility: hidden; height: auto; }

/* ---------- Contact ---------- */
.contact-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.contact {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-block: 48px;
}

.contact-thanks {
  font-size: clamp(30px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: clamp(32px, 5vw, 56px);
}

.contact-name { font-size: 20px; font-weight: 700; }

.contact-email {
  font-size: 18px;
  text-decoration: none;
}
.contact-email:hover { text-decoration: underline; text-underline-offset: 4px; }

.contact-info .socials { margin-top: 14px; }

.contact-copyright {
  text-align: center;
  padding: 0 var(--gutter) 32px;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(72px, 10vw, 128px);
  padding-bottom: 48px;
}

.footer-name { font-size: 18px; font-weight: 700; }

.footer-email { display: inline-block; margin-top: 4px; text-decoration: none; }
.footer-email:hover { text-decoration: underline; text-underline-offset: 4px; }

.copyright { margin-top: 12px; font-size: 13px; color: var(--muted); }

.socials { display: flex; gap: 6px; }
.socials a { transition: opacity 0.2s; }
.socials a:hover { opacity: 0.6; }
.socials svg { width: 52px; height: 52px; }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .work-row { flex-direction: column; gap: 32px; }
  .card { flex: none; width: 100%; }
  .logo img { height: 34px; }
  .socials svg { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-media video { transition: none; }
}
