/* ==========================================================================
   BRAND TOKENS  —  ⚠️  EDIT THIS BLOCK ONLY TO REBRAND THE WHOLE SITE
   Replace the hex values to recolour the site. Nothing else needs to
   change: every component below references these variables.
   Current palette: white background, black text and buttons.
   ========================================================================== */
:root {
  /* --- Core brand ------------------------------------------------------ */
  --color-bg:              #FFFFFF;  /* page background (white)             */
  --color-surface:         #F4F4F6;  /* cards, panels, placeholders         */
  --color-surface-raised:  #EAEAEE;  /* hover / elevated cards              */
  --color-fg:              #0B0C10;  /* primary text — 19.6:1 on white      */
  --color-fg-muted:        #52525B;  /* secondary text — 7.7:1 on white     */
  --color-border:          #D9DAE0;

  /* Brand colour: black. `accent` is for text, lines and focus rings;
     `accent-fill` is the solid button background. Kept as two tokens so a
     future colour that's too light for text can still be used as a fill. */
  --color-accent:          #000000;  /* text/links/focus — 21:1 on white    */
  --color-accent-hover:    #3F3F46;
  --color-accent-fill:     #000000;  /* button & skip-link background       */
  --color-accent-fill-hover: #27272A;
  --color-on-accent:       #FFFFFF;  /* text ON the fill — 21:1 contrast    */

  /* --- Typography ------------------------------------------------------ */
  --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;

  /* --- Spacing scale (density 3/10 — spacious, for galleries) ---------- */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;
  --space-2xl: 6rem;
  --space-3xl: 9rem;

  /* --- Motion (respects prefers-reduced-motion below) ------------------ */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:  180ms;
  --dur-base:  260ms;
  --dur-slow:  420ms;

  --radius:    2px;   /* editorial/cinematic = near-square corners */
  --maxw:      1280px;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-size: 1rem;            /* 16px base — never smaller for body */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;         /* guard against accidental h-scroll */
}

img, picture, video, canvas, iframe { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;         /* avoids orphan heading lines */
}

h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); }

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

/* Visible focus for keyboard users — never remove this. */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* Screen-reader-only utility */
.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;
}

/* Skip link — first tab stop on every page */
.skip-link {
  position: absolute; top: -100%; left: var(--space-sm);
  z-index: 200;
  background: var(--color-accent-fill); color: var(--color-on-accent);
  padding: var(--space-sm) var(--space-md);
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: var(--space-sm); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

/* ==========================================================================
   HEADER / NAV
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-md);
  min-height: 68px;
}

/* Wordmark — replace with your logo <img> when you send it */
.brand {
  display: inline-flex; align-items: center;
  min-height: 44px;                        /* 44px touch target */
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand .brand-mark { color: var(--color-accent); }
.brand img { height: 34px; width: auto; }

.nav-links { display: flex; align-items: center; gap: var(--space-xs); list-style: none; padding: 0; }

.nav-links a {
  display: inline-flex; align-items: center;
  min-height: 44px;                        /* 44px touch target */
  padding: 0 var(--space-sm);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
  transition: color var(--dur-fast) var(--ease);
  position: relative;
}
.nav-links a:hover { color: var(--color-fg); }
.nav-links a[aria-current="page"] { color: var(--color-accent); }
.nav-links a[aria-current="page"]::after {
  content: ""; position: absolute; left: var(--space-sm); right: var(--space-sm);
  bottom: 12px; height: 1px; background: var(--color-accent);
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;               /* 44px touch target */
  align-items: center; justify-content: center;
  background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-fg); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.nav-toggle:hover { border-color: var(--color-accent); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; inset: 68px 0 auto 0;
    flex-direction: column; align-items: stretch;
    gap: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-sm) var(--space-md) var(--space-lg);
    transform: translateY(-8px);
    opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity var(--dur-base) var(--ease),
                transform var(--dur-base) var(--ease),
                visibility var(--dur-base);
  }
  .nav-links[data-open="true"] {
    opacity: 1; pointer-events: auto; visibility: visible;
    transform: translateY(0);
  }
  .nav-links a { min-height: 52px; font-size: 0.95rem; padding-inline: 0; }
  .nav-links a[aria-current="page"]::after { left: 0; right: auto; width: 22px; bottom: 14px; }
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 48px;
  padding: 0 var(--space-lg);
  font-family: var(--font-display);
  font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.btn-primary { background: var(--color-accent-fill); color: var(--color-on-accent); }
.btn-primary:hover { background: var(--color-accent-fill-hover); transform: translateY(-2px); }

.btn-ghost { border-color: var(--color-border); color: var(--color-fg); background: transparent; }
.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ==========================================================================
   SECTION PRIMITIVES
   ========================================================================== */
.section { padding-block: var(--space-2xl); }
.section-tight { padding-block: var(--space-xl); }

.section-head { margin-bottom: var(--space-xl); max-width: 62ch; }

.eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--color-fg-muted); max-width: 62ch; }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  min-height: clamp(520px, 88vh, 900px);
  display: flex; align-items: flex-end;
  padding-block: var(--space-2xl);
  overflow: hidden;
  border-bottom: 1px solid var(--color-border);
}

