/* Photo albums use the site's lilac palette and show captions on every device. */
.album-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2.2vw, 26px);
}

.album-directory {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.album-grid a {
  display: flex;
  flex-direction: column;
  color: #403149;
  background: #fcf8fc;
  border: 1px solid #d8c9df;
  text-decoration: none;
}

.album-grid a:hover {
  background: #f3ebf7;
  border-color: #a98ab7;
}

.album-grid a:focus-visible,
.album-nav a:focus-visible,
.photo-viewer button:focus-visible {
  outline: 2px solid #765789;
  outline-offset: 3px;
}

.album-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eee5f3;
}

.album-directory img { aspect-ratio: 16 / 10; }

.album-caption {
  display: block;
  padding: 12px 14px;
  font-size: .83rem;
  line-height: 1.5;
}

.album-summary { padding: clamp(15px, 2.5vw, 28px); }
.album-summary h3 {
  margin: 5px 0 8px;
  font: 400 clamp(1.6rem, 3.6vw, 2.65rem)/1.12 'Palatino Linotype', Palatino, Georgia, serif;
}
.album-summary p { color: #604f68; }
.album-summary .album-meta { font-size: .8rem; }
.album-summary .album-action {
  display: inline-block;
  margin-top: 14px;
  color: #614574;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.album-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  margin-bottom: 14px;
}

.album-intro {
  max-width: 62ch;
  margin-bottom: 26px;
  color: #604f68;
}

.album-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #614574;
  text-underline-offset: 4px;
}

.folio :is(#albums, #cycling, #charity-sale, #leather-workshop) {
  scroll-margin-top: 86px;
}

html:has(.photo-viewer[open]) { overflow: hidden; }

.photo-viewer {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  max-width: none;
  max-height: none;
  border: 0;
  background: transparent;
  color: #403149;
}

.photo-viewer::backdrop { background: #211729dd; }

.photo-viewer-panel {
  width: min(860px, calc(100vw - 28px));
  padding: clamp(10px, 2vw, 20px);
  background: #fcf8fc;
  border: 1px solid #d8c9df;
}

.photo-viewer-header,
.photo-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-viewer-header { margin-bottom: 8px; }
.photo-viewer-footer { margin-top: 8px; }
.photo-position { font-size: .8rem; }
.photo-viewer figure { margin: 0; }

.photo-viewer-image {
  display: block;
  width: 100%;
  height: min(62dvh, 640px);
  object-fit: contain;
  background: #2c2331;
}

.photo-viewer figcaption {
  padding-top: 10px;
  font-size: .9rem;
  line-height: 1.4;
}

.photo-viewer button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cbb8d4;
  color: #4a3358;
  background: #f2eaf5;
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
}

