/* Gallery: off-white wall, graphite ink, small mono type. The photographs and their colours are the only colour. */
:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --ink: #1e1e1c;
  --soft: rgba(30, 30, 28, 0.52);
  --line: rgba(30, 30, 28, 0.16);
  --ph: #e7e4dd;
  --pad: 40px;
  --head: 72px;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 12px/1.5 var(--mono); letter-spacing: 0.01em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a, button { touch-action: manipulation; }   /* no double-tap zoom delay on phones */
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
.link { border-bottom: 1px solid var(--line); padding-bottom: 1px; transition: border-color .2s; }
.link:hover { border-color: var(--ink); }
.soft { color: var(--soft); }

/* ---------------------------------------------------------------- header */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 10; height: var(--head);
  display: flex; align-items: baseline; gap: 32px;
  padding: 26px var(--pad) 0;
  background: linear-gradient(var(--bg) 70%, rgba(244, 242, 237, 0));
}
.name { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; align-self: center; margin-top: -6px; line-height: 1; }
.top > .tabs, .top > .stats { align-self: center; margin-top: -6px; }
.logo { display: block; height: 30px; width: auto; transform-origin: 50% 80%; transition: transform .4s var(--ease); }
.name:hover .logo { transform: rotate(-8deg) scale(1.08); }
.tabs { display: flex; gap: 18px; }
.tabs a { color: var(--soft); border-bottom: 1px solid transparent; padding-bottom: 1px; transition: color .2s; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--ink); }
.stats { margin-left: auto; color: var(--soft); }

/* all / digital / film */
.kind { display: flex; align-items: center; gap: 0; margin-left: 14px; padding-left: 18px; border-left: 1px solid var(--line); align-self: center; margin-top: -6px; }
.kind button { --cycle: 0; color: var(--soft); padding: 2px 0; transition: color .2s; }
.kind button + button::before { content: "/"; color: var(--line); margin: 0 8px; }
.kind button:hover { color: var(--ink); }
.kind button[aria-pressed="true"] { color: var(--ink); }
.empty-note { position: absolute; left: var(--pad); top: 45%; margin: 0; color: var(--soft); }
.wall .empty-note { position: static; }

/* ---------------------------------------------------------------- 1. timeline */
.view-timeline { position: fixed; inset: 0; }
.flow {
  position: absolute; inset: 0 0 64px 0;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  cursor: grab; overscroll-behavior-x: contain; touch-action: pan-x;
}
.flow::-webkit-scrollbar { display: none; }
.flow.dragging { cursor: grabbing; }
.flow.dragging .fl { pointer-events: none; }
.flow-track { position: relative; height: 100%; }
.flow-track svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.flow-track svg text { font: 400 11px var(--mono); fill: var(--soft); }
.flow-track svg text.ch { fill: var(--ink); font-weight: 500; }
.fl {
  position: absolute; display: block; padding: 0;
  transition: opacity .35s ease;
}
.fl-in { display: block; width: 100%; height: 100%; }
.fl.near .fl-in { animation: bob var(--t, 7s) ease-in-out infinite alternate; animation-delay: var(--d, 0s); }   /* only prints near the screen bob */
.fl-sway { display: block; width: 100%; height: 100%; }
.fl.up .fl-sway { transform-origin: 50% 100%; }    /* hangs from the ribbon below */
.fl.down .fl-sway { transform-origin: 50% 0%; }    /* hangs from the ribbon above */
.fl img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  box-shadow: 0 2px 10px rgba(40, 30, 20, 0.14);
  opacity: 0; transition: opacity .6s, transform .5s var(--ease), box-shadow .5s;
}
.fl img.in { opacity: 1; }
.fl-cap {
  position: absolute; left: 0; white-space: nowrap; display: flex; gap: 8px; align-items: center;
  opacity: 0; transform: translateY(4px); transition: opacity .3s, transform .3s var(--ease);
}
.fl-cap i { width: 9px; height: 9px; flex: none; }
.fl.up .fl-cap { bottom: calc(100% + 8px); }
.fl.down .fl-cap { top: calc(100% + 8px); }
.flow-track.focus .fl { opacity: 0.35; }
.flow-track.focus .fl.hot { opacity: 1; }
.fl.hot img { transform: scale(1.045); box-shadow: 0 14px 30px -12px rgba(40, 30, 20, 0.38); }
.fl.hot .fl-cap { opacity: 1; transform: none; }
@keyframes bob { from { transform: translateY(-5px); } to { transform: translateY(5px); } }

