/* ---------------------------------------------------------
   Tokens
--------------------------------------------------------- */
/* ---------------------------------------------------------
   Tokens

   Colours and type come from the theme, which lives in the `theme` block
   of js/config.js and is edited under Appearance in the rating tool.
   generate-data.js writes the actual values into a <style> block in
   index.html; the fallbacks after each comma below are what you get if
   that block is ever missing.

   Each piece of text has its own set of --t-* variables (font, size,
   weight, spacing, transform, style) so headings, menu links, captions
   and so on can be changed independently.
--------------------------------------------------------- */
:root {
  --nav-bg: var(--c-nav-background, #171614);
  --nav-text: var(--c-nav-text, #ede7dd);
  --nav-text-dim: var(--c-nav-text-muted, #8b857a);

  --bg: var(--c-background, #f6f3ec);
  --surface: var(--c-surface, #eeebe1);
  --ink: var(--c-text, #211f1b);
  --ink-dim: var(--c-text-muted, #6f6a5e);
  --hairline: var(--c-hairline, #dcd9d3);

  /* labels sitting on top of photos stay light regardless of the theme,
     since they're always over a dark scrim */
  --overlay-text: #f6f3ec;
  --overlay-text-dim: rgba(246, 243, 236, 0.75);
  --overlay-scrim: rgba(15, 14, 12, 0.6);

  --safelight: var(--c-accent, #c1442d);

  --nav-h: 60px;
  --gutter: 2px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

img {
  max-width: 100%;
  display: block;
}

::selection { background: var(--safelight); color: var(--overlay-text); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------
   Accessibility: skip link + keyboard focus states
--------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 200;
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 10px 16px;
  font-family: var(--t-label-font);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 0 0 4px 4px;
  transition: top 0.2s ease;
}

.skip-link:focus { top: 0; }

a:focus-visible,
button:focus-visible,
.frame-media:focus-visible,
.album-card:focus-visible {
  outline: 2px solid var(--safelight);
  outline-offset: 2px;
}

#app:focus-visible { outline: none; }

/* ---------------------------------------------------------
   Nav (always dark)
--------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: rgba(23, 22, 20, 0.92);
  border-bottom: 1px solid rgba(139, 133, 122, 0.25);
}

.nav::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-inner {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-title {
  font-family: var(--t-site-name-font);
  font-size: var(--t-site-name-size);
  font-weight: var(--t-site-name-weight);
  letter-spacing: var(--t-site-name-spacing);
  text-transform: var(--t-site-name-transform);
  font-style: var(--t-site-name-style);
  color: var(--nav-text);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-item { position: relative; }

.nav-link {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--nav-text-dim);
  font-family: var(--t-menu-links-font);
  font-size: var(--t-menu-links-size);
  font-weight: var(--t-menu-links-weight);
  letter-spacing: var(--t-menu-links-spacing);
  text-transform: var(--t-menu-links-transform);
  font-style: var(--t-menu-links-style);
  padding: 8px 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active { color: var(--nav-text); }

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 1px;
  width: 0;
  background: var(--safelight);
  transition: width 0.2s ease;
}

.nav-link:hover::after,
.nav-link.active::after { width: 100%; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 22px;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 1px;
  width: 100%;
  background: var(--nav-text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (max-width: 780px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    background: var(--nav-bg);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 24px 40px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.28s ease;
  }

  .nav-links.open { transform: translateX(0); }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid rgba(139, 133, 122, 0.15);
  }

  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 16px 2px;
    font-size: 14px;
  }

  .nav-toggle.open span:nth-child(1) { transform: translateY(10.5px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-10.5px) rotate(-45deg); }
}

/* ---------------------------------------------------------
   Page shell / headers
--------------------------------------------------------- */
#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  min-height: 60vh;
}

.page-head { margin-bottom: 28px; }

.breadcrumb {
  font-family: var(--t-label-font);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  letter-spacing: var(--t-label-spacing);
  text-transform: var(--t-label-transform);
  font-style: var(--t-label-style);
  color: var(--ink-dim);
  margin-bottom: 10px;
}

.breadcrumb a { color: var(--ink-dim); }
.breadcrumb a:hover { color: var(--ink); }

.page-title {
  font-family: var(--t-page-title-font);
  font-size: var(--t-page-title-size);
  font-weight: var(--t-page-title-weight);
  letter-spacing: var(--t-page-title-spacing);
  text-transform: var(--t-page-title-transform);
  font-style: var(--t-page-title-style);
  margin: 0 0 6px;
  color: var(--ink);
}

.page-tagline {
  font-family: var(--t-body-text-font);
  font-size: var(--t-body-text-size);
  font-weight: var(--t-body-text-weight);
  letter-spacing: var(--t-body-text-spacing);
  text-transform: var(--t-body-text-transform);
  font-style: var(--t-body-text-style);
  color: var(--ink-dim);
  max-width: 56ch;
  line-height: 1.6;
  margin: 0;
}

.eyebrow {
  font-family: var(--t-label-font);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  letter-spacing: var(--t-label-spacing);
  text-transform: var(--t-label-transform);
  font-style: var(--t-label-style);
  color: var(--safelight);
  margin: 0 0 10px;
}

/* ---------------------------------------------------------
   Album index
--------------------------------------------------------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gutter);
  background: var(--hairline);
}

.album-card {
  background: var(--surface);
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: pointer;
  display: block;
}

.album-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  /* The original slight desaturation, restored. Delete the filter lines
     here and on :hover to show covers at full saturation instead. */
  filter: grayscale(10%);
  transition: opacity 0.4s ease, transform 0.5s ease, filter 0.4s ease;
}

.album-card img.loaded { opacity: 1; }

.album-card:hover img { transform: scale(1.045); filter: grayscale(0%); }

.album-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--overlay-scrim) 0%, rgba(15, 14, 12, 0.02) 55%);
}

.album-card-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px;
  z-index: 1;
}

.album-card-title {
  font-family: var(--t-album-title-font);
  font-size: var(--t-album-title-size);
  font-weight: var(--t-album-title-weight);
  letter-spacing: var(--t-album-title-spacing);
  text-transform: var(--t-album-title-transform);
  font-style: var(--t-album-title-style);
  color: var(--overlay-text);
  margin: 0 0 3px;
}

.album-card-count {
  font-family: var(--t-label-font);
  font-size: calc(var(--t-label-size) * 0.95);
  font-weight: var(--t-label-weight);
  letter-spacing: var(--t-label-spacing);
  text-transform: var(--t-label-transform);
  color: var(--overlay-text-dim);
}

/* ---------------------------------------------------------
   Masonry photo grid (contact-sheet style)

   Columns are flex children and each photo is placed into the shortest
   one by js/app.js. This replaced CSS `column-count`, which re-flowed
   every already-visible photo each time another batch was appended —
   so the grid jumped around under you while scrolling a long album.
--------------------------------------------------------- */
.masonry {
  display: flex;
  align-items: flex-start;
  gap: var(--gutter);
  background: var(--hairline);
}

.masonry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}

.frame {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.frame-media {
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  outline-offset: -2px;
  /* aspect-ratio is set inline per photo from the real file dimensions,
     so the full page height is correct before anything downloads. */
}

.frame-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.frame-media img.loaded { opacity: 1; }

/* A photo that fails to load keeps its reserved space rather than
   collapsing the column; it just reads as an empty frame. */
.frame-broken .frame-media img { display: none; }

.frame-number {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-family: var(--t-label-font);
  font-size: calc(var(--t-label-size) * 0.9);
  letter-spacing: var(--t-label-spacing);
  color: var(--overlay-text-dim);
  background: var(--overlay-scrim);
  padding: 3px 7px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.frame-media:hover .frame-number { opacity: 1; }

/* Captions sit under the photo, always visible — a note about a picture
   is worth reading without having to hover, and there is no hover at all
   on a phone. */
.frame-caption {
  margin: 0;
  padding: 8px 10px 12px;
  font-family: var(--t-caption-font);
  font-size: var(--t-caption-size);
  font-weight: var(--t-caption-weight);
  letter-spacing: var(--t-caption-spacing);
  text-transform: var(--t-caption-transform);
  font-style: var(--t-caption-style);
  line-height: 1.45;
  color: var(--ink-dim);
}

.sentinel { height: 1px; }

.load-more-hint {
  text-align: center;
  padding: 24px 0 4px;
  font-family: var(--t-label-font);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  letter-spacing: var(--t-label-spacing);
  text-transform: var(--t-label-transform);
  font-style: var(--t-label-style);
  color: var(--ink-dim);
}

.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--ink-dim);
  font-family: var(--t-label-font);
  font-size: 13px;
}

/* ---------------------------------------------------------
   Prose (About page, not-found)
--------------------------------------------------------- */
.prose {
  max-width: 62ch;
  font-family: var(--t-body-text-font);
  font-size: var(--t-body-text-size);
  font-weight: var(--t-body-text-weight);
  letter-spacing: var(--t-body-text-spacing);
  text-transform: var(--t-body-text-transform);
  font-style: var(--t-body-text-style);
  font-size: calc(var(--t-body-text-size) * 1.06);
  line-height: 1.75;
  color: var(--ink);
}

.prose p { margin: 0 0 1.1em; }

.prose-meta {
  font-family: var(--t-label-font);
  font-size: 12px;
  letter-spacing: var(--t-label-spacing);
  color: var(--ink-dim);
  text-transform: var(--t-label-transform);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.contact-link {
  font-family: var(--t-label-font);
  font-size: 12.5px;
  letter-spacing: var(--t-label-spacing);
  color: var(--safelight);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.contact-link:hover { border-bottom-color: var(--safelight); }

/* ---------------------------------------------------------
   Lightbox — kept dark for viewing photos, like a light table
--------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 9, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  /* `visibility: hidden` (not just opacity + pointer-events) is what keeps
     the close/prev/next buttons out of the keyboard tab order while the
     lightbox is closed. */
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  touch-action: pan-y;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.25s ease, visibility 0s;
}

.lb-figure {
  margin: 0;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb-figure img {
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lb-figure img.loaded { opacity: 1; }

.lb-figure figcaption {
  margin-top: 14px;
  font-family: var(--t-label-font);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  letter-spacing: var(--t-label-spacing);
  text-transform: var(--t-label-transform);
  font-style: var(--t-label-style);
  color: var(--nav-text-dim);
  text-align: center;
}

.lb-close, .lb-nav {
  position: absolute;
  background: none;
  border: none;
  color: var(--nav-text);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s ease;
}

.lb-close:hover, .lb-nav:hover { opacity: 1; }

.lb-close {
  top: 16px;
  right: 20px;
  font-size: 32px;
  line-height: 1;
  padding: 4px 12px;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  padding: 10px 16px;
}

.lb-prev { left: 4px; }
.lb-next { right: 4px; }

@media (max-width: 600px) {
  .lb-nav { font-size: 30px; padding: 8px 10px; }
}

/* ---------------------------------------------------------
   No-JavaScript fallback
--------------------------------------------------------- */
.noscript-fallback {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.noscript-fallback h1 {
  font-family: var(--font-display);
  font-weight: 500;
}

.noscript-fallback ul { line-height: 2; }
.noscript-fallback a { border-bottom: 1px solid var(--hairline); }

.noscript-fallback img {
  margin: 2px 0;
  max-width: 480px;
  height: auto;
}

/* ---------------------------------------------------------
   Footer
--------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 28px 20px 40px;
  text-align: center;
}

.site-footer .footer-note {
  font-family: var(--t-footer-font);
  font-size: var(--t-footer-size);
  font-weight: var(--t-footer-weight);
  letter-spacing: var(--t-footer-spacing);
  text-transform: var(--t-footer-transform);
  font-style: var(--t-footer-style);
  color: var(--ink-dim);
}

.site-footer .footer-links {
  margin-top: 10px;
  display: flex;
  gap: 18px;
  justify-content: center;
}

.site-footer .footer-links a {
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.site-footer .footer-links a:hover { color: var(--safelight); }

/* ---------------------------------------------------------
   "Other" dropdown in the menu bar
   Text pages (About, Contact, ...) are grouped here so they
   don't crowd out the photo menus.
--------------------------------------------------------- */
.nav-item-has-menu { position: relative; }

.nav-link-toggle {
  background: none;
  border: none;
  cursor: pointer;
}

.nav-caret {
  display: inline-block;
  transform: rotate(90deg);
  transition: transform 0.2s ease;
  font-size: 1.1em;
  line-height: 1;
}

.nav-item-has-menu.open .nav-caret { transform: rotate(-90deg); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: var(--nav-bg);
  border: 1px solid rgba(139, 133, 122, 0.25);
  padding: 6px 0;
  display: none;
  z-index: 50;
}

.nav-item-has-menu.open .nav-dropdown { display: block; }

.nav-dropdown-link {
  display: block;
  padding: 9px 18px;
  color: var(--nav-text-dim);
  font-family: var(--t-menu-links-font, var(--font-body));
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-dropdown-link:hover,
.nav-dropdown-link.active {
  color: var(--nav-text);
  background: rgba(139, 133, 122, 0.12);
}

@media (max-width: 780px) {
  /* In the slide-out panel the dropdown becomes a plain indented
     section — no floating panel to get lost behind anything. */
  .nav-item-has-menu { width: 100%; }

  .nav-dropdown {
    position: static;
    min-width: 0;
    border: none;
    background: none;
    padding: 0 0 8px;
  }

  .nav-dropdown-link {
    padding: 12px 2px 12px 18px;
    font-size: 13px;
    border-top: 1px solid rgba(139, 133, 122, 0.12);
  }
}

/* ---------------------------------------------------------
   Single-picture album
   An album holding one work — a collage, a panorama — gets the
   full width rather than sitting as one tile in a grid.
--------------------------------------------------------- */
.solo { margin: 0 0 8px; }

.solo-frame {
  position: relative;
  width: 100%;
  max-height: 88vh;
  background: var(--c-surface, var(--surface));
  overflow: hidden;
  cursor: zoom-in;
}

.solo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.solo-frame img.loaded { opacity: 1; }

.solo-caption {
  margin: 12px 0 0;
  font-family: var(--t-caption-font, var(--font-mono));
  font-size: var(--t-caption-size, 10.5px);
  color: var(--c-text-muted, var(--ink-dim));
}

/* On a wide screen the single work breaks out of the page margins
   and runs edge to edge. */
@media (min-width: 900px) {
  .solo {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
  .solo-frame { max-height: 92vh; }
  .solo-caption { padding: 0 20px; text-align: center; }
}

/* ---------------------------------------------------------
   Pictures on text pages (About, Contact)
--------------------------------------------------------- */
.page-portrait {
  float: right;
  width: min(260px, 38%);
  margin: 0 0 20px 28px;
}

.page-portrait img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 620px) {
  /* Too narrow to wrap text around a portrait — stack it instead. */
  .page-portrait { float: none; width: min(220px, 60%); margin: 0 0 24px; }
}

.page-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--gutter, 2px);
  margin-top: 32px;
  clear: both;
}

.page-image img { width: 100%; height: auto; display: block; }

/* ---------------------------------------------------------
   Lightbox zoom
--------------------------------------------------------- */
.lb-figure img {
  transform-origin: center center;
  transition: transform 0.18s ease;
  cursor: zoom-in;
  touch-action: none; /* we handle pinch and drag ourselves */
}

.lightbox.zoomed .lb-figure img { transition: none; }

/* Out of the way while you're looking closely. */
.lightbox.zoomed .lb-nav,
.lightbox.zoomed .lb-figure figcaption { opacity: 0; pointer-events: none; }

.lightbox.zoomed { touch-action: none; }

/* Caption under a page portrait, when the picture has one. */
.page-portrait-caption {
  margin: 8px 0 0;
  font-family: var(--t-caption-font, var(--font-mono));
  font-size: var(--t-caption-size, 10.5px);
  color: var(--c-text-muted, var(--ink-dim));
}

.page-image { cursor: zoom-in; }
