:root {
  color-scheme: dark;
  --bg: #0e0e0e;
  --fg: #f0f0ee;
  --muted: #9a9a96;
  --line: #262626;
  --tile: #1a1a1a;
  --signature: "Herr Von Muellerhoff", "Segoe Script", cursive;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* Landing screen */
/* How far the drag has gone: 0 is blurred, 1 is sharp */
@property --reveal {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
.splash {
  --reveal: 0;
  --signature-size: clamp(5rem, 22vw, 14rem);
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: --reveal 0.35s ease-out;
}
.splash.dragging { cursor: grabbing; transition: none; }
.splash.revealed .collage-track img { cursor: zoom-in; }
.splash-collage {
  position: absolute;
  /* Extends past the screen so the blur doesn't leave soft edges */
  inset: -24px;
  filter: blur(calc(8px * (1 - var(--reveal))));
  display: grid;
  grid-template-columns: repeat(var(--columns, 4), 1fr);
  gap: 4px;
  background: #000;
  opacity: 0;
}
.collage-column { overflow: hidden; min-width: 0; }
.collage-track {
  display: block;
  animation: collage-up 240s linear infinite;
  will-change: transform;
}
/* Every other column moves the opposite way, at a slightly different speed */
.collage-column:nth-child(even) .collage-track {
  animation-name: collage-down;
  animation-duration: 280s;
}
@keyframes collage-up { to { transform: translateY(-50%); } }
@keyframes collage-down {
  from { transform: translateY(-50%); }
  to { transform: translateY(0); }
}
.splash.ready .splash-collage { animation: fade-in 1.8s ease 1.4s forwards; }
.collage-track img {
  display: block;
  width: 100%;
  height: auto;
  padding-bottom: 4px;
}
/* Darkens the photos so the signature stays readable */
.splash-collage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.3));
  opacity: calc(1 - var(--reveal));
  pointer-events: none;
}
/* Clicks pass through these to the photos, apart from the link itself */
.signature, .splash-hint {
  position: relative;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}
/* The drag moves the signature to the top and the link to the bottom, out of the photos' way */
.signature {
  transform: translateY(calc(var(--reveal) * -34vh)) scale(calc(1 - var(--reveal) * 0.55));
}
.splash-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: absolute;
  left: 50%;
  /* From just under the signature (0) to the bottom of the screen (1) */
  top: calc((50% + var(--signature-size) * 0.72) * (1 - var(--reveal)) + (100% - 100px) * var(--reveal));
  transform: translateX(-50%);
  white-space: nowrap;
}
.splash-link {
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  text-decoration: none;
  pointer-events: auto;
  cursor: pointer;
  transition: background 0.2s;
}
.splash-link:hover { background: rgba(0, 0, 0, 0.8); }
.splash-tip {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.7rem;
}
.signature {
  /* side padding keeps the font's long swashes inside the reveal */
  padding: 0.25em 0.5em;
  font-family: var(--signature);
  font-size: var(--signature-size);
  line-height: 1.1;
  white-space: nowrap;
  clip-path: inset(0 100% 0 0);
}
.splash.ready .signature { animation: sign 2.2s cubic-bezier(0.55, 0.1, 0.4, 1) forwards; }
.splash-hint {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0;
  transition: color 0.2s;
}
.splash.ready .splash-hint { animation: fade-in 0.8s ease 2.2s forwards; }
.splash-hint { color: #d8d8d4; }
.splash.done .signature { animation: none; clip-path: none; }
.splash.done .splash-hint { animation: none; opacity: 1; }
.splash.done .splash-collage { animation: none; opacity: 1; }
@keyframes sign { to { clip-path: inset(0 0 0 0); } }
@keyframes fade-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .splash { transition: none; }
  .signature { clip-path: none; }
  .splash.ready .signature { animation: none; }
  .splash-hint, .splash.ready .splash-hint { animation: none; opacity: 1; }
  .splash-collage, .splash.ready .splash-collage { animation: none; opacity: 1; }
  .collage-track, .collage-column:nth-child(even) .collage-track { animation: none; }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(16px, 4vw, 48px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-family: var(--signature);
  font-size: 2.6rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
nav { display: flex; gap: clamp(14px, 3vw, 28px); }
nav a { color: var(--muted); font-size: 0.95rem; text-decoration: none; }
nav a:hover, nav a.active { color: var(--fg); }

main {
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 48px) 96px;
}

/* Gallery list */
.gallery-index {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.gallery-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--tile);
  text-decoration: none;
}
.gallery-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s;
}
.gallery-card:hover img { transform: scale(1.03); }
@media (min-width: 900px) {
  /* On desktop the gallery cards fill the whole screen below the header */
  main.fill-screen { max-width: none; padding: 16px; }
  .fill-screen .gallery-index {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    height: calc(100vh - 71px - 32px);
    min-height: 420px;
  }
  .fill-screen .gallery-card { aspect-ratio: auto; }
}
.gallery-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 20px 16px;
  font-size: 1.25rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