/* Placeholder backdrop — swap for your showreel poster frame / video */
.hero-media {
  position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 85%);
}
.hero-media::after {           /* subtle film grain, pure CSS */
  content: ""; position: absolute; inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hero-inner { position: relative; z-index: 2; width: 100%; }
.hero h1 { max-width: 16ch; margin-bottom: var(--space-md); }
.hero .lede { margin-bottom: var(--space-lg); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

/* --- Video hero (home page) ------------------------------------------------
   The showreel loops behind the text under a dark overlay, so everything in
   the hero switches to white. Scoped to .hero-dark so the rest of the site
   keeps its black-on-white look. */
.hero-dark { border-bottom: 0; }
.hero-dark .hero-media { background: #000; }
.hero-dark .hero-media::after { display: none; }   /* no grain over footage */

.hero-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;          /* fill the hero at any screen shape */
}

/* A flat tint plus extra darkness at the bottom, where the text sits. Worst
   case (a pure-white video frame) still leaves white text above 7:1. */
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 60%),
    rgba(0,0,0,0.5);
}

.hero-dark h1,
.hero-dark .eyebrow { color: #FFFFFF; }
.hero-dark .lede { color: rgba(255,255,255,0.86); }

.hero-dark .btn-primary { background: #FFFFFF; color: #000000; }
.hero-dark .btn-primary:hover { background: #E4E4E7; }
.hero-dark .btn-ghost { border-color: rgba(255,255,255,0.6); color: #FFFFFF; }
.hero-dark .btn-ghost:hover { border-color: #FFFFFF; color: #FFFFFF; background: rgba(255,255,255,0.08); }
.hero-dark :focus-visible { outline-color: #FFFFFF; }

.hero-pause {
  position: absolute; z-index: 3;
  right: var(--space-md); bottom: var(--space-md);
  width: 44px; height: 44px;                 /* 44px touch target */
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35);
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.hero-pause:hover { background: rgba(0,0,0,0.6); border-color: #FFFFFF; }
.hero-pause[hidden] { display: none; }
.hero-pause .icon-play { display: none; }
.hero-pause.is-paused .icon-play { display: block; }
.hero-pause.is-paused .icon-pause { display: none; }

/* ==========================================================================
   VIDEO EMBEDS
   Space is reserved before the iframe loads, so nothing jumps (no CLS).
   ========================================================================== */
.embed {
  position: relative;
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* YouTube / Vimeo */
.embed-wide { aspect-ratio: 16 / 9; }

/* Instagram's embed page wraps the media in fixed-height chrome (account
   header above; like bar, caption link and comment box below). Padding is a
   percentage of WIDTH, so this is "4:5 media + fixed chrome". */
.embed-instagram { height: 0; padding-bottom: calc(125% + 206px); background: var(--color-bg); }

/* Instagram cropped to just its video (set with an "aspect" in config.py).
   The box has the video's shape; the iframe inside is pulled up by the 54px
   Instagram header and made taller than the box, so the header sits above
   the box and the like/comment bar below it, both clipped by overflow. */
.embed-crop { background: #000; }
.embed-crop iframe {
  top: -54px; bottom: auto;
  height: calc(100% + 54px + 280px);
}

/* A project with no video link yet: a short bar, not a full-height tile. */
.embed-compact { height: 0; padding-bottom: 0; aspect-ratio: auto; min-height: 140px; }
.embed-compact .media-placeholder { position: absolute; }

/* Placeholder shown for any slot still waiting on a link */
.media-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-fg-muted);
  font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
  text-align: center; padding: var(--space-sm);
}

/* Portrait image frame (About page) */
.work-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.work-card-media img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   PROJECTS  —  title, then a row of videos, then client + credits
   ========================================================================== */
.project-list { display: grid; gap: var(--space-2xl); }

.project {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-lg);
}

.project-title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  margin-bottom: var(--space-md);
}

.badge {
  font-family: var(--font-body);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid var(--color-fg);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.video-row { display: grid; gap: var(--space-md); }
.video-row.cols-1 { grid-template-columns: 1fr; }
.video-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.video-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.video-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Vertical videos stretched full-width would be taller than the screen, so
   rows of them are capped to a comfortable width per video. */
.video-row.is-portrait.cols-1 { max-width: 420px; }
.video-row.is-portrait.cols-2 { max-width: 860px; }
.video-row.is-wide.cols-1     { max-width: 1000px; }

@media (max-width: 1000px) {
  .video-row.cols-3, .video-row.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
/* Vertical YouTube/Vimeo videos sharing a row with Instagram posts are
   sized to match the Instagram *video area*, not its whole white frame.
   Instagram's embed is: a 54px header, then the video in a 4:5 box
   (height = 1.25 x width), then the like/comment bar. So each Short is
   nudged down 54px to line up with that box, and drawn as a true 9:16 frame
   of the same height (1.25 x 9/16 = 70.3% of the column), centred, with no
   black bars. */
.video-row.has-instagram .embed-vertical {
  margin-top: 54px;
  width: calc(100% * 1.25 * 9 / 16);
  justify-self: center;
  align-self: start;
}

@media (max-width: 640px) {
  .video-row.cols-2, .video-row.cols-3, .video-row.cols-4 { grid-template-columns: 1fr; }
  .video-row.is-portrait { max-width: 420px; }
  /* Stacked one per line there's nothing to line up with, so Shorts go
     back to full width. */
  .video-row.has-instagram .embed-vertical { margin-top: 0; width: 100%; }
}

.project-credits {
  display: grid; gap: 0.5rem;
  margin-top: var(--space-md);
  font-size: 0.95rem;
}
.project-credits > div {
  display: grid;
  grid-template-columns: minmax(8rem, 13rem) 1fr;
  gap: var(--space-sm);
}
.project-credits dt {
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-fg-muted);
  padding-top: 0.2rem;
}
.project-credits dd { margin: 0; }
.project-credits a {
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease);
}
.project-credits a:hover { text-decoration-color: var(--color-fg); }
@media (max-width: 640px) {
  .project-credits > div { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* ==========================================================================
   FORM
   ========================================================================== */
.form-grid { display: grid; gap: var(--space-md); max-width: 680px; }
@media (min-width: 640px) { .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); } }

.field label {                    /* visible labels, never placeholder-only */
  display: block;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-fg);
  margin-bottom: var(--space-xs);
}
.field .hint { display: block; font-size: 0.85rem; color: var(--color-fg-muted); margin-top: 6px; font-weight: 400; letter-spacing: 0; text-transform: none; }

.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem var(--space-sm);
  background: var(--color-surface);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem;
  transition: border-color var(--dur-fast) var(--ease);
}
.field textarea { min-height: 150px; resize: vertical; padding-top: var(--space-sm); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-fg-muted); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-accent); }

.required-mark { color: var(--color-accent); }

/* "(optional)" next to a label — quieter than the label itself */
.hint-inline {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-fg-muted);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-xl) var(--space-lg);
  margin-top: var(--space-2xl);
}
.footer-top {
  display: flex; flex-wrap: wrap; gap: var(--space-lg);
  justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--space-xl);
}
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-md); list-style: none; padding: 0; }
.footer-nav a {
  font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-fg-muted);
  display: inline-flex; align-items: center; min-height: 44px;
  transition: color var(--dur-fast) var(--ease);
}
.footer-nav a:hover { color: var(--color-accent); }

.social-row { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.social-row a {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  min-height: 44px; padding: 0 1rem;          /* 44px touch target */
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-fg-muted);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.social-row a:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* Standalone email links — sized as real targets, not inline prose links. */
.email-link {
  display: inline-flex; align-items: center;
  min-height: 44px;                        /* 44px touch target */
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.email-link:hover { color: var(--color-accent-hover); }

.footer-legal {
  display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: space-between;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  font-size: 0.82rem; color: var(--color-fg-muted);
}

/* ==========================================================================
   SCROLL REVEAL  (progressive enhancement — content is visible without JS)
   ========================================================================== */
.reveal { opacity: 1; }
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}

/* ==========================================================================
   REDUCED MOTION  —  honour the user's OS setting
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }   /* render final state immediately */
  .btn-primary:hover { transform: none; }
}
