/* Project pages: full-bleed slideshow + details panel on the right */

/* IBM Plex Mono Italic, self-hosted (SIL Open Font License, see fonts/OFL.txt) */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-300-italic.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;          /* upright Light: used only for the hover on menu items */
  font-weight: 300;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-italic.woff2") format("woff2");
}

:root {
  --ink: #111;
  --paper: #f4f2ee;
  --muted: #6b6862;
  --rule: #d9d5ce;
  --stage: #0b0b0b;
  --accent: #111;
  --strip-w: 44px;
  /* sidebar (strip + panel) takes a third of the window, never narrower than ~360px */
  --panel-w: max(320px, calc(100vw / 3 - var(--strip-w)));
  --strip: #ffe100;        /* bold yellow, closed */
  --strip-hover: #ffd000;
  --panel-bg: #fff;        /* strip fades to this on open */
  --gutter: 28px;
  --font: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --mono: var(--font);
}
/* dust pages: red in place of the PkWr yellow (set "theme": "dust" in a page's data block) */
.theme-dust { --strip: #e63c18; --strip-hover: #cc3112; }   /* the dust red, from the dust logo */

* { box-sizing: border-box; }
/* no bold anywhere: one weight only, and no faux-bold */
h1, h2, h3, h4, strong, b, th, dt { font-weight: 400; }
html { font-synthesis: none; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-style: italic;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }

/* ---------- Layout ---------- */
.project {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  --slide-ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Stage ---------- */
.stage {
  position: absolute;
  inset: 0;
  background: var(--stage);
  overflow: hidden;
  outline: none;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--fade) ease-in-out;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide.is-active { opacity: 1; pointer-events: auto; }
.slide img, .slide video {
  width: 100%;
  height: 100%;
  object-fit: var(--fit, cover);
  object-position: var(--pos, center);
  display: block;
}
.slide[data-fit="contain"] { --fit: contain; }
/* two portrait images side by side, each filling its half of the screen (slight crop top/bottom) */
.slide.pair { gap: 0; padding: 0; }
.slide.pair img { width: 0; flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; }
/* Portrait screens: stack the pair top and bottom instead of two thin slivers */
@media (orientation: portrait) {
  .slide.pair { flex-direction: column; }
  .slide.pair img { width: 100%; height: 0; min-height: 0; }
}

/* home page: everything in greyscale; colour arrives on the project pages */
.home .slide { filter: grayscale(1); }

/* ambient: long crossfade on autoplay, quick when navigating by hand */
.stage { --fade: 5000ms; --drift: 14s; }
.stage.quick { --fade: 600ms; }
/* very slow drift on photographs while they're showing (artworks shown whole stay still);
   the image holds its zoom while fading out, then quietly resets */
.slide img { transform: scale(1); transform-origin: center; transition: transform 0s linear var(--fade); }
.slide.is-active:not([data-fit="contain"]):not([data-pan]) img { transform: scale(1.06); transition: transform var(--drift) linear; }
/* wide or tall images: sized to fill the screen and panned by site.js (see pan()) */
.slide[data-pan] img { position: absolute; left: 0; top: 0; max-width: none; max-height: none; object-fit: cover; will-change: transform; }
.slide iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.slide-missing {
  color: #777;
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
  padding: 24px;
}
.slide-missing strong { color: #bbb; font-weight: 400; display: block; font-size: 15px; }

/* Click zones */
.zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 30%;
  z-index: 2;
  cursor: w-resize;
  background: none;
  border: 0;
}
.zone.next { right: var(--strip-w); cursor: e-resize; }
.zone.prev { left: 0; }
.stage.has-iframe .zone { display: none; } /* let embedded pieces take clicks */

/* Stage chrome */
.stage-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  color: #eee;
  font-size: 13px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  pointer-events: none;
}
.stage-bar > * { pointer-events: auto; }
.caption { max-width: 60ch; line-height: 1.4; opacity: .9; }
.controls { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
/* plain type over the image: no boxes */
.controls button {
  font: inherit;
  color: #fff;
  background: none;
  border: 0;
  height: 32px;
  padding: 0 6px;
  cursor: pointer;
}
.controls button:focus-visible, .zone:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }
/* numbers: previous · current · next; the outer two are the links */
.num { font-size: 13px; font-variant-numeric: tabular-nums; }
.controls .num { opacity: .5; transition: opacity 200ms ease; }
.controls .num:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.num.current { color: #fff; padding: 0 6px; }
.controls .icon { display: inline-flex; align-items: center; opacity: .8; margin-left: 10px; transition: opacity 200ms ease; }
.controls .icon + .icon { margin-left: 2px; }
.controls .icon:hover { opacity: 1; }

/* fade the overlay after a few seconds without activity */
.progress { transition: opacity 600ms ease; }
.ui-idle .stage-bar, .ui-idle .progress { opacity: 0; pointer-events: none; }
.ui-idle .stage, .ui-idle .zone { cursor: none; }

.progress {
  position: absolute;
  left: 0; top: 0;
  height: 2px;
  background: rgba(255,255,255,.7);
  z-index: 3;
  width: 0;
}
.progress.running { transition: width linear, opacity 600ms ease; }

/* ---------- Panel (slides over the image) ---------- */
.project.panel-hidden .panel {
  visibility: hidden;
  transition: visibility 0s linear 720ms;
}
/* the panel's text: fades out first when the panel closes, and back in once it has opened */
.panel > * { transition: opacity 400ms ease 250ms; }
.project.panel-hidden .panel > * { opacity: 0; transition: opacity 180ms ease; }
/* keep the controls clear of the open panel */
.stage-bar { transition: padding-right 450ms var(--slide-ease), opacity 600ms ease; padding-right: calc(var(--panel-w) + var(--strip-w) + 22px); }
.project.panel-hidden .stage-bar { padding-right: calc(var(--strip-w) + 22px); transition: padding-right 450ms var(--slide-ease) 260ms, opacity 600ms ease; }

.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  transform: translateX(0);
  /* the side's colour is painted here, not on the scrolling panel: some browsers (seen in Dia,
     which is built on Chrome) don't repaint a scrolling element's background during a fade,
     which left the panel white while the section menu band turned yellow/red */
  background: var(--panel-bg);
  /* the shadow is cast from the drawer's outer edge, so it only ever falls on the image
     (on the strip it showed through onto the panel) */
  box-shadow: -10px 0 30px rgba(0,0,0,.22);
  transition: transform 450ms var(--slide-ease), background-color 700ms ease 120ms;
}
.project.panel-hidden .drawer {
  transform: translateX(var(--panel-w));
  /* on close: fade back to yellow first, then slide away */
  background: var(--strip);   /* the whole side is yellow while closed, fading to white as it opens */
  transition: transform 450ms var(--slide-ease) 260ms, background-color 420ms ease;
}
.project.panel-hidden .strip { transition: background-color 420ms ease; }

/* the strip: always visible, title set sideways */
.strip {
  width: var(--strip-w);
  flex-shrink: 0;
  margin: 0;
  padding: 22px 0;
  border: 0;
  background: var(--strip);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: background-color 700ms ease 120ms;
}
.project.panel-hidden .strip:hover { background: var(--strip-hover); }
.project:not(.panel-hidden) .strip { background: var(--panel-bg); }
.strip:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.strip-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.strip-icon {
  font-size: 22px;
  line-height: 1;
  font-style: normal;
  transition: transform 300ms var(--slide-ease);
}
.project:not(.panel-hidden) .strip-icon { transform: rotate(45deg); }
/* gentle nudge so the strip reads as interactive */
@media (prefers-reduced-motion: no-preference) {
  .project.panel-hidden .strip-icon { animation: nudge 2.4s ease-in-out 1.2s 2; }
}
/* subtle bounce when the mouse wakes the page */
.strip.bounce { animation: strip-bounce 750ms cubic-bezier(.3, .7, .3, 1); }
/* the strip grows out to the left and back, staying fixed to the right-hand edge
   (done with a solid yellow shadow, so nothing moves away from the edge) */
@keyframes strip-bounce {
  0%   { box-shadow: 0 0 0 0 var(--strip); }
  30%  { box-shadow: -12px 0 0 0 var(--strip); }
  55%  { box-shadow: 0 0 0 0 var(--strip); }
  75%  { box-shadow: -5px 0 0 0 var(--strip); }
  100% { box-shadow: 0 0 0 0 var(--strip); }
}
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }

