:root {
  --night: #000;                       /* screensaver black: the art supplies the color */
  --white: #fff;
  --soft: rgba(255, 255, 255, 0.74);   /* secondary text */
  --faint: rgba(255, 255, 255, 0.16);  /* rules, outlines */
  --focus: #8FA8FF;                    /* fineliner blue, lifted for dark */
  --gutter: clamp(18px, 4vw, 64px);
  --shadow: 0 1px 2px rgba(0,0,0,.55), 0 2px 18px rgba(0,0,0,.45);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  color: var(--white);
  background: var(--night);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-snap-type: y proximity; }
body { margin: 0; background: var(--night); font-size: 1.0625rem; line-height: 1.5; font-variation-settings: "opsz" 14; }
img { display: block; max-width: 100%; }
a { color: var(--white); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h2, h3 { margin: 0; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--white); color: #000; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

.ctl { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.ctl svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ctl .i-play { fill: currentColor; stroke: none; display: none; }
.paused .ctl .i-play { display: block; }
.paused .ctl .i-pause { display: none; }

/* ── Opening slideshow ─────────────────────────────────────── */
.show { position: relative; height: 100vh; height: 100dvh; min-height: 520px; overflow: hidden; scroll-snap-align: start; background: var(--night); }
.show-stage, .slide { position: absolute; inset: 0; }
.slide { opacity: 0; transition: opacity 1.8s ease; }
.slide.on { opacity: 1; }
.slide:not(.flight) img { width: 100%; height: 100%; object-fit: cover; object-position: 0% 0%; transform: scale(1.3); }
.slide.run:not(.flight) img { animation: drift 12s linear forwards; }
.slide.rev:not(.flight) img { animation-direction: reverse; }
.paused .slide.run:not(.flight) img { animation-play-state: paused; }

/* Doodles: a camera flight that stays close to the paper */
.slide.flight { overflow: hidden; }
.slide .art { position: absolute; left: 0; top: 0; }
.slide.flight .art { max-width: none; transform-origin: 0 0; will-change: transform; }
@keyframes drift {
  from { object-position: 0% 0%;     transform: scale(1.3); }
  to   { object-position: 100% 100%; transform: scale(1.42); }
}

.show-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.25) 32%, rgba(0,0,0,0) 52%),
    linear-gradient(to bottom, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 18%);
}

.show-text { position: absolute; left: var(--gutter); right: var(--gutter); bottom: clamp(56px, 9dvh, 96px); display: flex; justify-content: space-between; align-items: baseline; gap: 24px; text-shadow: var(--shadow); }
.wordmark {
  flex: none;
  margin: 0;
  font-family: "Syne", "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 700;
  font-variation-settings: normal;
  font-size: clamp(1.4rem, 1.9vw, 1.75rem);
  line-height: 1.1;
}
.show-cap { margin: 0; min-width: 0; font-size: clamp(1rem, 1.5vw, 1.25rem); color: var(--soft); min-height: 1.5em; transition: opacity .6s; }
.show-cap b { color: var(--white); font-weight: 600; }
.show-cap .award { margin-left: 0.6rem; }
.zoom-btn {
  margin-left: 0.6rem; padding: 0.05rem 0.75rem;
  font-size: 0.85em; font-weight: 600; text-shadow: none;
  color: #000; background: var(--white); border: 1.5px solid var(--white); border-radius: 999px;
}
.zoom-btn:hover { background: transparent; color: var(--white); }
.piece-cap .zoom-btn { margin: 0.5rem 0 0; display: inline-block; font-size: 0.85rem; }
.piece-cap .award + .zoom-btn { margin-left: 0.5rem; }

.show-bar { position: absolute; top: max(14px, env(safe-area-inset-top)); right: calc(var(--gutter) + 112px); display: flex; align-items: center; gap: 4px; transition: opacity .5s; filter: drop-shadow(0 1px 6px rgba(0,0,0,.5)); }
.show-count { font-size: 0.9rem; color: var(--soft); margin-right: 8px; font-variant-numeric: tabular-nums; }
.show-bar .ctl:hover { background: rgba(255,255,255,.12); }
.all-btn {
  position: fixed; z-index: 20;
  top: max(14px, env(safe-area-inset-top)); right: var(--gutter);
  height: 44px; padding: 0 16px;
  border: 1.5px solid rgba(255,255,255,.7); border-radius: 999px;
  background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-weight: 600; transition: opacity .5s;
}
.all-btn:hover { background: var(--white); color: #000; opacity: 1; }

.scroll-cue { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); font-size: 0.85rem; color: var(--soft); text-decoration: none; transition: opacity .5s; white-space: nowrap; }
.scroll-cue:hover { color: var(--white); }

