/* ---------- tokens ---------- */
:root {
  --bg: #f2f1ed;
  --fg: #171716;
  --mute: #8d8b85;
  --line: #dcdad4;
  --ph: #e4e2dc;          /* behind media while loading */
  --pad: 32px;
  --seam: 3px;            /* gap between frames on the wall */
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* type */
  --font: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: var(--font);     /* big titles */
  --trk: 1;                   /* how tight big type is tracked */
  --name-w: 500;
  --adjust: none;             /* font-size-adjust: evens out small x-heights of serifs */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0f0e;
  --fg: #e8e6e1;
  --mute: #75736d;
  --line: #2a2a28;
  --ph: #1a1a19;
  color-scheme: dark;
}

/* typefaces (data-font on <html>, set in Studio); --adjust evens out x-heights so sizes match */
:root[data-font="switzer"] { --font: "Switzer", "Helvetica Neue", Helvetica, Arial, sans-serif; --trk: .8; --adjust: .52; }
:root[data-font="jost"] { --font: "Jost", Futura, "Century Gothic", sans-serif; --trk: .5; --adjust: .51; }
:root[data-font="franklin"] { --font: "Libre Franklin", "Franklin Gothic", Arial, sans-serif; --trk: .85; --adjust: .52; }
:root[data-font="tenor"] { --font: "Tenor Sans", Optima, Candara, sans-serif; --trk: .35; --name-w: 400; --adjust: .5; }
:root[data-font="familjen"] { --font: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif; --trk: .7; --adjust: .52; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.45 var(--font);
  font-size-adjust: var(--adjust);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked, html:has(body.locked) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
img, video { display: block; width: 100%; height: 100%; object-fit: cover; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
.mute { color: var(--mute); }
.small { font-size: 12px; letter-spacing: .01em; }

/* ---------- header: floats over the images ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 22px var(--pad);
  color: #fff; mix-blend-mode: difference;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar .name { font-weight: var(--name-w); }
.bar nav { display: flex; gap: 28px; }
.bar nav button, .bar nav a { opacity: .85; transition: opacity .3s var(--ease); }
.bar nav button:hover, .bar nav a:hover { opacity: 1; }
/* when an overlay is open the header sits on plain background */
body.locked .bar { mix-blend-mode: normal; color: var(--fg); }

/* ---------- media frame ---------- */
.frame { position: relative; overflow: hidden; background: var(--ph); }
.frame > img, .frame > video { position: absolute; inset: 0; opacity: 0; transition: opacity .8s var(--ease); }
.frame > .ready { opacity: 1; }

/* ---------- wall: justified rows, edge to edge ---------- */
.wall { display: flex; flex-direction: column; gap: var(--seam); padding: var(--seam); }
.row { display: flex; gap: var(--seam); }
.cell { position: relative; display: block; min-width: 0; container-type: inline-size; -webkit-tap-highlight-color: transparent; }
.cell .frame { width: 100%; height: 100%; }
.label {
  position: absolute; left: 18px; right: 18px; bottom: 15px;
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  color: #fff; font-size: 13px; line-height: 1.3;
  text-shadow: 0 0 20px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(5px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  pointer-events: none;
}
.label i { font-style: normal; opacity: .72; font-size: 12px; }
a.cell:hover .label, a.cell:focus-visible .label { opacity: 1; transform: none; }
@media (hover: none) { .label { opacity: 1; transform: none; } }
/* narrow tiles: title only */
@container (max-width: 230px) { .label i { display: none; } .label { left: 10px; right: 10px; bottom: 9px; } }

.foot {
  display: flex; justify-content: space-between; align-items: end; gap: 24px;
  padding: 72px var(--pad) 40px;
}
.foot .line { font-family: var(--display); font-size: clamp(26px, 3.4vw, 54px); line-height: 1.02; letter-spacing: calc(-.025em * var(--trk)); max-width: 16ch; }
.foot .contact { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--mute); }
.foot .contact a:hover { color: var(--fg); }

/* ---------- project page ---------- */
.hero { position: relative; width: 100%; background: #000; }
.hero .frame { margin: 0 auto; max-height: 100vh; max-height: 100svh; }
.intro {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 24px;
  padding: 56px var(--pad) 88px;
}
.intro .kind { grid-column: 1 / span 12; margin: 0 0 14px; color: var(--mute); }
.intro h1 { font-family: var(--display);
  grid-column: 1 / span 7;
  margin: 0; font-weight: 400;
  font-size: clamp(44px, 6.4vw, 112px); line-height: .94; letter-spacing: calc(-.035em * var(--trk));
  text-wrap: balance;
}
.intro .about { grid-column: 9 / span 4; padding-top: 6px; }
.intro .about p { margin: 0 0 1em; }
.credits { margin: 28px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 20px; font-size: 13px; }
.credits dt { color: var(--mute); white-space: nowrap; }
.credits dd { margin: 0; }
.festivals { list-style: none; margin: 28px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--mute); }
.festivals li { padding: 1px 0; }

.film {
  position: relative; display: block; width: calc(100% - var(--seam) * 2); margin: 0 var(--seam) var(--seam);
  aspect-ratio: 16 / 9; max-height: 100vh; max-height: 100svh; background: #000; overflow: hidden; color: #f2f1ed;
}
.film img { position: absolute; inset: 0; opacity: .45; transition: opacity .5s var(--ease); }
.film:hover img { opacity: .3; }
.film .play { font-family: var(--display); position: absolute; left: var(--pad); bottom: 28px; font-size: clamp(22px, 2.4vw, 36px); letter-spacing: calc(-.02em * var(--trk)); }
.film iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* next project: a slice of its first shot */
.next { position: relative; display: block; height: 42vh; height: 42svh; min-height: 260px; margin: 0 var(--seam) var(--seam); overflow: hidden; color: #fff; }
.next .frame { position: absolute; inset: 0; }
.next .frame > * { transition: transform 1.4s var(--ease), opacity .8s var(--ease); }
.next:hover .frame > * { transform: scale(1.03); }
.next .txt { position: absolute; left: var(--pad); right: var(--pad); bottom: 26px; display: flex; justify-content: space-between; align-items: baseline; text-shadow: 0 0 24px rgba(0, 0, 0, .3); }
.next .txt b { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4.4vw, 72px); letter-spacing: calc(-.03em * var(--trk)); line-height: 1; }
.next .txt span { font-size: 13px; opacity: .8; }

/* ---------- overlays: index, information ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg); color: var(--fg);
  padding: 96px var(--pad) var(--pad);
  overflow-y: auto; overscroll-behavior: contain;
  animation: fade .35s var(--ease);
}
.sheet[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.sheet.index { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.sheet.index[hidden] { display: none; }
.sheet.index ol { list-style: none; margin: 0; padding: 0; }
.sheet.index li a { font-family: var(--display);
  display: flex; align-items: baseline; gap: 16px;
  font-size: clamp(30px, 3.6vw, 60px); line-height: 1.06; letter-spacing: calc(-.028em * var(--trk));
  transition: color .3s var(--ease);
}
.sheet.index li a small { font-size: 12px; letter-spacing: 0; color: var(--mute); transform: translateY(-1.2em); }
.sheet.index ol:hover a { color: var(--mute); }
.sheet.index ol:hover a:hover { color: var(--fg); }
.preview { position: relative; height: min(70vh, 640px); }
.preview .frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 100%; max-height: 100%; opacity: 0; transition: opacity .5s var(--ease); }
.preview .frame.on { opacity: 1; }

/* contact: small type, a lot of air, one portrait */
.sheet.info .wrap {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: 1fr auto;
  gap: 0 24px; min-height: 100%;
}
.portrait { grid-column: 7 / span 3; grid-row: 1 / span 2; align-self: center; margin: 0; padding: 24px 0; }
.portrait .frame { width: 100%; aspect-ratio: var(--r); max-height: 68vh; max-height: 68svh; }
.portrait .frame { width: min(100%, calc(68svh * var(--r))); }
.portrait figcaption { margin-top: 8px; font-size: 11px; color: var(--mute); }
.sheet.info .text { grid-column: 1 / span 4; grid-row: 2; align-self: end; max-width: 40ch; }
.sheet.info .nophoto .text { grid-column: 1 / span 5; }
.sheet.info .bio { font-size: 14px; line-height: 1.55; }
.sheet.info .bio p { margin: 0 0 1em; }
.sheet.info .links { display: grid; grid-template-columns: 6.5em 1fr; gap: 4px 12px; margin: 28px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.sheet.info .links dt { color: var(--mute); }
.sheet.info .links dd { margin: 0; }
.sheet.info .links a { border-bottom: 1px solid transparent; transition: border-color .3s var(--ease); }
.sheet.info .links a:hover { border-color: currentColor; }

/* ---------- showreel ---------- */
.reel { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-items: center; animation: fade .4s var(--ease); }
.reel .box { width: min(92vw, calc(86vh * 16 / 9)); aspect-ratio: 16 / 9; }
.reel iframe { width: 100%; height: 100%; border: 0; }
.reel .close { position: absolute; top: 22px; right: var(--pad); color: #8d8b85; }
.reel .close:hover { color: #e8e6e1; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  :root { --pad: 16px; --seam: 2px; }
  body { font-size: 14px; }
  .bar { padding: 16px var(--pad); }
  .bar nav { gap: 18px; }
  .label { left: 12px; right: 12px; bottom: 10px; font-size: 12px; }
  .intro { padding: 32px var(--pad) 56px; }
  .intro h1, .intro .about { grid-column: 1 / -1; }
  .intro .about { padding-top: 28px; }
  .sheet { padding-top: 76px; }
  .sheet.index { grid-template-columns: 1fr; align-content: start; }
  .preview { display: none; }
  .sheet.info .wrap { grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 0; align-content: space-between; }
  .portrait { grid-column: 1; grid-row: 1; width: 64%; margin-left: auto; padding: 8px 0 40px; }
  .sheet.info .text, .sheet.info .nophoto .text { grid-column: 1; grid-row: 2; max-width: none; }
  .foot { flex-direction: column; align-items: flex-start; padding-top: 48px; }
  .foot .contact { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* font try-out switcher (only with ?font= in the address) */
.fonttry { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60; display: flex; gap: 2px; padding: 4px; background: rgba(20,20,20,.86); border-radius: 999px; font: 400 12px/1 system-ui, sans-serif; letter-spacing: 0; font-size-adjust: none; max-width: calc(100vw - 16px); overflow-x: auto; }
.fonttry button { color: #cfcdc8; padding: 8px 12px; border-radius: 999px; white-space: nowrap; text-align: center; }
.fonttry button[aria-pressed="true"] { background: #f2f1ed; color: #111; }
