/* ---------- Tokens ---------- */
:root {
  --field: #0A0A0A;
  --type-primary: #FFFFFF;
  --type-secondary: rgba(255, 255, 255, 0.42);
  --type-meta: #8E8C88;
  --rule: rgba(255, 255, 255, 0.12);

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;

  --size-album: clamp(15px, 1.8vw, 28px);
  --size-photo-title: 15px;
  --size-meta: 11px;
  --size-name: 20px;

  --fade-ui: 280ms;
  --fade-bg: 680ms;

  --margin: clamp(20px, 3.5vw, 48px);
  --masthead-h: 61px;
}

@font-face {
  font-family: "Playfair Display";
  src: url("fonts/playfair-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--field);
  color: var(--type-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--type-secondary); outline-offset: 4px; }

.view { position: fixed; inset: 0; overflow: hidden; }

/* ---------- Chrome (auto-hiding UI) ---------- */
.chrome { transition: opacity var(--fade-ui) ease; }
body.idle .chrome { opacity: 0; pointer-events: none; }
body.idle { cursor: none; }

/* Readability on any photograph: directional scrims + a soft shadow lift
   the type. Never a flat overlay — that would dull the photograph. */
.masthead, .chrome-meta, .chrome-caption, .chrome-hint, #album-list {
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.55), 0 0 4px rgba(0, 0, 0, 0.4);
}

/* ---------- Masthead (all navigation lives here) ---------- */
.masthead {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--masthead-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--margin);
  z-index: 10;
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--size-name);
  letter-spacing: 0.01em;
}

.topnav { display: flex; gap: 2.2em; }
.topnav a {
  font-size: var(--size-meta);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--type-secondary);
  transition: color var(--fade-ui) ease;
}
.topnav a:hover { color: var(--type-primary); }

/* nav hardware */
.rule-v { width: 1px; height: 10px; background: var(--rule); align-self: center; }
kbd {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 2px 6px 1px;
  color: var(--type-primary);
}
.meta-inline { color: var(--type-meta); font-variant-numeric: tabular-nums; }

.album-heading {
  font-size: var(--size-meta);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--type-secondary);
  display: flex;
  gap: 1.2em;
  align-items: center;
}
.album-heading .topnav { gap: 1.6em; }
#counter-top .count { color: var(--type-primary); }

/* ---------- Stage: a stack of full-screen spreads, cross-faded ---------- */
#spreads {
  position: absolute; inset: 0;
  overflow: hidden;
  touch-action: none;
  z-index: 0;
}

.spread {
  position: absolute; inset: 0;
  display: flex;
  opacity: 0;
  visibility: hidden;
  transition: opacity 760ms cubic-bezier(0.33, 1, 0.68, 1), visibility 0s linear 760ms;
}
.spread.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 760ms cubic-bezier(0.33, 1, 0.68, 1);
  z-index: 1;
}
.spread figure {
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.spread img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Album-switch preview layer — cross-fades over the stage, never interactive */
#preview {
  position: absolute; inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade-bg) ease;
}
#preview.show { opacity: 1; }
#preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Caption drifts up as the next spread arrives */
@keyframes capin {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.chrome-caption.cap-in { animation: capin 480ms ease-out both; }

/* Directional scrims — top for the masthead, bottom-left for the list */
.scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.36) 0%, rgba(0,0,0,0) 30%),
    linear-gradient(38deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 52%);
  pointer-events: none;
  z-index: 2;
}

/* ---------- Album list (always present, floats on the stage) ---------- */
.chrome-list {
  position: absolute;
  left: var(--margin);
  bottom: var(--margin);
  z-index: 5;
  width: min(70vw, 560px);
}

#album-list {
  position: relative;
  list-style: none;
  height: calc(var(--size-album) * 6.2);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent, black 28%, black 72%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 28%, black 72%, transparent);
}
#album-list::-webkit-scrollbar { display: none; }
#album-list li {
  scroll-snap-align: center;
  height: calc(var(--size-album) * 1.55);
  display: flex;
  align-items: center;
}
#album-list li.spacer { pointer-events: none; }
#album-list a {
  font-family: var(--font-display);
  font-size: var(--size-album);
  line-height: 1;
  color: var(--type-primary);
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  opacity: 0.42;
  transform-origin: left center;
  will-change: transform, opacity;
}
#album-list a .idx {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--type-meta);
  margin-right: 1.2em;
}

/* ---------- Floating chrome ---------- */
.chrome-meta {
  position: absolute;
  top: calc(var(--masthead-h) + 20px);
  right: var(--margin);
  z-index: 5;
  text-align: right;
  font-size: var(--size-meta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--type-meta);
  line-height: 2.1;
  opacity: 0;
}
.chrome-meta.show { opacity: 1; }
.chrome-meta .count { color: var(--type-primary); }

.chrome-caption {
  position: absolute;
  top: calc(var(--masthead-h) + 20px);
  left: var(--margin);
  z-index: 5;
}
.chrome-caption .title {
  font-family: var(--font-display);
  font-size: var(--size-photo-title);
  margin-bottom: 0.4em;
}
.chrome-caption .exif {
  font-size: var(--size-meta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--type-meta);
}

.chrome-hint {
  position: absolute;
  right: var(--margin);
  bottom: var(--margin);
  z-index: 5;
  font-size: var(--size-meta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--type-meta);
  display: flex;
  gap: 0.8em;
  align-items: center;
  opacity: 0;
}
.chrome-hint.show { opacity: 1; }

/* Title card — the beat of nothing at the end */
.spread--card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6em;
}
.spread--card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: calc(var(--size-album) * 2.2);
}
.spread--card p {
  font-size: var(--size-meta);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--type-meta);
}

/* ---------- About ---------- */
.about-body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--margin);
  max-width: 54ch;
  gap: 2.4em;
  font-size: 16px;
  line-height: 1.8;
  color: var(--type-secondary);
}
.about-contact a {
  color: var(--type-primary);
  border-bottom: 1px solid var(--rule);
  transition: border-color var(--fade-ui) ease;
}
.about-contact a:hover { border-color: var(--type-primary); }
.about-contact { line-height: 2.4; font-size: 13px; letter-spacing: 0.08em; }

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  :root { --size-name: 17px; }
  .chrome-list { width: calc(100vw - 2 * var(--margin)); }
  #album-list { height: 34vh; }
  .album-heading { gap: 0.9em; }
  .album-heading .meta-inline, .album-heading .rule-v { display: none; }
  .chrome-hint { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --fade-ui: 120ms; --fade-bg: 200ms; }
  #album-list { scroll-behavior: auto; }
  .spread, .spread.on { transition: none; }
  .chrome-caption.cap-in { animation: none; }
}
