/* Shaun Libman — motion-first portfolio.
   Colour and typeface values come from content/theme.json. The visual system
   has two type sizes, one face, and no decorative effects competing with the
   work. */

:root {
  --fs: var(--body-size);
  --fs-feature: clamp(18px, 1.75vw, 24px);
  --gutter: clamp(14px, 1.7vw, 28px);
  --header-h: 64px;
  --page-max: 1600px;
  --radius: 2px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--ground);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: var(--body-weight);
  font-size: var(--fs);
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, iframe { display: block; max-width: 100%; }
button, input, textarea { font: inherit; }
/* Lowercasing what a visitor is actively typing would visually rewrite their
   own name or email as they type it — leave form fields at their real case. */
input, textarea { text-transform: none; }
h1, h2, h3 { font-size: var(--fs); }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Background-image pages -------------------------------------------------- */

body.has-bg { background: transparent; }
.page-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--ground); }
.page-bg picture { display: contents; }
.page-bg img { width: 100%; height: 100%; object-fit: cover; }
.page-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.1) 48%, rgba(0,0,0,.72));
}
body[data-page="bio"] .page-bg::after,
body[data-page="contact"] .page-bg::after {
  background: linear-gradient(90deg, rgba(0,0,0,.78), rgba(0,0,0,.42) 60%, rgba(0,0,0,.2));
}
.ink-dark, .ink-light { color: inherit; text-shadow: none; }

/* Intro video overlay ------------------------------------------------------ */
/* Sits on top of the whole page (the header included) while it plays once,
   then site.js adds .is-hidden on "ended" and this fades to reveal the page
   underneath, which was already there and already interactive. */
.intro-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ground);
  opacity: 1; transition: opacity .9s ease;
}
.intro-overlay video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* When iOS refuses autoplay (Low Power Mode) WebKit paints a play glyph on
   the element. The overlay is decorative and about to fade, so that glyph
   is never something a visitor should see or tap. */
.intro-overlay video::-webkit-media-controls,
.intro-overlay video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.intro-overlay.is-hidden { opacity: 0; pointer-events: none; }

/* Masthead ---------------------------------------------------------------- */

.masthead {
  position: sticky; top: 0; z-index: 30;
  min-height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: 100%; padding: 12px var(--gutter);
}

.wordmark {
  font-family: var(--font-display); font-weight: var(--display-weight);
  letter-spacing: .01em; text-decoration: none; white-space: nowrap;
}

.masthead nav { display: flex; align-items: center; gap: 20px; }
.nav-toggle,
.embed-play,
.player-play {
  appearance: none;
  border: 1px solid var(--rule); border-radius: 999px;
  background: color-mix(in srgb, var(--ground) 72%, transparent);
  color: var(--ink); text-decoration: none;
  padding: 7px 11px 8px; line-height: 1;
  cursor: pointer;
}
.nav-toggle:hover,
.embed-cover:hover .embed-play,
.player-play:hover {
  color: var(--ground); background: var(--ink); border-color: var(--ink);
}

/* Same treatment as the footer's social links: plain text, a thin rule
   underneath rather than a pill — just enough to read as a link. */
.masthead nav a,
.cta {
  display: inline-block; padding-bottom: 2px;
  border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none;
}
.masthead nav a:hover,
.masthead nav a[aria-current="page"],
.cta:hover {
  border-bottom-color: var(--ink); color: var(--ink);
}

.nav-toggle { display: none; width: 38px; height: 38px; padding: 0; position: relative; }
.nav-scrim { display: none; }
.nav-toggle span {
  position: absolute; left: 11px; width: 14px; height: 1px;
  background: currentColor; transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle span:nth-child(1) { transform: translateY(-4px); }
.nav-toggle span:nth-child(3) { transform: translateY(4px); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg); }

