/* Gerstner Programm is a licensed font. Once you have the web licence, put the
   .woff2 files in static/fonts/ and remove the comment marks around the url() lines. */
@font-face {
  font-family: "Gerstner Programm";
  font-weight: 400;
  font-display: swap;
  src: local("Gerstner Programm"), local("GerstnerProgramm-Regular")
    /* , url("/fonts/GerstnerProgramm-Regular.woff2") format("woff2") */;
}
@font-face {
  font-family: "Gerstner Programm";
  font-weight: 500;
  font-display: swap;
  src: local("Gerstner Programm Medium"), local("GerstnerProgramm-Medium")
    /* , url("/fonts/GerstnerProgramm-Medium.woff2") format("woff2") */;
}

:root {
  --bg: #ededed;                  /* soft neutral off-white: dark frames read better than on pure white */
  --ink: #000000;
  --soft: #6b6b6b;
  --cell: #efefee;
  --font: "Gerstner Programm", "Helvetica Neue", Helvetica, sans-serif;
  --pad: 16px;
  --top: 52px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  background: var(--bg); color: var(--ink);
  font: 500 12px/16px var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, video { display: block; }
.soft { color: var(--soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar (all pages) ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: var(--top);
  display: grid; grid-template-columns: 260px 1fr minmax(160px, auto); gap: 12px; align-items: center;
  padding: 0 var(--pad); background: var(--bg);
}
.brand { display: flex; gap: 10px; }
.brand:hover { text-decoration: none; }
.chip { padding: 4px 0; }
.top .chip, .top .links { justify-self: end; text-align: right; grid-column: -2 / -1; grid-row: 1; }
.top .links { display: flex; gap: 20px; align-items: center; }
/* dropdowns (Menu, and Credits on phones) */
.pop-btn { font: inherit; color: inherit; background: none; border: 0; padding: 4px 0; cursor: pointer; }
.pop-btn:hover, .pop.open .pop-btn { text-decoration: underline; text-underline-offset: 3px; }
.drop {                                                /* hangs under the top bar and slides open */
  position: absolute; top: 100%; right: var(--pad); z-index: 30;
  height: 0; overflow: hidden; background: var(--bg);
  transition: height .4s cubic-bezier(.2, .7, .2, 1);
}
.drop-in { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 140px; padding: 4px 0 16px 24px; }
.credits-pop { display: none; }
.bar { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bar-title { width: 400px; flex: none; font: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatches { display: flex; gap: 3px; flex: none; }
.swatches i { display: block; width: 24px; height: 16px; transition: background .25s; }

/* ---------- media (stills and videos keep their own ratio) ---------- */
.media { position: relative; flex: none; aspect-ratio: var(--r); overflow: hidden; }
.media img, .media video, .frame img, .frame video { width: 100%; height: 100%; object-fit: cover; }
/* stills fade in over their loading colour; videos stay visible (iPhones won't autoplay hidden videos) and show a poster frame */
.media img:not(.poster), .frame img { opacity: 0; transition: opacity .35s ease; }
.media img.in, .frame img.in { opacity: 1; }
.unmute {
  position: absolute; left: 12px; bottom: 14px; z-index: 3;
  border: 0; background: var(--bg); color: #000; font: inherit; padding: 4px 8px; cursor: pointer;
}

/* ---------- page transitions: white veil fades out on arrival, in on leaving ---------- */
html.arrive body::after, body.leaving::after {
  content: ""; position: fixed; inset: 0; z-index: 100; background: var(--bg); pointer-events: none;
}
html.arrive body::after { animation: veil-out .4s ease forwards; }
body.leaving::after { animation: veil-in .25s ease forwards; }
@keyframes veil-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- home: desktop ---------- */
.home .top .bar {                                      /* palette exactly at the centre of the screen */
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); height: var(--top); justify-content: center;
}
.home .bar-title { display: none; }
.home .swatches i { width: 28px; }
.frames { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  height: min(500px, 58vh); max-width: 70vw; aspect-ratio: var(--r);
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.frame.on { opacity: 1; pointer-events: auto; }
.frame video.over { position: absolute; inset: 0; z-index: 3; }
.entry { display: contents; }                         /* desktop: frames stack in the centre */
.caption { display: none; }
.m-only { display: none; }
.frame { aspect-ratio: var(--rd, var(--r)); }
.frame picture { display: contents; }
/* blurred preview: embedded in the page, so it's there from the first moment */
.blur { position: absolute; inset: 0; z-index: 1; background-size: cover; background-position: center;
  transition: opacity .4s ease; pointer-events: none; }
.media, .frame { overflow: hidden; }
.media img:not(.poster), .frame img { position: relative; z-index: 2; }
.media.playing .blur { opacity: 0; }
.media .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2;
  opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.media .poster.in { opacity: 1; }
.media.playing .poster { opacity: 0; }
/* never show the browser's own play button or controls over a video */
video::-webkit-media-controls, video::-webkit-media-controls-start-playback-button,
video::-webkit-media-controls-overlay-play-button, video::-webkit-media-controls-panel { display: none !important; -webkit-appearance: none; }
video { pointer-events: none; }
.media.main.ended { cursor: pointer; }                  /* click to play the film again */                        /* clicks go to the page, never to the video itself */
.index {
  position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 2;
  display: flex; flex-direction: column; mix-blend-mode: difference; pointer-events: none;
}
.line {
  /* 38px per line, tighter when many projects must fit the screen height */
  --lh: min(38px, calc((100vh - 2 * var(--top) - 24px) / var(--n, 1)));
  height: var(--lh); font-size: min(16px, calc(var(--lh) * .5)); line-height: 1.2; padding: 0 var(--pad); display: flex; align-items: center;
  color: #7a7a7a; pointer-events: auto;            /* the whole row is the link */
}
.line.on { color: #fff; }
.line:hover { text-decoration: none; }

/* ---------- project: desktop — film dead centre, everything else below at the same width ---------- */
.project { --w: min(62vw, 1180px, calc((100vh - 2 * var(--top)) * var(--r0))); }
.project .bar-title { width: auto; }
.project .top .swatches { display: none; }            /* the palette sits on the right instead */
/* title on the film's left edge, type and year on its right edge */
.project .top .bar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: var(--w); height: var(--top);
  justify-content: space-between;
}
.bar-meta { white-space: nowrap; flex: none; }
.credits .kind { display: none; }                     /* shown in the top bar on desktop */
.strip-sticky {
  display: flex; justify-content: center;
  padding: calc((100vh - var(--w) / var(--r0)) / 2) 0 calc(var(--top) * 2);
}
.track { display: flex; flex-direction: column; gap: 24px; width: var(--w); }
.track .media { width: 100%; }
.bottom {                                               /* credits: left side, centred on the film */
  position: fixed; left: var(--pad); top: 50%; transform: translateY(-50%); z-index: 20;
  width: calc((100vw - var(--w-page, 62vw)) / 2 - 2 * var(--pad)); max-width: 220px;
}
.credits { display: flex; flex-direction: column; gap: 14px; }
.credits div:empty, .credits div:has(dd:empty) { display: none; }
.credits dt { color: var(--soft); }
.credits dd { margin: 0; }
.palette-v { position: fixed; right: var(--pad); top: 50%; transform: translateY(-50%); z-index: 20; }
.swatches.vertical { flex-direction: column; gap: 3px; }
.swatches.vertical i { width: 28px; height: 28px; }

/* ---------- contact ---------- */
/* ---------- impressum / privacy ---------- */
.legal-main { max-width: 620px; margin: 0 auto; padding: calc(var(--top) + 48px) var(--pad) 80px; font-size: 14px; line-height: 20px; }
.legal-main h1 { font: 400 22px/28px var(--font); margin-bottom: 24px; }
.legal-main h2 { font: inherit; color: var(--soft); margin: 24px 0 4px; }
.legal-main p { margin-bottom: 8px; font-weight: 400; }
.legal-main a { text-decoration: underline; text-underline-offset: 3px; }

.contact-main {
  min-height: 100vh; padding: var(--top) var(--pad) 60px;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-content: center;
}
.about { grid-column: 2 / span 3; display: flex; flex-direction: column; gap: 20px; padding-right: 48px; }
.bio { font-size: 22px; line-height: 28px; font-weight: 400; }
.bio p + p { margin-top: 14px; }
.reach { grid-column: span 2; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 20px; padding-top: 4px; }
.reach .direct, .reach .gap { margin-top: 20px; }
.reach .awards { margin-top: 20px; display: flex; flex-direction: column; gap: 4px; }
.social-in { gap: 20px; margin-top: 32px; }
.reach .social-in.m-only { display: none; }
.social { position: fixed; left: var(--pad); bottom: 12px; display: flex; gap: 12px; }
.social { gap: 20px; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --top: 82px; }
  body { font-size: 14px; line-height: 19px; }          /* a little larger on phones */
  .top { grid-template-columns: 1fr auto; grid-template-rows: 24px 18px; row-gap: 12px; height: auto; padding: 14px var(--pad) 10px; }
  .top .bar { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; }
  .bar-title, .project .bar-title { width: auto; flex: 1; }
  .swatches i, .home .swatches i { width: 18px; height: 13px; }
  .home .top .bar { position: static; transform: none; height: auto; justify-content: space-between; }
  .home .bar-title { display: block; }
  .contact .top, .legal .top { grid-template-rows: 24px; }

  .index { display: none; }
  .frame video.over { display: none; }   /* phones: the home page shows the cover still only */
  .frames { position: static; display: flex; flex-direction: column; gap: 0; padding: calc(var(--top) + 8px) var(--pad) 40px; pointer-events: auto; }
  .entry { display: block; margin-bottom: 56px; }    /* room between projects */
  .caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; }
  .caption span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .caption .swatches i { width: 18px; height: 13px; }
  .home .top .bar { display: none; }                  /* title + palette live under each thumbnail now */
  .home .top { grid-template-rows: 24px; }
  .d-only { display: none; }
  .m-only { display: block; }
  .frame { aspect-ratio: var(--r); }
  .frame { position: relative; left: auto; top: auto; transform: none; height: auto; width: 100%; max-width: none; opacity: 1; pointer-events: auto; }

  .project .top .swatches { display: flex; }
  .project .top .bar { position: static; transform: none; width: auto; height: auto; }
  .bar-meta { display: none; }
  .credits .kind { display: block; }
  .credits-pop { display: block; }
  .drop { left: 0; right: 0; }                       /* full-width white band, links on the right */
  .drop-in { min-width: 0; padding: 10px var(--pad) 14px; }
  .drop.wide { text-align: left; }
  .drop.wide .drop-in { align-items: stretch; padding: 10px var(--pad) 18px; }
  .drop .credits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; }
  /* an open dropdown pushes the page down instead of covering it */
  .strip-sticky, .frames, .contact-main, .legal-main {
    margin-top: var(--push, 0px); transition: margin-top .4s cubic-bezier(.2, .7, .2, 1); }
  .palette-v { display: none; }
  .strip-sticky { display: block; padding: calc(var(--top) + 4px) var(--pad) 40px; }
  .track { width: 100%; gap: 12px; }
  .bottom { display: none; }                          /* credits live in the Credits dropdown */
  .credits div:has(dd:empty) { display: block; }

  .contact-main { display: flex; flex-direction: column; justify-content: center; gap: 32px; padding-bottom: 80px; }
  .about { padding: 0; gap: 12px; }
  .bio { font-size: 17px; line-height: 24px; }
  .reach { font-size: 16px; line-height: 22px; }
  .legal-main { font-size: 15px; line-height: 21px; }
  .reach .social-in.m-only { display: flex; }        /* phones: links sit under the emails */
}

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