/* Photographs: the homepage row, the library page and the viewer.
   The photographs stay crisp, with rounded corners and their own colours,
   like the portrait; glass appears only on the controls. */
.photo-page {
  margin: 0;
  padding: 0 0 72px;
  max-width: none;
  font-family: 'Opening Newsreader', 'Newsreader', Georgia, serif;
}
.photo-shell { width: calc(100% - 64px); max-width: 1240px; margin: 56px auto 0; }
.photo-header h1 {
  margin: 0 0 36px;
  font-size: clamp(56px, 7.4vw, 96px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.035em;
}
.photo-footer { margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--rule); font-size: 18px; }

.photo-wall { display: grid; gap: 12px; }
.photo-row { display: flex; gap: 12px; }
.photo-row .photo { flex: var(--ratio) 1 0; aspect-ratio: var(--ratio); min-width: 0; }
.photo-fill { flex: var(--fill) 1 0; }
.photo {
  display: block;
  overflow: hidden;
  border-radius: 14px;
  background: color-mix(in srgb, var(--olive) 9%, var(--bg));
  cursor: zoom-in;
}
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.home-photos { padding: 56px 0 58px; }
.home-photos > .section-title {
  margin: 0 0 30px;
  gap: 15px;
  font-size: 36px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.home-photos > .section-title .section-symbol { width: 28px; height: 28px; }
.home-photos > .section-title:focus { outline: none; }

/* The line that opens the fun part of the page, in his words. */
.fun-line {
  max-width: 720px;
  margin: 64px auto 0;
  padding: 0 12px;
  font-size: 22px;
  font-style: italic;
  line-height: 1.55;
  text-align: center;
  text-wrap: balance;
}

/* Pick a colour: seven colour families made from the photos themselves. */
.pick-prompt { margin: -12px 0 16px; color: var(--olive); font-size: 19px; font-style: italic; }
.photo-header .pick-prompt { margin-top: -22px; }
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 0 0 28px; }
.pick-dot {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.pick-dot:hover { transform: scale(1.08); }
.pick-dot[aria-pressed="true"] { transform: scale(1.12); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c); }
.pick-dot:focus-visible, .pick-all:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.pick-all { min-height: 42px; padding: 0 18px; border: 1px solid var(--rule); border-radius: 999px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.pick-all[aria-pressed="true"] { border-color: transparent; background: color-mix(in srgb, var(--olive) 16%, transparent); }
.photo-wall [hidden] { display: none !important; }
.photo-page { transition: background-color .9s ease, color .4s ease; }
.pick-wall, .pick-wall .photo-row { gap: 6px; }
.pick-wall .photo { border-radius: 8px; }

/* The viewer: one photograph, uncropped, with a glass dock. */
.photo-viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 24px 24px 96px;
  border: 0;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  color: var(--text);
}
.photo-viewer[open] { display: grid; place-items: center; }
.photo-viewer::backdrop { background: transparent; }
.viewer-image {
  max-width: 100%;
  max-height: calc(100dvh - 120px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 30px 60px -40px rgba(30, 26, 18, .5);
}
.viewer-dock {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
}
.viewer-dock button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--olive);
  cursor: pointer;
}
.viewer-dock button:hover { background: color-mix(in srgb, var(--olive) 12%, transparent); }
.viewer-dock button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.viewer-dock svg { width: 21px; height: 21px; }
#viewer-close { margin-left: 6px; }
#viewer-count { min-width: 58px; color: var(--olive); font-size: 15px; font-style: italic; text-align: center; }
.viewer-note {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  color: var(--olive);
  font-size: 15px;
  font-style: italic;
  opacity: 0;
  transition: opacity .2s ease;
}
.viewer-note.is-shown { opacity: 1; }

@media (max-width: 760px) {
  .photo-shell { width: calc(100% - 32px); margin-top: 36px; }
  .photo-header h1 { margin-bottom: 26px; }
  .photo-wall { display: block; columns: 2; column-gap: 8px; }
  .photo-row { display: contents; }
  .photo-row .photo { margin: 0 0 8px; break-inside: avoid; border-radius: 10px; }
  .photo-fill { display: none; }
  .home-photos { padding: 36px 0 44px; }
  /* Three photos on a phone: one wide, two square beneath it. */
  .home-photos .photo-wall { columns: auto; }
  .home-photos .photo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-photos .photo-row .photo { margin: 0; aspect-ratio: 1; }
  .home-photos .photo-row .photo:first-child { grid-column: 1 / -1; aspect-ratio: 3 / 2; }
  .home-photos > .section-title { font-size: 34px; gap: 13px; margin-bottom: 22px; }
  .home-photos > .section-title .section-symbol { width: 25px; height: 25px; }
  .photo-viewer { padding: 12px 12px 88px; }
  .viewer-image { max-height: calc(100dvh - 100px); }
  .fun-line { margin-top: 44px; font-size: 19px; }
  .photo-header .pick-prompt { margin-top: -14px; }
  .picker { gap: 9px; }
  .pick-dot { width: 34px; height: 34px; }
  .pick-all { min-height: 34px; padding: 0 12px; }
  /* The colour wall reads across rows, so phones get small squares, three to a row. */
  .pick-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; columns: auto; }
  .pick-wall .photo-row .photo { margin: 0; aspect-ratio: 1; border-radius: 6px; }
  .viewer-dock button { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .viewer-note, .pick-dot, .photo-page { transition: none; }
}
@media print {
  .photo-viewer, .opening-nav { display: none; }
}
