*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  /* Dotted paper: one dot every --grid-size */
  background-image: radial-gradient(circle at center, var(--grid) 1.3px, transparent 1.6px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: calc(var(--grid-size) / -2) calc(var(--grid-size) / -2);
  color: var(--text);
  font: 400 var(--step-0)/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
p, li { text-wrap: pretty; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Cross-fade between pages in browsers that support it */
@view-transition { navigation: auto; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--muted); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  background: var(--accent); color: var(--accent-text); border: var(--border) solid var(--line);
  padding: .6rem 1rem; font-weight: 700;
}
.skip:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding-inline: var(--gutter); }

/* Header: badge + name, nav, then a heavy rule */
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem 2rem; padding-block: 1.75rem 1.25rem;
  border-bottom: var(--border) solid var(--line);
  background-clip: content-box;
}
.site-header .wrap { border-bottom: 0; position: relative; }
.site-header .wrap::after {
  content: ""; position: absolute; left: var(--gutter); right: var(--gutter); bottom: 0;
  border-bottom: var(--border) solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .9rem; text-decoration: none; }
.brand:hover { color: inherit; }
.badge {
  flex: none; width: 2.75rem; height: 2.75rem; display: grid; place-items: center;
  background: var(--accent); border: var(--border) solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
}
.badge i {
  display: block; width: 76%; aspect-ratio: 1200 / 760; background: var(--accent-text);
  -webkit-mask: url(../assets/logo-initials.png) center / contain no-repeat;
          mask: url(../assets/logo-initials.png) center / contain no-repeat;
}
.brand-name { font: 800 clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem)/1 var(--font-display); letter-spacing: -.02em; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; }
.nav a { font-weight: 700; text-decoration: none; padding: .6rem .1rem; }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: .4em; text-decoration-color: var(--accent); }