.flow-foot {
  position: absolute; left: 0; right: 0; bottom: 0; height: 64px;
  display: flex; align-items: center; gap: 22px; padding: 0 var(--pad);
}
.flow-now { min-width: 13em; color: var(--soft); white-space: nowrap; }
.flow-now b { font-weight: 500; color: var(--ink); }
.mini { position: relative; flex: 1; height: 30px; cursor: pointer; touch-action: none; }
.mini-bar { position: absolute; left: 0; right: 0; top: 13px; height: 4px; display: flex; }
.mini-bar i { height: 100%; }
.mini-win {
  position: absolute; top: 6px; height: 18px; border: 1px solid var(--ink);
  background: rgba(244, 242, 237, 0.25); cursor: grab;
}
.flow-hint { color: var(--soft); white-space: nowrap; transition: opacity .6s; }
.flow-hint.gone { opacity: 0; }

/* ---------------------------------------------------------------- 2. colour */
.view-colour { padding: calc(var(--head) + 4px) 0 60px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
/* its own layer: squares must never float above the header or the photo viewer */
.chart { position: relative; flex: none; z-index: 0; isolation: isolate; }
.chart svg { position: absolute; inset: 0; overflow: visible; }
.chart svg text { font: 400 10.5px var(--mono); fill: var(--soft); }
.sq {
  position: absolute; width: var(--s); height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  transition: transform .2s var(--ease); isolation: isolate;
}
.sq i { position: absolute; inset: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22); }
.sq i + i { transform: translate(3px, 3px); z-index: -1; filter: brightness(.94); }
.sq i + i + i { transform: translate(6px, 6px); z-index: -2; filter: brightness(.88); }
.sq.on { transform: scale(1.6); z-index: 900 !important; }
@media (hover: hover) { .sq:hover { transform: scale(1.6); z-index: 900 !important; } }
.sq.on::after { content: ""; position: absolute; inset: -4px; border: 1px solid var(--ink); }
.marker {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  border: 1px solid var(--ink); pointer-events: none; z-index: 950;
  transition: left .45s var(--ease), top .45s var(--ease);
}
.marker::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; border-radius: 50%; background: var(--ink); }
.match { display: flex; align-items: center; gap: 10px; color: var(--soft); }
.match .sw { width: 11px; height: 11px; background: var(--sw, transparent); box-shadow: inset 0 0 0 1px var(--line); }
.match input { width: 8.5ch; background: none; border: 0; border-bottom: 1px solid var(--line); outline: none; padding: 2px 0; color: var(--ink); text-transform: lowercase; }
.match input:focus { border-color: var(--ink); }
.match input::placeholder { color: rgba(30, 30, 28, 0.3); }
.match button { color: var(--ink); }
.match.bad input { border-color: #b8432f; }
.strip-wrap { width: 100%; padding: 0 var(--pad); }
.panel-head { display: flex; align-items: center; gap: 10px; min-height: 20px; margin: 0 0 12px; color: var(--soft); }
.panel-head i { width: 12px; height: 12px; flex: none; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.pt {
  position: relative; flex: none; height: 170px; overflow: hidden; background: var(--ph);
  animation: pop .4s var(--ease) both; animation-delay: calc(min(var(--k), 12) * 22ms);
}
.pt img { height: 100%; width: auto; display: block; opacity: 0; transition: opacity .4s; }
.pt img.in { opacity: 1; }
.pt:hover { outline: 1px solid var(--ink); outline-offset: 2px; }
.pt .share { position: absolute; left: 0; bottom: 0; padding: 2px 6px; background: var(--bg); font-size: 10px; color: var(--soft); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 3. index: salon wall */
.view-index { padding: calc(var(--head) + 20px) var(--pad) 100px; }
.wall { display: flex; gap: 44px; align-items: flex-start; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 64px; }
.work { display: block; width: 100%; text-align: left; transition: opacity .4s; content-visibility: auto; contain-intrinsic-size: auto 360px; }   /* off-screen works aren't drawn */
.work.small { padding: 0 16%; }
.work.right { padding-left: 24%; }
.work img {
  display: block; width: 100%; height: auto; background: var(--ph);
  box-shadow: 0 1px 4px rgba(40, 30, 20, 0.14);
  opacity: 0; transition: opacity .6s, transform .5s var(--ease), box-shadow .5s;
}
.work img.in { opacity: 1; }
@media (hover: hover) {
  .wall:hover .work { opacity: 0.45; }
  .wall:hover .work:hover { opacity: 1; }
  .work:hover img { transform: translateY(-4px); box-shadow: 0 14px 28px -14px rgba(40, 30, 20, 0.4); }
}
.cap { display: flex; gap: 12px; align-items: baseline; margin-top: 12px; }
.cap em { font-style: normal; color: var(--soft); }
.cap b { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap .pal { display: flex; gap: 2px; }
.cap .pal i { width: 7px; height: 7px; }

/* ---------------------------------------------------------------- 4. info */
.view-info { padding: calc(var(--head) + 48px) var(--pad) 80px; }
.info { max-width: 560px; margin-left: 12vw; }
.bio { margin: 0 0 40px; font-size: 13px; line-height: 1.7; max-width: 460px; }
.info dl { margin: 0 0 64px; display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 14px 20px; }
.info dt { color: var(--soft); }
.info dd { margin: 0; }
.info dd button { margin-left: 10px; }
.sig-label { margin: 0 0 12px; }
.sig { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 48px; }
.sig i { width: var(--s, 18px); height: var(--s, 18px); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); animation: pop .5s var(--ease) both; animation-delay: calc(var(--k) * 25ms); }

.notice { position: fixed; left: var(--pad); top: calc(var(--head) + 20px); max-width: 40em; color: var(--soft); z-index: 5; }
.notice code { color: var(--ink); }

/* ---------------------------------------------------------------- lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  touch-action: pinch-zoom;            /* swipes go to the viewer, not the page behind; pinch still zooms */
  overscroll-behavior: contain;
}
#lbImg {
  max-width: calc(100vw - 220px); max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px);
  width: auto; height: auto; box-shadow: 0 2px 14px rgba(40, 30, 20, 0.16);
  opacity: 0; transition: opacity .35s;
}
#lbImg.ready { opacity: 1; }
.lb-nav { position: absolute; top: 0; bottom: 0; width: 110px; font-size: 16px; color: var(--soft); }
.lb-nav:hover { color: var(--ink); background: rgba(30, 30, 28, 0.03); }
.lb-prev { left: 0; } .lb-next { right: 0; }
.lb-close { position: absolute; top: 26px; right: var(--pad); }
.lb-cap { position: absolute; left: 0; right: 0; bottom: 24px; margin: 0; text-align: center; color: var(--soft); }

