/* monwithcam: warm paper, quiet type, photos first. */
:root {
  --paper: #f2f0e9;
  --ink: #24221f;
  --stone: #6b665e;
  --rule: #dcdbcf;
  --sage: #dcdbcf;
  --viewer: #f2f0e9;

  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", "Avenir Next", system-ui, sans-serif;

  --gutter: clamp(16px, 4.5vw, 72px);
  --gap: clamp(12px, 1.6vw, 24px);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

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

a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  z-index: 20;
}
.skip:focus { top: 10px; }

/* Header: wordmark left, three quiet links right, like Teo's. */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(20px, 3vw, 36px) var(--gutter) clamp(28px, 4vw, 56px);
}

.wordmark {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.top nav { display: flex; gap: clamp(16px, 2.5vw, 32px); }
.top nav a {
  padding: 10px 0;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--stone);
  transition: color 200ms ease;
}
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
}

/* Photos page: a masonry grid, like Fox's, with room to breathe. */
.grid {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: 0 var(--gutter);
}
.col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.photo {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--rule);
  cursor: zoom-in;
}
.photo img {
  width: 100%;
  aspect-ratio: var(--ar);
  transition: opacity 250ms ease;
}
.photo:hover img { opacity: 0.9; }

/* Story lines: a few photos carry a short line underneath, like a film still's subtitle. */
.story {
  margin: 10px 0 0;
  max-width: 38ch;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--ink);
}

/* A single series, opened from the Series page. */
.series-intro {
  padding: 0 var(--gutter) clamp(28px, 4vw, 48px);
  max-width: 60ch;
}
.series-intro h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1;
}
.series-intro p { margin: 0; }
.series-when { color: var(--stone); font-size: 0.9rem; margin-top: 6px !important; }

.series-back {
  padding: clamp(24px, 4vw, 48px) var(--gutter) 0;
  margin: 0;
}

/* Series list, like Teo's Work page, with one cover photo each. */
.series-list {
  margin: 0;
  padding: 0 var(--gutter);
  list-style: none;
  display: grid;
  gap: clamp(36px, 5vw, 64px);
  max-width: 1100px;
}

.series-item {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(20px, 3vw, 48px);
  align-items: end;
  text-decoration: none;
}
.series-item img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: opacity 250ms ease;
}
.series-item:hover img { opacity: 0.9; }

.series-text { display: grid; gap: 6px; }
.series-name {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  line-height: 1.05;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.series-blurb { max-width: 40ch; }
.series-meta { color: var(--stone); font-size: 0.9rem; }

/* About page */
.about {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: start;
  padding: 0 var(--gutter);
}
.about-photo { margin: 0; }
.about-photo figcaption {
  margin-top: 10px;
  text-align: right;
  color: var(--stone);
  font-size: 0.9rem;
}
.about-text { max-width: 46ch; }
.about-text h1 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  line-height: 1.1;
}
.about-text p { margin: 0 0 20px; }
.about-text ul { margin: 0; padding-left: 1.1em; }
.about-text li { margin-bottom: 10px; }

/* Footer band, borrowed from Teo's sage strip. */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: clamp(64px, 10vw, 140px);
  padding: 22px var(--gutter);
  background: var(--sage);
  font-size: 0.9rem;
}
.foot p { margin: 0; }
.foot a { padding: 10px 0; }

/* Viewer: the photo on the same paper colour, caption like a print label. */
dialog#viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--viewer);
  color: var(--ink);
  display: none;
  flex-direction: column;
}
dialog#viewer[open] { display: flex; animation: viewer-in 220ms ease-out; }
dialog#viewer::backdrop { background: var(--viewer); }

@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }

.viewer-stage {
  --pad: clamp(16px, 4vw, 56px);
  position: relative;
  flex: 1;
  min-height: 0;
}
.viewer-stage img {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: calc(100% - 2 * var(--pad));
  height: calc(100% - var(--pad));
  object-fit: contain;
  transition: opacity 160ms ease;
}
.viewer-stage img.loading { opacity: 0.35; }

.viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 56px) max(16px, env(safe-area-inset-bottom));
}
.viewer-text p { margin: 0; }
#viewer-caption { font-family: var(--serif); font-size: 1.3rem; line-height: 1.25; }
#viewer-story {
  margin-bottom: 4px !important;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.3;
}
#viewer-story:not([hidden]) + #viewer-caption {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--stone);
}
#viewer-meta { color: var(--stone); font-size: 0.9rem; }

.viewer-buttons { display: flex; gap: 4px; flex-shrink: 0; }
.viewer-buttons button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.viewer-buttons button:hover { background: var(--rule); }
.viewer-buttons svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .top { flex-direction: column; align-items: flex-start; gap: 8px; }
  .series-item { grid-template-columns: 1fr; }
  .foot { flex-direction: column; align-items: flex-start; gap: 4px; }
  .viewer-bar { flex-direction: column; align-items: stretch; }
  .viewer-buttons { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
