/* Photos page: a 24px-gutter masonry with search and sort (photos.js lays it out and animates it). */
body:has(#photos:not([hidden])) {gap:0;justify-content:flex-start}
body:has(#photos:not([hidden])) h1 {font-size:24px}
/* The title row stays put while the photos scroll under it. */
body:has(#photos:not([hidden])) header {position:sticky;top:0;background:#fff}

.photos-view {
  --photos-accent:#ad95ce;
  --photos-muted:#858585;
  --photos-band-top:72px;    /* title row → search bar */
  --photos-band-bottom:32px; /* search bar → photos */
  --photos-edge:60px;        /* search + photos from the left and right edges */
  flex:1;
  min-width:0;
  /* the search and photos sit 60px from the left and right edges; the bottom just gets breathing room */
  padding:0 var(--photos-edge) 48px;
  overflow:clip;
  color:#1b1b1b;
  font:400 15px/21px "IBM Plex Sans",Arial,sans-serif;
}

/* Search + sort row: a sticky white band right under the title row, 72px below the title and 32px above the photos.
   Photos scroll behind it and are cut off 32px below the bar. It tucks 1px under the title row so
   no sliver of photo shows through the seam; photos.js sets --photos-sticky-top to the title row's height. */
.photos-tools {
  position:sticky;top:calc(var(--photos-sticky-top,58px) - 1px);z-index:5;
  display:flex;align-items:flex-start;gap:0;
  margin:-1px calc(-1 * var(--photos-edge)) 0;padding:calc(var(--photos-band-top) + 1px) var(--photos-edge) var(--photos-band-bottom);
  background:#fff;color:var(--photos-muted);
}
.photos-tools svg {flex:none;transition:color .15s ease}
.photos-box:has(input:focus) > svg {color:#1b1b1b}
/* The search box: icon + field + Clear. It takes all the room the sort leaves, so the two span the full width. */
.photos-box {display:flex;align-items:center;gap:10px;flex:1 1 auto;min-width:0;min-height:44px}
.photos-field {position:relative;flex:1;min-width:0}
.photos-field input {
  width:100%;min-width:0;margin:0;padding:11px 0 12px;border:0;border-radius:0; /* 21px line + 23px = the box's 44px */
  background:transparent;color:#1b1b1b;font:inherit;outline:none;-webkit-appearance:none;appearance:none;
}
.photos-field input::placeholder {color:#a3a3a3}
.photos-field input::-webkit-search-cancel-button {-webkit-appearance:none;appearance:none}

/* "type “flowers”" — the word cycles every 4s while the empty field is unfocused */
.photos-prompt {position:absolute;inset:0;display:flex;align-items:center;gap:4px;color:#a3a3a3;pointer-events:none;visibility:hidden;white-space:nowrap}
.photos-prompt-words {display:grid}
.photos-prompt-words > span {
  grid-area:1/1;
  animation:photos-prompt-fade 16s linear infinite, photos-prompt-drift 16s cubic-bezier(.23,1,.32,1) infinite;
  animation-play-state:paused;
}
.photos-prompt-words > span:nth-child(2) {animation-delay:-12s}
.photos-prompt-words > span:nth-child(3) {animation-delay:-8s}
.photos-prompt-words > span:nth-child(4) {animation-delay:-4s}
.photos-tools[data-empty=true] .photos-field:not(:focus-within) .photos-prompt {visibility:visible}
.photos-tools[data-empty=true] .photos-field:not(:focus-within) input::placeholder {color:transparent}
.photos-tools[data-empty=true] .photos-field:not(:focus-within) .photos-prompt[data-running=true] .photos-prompt-words > span {animation-play-state:running}
@keyframes photos-prompt-fade {0%,22.5% {opacity:1} 25%,97.5% {opacity:0} to {opacity:1}}
@keyframes photos-prompt-drift {0%,22.5% {transform:translateY(0)} 25%,97.5% {transform:translateY(-20%)} 97.501% {transform:translateY(20%)} to {transform:translateY(0)}}

.photos-clear {min-height:44px;padding:0 4px;border:0;background:transparent;color:var(--photos-muted);font:inherit;font-size:13px;cursor:pointer}
.photos-clear:hover {color:#1b1b1b}

/* Sort menu */
.photos-sort {position:relative;flex:none;margin-left:24px} /* at the right end, beside the search box */
.photos-sort summary {display:flex;align-items:center;justify-content:flex-end;gap:8px;min-height:44px;list-style:none;cursor:pointer;color:#1b1b1b;white-space:nowrap}
.photos-sort summary::-webkit-details-marker {display:none}
.photos-sort summary svg {transition:rotate .2s cubic-bezier(.23,1,.32,1)}
.photos-sort[open] summary svg {rotate:180deg}
.photos-sort .sort-label {color:var(--photos-muted)}
.sort-options {
  position:absolute;top:calc(100% + 4px);right:0;z-index:7;width:200px;padding:4px;
  background:#fff;box-shadow:0 1px 3px rgba(27,27,27,.08),0 8px 28px rgba(27,27,27,.12);
  transform-origin:top right;
}
.photos-sort[open] .sort-options {animation:photos-menu-in .18s cubic-bezier(.23,1,.32,1)}
@keyframes photos-menu-in {from {opacity:0;transform:translateY(-4px) scale(.97)}}
.sort-options button {
  display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:10px 12px;
  border:0;background:transparent;color:#1b1b1b;font:inherit;text-align:left;cursor:pointer;
}
.sort-options button:is(:hover,:focus-visible) {background:var(--photos-accent);outline:none}
.sort-options [aria-pressed=false] .sort-check {visibility:hidden}
:is(.photos-sort summary,.photos-clear):focus-visible {outline:2px solid #1b1b1b;outline-offset:4px}

/* Masonry */
.photos-gallery {--photos-columns:4;column-gap:24px;position:relative}
.photos-gallery[data-ready=false] {visibility:hidden}
.photo {position:absolute;margin:0;overflow:hidden;background:var(--tint,#eee)}
.photo img {display:block;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .2s cubic-bezier(.23,1,.32,1);-webkit-user-select:none;user-select:none}
.photo img[data-loaded] {opacity:1}
.photo[data-visible=false] {opacity:0;pointer-events:none}
.photos-empty {margin:24px 0 0;text-align:center;color:var(--photos-muted)}
.photos-status {position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

@media (min-width:1680px) {.photos-gallery {--photos-columns:5}}
@media (max-width:1080px) {.photos-gallery {--photos-columns:3}}
/* Phones: 12px edges and 12px between photos; the sort stays beside the search box as just its arrow
   (the menu still shows Photography style / Colour when it opens). */
@media (max-width:760px) {
  body:has(#photos:not([hidden])) header {padding:12px 12px 0}
  .photos-view {--photos-edge:12px}
  .photos-sort {margin-left:12px}
  .photos-sort summary {min-width:44px} /* a full-size tap target for the arrow */
  .photos-sort :is(.sort-label,.sort-value) {display:none}
  .photos-gallery {--photos-columns:2;column-gap:12px}
}
@media (prefers-reduced-motion:reduce) {
  .photos-prompt-words > span {opacity:0;animation:none;transform:none}
  .photos-prompt-words > span:first-child {opacity:1}
  .photo img,.photos-sort summary svg {transition:none}
  .photos-sort[open] .sort-options {animation:none}
}
