@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,800&display=swap");

:root {
  --page: #f7f8f9;      /* cool drawing-paper white */
  --paper: #eef0f2;     /* collage ground, overridable in the studio */
  --ink: #1d2433;       /* ballpoint blue-black */
  --graphite: #687080;  /* pencil grey for secondary text */
  --rule: #d9dde3;
  --crayon: #2a55e5;    /* the one accent: active filters, focus */
  --mat: #ffffff;

  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;

  --gutter: clamp(16px, 3vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #14171d;
    --paper: #1b1f27;
    --ink: #e8ebf0;
    --graphite: #9aa2b1;
    --rule: #2c323d;
    --crayon: #7d9bff;
    --mat: #f4f5f7;
  }
}
:root[data-theme="dark"] {
  --page: #14171d; --paper: #1b1f27; --ink: #e8ebf0; --graphite: #9aa2b1;
  --rule: #2c323d; --crayon: #7d9bff; --mat: #f4f5f7;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 17px/1.55 var(--body);
}
img { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--crayon); outline-offset: 2px; }

/* ---------- Header ---------- */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px 32px;
  padding: clamp(20px, 4vw, 48px) var(--gutter) clamp(16px, 2.5vw, 28px);
}
.wordmark {
  margin: 0;
  font: 800 clamp(72px, 17vw, 232px)/0.78 var(--display);
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.045em;
  text-decoration: none;
  /* optical nudge so the M sits on the left margin */
  margin-left: -0.04em;
}
.masthead-side {
  max-width: 30ch;
  padding-bottom: 0.4em;
  text-align: right;
}
.intro { margin: 0 0 10px; color: var(--graphite); }
.site-nav { display: flex; justify-content: flex-end; gap: 18px; font-weight: 700; }
.site-nav a { text-decoration-thickness: 2px; text-underline-offset: 4px; }
.site-nav a[aria-current="page"] { text-decoration-color: var(--crayon); }

.masthead.compact { align-items: center; padding-bottom: 12px; }
.masthead.compact .wordmark { font-size: clamp(44px, 8vw, 76px); }
.masthead.compact .masthead-side { padding-bottom: 0; }

@media (max-width: 640px) {
  .masthead { grid-template-columns: 1fr; }
  .masthead-side { text-align: left; max-width: none; }
  .site-nav { justify-content: flex-start; }
}

/* ---------- Collage ---------- */
.collage-wrap { container-type: inline-size; background: var(--collage-bg, var(--paper)); padding: var(--edge, 0); }
.collage {
  --cols: 6;
  --gap: 6px;
  --radius: 0px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols));
  grid-auto-flow: dense;
  gap: var(--gap);
}
.tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--tile-color, var(--rule));
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.collage.fit-whole .tile { background: transparent; }
.collage.fit-whole .tile img { object-fit: contain; }

.collage.border-line .tile { box-shadow: inset 0 0 0 1.5px var(--ink); }
.collage.border-line .tile img { padding: 1.5px; }
.collage.border-mat .tile { background: var(--mat); padding: clamp(5px, 6%, 18px); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.collage.border-mat .tile img { border-radius: calc(var(--radius) / 2); }

.tile-title {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 10px 8px;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.55));
  opacity: 0;
}
.tile:focus-visible .tile-title { opacity: 1; }
.tile:focus-visible { outline-offset: -3px; }

.empty {
  padding: 80px var(--gutter);
  max-width: 46ch;
  color: var(--graphite);
}
.empty strong { display: block; color: var(--ink); font: 800 28px/1.1 var(--display); margin-bottom: 8px; }

.site-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px var(--gutter) 40px;
  color: var(--graphite); font-size: 14px;
}

/* ---------- Archive ---------- */
.filters { padding: 0 var(--gutter) 8px; display: grid; gap: 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row > span { width: 84px; color: var(--graphite); font-size: 14px; }
.chip {
  font: 700 15px/1 var(--body);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}
.chip small { font-weight: 400; color: var(--graphite); margin-left: 6px; }
.chip[aria-pressed="true"] { background: var(--crayon); border-color: var(--crayon); color: #fff; }
.chip[aria-pressed="true"] small { color: rgb(255 255 255 / 0.8); }

.year-block { padding: 28px var(--gutter) 8px; }
.year-block h2 {
  margin: 0 0 18px;
  font: 800 clamp(48px, 8vw, 96px)/0.9 var(--display);
  letter-spacing: -0.03em;
  color: var(--ink);
}
.year-block h2 small { font: 400 16px var(--body); letter-spacing: 0; color: var(--graphite); margin-left: 12px; }
.masonry { columns: 4 220px; column-gap: 18px; }
.card { break-inside: avoid; margin: 0 0 22px; text-decoration: none; display: block; }
.card img { width: 100%; height: auto; background: var(--tile-color, var(--rule)); }
.card-meta { padding-top: 7px; font-size: 15px; line-height: 1.35; }
.card-meta span { display: block; color: var(--graphite); font-size: 13px; }
.result-note { padding: 24px var(--gutter); color: var(--graphite); }

/* ---------- Piece ---------- */
.piece {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(20px, 4vw, 56px);
  padding: 8px var(--gutter) 48px;
  align-items: start;
}
.piece-stage {
  background: var(--paper);
  padding: clamp(14px, 4vw, 56px);
  display: grid; place-items: center;
  min-height: 50vh;
}
.piece-stage img { max-height: 78vh; width: auto; box-shadow: 0 2px 10px rgb(0 0 0 / 0.12); }
.piece-info h1 { margin: 0 0 6px; font: 800 clamp(32px, 4vw, 48px)/1.02 var(--display); letter-spacing: -0.02em; }
.piece-date { color: var(--graphite); margin: 0 0 16px; }
.piece-media { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; }
.piece-media li { border: 1.5px solid var(--rule); border-radius: 999px; padding: 4px 11px; font-size: 14px; font-weight: 700; }
.piece-notes { white-space: pre-wrap; max-width: 60ch; margin: 0 0 24px; }
.piece-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  font: 700 15px/1 var(--body); color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: 999px; padding: 10px 16px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.piece-stage img.flip { animation: flip 0.35s ease; }
@keyframes flip { from { transform: perspective(900px) rotateY(80deg); opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .piece-stage img.flip { animation: none; } }
@media (max-width: 820px) { .piece { grid-template-columns: 1fr; } .piece-stage { min-height: 0; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
