/* Field 7: the work in rows of three, the name in marker on top. */

:root {
  --bg: #000;
  --ink: rgba(255, 255, 255, 0.8);
  --ink-strong: rgba(255, 255, 255, 0.92);
  --ink-dim: rgba(255, 255, 255, 0.55);
  --line: #fff;
  --tile: #0b0b0c;
  --logo-bg: #f1ede6;
  --dot: rgb(255, 255, 255);
  --type: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  --side: 20px;   /* page margin */
  --gap: 15px;    /* between the three */
  color-scheme: dark;
}
/* day: warm paper, dark ink (the dot at the top switches) */
:root[data-theme="light"] {
  --bg: #efebe4;
  --ink: rgba(24, 22, 20, 0.82);
  --ink-strong: rgba(24, 22, 20, 0.94);
  --ink-dim: rgba(24, 22, 20, 0.55);
  --line: #18161a;
  --tile: #e2ddd4;
  --logo-bg: #fbf9f5;
  --dot: rgb(24, 22, 20);
  color-scheme: light;
}
html, body { transition: background-color 500ms ease, color 500ms ease; }

* { box-sizing: border-box; }
/* the page sits on the html background: past the ends (the stretch) the
   colours flicker there (v7.js, Stretch) */
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
html.own-stretch { overscroll-behavior-y: none; }
html.lb-open { overflow: hidden; }
body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font: 700 15px/27px var(--type);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
/* behind the page, taller than the screen: the flickering colours (Stretch) */
.gap { position: fixed; left: 0; right: 0; top: -100vh; height: 300vh; z-index: -1; background: var(--bg); pointer-events: none; }
.gap-face, .gap-text { position: fixed; left: 50%; z-index: -1; margin: 0; pointer-events: none; visibility: hidden; transform: translateX(-50%); }
.gap-face { top: 0; width: 80px; height: 69px; }
.gap-face svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gap-face path { fill: none; stroke: #1b1918; stroke-width: 3.1; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 3; opacity: 0.42; }
.gap-text { bottom: 0; width: max-content; max-width: calc(100vw - 32px); text-align: center; font: 400 30px/1.15 "Permanent Marker", "Marker Felt", cursive; color: #1b1918; }
.gap-face.on, .gap-text.on { visibility: visible; }
@media (max-width: 640px) { .gap-face { width: 68px; height: 59px; } .gap-text { font-size: 24px; } }
/* iPhones: the page scrolls inside a full-screen panel that bounces natively;
   the panel is see-through, so its bounce uncovers the gap behind */
html.ios, html.ios body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.ios .scroller { position: fixed; inset: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
html.ios .page { min-height: 100%; }
html.ios.lb-open .scroller { overflow: hidden; }
.page { position: relative; min-height: 100vh; background: var(--bg); transition: background-color 500ms ease; }

/* the intro: on top of everything until the drop has fallen */
.intro { position: fixed; inset: 0; z-index: 50; background: var(--bg); transition: opacity 600ms ease, visibility 0s linear 600ms; }
.intro canvas { display: block; width: 100%; height: 100%; }
.intro.fading { opacity: 0; visibility: hidden; }
.intro.done { display: none; }
.defs { position: absolute; width: 0; height: 0; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ */
/* Header: the name, the pages, a line                                */
/* ------------------------------------------------------------------ */

.head { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 22px; }
/* the name: written in thick black marker on a scrap of paper */
.logo {
  display: grid;
  place-items: center;
  padding: 16px 30px 12px;
  background: var(--logo-bg);
  transform: rotate(-1.5deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
  transition: background-color 500ms ease, transform 300ms ease;
}
.logo:hover { transform: rotate(-0.5deg); }
.logo span {
  display: inline-block;
  font: 400 50px/1 "Permanent Marker", "Marker Felt", "Comic Sans MS", cursive;
  letter-spacing: 0.01em;
  color: #111;
  filter: url(#marker);
}
.nav { display: flex; justify-content: center; margin-top: 18px; }
.nav a {
  margin: 0 43px;
  padding: 7px 0;
  font-size: 11px;
  line-height: 11px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--ink-strong);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease, color 200ms ease;
}
.nav a:hover, .nav a.on, .mini-nav a:hover, .mini-nav a.on { border-bottom-color: currentColor; }
.rule { width: calc(100% - 280px); max-width: 1160px; height: 1px; margin: 56px auto 0; border: 0; background: var(--line); }

/* day / night: a filled dot in the ink colour (as in Field 6) */
.theme-dot { position: relative; flex: none; width: 14px; height: 14px; padding: 0; border: 0; border-radius: 50%; background: var(--ink-strong); cursor: pointer; transition: transform 250ms ease, background-color 500ms ease; }
.theme-dot::before { content: ""; position: absolute; inset: -12px; }
.theme-dot:hover { transform: scale(1.2); }
.head-dot { position: absolute; right: 26px; top: 130px; }

/* the slim bar: slides down once the big header has gone */
.mini {
  position: fixed;
  z-index: 15;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 52px;
  padding: 0 26px 0 var(--side);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 18%, transparent);
  transform: translateY(-100%);
  /* hidden really hidden: not peeking out when a phone bounces at the top */
  visibility: hidden;
  transition: transform 350ms cubic-bezier(0.2, 0.7, 0.2, 1), background-color 500ms ease, visibility 0s linear 350ms;
}
.mini.on { transform: none; visibility: visible; transition: transform 350ms cubic-bezier(0.2, 0.7, 0.2, 1), background-color 500ms ease; }
.mini-logo { padding: 5px 10px 3px; background: var(--logo-bg); transform: rotate(-1.5deg); transition: background-color 500ms ease; }
.mini-logo span { display: inline-block; font: 400 19px/1 "Permanent Marker", "Marker Felt", cursive; color: #111; filter: url(#marker); white-space: nowrap; }
.mini-nav { display: flex; gap: 34px; margin: 0 auto; }
.mini-nav a { padding: 5px 0; font-size: 11px; line-height: 11px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--ink-strong); border-bottom: 1px solid transparent; }

main { min-height: 50vh; }

/* ------------------------------------------------------------------ */
/* The work: one project under another, three pictures each          */
/* ------------------------------------------------------------------ */

.work { padding: 109px var(--side) 40px; }
.proj { margin: 0 0 22px; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--tile);
  cursor: pointer;
}
.tile > img, .tile > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 600ms ease, transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* each tile shows its colour, then fades in its still, then its loop */
.tile.ready > img, .tile.ready > video { opacity: 1; }
.tile:hover > img, .tile:hover > video { transform: scale(1.025); }
.cap {
  margin: 12px 0 0;
  text-align: center;
  font-size: 15px;
  line-height: 27px;
  text-transform: uppercase;
  color: var(--ink-strong);
}
.cap a:hover { border-bottom: 1px solid currentColor; }

/* ------------------------------------------------------------------ */
/* About, reel, contact: one narrow column of bold type               */
/* ------------------------------------------------------------------ */

.col { width: min(920px, 100% - 2 * var(--side)); margin: 0 auto; padding: 150px 0 70px; }
.col.wide { width: min(1200px, 100% - 2 * var(--side)); }
.col p { margin: 0 0 17px; font-size: 15px; line-height: 27px; }
.col em { font-style: italic; }
/* contact: the email on its own, with room around it; the reel far below */
.contact .col { padding-bottom: 40px; }
.contact-mail { margin: 120px 0 !important; text-align: center; font-size: 22px !important; line-height: 1.4 !important; letter-spacing: 0.04em; }
.contact-mail a, .contact-more a { border-bottom: 1px solid var(--ink-dim); }
.contact-mail a:hover, .contact-more a:hover { border-bottom-color: currentColor; }
.contact-more { margin-top: 34vh !important; text-align: center; text-transform: uppercase; letter-spacing: 2.2px; font-size: 11px !important; color: var(--ink-dim); }
.reel-frame { position: relative; aspect-ratio: 16 / 9; background: var(--tile); }
.reel-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel-off { display: grid; place-items: center; }
.reel-off a { text-transform: uppercase; letter-spacing: 2.2px; font-size: 12px; border-bottom: 1px solid var(--ink-dim); }

/* ------------------------------------------------------------------ */
/* A project's page                                                   */
/* ------------------------------------------------------------------ */

.pcol { width: min(1200px, 100% - 2 * var(--side)); margin: 0 auto; padding: 70px 0 40px; }
.back, .pmeta, .pnext-label { font-size: 11px; line-height: 18px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--ink-dim); }
.back:hover { color: var(--ink-strong); }
.ptitle { margin: 34px 0 8px; font-size: clamp(24px, 3.4vw, 38px); line-height: 1.15; font-weight: 700; text-transform: uppercase; color: var(--ink-strong); text-align: center; }
.pmeta { margin: 0 0 34px; text-align: center; }
.phero > *, .prow > * { display: block; width: 100%; height: auto; background: var(--tile); cursor: zoom-in; }
.phero > video { aspect-ratio: 16 / 9; object-fit: cover; }
.ptext { max-width: 62ch; margin: 30px auto 0; text-align: center; }
.pmedia { display: grid; gap: var(--gap); margin-top: 40px; }
.prow { display: grid; gap: var(--gap); }
.prow.n2 { grid-template-columns: 1fr 1fr; }
.prow.n2 > * { aspect-ratio: 16 / 9; object-fit: cover; }
.prow.n1 > video { object-fit: cover; }
.pnext { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 80px auto 0; text-align: center; }
.pnext-title { font-size: 18px; text-transform: uppercase; color: var(--ink-strong); }
.pnext:hover .pnext-title { border-bottom: 1px solid currentColor; }

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

.foot { padding: 60px var(--side) 70px; text-align: center; font-size: 11px; line-height: 20px; letter-spacing: 2.2px; text-transform: uppercase; }
.foot p { margin: 0 0 14px; }
.foot .copy { margin-top: 26px; }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 0s linear 300ms;
}
.lightbox.on { opacity: 1; visibility: visible; transition: opacity 300ms ease; }
/* its backdrop: fades as a picture is swiped away (the page shows through) */
.lb-back { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 96%, transparent); }
.lightbox.dragging .lb-close, .lightbox.dragging .lb-count { opacity: 0; transition: opacity 150ms ease; }
.lb-track.free { scroll-snap-type: none; }
/* the pictures side by side; one fills the view, swipe / scroll to the next */
.lb-track {
  position: relative;
  display: flex;
  touch-action: pan-x;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.lb-track::-webkit-scrollbar { display: none; }
.lb-slide { flex: 0 0 100%; height: 100%; display: grid; place-items: center; scroll-snap-align: center; scroll-snap-stop: always; }
/* as big as fits: computers keep a margin for the arrows, phones go edge to edge */
.lb-media {
  display: block;
  width: min(100vw - 180px, (100vh - 110px) * var(--r, 1.7778));
  height: auto;
  aspect-ratio: var(--r, 1.7778);
  object-fit: contain;
  background: var(--tile);
  transform: scale(0.97);
  transition: transform 450ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.lightbox.on .lb-media { transform: none; }
.lb-count { position: absolute; left: 50%; bottom: 20px; margin: 0; transform: translateX(-50%); font-size: 11px; letter-spacing: 2.2px; color: var(--ink-dim); pointer-events: none; }
/* the arrows: they pop up when it opens */
.lb-arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-top: -32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--ink-strong);
  cursor: pointer;
  transition: background-color 200ms ease;
}
.lb-arrow:hover { background: color-mix(in srgb, var(--ink-strong) 12%, var(--bg)); }
.lb-arrow[hidden] { display: none; }
.lb-prev { left: 28px; }
.lb-next { right: 28px; }
.lb-chev { width: 18px; height: 18px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateX(3px) rotate(45deg); }
.lb-next .lb-chev { transform: translateX(-3px) rotate(-135deg); }
.lightbox.on .lb-arrow { animation: lb-pop 650ms cubic-bezier(0.3, 1.6, 0.4, 1) 200ms both; }
@keyframes lb-pop { 0% { scale: 0.2; opacity: 0; } 60% { opacity: 1; } 100% { scale: 1; opacity: 1; } }
/* touch screens: swipe, no arrows; full screen */
@media (pointer: coarse) {
  .lb-back { background: var(--bg); }
  .lb-arrow { display: none; }
  .lb-media { width: min(100vw, 100svh * var(--r, 1.7778)); }
}
.lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--ink-strong);
  font: 400 34px/1 var(--type);
  cursor: pointer;
}
:focus-visible { outline: 1px solid var(--ink-strong); outline-offset: 3px; }
.lb-close:focus:not(:focus-visible) { outline: none; }
@media (pointer: coarse) {
  /* phones: a small × at the bottom, in a big, easy target; the count on top */
  .lb-close { top: auto; right: auto; left: 50%; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); width: 72px; height: 64px; margin-left: -36px; font-size: 24px; color: var(--ink-dim); }
  .lb-count { bottom: auto; top: calc(18px + env(safe-area-inset-top, 0px)); }
}

