/* Black on pure white: #fff is the paper white of the zine scans. */
:root {
  --pad: clamp(1.1rem, 4vw, 3.5rem);
  --max: 1240px;
  --col-gap: clamp(.75rem, 1.6vw, 1.5rem);
  --row-gap: clamp(1.75rem, 4.5vw, 4.5rem);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #fff; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  color: #000; background: transparent; /* the ash canvas sits behind the page, on the white of html */
  font-family: "Times New Roman", Times, Tinos, "Liberation Serif", serif;
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); line-height: 1.5;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:focus-visible, button:focus-visible { outline: 1px solid #000; outline-offset: 4px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2 { font-weight: 400; }

.skip { position: absolute; left: -999em; }
.skip:focus { left: var(--pad); top: .5rem; background: #fff; z-index: 20; padding: .25rem .5rem; }

/* Header: a light translucent layer the work scrolls under */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: max(.85rem, env(safe-area-inset-top)) var(--pad) .85rem;
  background: rgb(255 255 255 / .82);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
@media (prefers-reduced-transparency: reduce) { .bar { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; } }
.name { display: block; padding: .35rem 0; }
.sig { display: block; width: clamp(8.5rem, 16vw, 11.5rem); height: auto; overflow: visible; }
.sig path { fill: #000; }
/* first visit: the name writes itself, then the ink settles */
.write .sig path {
  fill: transparent; stroke: #000; stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: sig-write 2.4s cubic-bezier(.45, .05, .35, 1) .2s forwards, sig-ink .7s ease 2.2s forwards;
}
@keyframes sig-write { to { stroke-dashoffset: 0; } }
@keyframes sig-ink { to { fill: #000; stroke-width: 0; } }

/* charcoal dust left by the pointer, drifting down and fading (drawn by app.js) */
.ash { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; }

/* small preview that follows the pointer over the work index */
.peek {
  position: fixed; left: 0; top: 0; z-index: 5; width: 15rem; height: auto;
  pointer-events: none; opacity: 0; transform-origin: 0 50%; will-change: transform, opacity;
}
.bar nav { display: flex; gap: clamp(1rem, 2.5vw, 2rem); }
.bar nav a { text-decoration: none; padding: .6rem 0; }
.bar nav a:hover { text-decoration: underline; }

main { padding: 0 var(--pad); overflow-x: clip; }

/* About + index: the first screen */
.about {
  max-width: 35em; margin: 0 auto;
  min-height: calc(100svh - 5rem);
  padding: clamp(3rem, 12vh, 8rem) 0 clamp(4rem, 12vh, 8rem);
  display: flex; flex-direction: column; justify-content: center;
}
.about h1, .contact h2, .index h2 {
  font-size: .8em; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 1.1rem;
}
.about p { hyphens: manual; }
.index { margin-top: clamp(3rem, 8vh, 5rem); }
.index ol { list-style: none; border-top: 1px solid #000; }
.index li { border-bottom: 1px solid #000; }
.index a { display: flex; gap: 1.25rem; padding: .7rem 0; text-decoration: none; }
.index a:hover span:last-child { text-decoration: underline; }
.index .n { font-variant-numeric: tabular-nums; min-width: 1.6em; }

/* Works */
.works { max-width: var(--max); margin: 0 auto; }
.work { padding: clamp(4rem, 9vw, 8rem) 0; scroll-margin-top: 4rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--row-gap) var(--col-gap); align-items: start; }
.it, .cap, .stills { grid-column: 1 / -1; }
.it.h { grid-column: auto; }
.it { display: block; cursor: zoom-in; -webkit-tap-highlight-color: transparent; align-self: var(--a, start); }
.it img {
  width: 100%;
  transition: opacity .2s ease, scale .5s cubic-bezier(.3, 1.35, .5, 1),
              filter 1.4s cubic-bezier(.2, .8, .2, 1), translate 1.1s cubic-bezier(.2, .8, .2, 1);
  transition-delay: 0s, 0s, var(--delay, 0s), var(--delay, 0s);
}
/* images surface like a memory coming back: out of a blur, slightly from below */
.js .it:not(.in) img { opacity: 0; filter: blur(14px) grayscale(1); translate: 0 1.75rem; }
.js .it.in img { transition-duration: 1.1s, .5s, 1.4s, 1.1s; transition-delay: var(--delay, 0s); }
.it:active img { opacity: .82; transition-duration: 0s, .5s; }
/* hover: the image lifts slightly towards the viewer (only with a mouse, not on touch) */
@media (hover: hover) and (pointer: fine) {
  .it { position: relative; }
  .it:hover, .it:focus-visible { z-index: 1; }
  .it:hover img, .it:focus-visible img { scale: 1.035; }
  .stills .it:hover img { scale: 1.06; }
}
@media (prefers-reduced-motion: reduce) {
  .it img, .js .it.in img { transition: opacity .6s ease; transition-delay: 0s; }
  .js .it:not(.in) img { filter: none; translate: none; }
  .it:hover img, .stills .it:hover img { scale: none; opacity: .88; }
  .write .sig path { animation: none; fill: #000; stroke: none; }
}
.cap { margin-top: calc(var(--row-gap) * -1 + .9rem); font-size: .82em; line-height: 1.4; max-width: 38em; }
.stills { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.35rem, .8vw, .6rem); }
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .it, .it.h, .cap, .stills { grid-column: var(--d); }
  .stills { grid-template-columns: repeat(3, 1fr); }
}
.stills .it { grid-column: auto; }

/* Contact & footer */
.contact { max-width: 35em; margin: 0 auto; padding: clamp(4rem, 10vw, 8rem) 0 clamp(5rem, 12vw, 9rem); }
.contact a { display: inline-block; padding: .3rem 0; overflow-wrap: anywhere; }
footer {
  display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; justify-content: center;
  padding: 1.5rem var(--pad) max(2rem, env(safe-area-inset-bottom)); font-size: .82em;
}
footer a { padding: .25rem 0; }
footer span { padding: .25rem 0; }

/* Imprint / privacy */
.text { max-width: 36em; margin: 0 auto; padding: clamp(3rem, 10vh, 6rem) 0 5rem; }
.text h1 { font-size: 1.6em; line-height: 1.15; letter-spacing: -.01em; margin-bottom: 1.5rem; }
.text h2 { font-size: 1.05em; margin: 2rem 0 .4rem; }
.text p + p { margin-top: .75rem; }
.todo { border: 1px dashed #000; padding: .5rem .75rem; }

/* Image viewer */
.lb {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  border: 0; padding: 0; background: transparent; color: #000; overflow: hidden;
  touch-action: none; overscroll-behavior: contain;
}
.lb::backdrop { background: transparent; }
.lb-bg { position: absolute; inset: 0; background: #fff; }
.lb-stage { position: absolute; inset: 0; }
.lb-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; user-select: none; -webkit-user-drag: none; }
.lb-bar {
  position: absolute; left: var(--pad); right: var(--pad); bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; font-size: .82em; line-height: 1.4;
}
.lb-cap { max-width: 40em; }
.lb-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-btn {
  position: absolute; font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  min-width: 2.75rem; min-height: 2.75rem; padding: .5rem;
}
.lb-btn:active { opacity: .5; }
.lb-close { top: max(.75rem, env(safe-area-inset-top)); right: calc(var(--pad) - .5rem); }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 1.3em; }
.lb-prev { left: calc(var(--pad) - .9rem); }
.lb-next { right: calc(var(--pad) - .9rem); }
.lb-btn[hidden] { display: none; }
.lb-chrome { transition: opacity .25s ease; }
.lb.is-dragging .lb-chrome, .lb.is-entering .lb-chrome { opacity: 0; }
@media (hover: none) { .lb-prev, .lb-next { display: none; } }
html.lb-open { overflow: hidden; }