@media (max-width: 720px) {
  body.nav-open { overflow: hidden; }
  .nav-toggle { display: block; z-index: 32; }
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 30;
    width: 100%; height: 100%; padding: 0; border: 0;
    background: rgba(0,0,0,.58); cursor: pointer;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .32s ease, visibility 0s linear .4s;
  }
  body.nav-open .nav-scrim {
    opacity: 1; visibility: visible; pointer-events: auto;
    transition-delay: 0s;
  }
  .masthead nav {
    display: flex; position: fixed; inset: 0 0 0 auto; z-index: 31;
    width: min(88vw, 420px); height: 100dvh;
    padding: calc(var(--header-h) + 40px) var(--gutter) 36px;
    background: var(--ground);
    flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 8px;
    box-shadow: -24px 0 64px rgba(0,0,0,.28);
    transform: translateX(100%); visibility: hidden;
    transition: transform .42s cubic-bezier(.22,1,.36,1), visibility 0s linear .42s;
    will-change: transform;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .masthead nav.is-open {
    transform: translateX(0); visibility: visible;
    transition-delay: 0s;
  }
  .masthead nav a {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 54px; padding: 12px 0;
    border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
    background: transparent; font-size: var(--fs-feature);
    opacity: 0; transform: translateX(18px);
    transition: opacity .24s ease, transform .38s cubic-bezier(.22,1,.36,1);
  }
  .masthead nav.is-open a { opacity: 1; transform: translateX(0); }
  .masthead nav.is-open a:nth-child(1) { transition-delay: .08s; }
  .masthead nav.is-open a:nth-child(2) { transition-delay: .12s; }
  .masthead nav.is-open a:nth-child(3) { transition-delay: .16s; }
  .masthead nav.is-open a:nth-child(4) { transition-delay: .2s; }
  .masthead nav a::after { content: "→"; color: var(--muted); }
  .masthead nav a:hover, .masthead nav a[aria-current="page"] {
    color: var(--ink); background: transparent; border-color: var(--ink);
  }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  .nav-scrim, .masthead nav, .masthead nav a, .nav-toggle span {
    transition-duration: 0s;
  }
}

/* Page rhythm and the two-size type system ------------------------------- */

main { display: block; flex: 1 0 auto; }
.band {
  width: min(calc(100% - 2 * var(--gutter)), var(--page-max));
  margin: 0 auto; padding: clamp(64px, 8vw, 120px) 0;
}
.band + .band { border-top: 1px solid var(--rule); }
.band-wide { width: min(calc(100% - 2 * var(--gutter)), var(--page-max)); }

.display, .heading, .lede, .contact-email > a { font-size: var(--fs-feature); }
.display, .heading {
  margin: 0; font-family: var(--font-display); font-weight: var(--display-weight);
  line-height: 1.15; letter-spacing: 0; text-wrap: balance;
}
.display { max-width: 22ch; margin-bottom: clamp(36px, 5vw, 72px); }
.heading { margin: clamp(42px, 6vw, 84px) 0 20px; }
.display + .heading { margin-top: 0; }
.heading.small { margin-top: 22px; }
.heading.look-text { font-family: var(--font-body); }
.heading a { text-decoration: none; }
.heading a:hover { text-decoration: underline; }

.eyebrow { margin: 0 0 14px; color: var(--muted); letter-spacing: .08em; }
.lede { max-width: 40ch; margin: 0 0 28px; line-height: 1.35; text-wrap: balance; }
.lede.look-display { font-family: var(--font-display); font-weight: var(--display-weight); }
.prose { max-width: var(--measure); margin: 0; color: color-mix(in srgb, var(--ink) 86%, transparent); }
.prose p { margin: 0 0 1.2em; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }

.cta { display: inline-block; margin-top: 8px; }
.more { display: inline-block; text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.more:hover { border-bottom-color: var(--ink); }

/* Home -------------------------------------------------------------------- */

body[data-page="home"] { min-height: 100svh; }
body[data-page="home"] main { display: flex; flex: 1 0 auto; align-items: flex-end; }
body[data-page="home"] #index-main {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px;
  width: 100%; max-width: none; margin: 0;
  padding: clamp(160px, 28vh, 340px) var(--gutter) 34px;
}
body[data-page="home"] #index-main .display { grid-column: 1 / span 7; align-self: end; margin: 0; }
body[data-page="home"] #index-main .lede { grid-column: 9 / -1; align-self: end; margin: 0; }
body[data-page="home"] #index-main .cta { grid-column: 9 / -1; justify-self: start; }

