/* ============================================================
   STUDIO ESEM · VIDEOS
   Shared styles for index gallery + watch pages.
   Brand tokens lifted from BrandGuidelines.pdf, matching the
   gould-birds talk template so siblings feel like one family.
   ============================================================ */

:root {
  /* ESEM brand palette */
  --chartreuse:   #D7DF23;
  --ultraviolet:  #8C39D8;
  --tangerine:    #FFAA00;
  --teal:         #00A69B;
  --silver:       #BEBEBE;
  --black:        #000000;
  --white:        #FFFFFF;

  /* Working tokens */
  --ink:          #0A0A0A;
  --ink-soft:     #2A2A2A;
  --ink-faint:    #6A6A6A;
  --paper:        #FFFFFF;
  --paper-soft:   #F5F5F3;

  /* Type */
  --font-display:   'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-condensed: 'Archivo Narrow', 'Helvetica Neue', sans-serif;
  --font-mono:      'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gutter:       clamp(1.5rem, 4vw, 4rem);
  --content-max:  1600px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(16px, 1.1vw, 18px);
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.0;
  margin: 0;
}
p { margin: 0 0 0.8em; }

/* ============================================================
   PERSISTENT MARK · top-right Studio ESEM logo on every page
   ============================================================ */
.site-mark {
  position: fixed;
  top: var(--gutter);
  right: var(--gutter);
  width: 90px;
  aspect-ratio: 568.82 / 200;
  background-image: url('../logos/StudioEsem_Logo_2024_Stacked_BlackColour.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top right;
  z-index: 50;
}
.theme-dark .site-mark {
  background-image: url('../logos/StudioEsem_Logo_2024_Stacked_WhiteColour.svg');
}

/* ============================================================
   INDEX · gallery layout
   ============================================================ */
.theme-dark { background: var(--ink); color: var(--white); }

.site-head {
  padding: var(--gutter);
  padding-bottom: clamp(2rem, 5vw, 5rem);
  max-width: var(--content-max);
}
.site-head .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 1.5rem;
  display: block;
}
.site-head h1 {
  font-size: clamp(2.4rem, 5.5vw, 5rem);
  font-weight: 400;
  line-height: 1.0;
  margin-bottom: 0.6em;
  max-width: 22ch;
}
.site-head h1 em {
  font-style: italic;
  color: var(--chartreuse);
  font-weight: 300;
}
.site-head .lede {
  font-size: clamp(1.05rem, 1.4vw, 1.4rem);
  line-height: 1.45;
  max-width: 56ch;
  color: rgba(255,255,255,0.78);
}

.gallery {
  padding: 0 var(--gutter) var(--gutter);
  max-width: var(--content-max);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
}

.card {
  scroll-margin-top: 2rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  background: transparent;
  transition: transform 0.3s ease;
}
.card:hover { transform: translateY(-4px); }
.card:hover .card-poster::after { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--chartreuse); outline-offset: 4px; }

/* Wide cards span 2 grid columns for visual rhythm. Applied to landscape
   entries by default + every 7th square (see build-pages.py). */
.card--wide { grid-column: span 2; }
.card--wide h2 {
  font-size: clamp(1.4rem, 1.9vw, 1.9rem);
  max-width: 28ch;
}
@media (max-width: 720px) {
  .card--wide { grid-column: span 1; }
}

.card-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  overflow: hidden;
  margin-bottom: 1.2rem;
}
.card-poster.square   { aspect-ratio: 1 / 1; }
.card-poster.portrait { aspect-ratio: 9 / 16; }
.card-poster img,
.card-poster video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(1.4) contrast(1.05);
}
/* Cards become live previews on scroll: video replaces img and plays
   muted/looped while in viewport. The video is non-interactive (no
   controls, no pointer-events) so clicks fall through to the wrapping
   anchor and navigate to the watch page. */
.card-poster video {
  pointer-events: none;
}
.card-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(215,223,35,0.15), transparent 60%),
    linear-gradient(transparent 60%, rgba(0,0,0,0.4));
  opacity: 0.6;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.card-poster .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  pointer-events: none;
}
.card-poster .play::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent currentColor;
  margin-right: 0.6em;
}
.card-poster .duration {
  position: absolute;
  bottom: 0.8rem;
  right: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  background: rgba(0,0,0,0.65);
  color: var(--white);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 0.6rem;
}
.card-meta .dot { margin: 0 0.5em; opacity: 0.4; }
.card h2 {
  font-size: clamp(1.2rem, 1.6vw, 1.6rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.5em;
  max-width: 22ch;
}
.card .blurb {
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255,255,255,0.65);
  max-width: 38ch;
}

/* ============================================================
   WATCH PAGE · single video, full focus
   ============================================================ */
.watch {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.watch-head {
  padding: var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.back-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 0.2s ease;
}
.back-link:hover { color: var(--chartreuse); }
.back-link::before { content: '← '; }

.watch-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--gutter);
  position: relative;
}
.video-frame {
  position: relative;
  width: 100%;
  max-width: 1600px;
  aspect-ratio: 16 / 9;
  background: var(--black);
  overflow: hidden;
}
.video-frame.square {
  aspect-ratio: 1 / 1;
  max-width: min(90vh, 900px);
  margin: 0 auto;
}
.video-frame.portrait {
  aspect-ratio: 9 / 16;
  max-width: min(60vh, 540px);
  margin: 0 auto;
}
.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--black);
}

/* The supered overlay: Title / Project / Credit / Year.
   Visible at start of playback and on pause; fades during play. */
.super {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: auto;
  max-width: 60%;
  color: var(--white);
  pointer-events: none;
  z-index: 5;
  opacity: 1;
  transition: opacity 0.6s ease;
  text-shadow: 0 1px 16px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.7);
}
.video-frame.playing .super { opacity: 0; }
.video-frame.playing:hover .super,
.video-frame.paused .super { opacity: 1; }

.super .title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.05;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.super .meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-wrap: wrap;
  gap: 0 1em;
}
.super .meta .dot {
  opacity: 0.5;
}

.watch-foot {
  padding: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}
.watch-foot .description {
  max-width: 60ch;
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.78);
}
.watch-foot .credits {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  text-align: right;
  line-height: 1.6;
}
.watch-foot .credits a { color: var(--chartreuse); text-decoration: none; }
.watch-foot .credits a:hover { text-decoration: underline; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .site-mark { width: 64px; }
  .super { left: 1rem; bottom: 1rem; max-width: 80%; }
  .super .title { font-size: 1.2rem; }
}
