/* ============================================
   Components — header, hero, rail, work,
   ticker, timeline, acting, contact
   ============================================ */

/* Everything set in the display face gets the expanded width */
.brand,
.stat .stat-num,
.ticker-track li,
.project-card .client,
.credit-title,
.contact-email {
  font-stretch: 125%;
}

/* --- Header --- */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  transition:
    background 0.4s var(--ease-out),
    border-color 0.4s var(--ease-out),
    transform 0.4s var(--ease-out);
  border-bottom: 1px solid transparent;
}

/* Hides when scrolling down, returns on scroll up */
.site-header.is-hidden {
  transform: translateY(-100%);
}

.site-header.is-scrolled {
  background: rgba(20, 17, 16, 0.86);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: 0.01em;
}

.brand span {
  color: var(--amber);
}

.site-nav {
  display: flex;
  gap: var(--space-3);
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  transition: color 0.25s;
}

.site-nav a:hover {
  color: var(--amber);
}

@media (max-width: 640px) {
  .site-nav {
    display: none;
  }
}

/* --- Hero --- */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-block: var(--space-5) var(--space-4);
  position: relative;
}

.hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.hero-main {
  min-width: 0;
}

.hero-portrait {
  flex: 0 0 auto;
  width: clamp(150px, 21vw, 300px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  filter: grayscale(1) contrast(1.05);
  opacity: 0;
  animation: portrait-in 1s var(--ease-out) 0.25s forwards;
}

@keyframes portrait-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .hero-top {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .hero-portrait {
    width: 150px;
  }
}

.hero-name {
  font-size: var(--text-hero);
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 0.92;
  display: flex;
  flex-direction: column;
}

.hero-name .line {
  display: block;
  overflow: hidden;
  /* never break inside the name — it scales down instead */
  white-space: nowrap;
}

.hero-name .line:nth-child(2) {
  color: var(--amber);
}

/* JS splits each line into .char spans and sets --d per letter */
.hero-name .char {
  display: inline-block;
  transform: translateY(115%) rotate(4deg);
  animation: char-rise 0.75s var(--ease-out) forwards;
  animation-delay: var(--d, 0s);
}

/* Fallback when JS is off: lines rise whole */
.hero-name .line > span {
  display: block;
}

@keyframes char-rise {
  to {
    transform: translateY(0) rotate(0);
  }
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.hero-meta p {
  font-size: var(--text-lg);
  line-height: 1.4;
  max-width: 34ch;
  text-wrap: balance;
}

.hero-stats {
  display: flex;
  gap: var(--space-4);
}

.stat .stat-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.stat .stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

/* --- Reel rail --- */

.rail-section {
  padding-block: var(--space-6) var(--space-5);
  overflow: hidden;
}

.rail {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-inline: var(--gutter);
  padding-bottom: var(--space-2);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  cursor: grab;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

/* Media inside reels must never hijack the drag:
   no native image-drag, no pointer target, no text select */
.rail {
  user-select: none;
  -webkit-user-select: none;
}

.reel img,
.reel video {
  pointer-events: none;
}

/* Reels cascade in when the rail first enters the viewport */
.rail .reel {
  opacity: 0;
  transform: translateY(36px) scale(0.96);
  transition:
    opacity 0.6s var(--ease-out),
    transform 0.6s var(--ease-out);
}

.rail.is-visible .reel {
  opacity: 1;
  transform: none;
}

.rail.is-visible .reel:nth-child(1) { transition-delay: 0s; }
.rail.is-visible .reel:nth-child(2) { transition-delay: 0.07s; }
.rail.is-visible .reel:nth-child(3) { transition-delay: 0.14s; }
.rail.is-visible .reel:nth-child(4) { transition-delay: 0.21s; }
.rail.is-visible .reel:nth-child(5) { transition-delay: 0.28s; }
.rail.is-visible .reel:nth-child(6) { transition-delay: 0.35s; }
.rail.is-visible .reel:nth-child(7) { transition-delay: 0.42s; }
.rail.is-visible .reel:nth-child(8) { transition-delay: 0.49s; }
.rail.is-visible .reel:nth-child(9) { transition-delay: 0.56s; }
.rail.is-visible .reel:nth-child(10) { transition-delay: 0.63s; }
.rail.is-visible .reel:nth-child(11) { transition-delay: 0.7s; }

.reel {
  position: relative;
  flex: 0 0 auto;
  width: clamp(220px, 26vw, 300px);
  aspect-ratio: 9 / 16;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  scroll-snap-align: start;
  border: 1px solid var(--line);
}

.reel video,
.reel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel figcaption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: var(--space-3) var(--space-2) var(--space-2);
  background: linear-gradient(to top, rgba(20, 17, 16, 0.85), transparent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
}

/* --- Selected work --- */

.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: center;
  padding-block: var(--space-5);
  border-top: 1px solid var(--line);
}

.feature:nth-of-type(even) .feature-media {
  order: 2;
}

.feature-media {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}

.feature-media img,
.feature-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* JS drives a scroll parallax on these — base scale hides the travel */
  transform: scale(1.12);
  will-change: transform;
}

.feature-media video {
  aspect-ratio: 9 / 16;
  max-height: 560px;
}

.feature-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feature-body h3 {
  font-size: var(--text-xl);
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3em 0.9em;
}

@media (max-width: 800px) {
  .feature {
    grid-template-columns: 1fr;
  }

  .feature:nth-of-type(even) .feature-media {
    order: 0;
  }
}

/* Project card grid (type-led) */

/* Project cards cascade in */
.project-grid .project-card:nth-child(2) { transition-delay: 0.07s; }
.project-grid .project-card:nth-child(3) { transition-delay: 0.14s; }
.project-grid .project-card:nth-child(4) { transition-delay: 0.07s; }
.project-grid .project-card:nth-child(5) { transition-delay: 0.14s; }
.project-grid .project-card:nth-child(6) { transition-delay: 0.21s; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    background 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}

.project-card:hover {
  background: var(--surface-2);
  transform: translateY(-4px);
}

.project-card .client {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  line-height: 1.15;
}

.project-card .scope {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  flex-grow: 1;
}

.project-card .year {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  color: var(--amber);
}

/* --- Brand ticker --- */

.ticker-section {
  padding-block: var(--space-5);
  border-block: 1px solid var(--line);
  overflow: hidden;
}

.ticker {
  display: flex;
  width: max-content;
  animation: ticker-scroll 42s linear infinite;
}

.ticker:hover {
  animation-play-state: paused;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-right: var(--space-4);
}

.ticker-track li {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xl);
  white-space: nowrap;
  color: var(--ink-faint);
  transition: color 0.3s;
}