/* One gallery */
.gallery-heading { margin-bottom: 24px; }
.back { color: var(--muted); font-size: 0.9rem; text-decoration: none; }
.back:hover { color: var(--fg); }
.gallery-heading h1, .about h1 { margin: 4px 0 0; font-size: 2rem; font-weight: 400; }
.photo-grid { columns: 3 300px; column-gap: 12px; }
.tile {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: var(--tile);
  cursor: zoom-in;
  break-inside: avoid;
}
.tile img { display: block; width: 100%; height: auto; }
.empty { color: var(--muted); margin: 0; }

.gallery-note { margin: 6px 0 0; color: var(--muted); }

/* Contact sheet */
.contact-sheet {
  --frame-height: clamp(170px, 21vw, 300px);
  display: flex;
  flex-wrap: wrap;
  row-gap: 14px;
  padding: clamp(10px, 2vw, 24px);
  background: #000;
}
.contact-sheet > .empty { padding: 8px; }
.frame {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: #17130f;
  cursor: zoom-in;
}
.film-rail {
  align-self: stretch;
  height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='15'%3E%3Crect x='4' y='3' width='8' height='9' rx='1.5' fill='%23cfc8b6'/%3E%3C/svg%3E") left center / 16px 15px round;
}
.film-text {
  align-self: stretch;
  overflow: hidden;
  height: 15px;
  padding: 0 8px;
  color: #d39a3a;
  font: 600 9px/15px ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: 0.14em;
  text-align: left;
  white-space: nowrap;
}
.frame-picture {
  position: relative;
  display: block;
  margin: 2px 5px;
}
.frame-picture img {
  display: block;
  height: var(--frame-height);
  /* Holds a frame's place until its photo has loaded */
  min-width: calc(var(--frame-height) * 1.5);
  max-width: 100%;
  background: #000;
  transition: filter 0.25s;
}
.frame.loaded .frame-picture img { min-width: 0; }
.pencil {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  overflow: visible;
  pointer-events: none;
}
.pencil path {
  fill: none;
  stroke: #e5332a;
  stroke-width: 3;
  stroke-linecap: round;
}
.pencil {
  opacity: 0;
  clip-path: inset(-8px 100% -8px -8px);
  transition: clip-path 0.45s ease-out, opacity 0.1s;
}
.frame:hover .pencil, .frame:focus-visible .pencil {
  opacity: 1;
  clip-path: inset(-8px -8px -8px -8px);
}
.frame:hover .frame-picture img, .frame:focus-visible .frame-picture img { filter: brightness(1.08); }
@media (prefers-reduced-motion: reduce) {
  .pencil { transition: none; }
}
@media (max-width: 600px) {
  .contact-sheet { --frame-height: 44vw; padding: 8px; }
}

/* About */
.about { max-width: 640px; }
.about p { color: var(--muted); margin: 16px 0 0; }
.about a:hover { color: var(--fg); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.95);
}
/* Opened from the landing screen: the moving photos stay visible behind */
.lightbox.over-slideshow {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.over-slideshow .lb-frame { box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7); }
/* The zoomed photo stays inside this box */
.lb-frame {
  width: fit-content;
  margin: 0 auto;
  overflow: hidden;
}
.lb-frame img { cursor: zoom-in; transition: transform 0.2s ease-out; }
.zoomed .lb-frame img { cursor: zoom-out; touch-action: none; }
.lb-zoom { top: 8px; right: 64px; }
@media (prefers-reduced-motion: reduce) {
  .lb-frame img { transition: none; }
}
.lightbox figure { margin: 0; max-width: 92vw; text-align: center; }
.lightbox img { display: block; max-width: 92vw; max-height: 80vh; margin: 0 auto; object-fit: contain; }
.lightbox figcaption { margin-top: 10px; color: #ddd; font-size: 0.95rem; }
.lightbox figcaption span { display: block; }
.lightbox figcaption span:empty { display: none; }
/* Camera-style shot details */
.lb-details {
  margin-top: 2px;
  color: #d39a3a;
  font: 600 0.75rem/1.5 ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: 0.08em;
}
.over-slideshow figcaption { text-shadow: 0 1px 6px #000; }
.over-slideshow .lb-details {
  display: inline-block;
  margin-top: 0;
  padding: 2px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
}
.lb-btn {
  position: absolute;
  z-index: 1;
  padding: 16px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.lb-btn:hover { opacity: 1; }
.lb-close { top: 8px; right: 8px; }
.lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 4px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  /* Keeps the text clear of the arrows in the bottom corners */
  .lightbox figcaption { padding: 0 48px; }
}