@media (max-width: 720px) {
  body[data-page="home"] #index-main { grid-template-columns: 1fr; gap: 18px; padding-bottom: 24px; }
  body[data-page="home"] #index-main .display,
  body[data-page="home"] #index-main .lede,
  body[data-page="home"] #index-main .cta { grid-column: 1; }
}

/* Reel and external video facades ---------------------------------------- */

.embed { margin: 0 0 clamp(64px, 9vw, 128px); }
.band .embed { max-width: none; }
.embed iframe, .embed > video, .embed-frame iframe, .embed-frame video { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; background: #000; }
.embed-empty { display: none; }
.embed-facade { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.embed-cover {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0;
  border: 0; background: #000; color: var(--ink); cursor: pointer; overflow: hidden;
}
.embed-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.embed-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 48%, rgba(0,0,0,.6)); }
.embed-play { position: absolute; left: 18px; bottom: 18px; z-index: 1; }
.embed-cover:hover img { transform: scale(1.01); opacity: .9; }
.embed-frame { position: absolute; inset: 0; }
.embed-frame iframe, .embed-frame video { height: 100%; }
.embed-facade.is-playing .embed-cover { display: none; }

/* Project channels -------------------------------------------------------- */

.channel { margin: 0; }
.channel-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  margin-bottom: 16px; padding-top: 14px; border-top: 1px solid var(--rule);
}
.channel-head h2 { margin: 0; font: inherit; font-weight: 500; }
.channel-head > span { color: var(--muted); }