/* Hero */
.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) var(--section); }
.eyebrow {
  margin: 0 0 1.25rem;
  font: 700 var(--step--1)/1.4 var(--font-mono);
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.hero h1, .page-title {
  margin: 0; max-width: 15ch;
  font: 800 var(--step-hero)/.98 var(--font-display);
  letter-spacing: -.035em; text-wrap: balance;
}
.lede {
  margin: 1.75rem 0 0; max-width: 34rem;
  font: 400 var(--step-lede)/1.5 var(--font-display); color: var(--muted);
}
.actions { display: flex; flex-wrap: wrap; gap: 1.25rem 1.5rem; margin-top: 2.75rem; }
.btn {
  display: inline-flex; align-items: center; min-height: 3.5rem; padding: 0 1.6rem;
  background: var(--accent); color: var(--accent-text);
  border: var(--border) solid var(--line); box-shadow: var(--offset) var(--offset) 0 var(--shadow);
  font: 700 var(--step-1)/1 var(--font-body); text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { color: var(--accent-text); transform: translate(-2px, -2px); box-shadow: calc(var(--offset) + 2px) calc(var(--offset) + 2px) 0 var(--shadow); }
.btn:active { transform: translate(var(--offset), var(--offset)); box-shadow: 0 0 0 var(--shadow); }
.btn.ghost { background: var(--surface); color: var(--text); }
.btn.ghost:hover { color: var(--text); }
.note { margin: 1.75rem 0 0; max-width: 36rem; color: var(--muted); }

/* Sections */
.section { padding-block: var(--section); }
/* Back-to-back sections share one gap instead of stacking two */
.section + .section, .section + .contact { padding-top: 0; }
.page-hero { padding-bottom: 2.5rem; }
.page-hero + .section { padding-top: 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: .5rem 1rem; margin-bottom: 2.25rem; padding-bottom: 1rem;
  border-bottom: var(--border) solid var(--line);
}
.section-head h2 { margin: 0; font: 800 var(--step-2)/1.1 var(--font-display); letter-spacing: -.02em; }
.section-head a { font-weight: 700; }

/* Boxed cards: the Overflow feature blocks */
.box {
  background: var(--surface); border: var(--border) solid var(--line);
  box-shadow: var(--offset) var(--offset) 0 var(--shadow);
}
.points {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1.75rem; margin: 0; padding: 0 var(--offset) var(--offset) 0; list-style: none;
}
.points li { padding: clamp(1.5rem, 3vw, 2rem); min-height: 13rem; }
.points h3 { margin: 0 0 .9rem; font: 800 var(--step-2)/1.1 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.points p { margin: 0; color: var(--muted); }

/* Logos wrap as a centred row with equal gaps between their edges. */
.logos {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 2.25rem clamp(1.25rem, 2.5vw, 1.75rem); margin: 0; padding: 0; list-style: none;
}
.logos li {
  height: 4rem; max-width: 100%; display: grid; place-items: center; text-align: center;
  font: 700 var(--step--1)/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.logos a { display: block; line-height: 0; }
.logos img { height: 2.75rem; width: auto; max-height: 100%; max-width: 100%; object-fit: contain; filter: var(--logo-filter); }

/* Closing line + footer, set in mono like Overflow's */
.site-footer .wrap { position: relative; padding-block: 1.75rem 3rem; }
.site-footer .wrap::before {
  content: ""; position: absolute; left: var(--gutter); right: var(--gutter); top: 0;
  border-top: var(--border) solid var(--line);
}
.closing { margin: 0 0 .5rem; color: var(--muted); font: 400 var(--step-0)/1.6 var(--font-mono); }
.foot-links { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin: 0; padding: 0; list-style: none; font: 400 var(--step-0)/1.6 var(--font-mono); }
.foot-links li + li::before { content: "·"; margin-right: .75rem; color: var(--muted); }
.foot-links a { text-decoration-thickness: 2px; text-underline-offset: .25em; }
.contact { padding-block: var(--section); }
.contact h2 { margin: 0; max-width: 18ch; font: 800 var(--step-2)/1.1 var(--font-display); letter-spacing: -.02em; }
.contact .actions { margin-top: 2rem; }
.email { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); margin: 1.5rem 0 0; user-select: all; }

/* Work page controls */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.25rem 2rem; margin-bottom: 1.5rem; }
.filter-groups { display: grid; gap: 1rem; min-width: 0; }
.filter-row { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.filter-label { flex: none; width: 3.5rem; font: 700 var(--step--1)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; padding: 0 4px 4px 0; }
.chip {
  min-height: 2.75rem; padding: 0 1rem; cursor: pointer;
  background: var(--surface); color: var(--text); border: 2px solid var(--line);
  font: 700 var(--step--1)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.chip:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--shadow); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); box-shadow: 4px 4px 0 var(--shadow); transform: none; }
.count { margin: 0 0 1.75rem; font: 400 var(--step--1)/1 var(--font-mono); color: var(--muted); }

/* Film grid */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 2.25rem 1.75rem; margin: 0; padding: 0 var(--offset) var(--offset) 0; list-style: none;
}
.card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none;
  background: var(--surface); border: var(--border) solid var(--line);
  box-shadow: var(--offset) var(--offset) 0 var(--shadow);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