/* On computers, controls rest out of sight until the mouse moves — like a screensaver */
@media (hover: hover) {
  .show .show-bar, .show .scroll-cue { opacity: 0; }
  .show.awake .show-bar, .show.awake .scroll-cue, .show-bar:focus-within { opacity: 1; }
  .show:not(.awake) { cursor: none; }
  body.quiet .all-btn:not(:hover):not(:focus-visible) { opacity: 0; }
}

.award {
  display: inline-block;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--white);
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: 0.05rem 0.7rem;
  text-shadow: none;
}

/* ── Chapter title screens ─────────────────────────────────── */
.chapter { min-height: 62vh; min-height: 62dvh; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 var(--gutter) clamp(40px, 7dvh, 80px); scroll-snap-align: start; }
.chapter h2 {
  font-weight: 800;
  font-variation-settings: "opsz" 96, "wdth" 75;
  font-size: clamp(3.2rem, 10vw, 9rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
}
.chapter p { margin: 1rem 0 0; max-width: 40ch; color: var(--soft); font-size: clamp(1.05rem, 1.6vw, 1.3rem); }

/* ── One drawing per screen ────────────────────────────────── */
.piece {
  position: relative; overflow: hidden;
  height: 100vh; height: 100dvh; min-height: 520px;
  display: grid; place-items: center;
  padding: 6dvh var(--gutter) 15dvh;
  scroll-snap-align: start;
  isolation: isolate;
}
.piece-glow { position: absolute; inset: -10%; width: 120%; height: 120%; max-width: none; object-fit: cover; filter: blur(60px) saturate(1.4) brightness(.42); z-index: -1; }
.piece-art { display: block; cursor: zoom-in; }
.piece-art img { width: auto; height: auto; max-height: 79dvh; max-width: min(100%, 1500px); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.piece-cap { position: absolute; left: var(--gutter); right: var(--gutter); bottom: clamp(20px, 4dvh, 44px); text-shadow: var(--shadow); }
.piece-cap h3 { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 700; line-height: 1.1; font-variation-settings: "opsz" 48; }
.piece-cap p { margin: 0.3rem 0 0; color: var(--soft); }
.piece-cap .award { margin-top: 0.5rem; }

/* ── Sketchbook ────────────────────────────────────────────── */
.sketchbook { padding: 0 var(--gutter) clamp(60px, 9dvh, 120px); }
.sketchbook .chapter { padding-left: 0; padding-right: 0; min-height: 50dvh; }
.grid { columns: 5 170px; column-gap: 16px; }
.tile { break-inside: avoid; margin: 0 0 22px; }
.tile button { display: block; width: 100%; text-align: left; }
.tile img { width: 100%; height: auto; background: #1a1a1a; transition: opacity .2s; }
.tile button:hover img { opacity: .82; }
.tile span { display: block; padding-top: 0.4rem; font-size: 0.9rem; color: var(--soft); line-height: 1.3; }

/* ── About ─────────────────────────────────────────────────── */
.about { position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-end; padding: 12dvh var(--gutter) clamp(48px, 10dvh, 110px); scroll-snap-align: start; isolation: isolate; }
.about-bg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; filter: brightness(.28) saturate(.9); z-index: -1; }
.about-text { max-width: 640px; text-shadow: var(--shadow); }
.about-text h2 { font-weight: 800; font-variation-settings: "opsz" 96, "wdth" 75; font-size: clamp(3rem, 7vw, 6rem); line-height: .9; letter-spacing: -0.03em; margin-bottom: 1.4rem; }
#about-body p { margin: 0 0 1rem; font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; }
.facts { color: var(--soft); margin: 1rem 0 0; }
.contact { margin: 0.6rem 0 0; font-size: 1.2rem; font-weight: 600; }

.foot { padding: 22px var(--gutter) 32px; color: rgba(255,255,255,.55); font-size: 0.875rem; border-top: 1px solid var(--faint); }

/* ── All work drawer ───────────────────────────────────────── */
.drawer {
  width: min(420px, 100vw); height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0 0 0 auto; padding: 0; border: 0;
  background: rgba(14,14,14,.86); -webkit-backdrop-filter: blur(28px) saturate(1.3); backdrop-filter: blur(28px) saturate(1.3);
  color: var(--white); overflow-y: auto; overscroll-behavior: contain;
}
.drawer::backdrop { background: rgba(0,0,0,.18); cursor: default; }
.drawer[open] { animation: drawer-in .3s cubic-bezier(.2,.8,.2,1); }
.drawer.closing { animation: drawer-out .22s ease-in forwards; }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }
.drawer-inner { padding: 0 12px 40px; }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px 8px; margin: 0 -12px; padding-inline: 20px; background: #0e0e0e; }
.drawer-head h2 { font-weight: 800; font-variation-settings: "opsz" 96, "wdth" 75; font-size: 2rem; letter-spacing: -0.02em; }
.drawer-close { font-weight: 600; padding: 8px 4px; }
.drawer h3 { font-size: 1rem; font-weight: 600; color: var(--soft); margin: 1.4rem 8px 0.4rem; }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
.row:hover { background: rgba(255,255,255,.09); }
.row[aria-current="true"] { background: rgba(255,255,255,.17); }
.row img { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #222; }
.row-text { min-width: 0; line-height: 1.25; }
.row-text b { display: block; font-weight: 600; }
.row-text small { display: block; margin-top: 2px; font-size: 0.85rem; color: var(--soft); }

/* ── Zoom in ───────────────────────────────────────────────── */
.explore { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: var(--white); overflow: hidden; }
.explore::backdrop { background: #000; }
#osd { position: absolute; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; }
.ex-cap { position: absolute; left: var(--gutter); bottom: 24px; color: var(--soft); text-shadow: var(--shadow); pointer-events: none; }
.ex-cap b { color: var(--white); font-weight: 600; }
.ex-hint { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(0,0,0,.6); font-size: 0.9rem; white-space: nowrap; pointer-events: none; animation: hint-out .6s 4s forwards; }
@keyframes hint-out { to { opacity: 0; } }
.ex-tools { position: absolute; top: max(14px, env(safe-area-inset-top)); right: var(--gutter); display: flex; align-items: center; gap: 6px; }
.ex-tools .ctl { background: rgba(0,0,0,.55); }
.ex-tools .ctl:hover { background: rgba(255,255,255,.2); }
.ex-close { height: 44px; padding: 0 16px; margin-left: 6px; border-radius: 999px; background: rgba(0,0,0,.55); font-weight: 600; }
.ex-close:hover { background: var(--white); color: #000; }

/* ── Viewer ────────────────────────────────────────────────── */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: var(--white); }
.viewer[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.viewer::backdrop { background: #000; }
.v-fig { margin: 0; height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 0 20px; min-width: 0; }
.v-img { max-height: calc(100dvh - 130px); max-width: 100%; width: auto; height: auto; object-fit: contain; }
.v-cap { margin-top: 0.9rem; text-align: center; color: var(--soft); }
.v-cap b { color: var(--white); font-weight: 600; }
.v-prev, .v-next { justify-self: center; color: var(--soft); }
.v-prev:hover, .v-next:hover { color: var(--white); background: rgba(255,255,255,.1); }
.v-close { position: absolute; top: 14px; right: var(--gutter); font-weight: 600; padding: 6px 10px; z-index: 2; }

/* ── Small screens ─────────────────────────────────────────── */
@media (max-width: 760px) {
  .show-text { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .wordmark { align-self: flex-end; }
  .show-bar { left: var(--gutter); right: calc(var(--gutter) + 100px); justify-content: flex-end; }
  .show-count { margin-right: auto; }
  .ex-hint { top: auto; bottom: 86px; }
  .show-cap .award, .show-cap .zoom-btn { margin-left: 0; margin-top: 0.4rem; }
  .show-cap b { margin-right: 0.6rem; }
  .piece { padding: 10dvh 14px 17dvh; }
  .piece-art img { max-height: 72dvh; }
  .grid { columns: 2 140px; }
  .viewer[open] { grid-template-columns: 1fr; }
  .v-fig { grid-column: 1; grid-row: 1; padding: 56px 12px 72px; }
  .v-img { max-height: calc(100dvh - 190px); }
  .v-prev, .v-next { position: absolute; bottom: 12px; }
  .v-prev { left: 12px; } .v-next { right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .slide.run img { animation: none; }
  .slide { transition-duration: .4s; }
  .drawer[open], .drawer.closing { animation: none; }
}