/* ---------------------------------------------------------------- narrow screens */
@media (hover: none) {
  .fl.near .fl-in { animation: none; }        /* the wind is enough motion on phones, and saves battery */
  .flow-track.focus .fl { opacity: 1; }
}
@media (max-width: 860px) {
  :root { --pad: 16px; --head: calc(58px + env(safe-area-inset-top)); }
  .top { gap: 14px; padding: calc(12px + env(safe-area-inset-top)) var(--pad) 0; align-items: center; }
  .stats { display: none; }
  .tabs { gap: 2px; margin-left: auto; }
  /* phones: one small button showing the current choice; tap to cycle all → digital → film */
  .kind { margin: 0; padding: 0; border: 0; }
  .kind button { --cycle: 1; display: none; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
  .kind button[aria-pressed="true"] { display: inline-block; }
  .kind button + button::before { content: none; }
  .tabs a { padding: 10px 7px; }              /* finger-sized tap targets */
  .flow { bottom: calc(56px + env(safe-area-inset-bottom)); }
  .flow-foot { height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); gap: 14px; }
  .flow-now { min-width: 0; }
  .flow-hint { display: none; }
  .match input { font-size: 16px; }           /* stops iPhones zooming in on focus */
  .view-colour { gap: 16px; }
  .pt { height: 130px; }
  .wall { gap: 18px; }
  .col { gap: 36px; }
  .work.small { padding: 0 8%; }
  .work.right { padding-left: 12%; }
  .info { margin-left: 0; }
  .info dl { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .info dd { margin-bottom: 14px; }
  /* phone viewer: photo centred with a margin on every side, sitting a little high
     (the controls take the bottom, so true centre looks low) */
  .lightbox { padding: calc(40px + env(safe-area-inset-top)) 0 calc(120px + env(safe-area-inset-bottom)); }
  #lbImg {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 190px);
    max-height: calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .lb-close { top: calc(18px + env(safe-area-inset-top)); }
  .lb-nav {
    top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); width: 56px; height: 48px;
    font-size: 18px; color: var(--ink);
  }
  .lb-nav:hover { background: none; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .lb-cap { bottom: calc(24px + env(safe-area-inset-bottom)); padding: 0 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 420px) {
  .name-text { display: none; }
  .tabs a { padding: 10px 5px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  :root { --head: 52px; }
  .top { padding-top: 10px; }
  .flow-track svg text:not(.ch) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fl-in, .pt, .sig i { animation: none !important; }
  .sq, .marker, .fl img, .work img, #lbImg { transition: none !important; }
}