a.card:hover { color: inherit; transform: translate(-3px, -3px); box-shadow: calc(var(--offset) + 3px) calc(var(--offset) + 3px) 0 var(--shadow); }
/* A card with extra links: its title link covers the whole card */
.card:has(.card-link) { position: relative; }
.card:has(.card-link:hover) { transform: translate(-3px, -3px); box-shadow: calc(var(--offset) + 3px) calc(var(--offset) + 3px) 0 var(--shadow); }
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card-extra {
  position: relative; z-index: 1; align-self: flex-start; margin-top: .35rem;
  font: 700 .75rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: inherit;
  text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 2px;
}
.card-extra:hover { color: var(--accent); }
a.card:active { transform: translate(var(--offset), var(--offset)); box-shadow: 0 0 0 var(--shadow); }
.thumb { position: relative; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; background: var(--bg); border-bottom: var(--border) solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Exactly four films: two by two rather than three and a lone card */
@media (min-width: 760px) { .grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Featured with four films: the big one, then three in a row */
@media (min-width: 1000px) { .picks[data-count="4"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.thumb .ph {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center;
  font: 700 var(--step--1)/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.play {
  position: absolute; right: .75rem; bottom: .75rem; width: 2.5rem; height: 2.5rem;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-text);
  border: 2px solid var(--line); box-shadow: 3px 3px 0 var(--shadow);
}
.card-body { display: flex; flex-direction: column; gap: .4rem; padding: 1.1rem 1.25rem 1.3rem; }
.card h3 { margin: 0; font: 800 var(--step-1)/1.2 var(--font-display); letter-spacing: -.015em; }
.meta { color: var(--muted); font-size: var(--step--1); }
.tags { font: 700 .75rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* Featured work: hand-picked films, the first one large */
.picks { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.summary { margin: .25rem 0 0; color: var(--muted); }
@media (min-width: 760px) {
  .picks > li:first-child { grid-column: 1 / -1; }
  .picks > li:first-child .card { display: grid; grid-template-columns: 3fr 2fr; }
  .picks > li:first-child .thumb { border-bottom: 0; border-right: var(--border) solid var(--line); }
  .picks > li:first-child .card-body { justify-content: center; padding: 2rem; }
  .picks > li:first-child h3 { font-size: var(--step-2); }
}

/* Instagram: the five latest posts as small square tiles in one row */
.ig-grid {
  --offset: 5px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(.5rem, 1.5vw, 1rem); margin: 0; padding: 0 var(--offset) var(--offset) 0; list-style: none;
}
.ig-post {
  position: relative; display: block; aspect-ratio: 1; overflow: hidden;
  background: var(--bg); border: 2px solid var(--line);
  box-shadow: var(--offset) var(--offset) 0 var(--shadow);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.ig-post:hover { transform: translate(-2px, -2px); box-shadow: calc(var(--offset) + 2px) calc(var(--offset) + 2px) 0 var(--shadow); }
.ig-post:active { transform: translate(var(--offset), var(--offset)); box-shadow: 0 0 0 var(--shadow); }
.ig-post img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ig-video {
  position: absolute; right: .35rem; bottom: .35rem; width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); border: 2px solid var(--line);
}
.ig-video svg { width: 9px; height: 9px; }
@media (max-width: 640px) { .ig-grid { --offset: 3px; } .ig-video { display: none; } }

/* Lightbox player */
.player {
  width: min(64rem, calc(100vw - 2 * var(--gutter))); max-width: none; max-height: none;
  margin: auto; padding: 0; overflow: visible;
  background: var(--surface); color: var(--text);
  border: var(--border) solid var(--line); box-shadow: var(--offset) var(--offset) 0 var(--accent);
}
.player::backdrop { background: rgba(23, 22, 15, .82); }
.player-bar { display: flex; align-items: center; gap: 1rem; padding: .6rem .6rem .6rem 1.1rem; border-bottom: var(--border) solid var(--line); }
.player-title { flex: 1; min-width: 0; margin: 0; font: 800 var(--step-1)/1.2 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-out { font: 700 var(--step--1)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; }
.player form { margin: 0; }
.player-close {
  min-height: 2.75rem; padding: 0 1rem; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 2px solid var(--line);
  font: 700 var(--step--1)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em;
}
.player-frame { aspect-ratio: 16 / 9; background: #000; }
.player-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 640px) { .player-out { display: none; } }

/* Gentle entrance: content is visible at rest, it just settles into place */
.reveal { transform: translateY(12px); transition: transform .6s var(--ease); }
.reveal.in { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { transform: none; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; }
  .points li { min-height: 0; }
  /* Filters as one row that scrolls sideways, so films start higher up */
  .toolbar { display: block; }
  .filter-groups { margin-bottom: 1.25rem; }
  .filter-row { display: block; }
  .filter-label { display: block; width: auto; margin-bottom: .6rem; }
  .filters {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 6px;
    scroll-padding-inline: var(--gutter);
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters { gap: .5rem; }
  .chip { flex: none; padding: 0 .85rem; }
  .filter-row { position: relative; }
  .filter-row::after {
    content: "\203A"; position: absolute; right: calc(-1 * var(--gutter)); bottom: 6px;
    width: 4.5rem; height: 2.75rem; padding-right: var(--gutter);
    display: flex; align-items: center; justify-content: flex-end;
    font: 700 1.75rem/1 var(--font-mono); color: var(--text);
    background: linear-gradient(to right, transparent, var(--bg) 70%);
    pointer-events: none; opacity: 0; transition: opacity .2s var(--ease);
  }
  .filter-row.more::after { opacity: 1; }
}
.count:empty { display: none; }