.panel {
  width: var(--panel-w);
  background: transparent;    /* colour comes from the drawer behind it */
  transition: visibility 0s linear 0s;
  overflow-y: auto;
  padding: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.panel header .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.panel h1 {
  font-size: clamp(30px, 2.6vw, 42px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 300;
  margin: 0;
}
.panel .subtitle { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.panel .summary p { margin: 0 0 1em; font-size: 14px; line-height: 1.6; max-width: 60ch; }
.panel .summary p:last-child { margin-bottom: 0; }

dl.meta {
  margin: 0;
  display: grid;
  grid-template-columns: 8.5em 1fr;
  border-top: 1px solid var(--ink);
  font-size: 13px;
}
dl.meta dt, dl.meta dd {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.4;
}
dl.meta dt { color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding-top: 11px; }

.panel h2 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 10px;
}
.links ul, .related ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.links li, .related li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.links a[target="_blank"]::after { content: " \2197"; }

.panel footer {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Sections + sub-nav ---------- */
.subnav {
  position: sticky;
  top: calc(-1 * var(--gutter));          /* sit flush with the top edge once scrolled */
  z-index: 2;
  margin: 0 calc(-1 * var(--gutter));
  padding: 14px var(--gutter) 12px;
  /* same colour and fade as the drawer behind the panel; it needs its own opaque
     background because it stays stuck to the top while the panel scrolls */
  background: var(--panel-bg);
  transition: background-color 700ms ease 120ms;
  border-bottom: 1px solid var(--rule);
}
.project.panel-hidden .subnav { background: var(--strip); transition: background-color 420ms ease; }
.subnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.subnav a {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color 200ms ease, box-shadow 200ms ease;
}
.subnav a:hover { color: var(--ink); }
.subnav a.is-active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--strip); }
.sec { scroll-margin-top: 64px; }
.sec p { margin: 0 0 1em; font-size: 14px; line-height: 1.6; max-width: 60ch; }
.sec p:last-child { margin-bottom: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); font-size: 13px; }
ul.plain li { padding: 9px 0; border-bottom: 1px solid var(--rule); line-height: 1.4; }