.player { position: relative; background: #000; aspect-ratio: 16 / 9; overflow: hidden; }
.player-cover, .player-cover img { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-cover img { object-fit: cover; }
.player-overlay {
  position: absolute; inset: 0; z-index: 1; display: flex;
  align-items: flex-end; justify-content: flex-start; padding: 18px;
  background: linear-gradient(180deg, transparent 58%, rgba(0,0,0,.45));
}
.player-play { padding-inline: 13px; }
.player-play[disabled] { opacity: .45; cursor: default; }
.player-frame { position: absolute; inset: 0; z-index: 2; }
.player-frame iframe, .player-frame video { width: 100%; height: 100%; border: 0; background: #000; }
.player.is-playing .player-overlay, .player.is-playing .player-cover { display: none; }
.player-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  min-height: 42px; margin: 0; padding: 10px 0 12px; border-bottom: 1px solid var(--rule);
}
.player-meta [data-player-duration] { color: var(--muted); font-variant-numeric: tabular-nums; }

.thumbs {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 12px;
}
.thumbs li, .thumb, .thumb-info, .thumb-title { min-width: 0; }
.thumb { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.thumb-media { display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #111; }
.thumb-media img, .thumb-media video { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .25s; }
.thumb-media video { pointer-events: none; }
.thumb:hover .thumb-media img, .thumb:hover .thumb-media video { transform: scale(1.015); opacity: .88; }
.thumb.is-current .thumb-media::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--ink); }
.thumb-blank { display: block; width: 100%; height: 100%; background: color-mix(in srgb, var(--ground) 78%, var(--ink)); }
.thumb-info { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 8px; }
.thumb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-duration { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.channel-compact .player { max-width: none; margin: 0; aspect-ratio: 16 / 9; }
.channel-compact .thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 12px; margin-top: 14px; }
.channel-compact .thumbs li { width: auto; }

@media (min-width: 1400px) {
  .thumbs, .channel-compact .thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .thumbs, .channel-compact .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .thumbs, .channel-compact .thumbs { grid-template-columns: 1fr; row-gap: 28px; }
}

/* Directing stills -------------------------------------------------------- */

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 clamp(64px, 8vw, 112px); }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; cursor: zoom-in; }
.gallery figcaption { margin-top: 8px; color: var(--muted); }
.gallery.is-slideshow { display: block; }
.gallery.is-slideshow .gallery-item { display: none; }
.gallery-stage { position: relative; margin: 0; background: #000; }
.gallery-stage img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.gallery-arrow { position: absolute; top: 0; bottom: 0; width: 25%; padding: 0; border: 0; color: transparent; background: transparent; cursor: pointer; }
.gallery-arrow:focus-visible { color: var(--ink); }
.gallery-prev { left: 0; cursor: w-resize; }
.gallery-next { right: 0; cursor: e-resize; }
.gallery-strip { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 0; padding: 0; }
.gallery-strip button { width: 100%; padding: 0; border: 0; background: #000; cursor: pointer; opacity: .48; }
.gallery-strip button img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.gallery-strip button:hover, .gallery-strip button.is-current { opacity: 1; }

/* Image and content pages ------------------------------------------------- */

.image { margin: 0 0 32px; }
.image img { width: 100%; height: auto; }
.image figcaption { margin-top: 8px; color: var(--muted); }

body[data-page="bio"] main,
body[data-page="contact"] main { display: flex; align-items: center; }
body[data-page="bio"] .band,
body[data-page="contact"] .band {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px;
  padding-top: clamp(80px, 12vw, 180px); padding-bottom: clamp(80px, 12vw, 180px);
}
body[data-page="bio"] .display,
body[data-page="contact"] .display { grid-column: 1 / span 3; margin: 0; }
body[data-page="bio"] .prose { grid-column: 5 / span 5; }
body[data-page="contact"] .contact-email,
body[data-page="contact"] .social,
body[data-page="contact"] .lede { grid-column: 5 / span 6; }
body[data-page="contact"] .contact-email { margin-bottom: 30px; }

.contact-email a { text-decoration: none; }
.contact-email a:hover { text-decoration: underline; }
.contact-email .heading, .social .heading { margin: 0 0 8px; font-size: var(--fs); color: var(--muted); }
.social { margin: 0; }
.social-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.social-links a {
  display: inline-block; padding-bottom: 2px;
  border-bottom: 1px solid var(--rule); text-decoration: none;
}
.social-links a:hover { border-bottom-color: var(--ink); color: var(--ink); }

@media (max-width: 760px) {
  body[data-page="bio"] .band,
  body[data-page="contact"] .band { grid-template-columns: 1fr; gap: 34px; }
  body[data-page="bio"] .display,
  body[data-page="contact"] .display,
  body[data-page="bio"] .prose,
  body[data-page="contact"] .contact-email,
  body[data-page="contact"] .social,
  body[data-page="contact"] .lede { grid-column: 1; }
}

/* Form -------------------------------------------------------------------- */

.contact-form { grid-column: 5 / span 6; max-width: 560px; text-align: left; }
.contact-form .field { margin: 0 0 14px; }
.contact-form label { display: block; margin: 0 0 6px; color: var(--muted); }
.contact-form input, .contact-form textarea { width: 100%; padding: 12px 13px; color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: var(--radius); }
.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form button { padding: 8px 12px; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: var(--ground); cursor: pointer; }
.contact-form button[disabled] { opacity: .5; }
.form-status { min-height: 1.4em; margin: 10px 0 0; }

/* Footer ------------------------------------------------------------------ */

footer {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px 28px;
  width: 100%; padding: 18px var(--gutter) 22px;
  color: var(--muted);
}
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }
footer .social-links { justify-content: flex-end; }

@media (max-width: 620px) {
  footer { grid-template-columns: 1fr auto; }
  footer .footer-links { grid-column: 1 / -1; grid-row: 2; }
}

/* Lightbox ---------------------------------------------------------------- */

.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center;
  padding: var(--gutter); background: color-mix(in srgb, var(--ground) 96%, transparent);
}
.lightbox[hidden] { display: none; }
.lb-stage { margin: 0; display: grid; place-items: center; max-height: 90vh; }
.lb-stage img { max-width: 100%; max-height: 84vh; object-fit: contain; }
.lb-stage figcaption { margin-top: 8px; color: var(--muted); }
.lb-close, .lb-nav { border: 0; background: transparent; color: var(--ink); cursor: pointer; padding: 12px; }
.lb-close { position: absolute; top: var(--gutter); right: var(--gutter); }
.lb-prev { grid-column: 1; }
.lb-stage { grid-column: 2; }
.lb-next { grid-column: 3; }
.lb-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .intro-overlay { display: none; }
}
