/* ─────────────────────────────────────────────
   6c66

   Warm paper. Documentary photography.
   Braun White (#F0EDE5) walls, Warm Black (#1A1A18) ink.
   Two type sizes. Everything earns its place.
   ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-size: var(--text-sm);
}
.skip-link:focus {
  left: 0;
}

:root {
  color-scheme: light dark;
  /* Palette */
  --bg:      #F0EDE5;
  --text:    #1A1A18;
  --muted:   #6B6862;
  /* Type — two sizes: md identifies, sm supports
     sm → md  =  12 → 14 px  */
  --text-sm:  0.75rem;
  --text-md:  0.875rem;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
          Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code",
          "Fira Code", Menlo, monospace;

  /* Layout — all dimensions proportional to the viewport */
  --page-pad:    max(1.5rem, 5vw);
  --grid-gap:    max(8px, 1.5vw);
  --row-height:  clamp(200px, 28vw, 40vh);
}

/* ─────────────────────────────────────────────
   Base
   ───────────────────────────────────────────── */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: calc(4 * var(--grid-gap)) var(--page-pad) var(--grid-gap);
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ─────────────────────────────────────────────
   Header
   ───────────────────────────────────────────── */
.site-header {
  padding: var(--grid-gap) var(--page-pad) 0;
}

.site-title {
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--muted);
}

.site-title:hover {
  color: var(--text);
}

/* ─────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────── */
.site-footer {
  display: flex;
  gap: 1.5rem;
  padding: calc(2 * var(--grid-gap)) var(--page-pad) var(--grid-gap);
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--muted);
}

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

/* ─────────────────────────────────────────────
   Gallery section
   ───────────────────────────────────────────── */
.gallery {
  margin-bottom: calc(8 * var(--grid-gap));
}

.gallery:last-child {
  margin-bottom: 0;
}

.gallery-header {
  margin-bottom: var(--grid-gap);
}

.gallery-title {
  font-family: var(--mono);
  font-size: var(--text-md);
  font-weight: 400;
  color: var(--muted);
}

.gallery-title a:hover {
  color: var(--text);
}

.gallery-description,
.gallery-date {
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Photo grid — justified rows

   Each row fills the width. Images flex-grow by
   their aspect ratio so every photograph keeps
   its native proportions.
   ───────────────────────────────────────────── */
.photo-grid {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
}

.photo-row {
  display: flex;
  gap: var(--grid-gap);
}

.photo-row.partial::after {
  content: '';
  flex-grow: 999;
}

.photo-cell {
  flex-grow: var(--ratio);
  flex-basis: calc(var(--ratio) * var(--row-height));
  min-width: 0;
  overflow: hidden;
}

/* ─────────────────────────────────────────────
   Photo card — grid thumbnail with caption
   ───────────────────────────────────────────── */
.photo-card a {
  display: block;
}

.photo-card img {
  width: 100%;
  height: auto;
}

.photo-card-caption {
  padding-top: 0.5rem;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
   Single photo page

   The photograph fills exactly one viewport.
   Nothing scrolls, nothing competes.
   ───────────────────────────────────────────── */
.layout-photo {
  height: 100dvh;
  overflow: hidden;
}

.layout-photo main {
  padding: var(--grid-gap) var(--page-pad);
}

.photo-single {
  display: flex;
  justify-content: center;
  /* 3 × grid-gap = header-top + main-top + main-bottom.
     text-sm × 1.5 = one header text line at body line-height. */
  --single-h: calc(100dvh - 3 * var(--grid-gap) - var(--text-sm) * 1.5);
  overflow: hidden;
}

.photo-single-content {
  /* --photo-ratio set via inline style.
     Width assumes the photo fills the full height — the details
     bar makes it slightly shorter, so the container is marginally
     wider than the photograph. No fragile pixel estimates. */
  width: min(100%, calc(var(--single-h) * var(--photo-ratio)));
  height: var(--single-h);
  display: flex;
  flex-direction: column;
}

.photo-single-image {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-single-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.photo-single-details {
  min-height: 0;
  overflow-y: auto;
  padding-top: clamp(1rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.photo-single-info {
  text-align: center;
}

.photo-caption {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.4;
}

.photo-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.25rem;
  font-size: var(--text-sm);
  color: var(--muted);
}

.photo-single-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: var(--text-sm);
  color: var(--muted);
  white-space: nowrap;
}

.photo-single-nav a:hover {
  color: var(--text);
}

/* ─────────────────────────────────────────────
   Page header
   ───────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--grid-gap);
}

.page-header h1 {
  font-family: var(--mono);
  font-size: var(--text-md);
  font-weight: 400;
}

/* ─────────────────────────────────────────────
   Empty state
   ───────────────────────────────────────────── */
.empty-state {
  font-size: var(--text-sm);
  color: var(--muted);
  padding: var(--grid-gap) 0;
}

/* ─────────────────────────────────────────────
   Utilities
   ───────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────────────────────────────────────
   Focus
   ───────────────────────────────────────────── */
a:focus-visible {
  color: var(--text);
  outline: 1px solid var(--muted);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .photo-row {
    flex-wrap: wrap;
  }

  .photo-cell {
    flex-grow: 0;
    flex-basis: 100%;
  }

  .photo-single-nav {
    gap: 0;
  }

  .photo-single-nav a {
    padding: 0.75rem 0.5rem;
  }
}

/* ─────────────────────────────────────────────
   Dark mode
   ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:    #1A1A18;
    --text:  #F0EDE5;
    --muted: #9E9B93;
  }
}

/* ─────────────────────────────────────────────
   Accessibility
   ───────────────────────────────────────────── */
@media (prefers-contrast: more) {
  :root {
    --text:   #000000;
    --muted:  #555555;
  }
}

/* ─────────────────────────────────────────────
   Print — prevent clipping, hide interactive chrome
   ───────────────────────────────────────────── */
@media print {
  .skip-link,
  .photo-single-nav {
    display: none;
  }

  .layout-photo {
    height: auto;
    overflow: visible;
  }

  .photo-single {
    height: auto;
    --single-h: auto;
  }

  .photo-single-content {
    width: 100%;
    height: auto;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --text:   #FFFFFF;
    --muted:  #BBBBBB;
  }
}
