/* Avril Dutheil book. One theme (off-black), one typeface, photos first. */
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/InstrumentSans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --bg: #0e0e0e;
  --fg: #ededeb;
  --muted: #8b8b87;
  --line: #2a2a29;
  --panel: #1d1d1c;
  --sheet: #171716;
  --font: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --bar-h: 52px;
  --top-h: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --vh: 100vh;
  --screen: 100vh;
}
@supports (height: 100svh) { :root { --vh: 100svh; --screen: 100svh; } }

* { box-sizing: border-box; }
html {
  background: var(--bg);
  color: var(--fg);
  scroll-snap-type: y mandatory;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
h2, h3, p { margin: 0; }
.label, .bar button, .wordmark, .top-meta, .sheet h2, .overview h2, dt, .units button, .btn, .contact-list span {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- book: mobile, one frame per screen ---------- */
.spread { display: contents; }
.frame {
  position: relative;
  margin: 0;
  height: var(--vh);
  padding: calc(var(--top-h) + var(--safe-t)) 0 calc(var(--bar-h) + var(--safe-b));
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
}
.frame picture { display: block; width: 100%; height: 100%; }
.frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-touch-callout: default;
}

/* cover: on phones the name and height live in the top band; beside the cover on desktop */
.meta { display: none; position: absolute; pointer-events: none; }
.meta-name { font-size: 20px; font-weight: 500; letter-spacing: .01em; }
.meta-name span { color: var(--muted); font-weight: 400; }
.meta-name span + span, .meta-name [data-cm] { color: var(--fg); }
.meta-loc { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- digitals: each group fits one screen ---------- */
.digitals {
  scroll-snap-align: start;
  background: var(--panel);
  min-height: var(--vh);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--top-h) + var(--safe-t) + 12px) 12px calc(var(--bar-h) + var(--safe-b) + 12px);
}
.digitals .label { color: var(--fg); margin: 0 auto 12px; width: 100%; max-width: 1400px; }
.digitals .label span, .overview .label span { color: var(--muted); }
/* a snapcard: --cols angles across, close-ups above full length, sized to fit the width and two rows of height */
.digital-grid {
  --gap: 4px;
  --area: calc(var(--screen) - var(--top-h) - var(--safe-t) - var(--bar-h) - var(--safe-b) - 24px - 28px);
  --w: min(calc((100vw - 24px - (var(--cols) - 1) * var(--gap)) / var(--cols)),
           calc((var(--area) - var(--gap)) / 2 * 2 / 3));
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--w));
  justify-content: center;
  gap: var(--gap);
}
.digital { display: block; aspect-ratio: 2 / 3; background: var(--c); }
.digitals .hint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 12px; }
.digital picture, .digital img, .overview picture, .overview img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- closing ---------- */
.closing {
  scroll-snap-align: start;
  min-height: var(--vh);
  display: flex;
  align-items: center;
  padding: calc(var(--top-h) + var(--safe-t) + 12px) 20px calc(var(--bar-h) + var(--safe-b) + 12px);
}
.closing-inner { width: 100%; max-width: 560px; margin: 0 auto; }
.closing-name { font-size: 28px; font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
.closing-status { color: var(--muted); margin-top: 6px; font-size: 13px; }
.closing-stats { margin-top: 18px; }
.closing-stats .stats div { padding: 7px 0; }
.closing-contact { margin-top: 8px; }
.closing-contact .contact-list li { padding: 9px 0; }
.closing-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.credits { margin-top: 16px; color: var(--muted); font-size: 12px; }
.credits a { text-decoration: none; color: var(--fg); }
.fineprint { margin-top: 4px; color: var(--muted); font-size: 11px; }
/* short phones: tighten the closing page so it still fits one screen */
@media (max-height: 700px) and (max-width: 899px) {
  .closing-name { font-size: 24px; }
  .closing-stats { margin-top: 12px; }
  .closing-stats .stats div { padding: 5px 0; }
  .closing-contact .contact-list li { padding: 6px 0; }
  .closing-actions { margin-top: 12px; }
  .credits { margin-top: 12px; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #3a3a38;
  border-radius: 999px;
  text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: #1f1f1e; border-color: #555; }

/* ---------- stats ---------- */
.stats { margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.stats div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stats div:last-child { grid-column: 1 / -1; }
dt { color: var(--muted); align-self: center; }
dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.units { display: inline-flex; border: 1px solid #3a3a38; border-radius: 999px; padding: 2px; }
.units button { padding: 7px 14px; border-radius: 999px; color: var(--muted); min-height: 32px; }
.units button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* ---------- chrome: top band (name, height, progress), bar ---------- */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  background: rgba(14, 14, 14, .86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.wordmark { text-decoration: none; white-space: nowrap; }
.top-meta { color: var(--muted); white-space: nowrap; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 21; pointer-events: none; }
.progress i { display: block; height: 100%; background: rgba(255, 255, 255, .85); transform-origin: 0 50%; transform: scaleX(0); }

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--bar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(14, 14, 14, .86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.bar button { height: var(--bar-h); }
.bar button:active { opacity: .6; }


/* ---------- default scroll mode (shell): the photo area scrolls, the page never does ---------- */
.shell, .shell body { height: 100%; overflow: hidden; }
.shell { scroll-snap-type: none; }
.shell main {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  --vh: 100%;
}

/* ---------- sheets ---------- */
dialog { color: var(--fg); border: 0; padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.sheet {
  margin: auto 0 0;
  width: 100%;
  max-width: 100%;
  max-height: 88vh;
  background: var(--sheet);
  border-radius: 16px 16px 0 0;
  padding: 18px 20px calc(24px + var(--safe-b));
  overscroll-behavior: contain;
}
.sheet[open] { animation: up .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet header, .overview header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.close { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); min-height: 40px; padding: 0 0 0 16px; }
.sheet-note { color: var(--muted); font-size: 13px; margin-top: 18px; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.contact-list span { color: var(--muted); }
.contact-list a { font-size: 16px; text-decoration: none; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.overview {
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--bg);
  padding: 16px 12px calc(24px + var(--safe-b));
  overscroll-behavior: contain;
}
.overview .label { color: var(--muted); margin: 24px 2px 10px; }
/* a plain gallery in book order: as many columns as fit */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; }
.ov-grid.ov-snap { grid-template-columns: repeat(var(--cols), minmax(0, 120px)); }
.overview [data-jump] { aspect-ratio: 2 / 3; background: var(--c); overflow: hidden; }
.overview [data-jump]:active { opacity: .7; }

.lightbox { margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; background: #000; padding: var(--safe-t) 0 0; }
.lightbox img { width: 100%; height: calc(100% - var(--bar-h) - var(--safe-b)); object-fit: contain; display: block; }
.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  align-items: center;
  height: calc(var(--bar-h) + var(--safe-b));
  padding: 0 8px var(--safe-b);
}
.lb-prev, .lb-next { font-size: 28px; line-height: 1; height: var(--bar-h); color: var(--fg); }
.lb-count { font-size: 12px; letter-spacing: .12em; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }
.lb-bar .close { justify-self: end; padding: 0 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + var(--safe-b) + 16px);
  transform: translate(-50%, 8px);
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* no focus rings: the arrow keys move through the book, they don't select buttons */
:focus, :focus-visible { outline: none; }

/* ---------- desktop: curated pairs ---------- */
@media (min-width: 900px) and (orientation: landscape) {
  :root { --pad-t: 60px; --pad-b: 36px; }
  .spread {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    gap: 16px;
    height: var(--vh);
    padding: var(--pad-t) 48px var(--pad-b);
    scroll-snap-align: start;
  }
  .frame {
    height: 100%;
    aspect-ratio: 2 / 3;
    max-width: calc(50% - 8px);
    padding: 0;
    scroll-snap-align: none;
  }
  .meta {
    display: block;
    right: calc(100% + 40px);
    bottom: 0;
    white-space: nowrap;
    text-align: right;
  }
  .meta-name { font-size: 22px; }
  .meta-loc { color: var(--muted); }

  .bar {
    top: 0;
    bottom: auto;
    left: auto;
    right: 32px;
    height: var(--pad-t);
    padding: 0;
    display: flex;
    gap: 28px;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 0;
  }
  .bar button { height: var(--pad-t); color: var(--muted); transition: color .15s; }
  .bar button:hover { color: var(--fg); }
  .top {
    height: var(--pad-t);
    padding: 0 48px;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: none;
  }
  .wordmark { pointer-events: auto; }
  .top-meta { display: none; }

  .digitals { padding: var(--pad-t) 48px var(--pad-b); }
  .digitals .label { max-width: none; text-align: center; margin-bottom: 20px; }
  .digital-grid {
    --gap: 10px;
    --w: min(calc((100vw - 96px - (var(--cols) - 1) * var(--gap)) / var(--cols)),
             calc((var(--screen) - var(--pad-t) - var(--pad-b) - 44px - var(--gap)) / 2 * 2 / 3));
  }
  .digital { cursor: zoom-in; }
  .digitals .hint { display: none; }
  .closing { padding: var(--pad-t) 48px var(--pad-b); }
  .closing-name { font-size: 34px; }
  .closing-stats { margin-top: 28px; }
  .closing-stats .stats div { padding: 9px 0; }
  .closing-actions { margin-top: 24px; }
  .credits { margin-top: 28px; }

  .sheet {
    margin: auto;
    width: 440px;
    border-radius: 16px;
    padding: 22px 26px 28px;
  }
  .overview { padding: 24px 48px 48px; }
  /* at most 5 across, like the digitals below it */
  .ov-grid { grid-template-columns: repeat(auto-fill, minmax(max(140px, calc((100% - 24px) / 5)), 1fr)); gap: 6px; max-width: 1400px; margin: 0 auto; }
  /* same column width as the gallery above, so the two line up */
  .ov-grid.ov-snap { grid-template-columns: repeat(var(--cols), calc((100% - 24px) / 5)); justify-content: start; }
  .overview .label { max-width: 1400px; margin: 36px auto 10px; }
  .overview header { margin-bottom: 28px; }
  .toast { bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