/* ---------- Home: project menu ---------- */
.menu ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.menu li { border-bottom: 1px solid var(--rule); }
.menu a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 6px;
  margin: 0 -6px;
  text-decoration: none;
}
.menu .menu-label { font-size: 24px; font-weight: 300; letter-spacing: -0.02em; line-height: 1.05; }
.menu .menu-meta { font-size: 12px; color: var(--muted); }
.menu a.ext .menu-label::after { content: " \2197"; font-size: 16px; }
.menu a:hover .menu-label, .menu a:focus-visible .menu-label { font-style: normal; }  /* hover: italic to upright */
.menu a:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.menu a.is-current .menu-label::after { content: " \2190"; font-weight: 400; font-size: 16px; }
.home .panel header { margin-bottom: -8px; }

/* caption that links to its project (home page) */
.caption-link { color: inherit; text-decoration: none; }
.caption-link:hover { text-decoration: underline; }
.caption-credit { opacity: .65; white-space: pre; }
.slide.broken { display: none; }

/* ---------- Index page ---------- */
.index {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 16px 80px;
}
.index h1 { font-weight: 300; font-size: clamp(36px, 5vw, 64px); letter-spacing: -0.03em; margin: 0 0 8px; }
.index > p { color: var(--muted); margin: 0 0 40px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.card { text-decoration: none; display: block; }
.card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--stage);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: #666; font-family: var(--mono); font-size: 12px;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.card:hover .thumb img { transform: scale(1.03); }
.card h2 { font-size: 20px; margin: 12px 0 2px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Small screens: stack ---------- */
/* ---------- Way home ---------- */
.home-link {
  position: absolute; top: 16px; left: 22px; z-index: 4;
  color: #fff; text-decoration: none;
  font-size: 22px; font-weight: 300; letter-spacing: -0.02em;
  text-shadow: 0 0 12px rgba(0,0,0,.45);
  opacity: .85; transition: opacity 200ms ease;
}
.home-link:hover { opacity: 1; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.home-link:focus-visible { outline: 1px solid #fff; outline-offset: 4px; }
/* optional logo over the image (data "logo"): white, centred on the part of the image not covered by the panel */
.stage-logo {
  position: absolute; z-index: 3; top: 50%;
  left: calc((100% - var(--panel-w) - var(--strip-w)) / 2);
  width: clamp(330px, 60vmin, 660px); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: var(--logo-blend, normal);
  transition: left 450ms var(--slide-ease);
}
.project.panel-hidden .stage-logo { left: calc((100% - var(--strip-w)) / 2); transition: left 450ms var(--slide-ease) 260ms; }
.stage-logo-mark {
  display: block; width: 100%; height: 100%; background: var(--logo-colour, #fff);
  -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat;
}
.panel .eyebrow .crumb { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--strip); }
.panel .eyebrow .crumb:hover { border-bottom-color: var(--ink); }

@media (max-width: 860px) {
  /* Phones: the image stays fixed full screen and the text panel scrolls up over it */
  .project { height: auto; overflow: visible; --peek: 18svh; }
  .stage { position: fixed; inset: 0; height: 100vh; height: 100svh; }
  .drawer, .project.panel-hidden .drawer {
    position: relative; display: block; transform: none;
    margin-top: calc(100vh - 18vh); margin-top: calc(100svh - var(--peek));
  }
  .strip { display: none; }
  .zone.next { right: 0; }
  .drawer, .project.panel-hidden .drawer { background: transparent; box-shadow: none; }
  .project.panel-hidden .panel > * { opacity: 1; }   /* phones: the panel is always there */
  .panel, .project.panel-hidden .panel, .project.panel-hidden .subnav { background: var(--panel-bg); }
  .panel, .project.panel-hidden .panel {
    width: auto; visibility: visible; overflow: visible;
    min-height: calc(100svh - var(--peek));
    padding: 28px 16px 40px;
    box-shadow: 0 -10px 30px rgba(0,0,0,.25);
    position: relative;
  }
  .panel::before {            /* small handle: there's more to scroll */
    content: ""; position: absolute; top: 10px; left: 50%;
    width: 36px; height: 3px; margin-left: -18px;
    border-radius: 2px; background: var(--rule);
  }
  .subnav { top: 0; margin: 0 -16px; padding: 12px 16px; }
  .stage-logo, .project.panel-hidden .stage-logo { left: 50%; top: calc(50% - var(--peek) / 2); }
  /* controls sit just above where the panel starts */
  .stage-bar, .project.panel-hidden .stage-bar { padding-right: 22px; bottom: 18vh; bottom: var(--peek); }
  [data-action="panel"] { display: none; }
  .caption { display: none; }
  .slide.pair { bottom: 18vh; bottom: var(--peek); }  /* keep both halves clear of the panel's top edge */
}

@media (prefers-reduced-motion: reduce) {
  .slide { transition: none; }
  .slide img, .slide.is-active img { transform: none !important; transition: none !important; }
}

/* used when arriving with the panel already open */
.no-anim .drawer, .no-anim .panel, .no-anim .panel > *, .no-anim .strip, .no-anim .stage-bar { transition: none !important; }
.controls [hidden] { display: none !important; }
.contact-line { white-space: pre-wrap; }