.photo-viewer button:hover { background: #eadcf0; }

@media (max-width: 820px) {
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .album-directory { grid-template-columns: minmax(0, 1fr); }
  .album-caption { padding: 9px; }
}

@media (max-height: 480px) {
  .photo-viewer-image { height: max(110px, calc(100dvh - 160px)); }
}

/* The photo section shares the site's watercolor palette and gives the images room. */
.photo-masthead {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
  align-items: center;
  gap: clamp(24px, 6vw, 92px);
  width: min(1360px, calc(100% - 48px));
  margin: 104px auto 0;
  padding: clamp(30px, 6vw, 80px);
  background: linear-gradient(100deg, #fbf5fae3, #f7eef660), url('../images/hero-bg.png') center / cover;
  border: 1px solid #e0d0e5;
}

.photo-masthead h1,
.photo-index h2,
.album-summary h3 {
  font-family: 'Palatino Linotype', Palatino, Georgia, serif;
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: 1;
}

.photo-masthead h1 {
  margin: 16px 0;
  font-size: clamp(3.3rem, 8vw, 7rem);
  font-style: italic;
  color: #35263d;
}

.photo-masthead p {
  max-width: 32ch;
  color: #54415c;
  line-height: 1.65;
}

.photo-masthead .folio-kicker { max-width: none; }

.photo-masthead .photo-explore {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  min-height: 46px;
  margin-top: 24px;
  padding: 0 16px;
  background: #4e365a;
  color: #fff8ff;
  text-decoration: none;
}

.photo-masthead .photo-explore:hover { background: #664676; }

.photo-collage {
  position: relative;
  isolation: isolate;
  min-width: 0;
  margin: 0;
  padding: 7% 0 1% 7%;
}

.photo-collage figure,
.photo-plate {
  margin: 0;
  padding: 9px 9px 7px;
  background: #fffbf7;
  box-shadow: 0 12px 28px #3a234021;
}

.photo-collage figure:first-child { width: 58%; transform: rotate(-5deg); }

.photo-collage figure:last-child {
  position: absolute;
  z-index: 1;
  top: 2%;
  right: 1%;
  width: 51%;
  transform: rotate(6deg);
}

.photo-collage img,
.photo-plate img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.photo-collage img { aspect-ratio: 3 / 4; }

.photo-collage figcaption,
.photo-plate figcaption {
  padding: 7px 3px 1px;
  color: #5d4c61;
  font: .72rem/1.45 Georgia, serif;
}

.photo-plate { transform: rotate(2deg); }
.photo-plate img { aspect-ratio: 16 / 10; }

.folio .photo-index { padding-block: clamp(40px, 6vw, 85px); }
.photo-index h2 { font-size: clamp(2.4rem, 5vw, 4rem); margin-bottom: 24px; }

.photo-index .album-directory {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: start;
  gap: clamp(22px, 5vw, 64px);
}

.photo-index .album-directory a {
  border: 0;
  border-bottom: 1px solid #cebcd6;
  background: transparent;
}

.photo-index .album-directory img { aspect-ratio: 5 / 3; }
.photo-index .album-directory a:nth-child(2) { margin-top: clamp(10px, 5vw, 62px); }
.photo-index .album-directory a:nth-child(2) img { aspect-ratio: 4 / 3; }

.photo-index .album-summary {
  position: relative;
  padding: 18px 56px 22px 0;
}

.photo-index .album-summary h3 { font-size: clamp(2.2rem, 4.2vw, 3.6rem); }
.photo-index .album-summary .album-meta { color: #695270; }
.photo-index .album-summary .album-action {
  position: absolute;
  top: 23px;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin: 0;
  border: 1px solid #b49ac0;
  border-radius: 50%;
  text-decoration: none;
}

.photo-index .album-directory a:hover .album-action {
  background: #4e365a;
  border-color: #4e365a;
  color: #fff8ff;
}

.album-story .album-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(14px, 3vw, 34px);
  counter-reset: frame;
}

.album-story .album-photo-link {
  grid-column: span 6;
  min-width: 0;
  padding: 7px 7px 0;
  background: #fdf9fc;
  border: 1px solid #dfd0e4;
  box-shadow: 0 5px 16px #402b4710;
  counter-increment: frame;
}

.page-photos-cycling .album-photo-link { grid-column: span 4; }
.page-photos-cycling .album-photo-link:nth-child(4),
.page-photos-cycling .album-photo-link:nth-child(5) { grid-column: span 6; }

.album-story .album-photo-link img { aspect-ratio: 4 / 3; }
.album-story .album-photo-link:hover { background: #f0e8f5; }

.album-story .album-caption {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 11px 4px;
}

.album-caption::before {
  content: counter(frame, decimal-leading-zero);
  color: #74617b;
  font: .7rem/1.4 Georgia, serif;
}

.photo-viewer[open] {
  --photo-pigment-1: #91799e;
  --photo-pigment-2: #9b8aab;
  --photo-pigment-3: #cbb4c9;
  --photo-accent: color-mix(in srgb, var(--photo-pigment-1), #fff1ff 66%);
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #211827;
  color: #fff3ff;
  color-scheme: dark;
}

.photo-viewer[open]::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, #211827e6, #21182755 42%, #211827ef),
    var(--photo-scene, none) center / cover;
  filter: blur(45px) saturate(.9);
  opacity: .48;
  pointer-events: none;
  content: "";
}

.photo-viewer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(170px, 1fr) auto;
  width: min(100%, 1440px);
  min-height: 100%;
  height: 100dvh;
  margin: auto;
  padding: clamp(10px, 2.5vw, 30px);
  background: transparent;
  border: 0;
}

.photo-viewer-header { border-bottom: 1px solid #7d678591; padding-bottom: 10px; }
.photo-position { font-variant-numeric: tabular-nums; color: #ead8ed; }
.photo-viewer-actions { display: flex; gap: 8px; }
.photo-copy-link { min-width: 78px; }
.photo-copy-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.photo-viewer figure { display: grid; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
.photo-viewer figcaption { padding: 12px 0 0; text-align: center; color: #f7edf8; }

.photo-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  container-type: size;
}

.photo-frame {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  width: min(calc(100cqw - 12px), 75cqh);
  aspect-ratio: 3 / 4;
  container-type: inline-size;
  box-shadow: 0 8px 34px #130d18a6;
}

.photo-frame::after {
  position: absolute;
  inset: -6px;
  background:
    linear-gradient(var(--photo-accent), var(--photo-accent)) top left / 13px 1px,
    linear-gradient(var(--photo-accent), var(--photo-accent)) top left / 1px 13px,
    linear-gradient(var(--photo-accent), var(--photo-accent)) bottom right / 13px 1px,
    linear-gradient(var(--photo-accent), var(--photo-accent)) bottom right / 1px 13px;
  background-repeat: no-repeat;
  opacity: .7;
  pointer-events: none;
  content: "";
}

.photo-viewer-image { height: 100%; min-height: 0; background: transparent; }

.photo-palette,
.photo-crop {
  grid-row: 1;
  justify-self: center;
  display: none;
}

@container (min-width: 840px) and (min-height: 320px) and (min-aspect-ratio: 5 / 4) {
  .photo-palette {
    display: flex;
    grid-column: 1;
    align-items: center;
    gap: 6px;
    margin-top: 62px;
  }

  .photo-palette::before {
    width: clamp(18px, 4cqw, 62px);
    height: 1px;
    margin-right: 7px;
    background: var(--photo-accent);
    opacity: .55;
    content: "";
  }

  .photo-palette span {
    width: clamp(11px, 1.25cqw, 21px);
    aspect-ratio: 1;
    border: 1px solid #fff3ff33;
    background: var(--photo-pigment-1);
  }

  .photo-palette span:nth-child(2) { background: var(--photo-pigment-2); }
  .photo-palette span:nth-child(3) { background: var(--photo-pigment-3); }

  .photo-crop {
    display: block;
    grid-column: 3;
    width: clamp(68px, 9cqw, 132px);
    aspect-ratio: 1;
    margin-top: -80px;
    border: 4px solid #211827bd;
    outline: 1px solid color-mix(in srgb, var(--photo-accent), transparent 52%);
    outline-offset: 4px;
    background: var(--photo-scene, none) var(--photo-crop-x, 50%) var(--photo-crop-y, 50%) / 280% auto no-repeat;
    box-shadow: 9px 9px 0 color-mix(in srgb, var(--photo-pigment-1), transparent 74%);
    opacity: .72;
    rotate: 5deg;
  }
}

.photo-viewer-footer { margin-top: 12px; justify-content: center; }
.photo-viewer button {
  flex: 0 0 auto;
  background: #392a43;
  color: #fff3ff;
  border: 1px solid #967ba2;
  border-radius: 4px;
}
.photo-viewer button:hover { background: #523d5e; }
.photo-viewer button:focus-visible { outline-color: #e5bbf4; }

.photo-viewer .photo-notes-toggle {
  background: #201725aa;
  border-color: #967ba28f;
}

.photo-viewer .photo-notes-toggle[aria-pressed="true"] {
  border-color: var(--photo-accent);
  background: color-mix(in srgb, var(--photo-pigment-1) 35%, #2d2233);
}

.photo-notes-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border: 1px solid var(--photo-accent);
  border-radius: 50%;
  vertical-align: 1px;
}

.photo-notes-toggle[aria-pressed="true"] .photo-notes-icon { background: var(--photo-accent); }

.photo-notes,
.photo-pins { position: absolute; inset: 0; pointer-events: none; }

.photo-notes { opacity: 1; transition: opacity .22s ease; }
.photo-notes[data-visible="false"] { opacity: 0; }

.photo-viewer .photo-note {
  position: absolute;
  top: var(--pin-y);
  left: calc(var(--pin-x) - 12px);
  display: flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0 0 24px;
  translate: 0 -50%;
  pointer-events: auto;
  border: 0;
  background: transparent;
}

.photo-viewer .photo-note[data-side="left"] {
  right: calc(100% - var(--pin-x) - 12px);
  left: auto;
  padding: 0 24px 0 0;
}

.photo-notes[data-visible="false"] .photo-note { pointer-events: none; }

.photo-note::before {
  position: absolute;
  left: 12px;
  width: 8px;
  height: 8px;
  translate: -50% 0;
  border-radius: 50%;
  background: #fff7ff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--photo-accent), transparent 50%), 0 0 0 5px #2a20328c;
  content: "";
}

.photo-note[data-side="left"]::before { right: 12px; left: auto; translate: 50% 0; }

.photo-note::after {
  position: absolute;
  left: 17px;
  width: 7px;
  height: 1px;
  background: #fff7ffbf;
  content: "";
}

.photo-note[data-side="left"]::after { right: 17px; left: auto; }

.photo-note span {
  max-width: min(calc(var(--pin-room) - 14px), 11rem);
  padding: 5px 9px;
  border: 1px solid #fff3ff70;
  border-radius: 4px;
  background: #211827aa;
  backdrop-filter: blur(9px);
  box-shadow: 0 2px 12px #21182744;
  font-size: .75rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-align: left;
}

.photo-viewer .photo-note:is(:hover, :focus-visible, [aria-expanded="true"]) { background: transparent; }
.photo-note:is(:hover, :focus-visible, [aria-expanded="true"]) span {
  border-color: var(--photo-accent);
  background: #211827e6;
}

.photo-notes[data-visible="true"] .photo-note span {
  animation: photo-note-in .35s var(--pin-delay, 0ms) both;
}

@keyframes photo-note-in {
  from { opacity: 0; translate: 0 5px; }
  to { opacity: 1; translate: 0; }
}

.photo-note-detail {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  margin: 0;
  padding: 9px 12px;
  border-left: 2px solid var(--photo-accent);
  border-radius: 2px;
  background: #211827e6;
  backdrop-filter: blur(9px);
  color: #fff7ff;
  font-size: .82rem;
  line-height: 1.45;
}

.photo-note-detail:not(:empty) { animation: photo-note-in .22s ease-out both; }
.photo-note-detail:empty { padding: 0; border: 0; }

@media (prefers-reduced-motion: reduce) {
  .photo-notes { transition: none; }
  .photo-notes[data-visible="true"] .photo-note span,
  .photo-note-detail:not(:empty) { animation: none; }
}

.photo-strip {
  display: flex;
  gap: 6px;
  overflow: auto;
  min-width: 0;
  max-width: 100%;
  padding: 6px;
  scrollbar-width: thin;
}

.photo-strip button { width: 58px; height: 48px; padding: 2px; opacity: .72; }
.photo-strip button[aria-current="true"] { border-color: #edc9fa; border-width: 2px; opacity: 1; }
.photo-strip button:hover, .photo-strip button:focus-visible { opacity: 1; }
.photo-strip img { display: block; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 700px) {
  .photo-viewer figure {
    grid-template-rows: minmax(0, min(calc(100% - 34px), calc((100vw - 36px) * 4 / 3))) auto;
    align-content: center;
  }

  .photo-masthead {
    grid-template-columns: 1fr;
    width: calc(100% - 24px);
    margin-top: 82px;
    padding: 24px;
  }
  .photo-collage, .photo-plate { width: min(100%, 390px); justify-self: center; }
  .photo-masthead h1 { font-size: clamp(2.8rem, 11vw, 4.5rem); }
  .photo-index .album-directory { grid-template-columns: 1fr; }
  .photo-index .album-directory a:nth-child(2) { margin-top: 0; }
  .photo-index .album-directory a:nth-child(2) img { aspect-ratio: 5 / 3; }
  .album-story .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .album-story .album-grid .album-photo-link { grid-column: span 1; }
  .album-story .album-caption { flex-wrap: wrap; gap: 2px 6px; }
}

@media (max-width: 450px) {
  .photo-viewer-footer { gap: 6px; }
  .photo-viewer-footer > button { width: 44px; padding: 0; font-size: 1.15rem; }
  .photo-viewer-footer .photo-button-text { display: none; }
  .photo-strip button { width: 47px; }
}