/* ------------------------------------------------------------------ */
/* Smaller screens                                                    */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .nav a { margin: 0 20px; }
  .rule { width: calc(100% - 2 * var(--side)); margin-top: 44px; }
  .mini-nav { gap: 20px; }
  .work { padding-top: 64px; }
  .col { padding-top: 80px; }
}
@media (max-width: 640px) {
  :root { --side: 12px; --gap: 8px; }
  .logo { padding: 11px 18px 8px; }
  .logo span { font-size: 32px; }
  .head-dot { right: 14px; top: 22px; }
  .mini { gap: 12px; padding-right: 14px; height: 46px; }
  .mini-logo span { font-size: 14px; }
  .mini-nav { gap: 14px; }
  .mini-nav a { font-size: 10px; letter-spacing: 1.6px; }
  .pcol { padding-top: 44px; }
  .ptitle { margin-top: 24px; }
  .nav { display: grid; grid-template-columns: repeat(2, auto); gap: 6px 48px; }
  .nav a { margin: 0; text-align: center; }
  .rule { margin-top: 36px; }
  .work { padding-top: 44px; }
  /* phones: the film large, the other two side by side under it */
  .trio { grid-template-columns: 1fr 1fr; }
  .trio .tile.main { grid-column: 1 / -1; order: -1; }
  .proj { margin-bottom: 30px; }
  .cap { font-size: 13px; line-height: 20px; margin-top: 10px; }
  .col { padding-top: 56px; }
  .col p { font-size: 14px; line-height: 24px; }
  .lb-media { width: min(100vw, 100svh * var(--r, 1.7778)); }
  /* a project page: just the slim bar, in one row */
  body.v-project .head { display: none; }
  body.v-project .mini { transform: none; visibility: visible; transition: none; }
  body.v-project main { padding-top: 46px; }
  .contact-mail { margin: 80px 0 !important; font-size: 17px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tile > img, .tile > video, .lightbox, .lb-media, .mini { transition: none; }
  .lightbox.on .lb-arrow { animation: none; }
}