.ticker-track li:hover {
  color: var(--amber);
}

.ticker-track li::after {
  content: "·";
  margin-left: var(--space-4);
  color: var(--amber-deep);
}

@keyframes ticker-scroll {
  to {
    transform: translateX(-50%);
  }
}

/* --- Timeline --- */

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: var(--space-3);
  align-items: baseline;
  padding-block: var(--space-3);
  border-top: 1px solid var(--line);
  transition: background 0.3s;
}

.timeline-row:hover {
  background: var(--surface);
}

.timeline-years {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.timeline-role .role {
  font-weight: 600;
}

.timeline-role .org {
  color: var(--ink-muted);
}

.timeline-note {
  font-size: var(--text-sm);
  color: var(--ink-faint);
  text-align: right;
  max-width: 34ch;
}

@media (max-width: 720px) {
  .timeline-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .timeline-note {
    text-align: left;
  }
}

/* --- Acting --- */

.acting {
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.acting-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: var(--space-5);
  align-items: center;
}

/* Four-photo mosaic: two tall frames on top, two wide below */
.acting-mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 170px;
  gap: 10px;
}

.mosaic-item {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: transform 0.6s var(--ease-out), filter 0.6s var(--ease-out);
}

.mosaic-tall {
  grid-row: span 2;
}

/* The 4-frame scene strip: keep the top frame whole, crop from the bottom */
.acting-mosaic .mosaic-item:nth-child(1) {
  object-position: top;
}

.mosaic-item:hover {
  transform: scale(1.02);
}

.acting-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.credits-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  margin-top: var(--space-3);
}

.credits {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-1);
}

/* Commercials: tighter two-column grid */
.credits-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: var(--space-3);
}

.credits-compact .credit-title {
  font-size: var(--text-base);
}

@media (max-width: 520px) {
  .credits-compact {
    grid-template-columns: 1fr;
  }
}

.credit {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-block: var(--space-2);
  border-top: 1px solid var(--line);
}

.credit-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
}

.credit-title [dir="rtl"] {
  color: var(--vermilion);
  margin-left: 0.5em;
  font-weight: 400;
}

.credit-detail {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

@media (max-width: 720px) {
  .acting-grid {
    grid-template-columns: 1fr;
  }

  .acting-mosaic {
    grid-auto-rows: 140px;
  }
}

/* --- Contact / footer --- */

.contact {
  padding-block: var(--space-6) var(--space-4);
}

.eyebrow-vermilion {
  color: var(--vermilion);
}

.contact-title {
  margin-block: var(--space-2) var(--space-3);
}

.contact-email {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-word;
  transition: color 0.3s;
}

.contact-email:hover {
  color: var(--amber);
}

.contact-rows {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-item .label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.contact-item a:hover {
  color: var(--amber);
}

.copyleft {
  display: inline-block;
  transform: scaleX(-1); /* mirrored © = copyleft */
}

.footer-line {
  margin-top: var(--space-5);
  padding-block: var(--space-3);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}
