/* photos.madcowsailing.com — site layout. Loaded after shared tokens.css and
   base.css, as on the other two sites. Everything all three share belongs in
   shared/css/base.css instead.

   Every colour, type size and space is a var(--…) from tokens.css, the rule
   CLAUDE.md's Conventions state for both other sites. The one bare length is
   the @media condition, because CSS allows no var() in a media query.

   The header shell (.site-header, .header-inner, .lockup) and .footer-inner
   live in shared/css/base.css since #169, once for every site (three until
   #371 removed hq/). Until
   then this file carried a copy of sailing's, which carried a copy of hq's;
   the photo site was the third copy that made the move worth it. This site
   uses base.css's defaults for both values that differ by site: the 3rem
   header mark and the left-aligned footer. The [hidden] rule this file
   restated for share.js's "Try again" is in base.css since #203, which
   needed it on the sailing site's lightbox too. */

/* ---- Shell ---------------------------------------------------------- */

/* The sailing site's sailboat mark, in the logo pack's Sail Blue, as there. */
.lockup-mark { color: var(--mark-blue); }

/* ---- Page head ------------------------------------------------------ */

.page-head .lede {
  font-size: var(--text-lg);
}

/* What an admin press did, which can name a person, an album's title or its
   address, each one unbroken word as typed: "Added <title>" made
   /admin/albums 380 px wide at 320 until it could wrap (#271). */
.page-head [role="status"] {
  overflow-wrap: anywhere;
}

/* /account's lede names who is signed in, "As <name>, <address>, approved
   for …", and a name or an address is one unbroken word as typed: a
   40-character name and a 70-character address made the page 579 px wide at
   320, 360 and 390 until it could wrap (#304). Every other lede is the site's
   own words, so nothing there is long enough to break. */
.page-head .lede {
  overflow-wrap: anywhere;
}

/* The page head's row of buttons (#272): Add photos on / and each team's
   section, Sign in and Ask for an account on the share page. base.css sets
   no margins, so the row sat flush against the lede above it, and the share
   page's policy link flush against it below (0 and 2 px, measured in Chrome
   and WebKit at 320 px). */
.page-head > .actions {
  margin-block: var(--space-4);
}

/* ---- Admin: a row of buttons, and the confirm dialog (#152) --------- */

/* First written for the invite code's page, whose code and link styles went
   with it at #226. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* A modal dialog is centred by the browser's own `margin: auto`, and base.css's
   reset sets every margin to 0, so it is restated here or the dialog opens at
   the top-left corner. The max-width keeps a gutter on a phone, as the
   browser's own dialog width does. */
.confirm {
  margin: auto;
  max-width: min(var(--measure), calc(100% - 2 * var(--space-4)));
  border: var(--border-hair);
  padding: var(--space-5);
  background: var(--chalk);
  color: var(--deep);
}

/* ---- Admin: the home's to-do list (#269) ---------------------------- */

/* The home opens on what is waiting, so the list follows its head closely,
   as the request form does. */
.admin-todo {
  padding-block-start: 0;
}

.todo {
  list-style: none;
  padding: 0;
  margin-block-start: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

/* One full-width button per thing waiting, a zero included. --space-6 is
   48 px, past the 44 px #269 asks for a thumb on a phone, and the text wraps
   inside it at 320 px rather than widening the page (WCAG 1.4.10). */
.todo-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--space-6);
  font-size: var(--text-base);
}

.todo-count {
  font-family: var(--font-display);
  font-size: var(--text-xl);
}

/* The other sections are links in sentences; each gets a little height and
   a step apart, so a thumb does not take the next one by mistake. */
.admin-links li + li {
  margin-block-start: var(--space-2);
}

.admin-links a {
  display: inline-block;
  padding-block: var(--space-1);
}

/* The storage figure is a line of its own under the links, not a fifth one. */
.admin-storage {
  margin-block-start: var(--space-3);
}

/* An email address is one unbroken word, which can be wider than a 320 px
   screen (as on /admin/people, #221). */
.signed-in {
  overflow-wrap: anywhere;
}

/* "Forget this phone" and Sign out (#274) are 48 px square (--space-6), as
   every button on the people, albums and removals pages is (#271). The
   second form stands a step below the first, so a thumb does not take one
   for the other; each form's hint says what its button ends. */
.admin-sign-in .button {
  min-height: var(--space-6);
  min-width: var(--space-6);
}

.admin-sign-in form + form {
  margin-block-start: var(--space-4);
}

/* ---- Admin: albums (#153) ------------------------------------------- */

/* The first form fields on any of the three sites. The border is --deep, not
   the --spray hairline, because a field's edge must read 3:1 against the
   page to be seen as a field (WCAG 1.4.11): on --hull, --spray reads 1.64:1
   and --deep 13.45:1. */
.album-form .field {
  margin-block-end: var(--space-3);
}

/* Each section's form or list sits a step below the sentence introducing it. */
.album-form,
.albums,
.albums-empty {
  margin-block-start: var(--space-3);
}

.album-form label,
.album-form legend {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.album-form .choices label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-base);
  margin-inline-end: var(--space-4);
}

.album-form fieldset {
  border: none;
  padding: 0;
}

.album-form input[type="text"],
.album-form input[type="email"],
.album-form input[type="date"] {
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
  max-width: 100%;
}

.album-form input[type="text"],
.album-form input[type="email"] {
  width: var(--measure);
}

/* Chrome's date field takes one Tab stop more than its three parts: the
   calendar button, inside the input's own closed shadow tree. With focus
   there the input matches neither :focus nor :focus-visible, only
   :focus-within, so base.css's ring vanished and nothing on screen showed
   where focus was (measured in Chrome, #153). */
.album-form input[type="date"]:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.albums {
  list-style: none;
  padding: 0;
}

.album {
  border-top: var(--border-hair);
  padding-block: var(--space-4);
}

/* A title is 1 to 80 characters as the admin typed it, and one long word
   made the page 383 px wide at 320 until it could wrap (#271). Since #273 the
   facts line names the account that made a sender's event, and a one-word
   name made it 360 px wide at 320 (#273's ux audit). */
.album h3,
.album-facts {
  overflow-wrap: anywhere;
}

.album-facts code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.album details {
  margin-block: var(--space-2);
}

/* "Edit" opens the album's form, so it is a button to a thumb: the block
   padding takes its row past 44 px (#271). Padding rather than a flex row,
   which would delete the disclosure marker. */
.album summary {
  cursor: pointer;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding-block: var(--space-3);
}

/* ---- Admin: the team filter (#227) ------------------------------------ */

/* All teams, then each team, on the queue and removals pages: one row of
   links that wraps on a phone, the one showing marked as the site nav marks
   its page, in the nav's type. */
.team-filter ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  list-style: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* Each link changes what the list below shows, so to a thumb it is a
   button: a 48 px target, as the pages' buttons are (#271; the owner's
   reading of its "link used as a button"). It was 18 px tall. The queue's
   filter shares the rule. */
.team-filter a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--space-6);
  min-width: var(--space-6);
}

.team-filter a[aria-current="page"] {
  color: var(--blue-deep);
  font-weight: 700;
  text-decoration: none;
}

/* ---- Admin: the approval queue (#156) ------------------------------- */

.batch {
  border-top: var(--border-hair);
  padding-block: var(--space-5);
}

.batch-facts,
.waiting-album,
.waiting-facts,
.waiting figcaption,
.waiting .field label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* A size's caption sits under half a card, 150 px wide at 360: "Full, 2560 ×
   1920" wrapped at --text-sm there. */
.waiting figcaption {
  font-size: var(--text-xs);
}

/* An album's title and a sender's name are each as typed, and one long word
   in either made the queue 545 px wide at every phone width, 320 to 430,
   until they could wrap (#271, folded in at its gate; #270's reading seeded
   no long title). A Move's notice, in a card or a batch, names the event. */
.batch h2,
.waiting-album,
.waiting-facts,
.waiting > [role="status"],
.batch > [role="status"] {
  overflow-wrap: anywhere;
}

.batch-form > .actions {
  margin-block: var(--space-3);
}

/* One photo a row on a phone, two on a wide screen, each still wide enough
   to tell one face from another. */
.queue {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(5 * var(--space-8))), 1fr));
  gap: var(--space-4);
}

.waiting {
  background: var(--chalk);
  border: var(--border-hair);
  padding: var(--space-3);
}

.waiting > * + * {
  margin-block-start: var(--space-2);
}

/* The width and height attributes give each picture its shape before it
   arrives, so nothing below it moves. */
.waiting img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--hull);
}

/* A clip (#198) is a card's width too, its shape from the frame size the row
   records. It loads nothing until Play, so until then it is this ground,
   night water, under the player's own controls. */
.waiting video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--deep);
}

.waiting-sizes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.waiting .field label {
  display: block;
}

/* The same field edge as .album-form's: --deep reads 3:1 and more against a
   card, where the --spray hairline does not (WCAG 1.4.11). */
.waiting input[type="text"] {
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
  width: 100%;
}

/* Every button on the queue is a thumb's size (#270): --space-6 is 48 px,
   past the 44 px the story asks for on a phone. Wide screens keep it too; a
   taller button costs a mouse nothing. The reject dialog's two are on the
   same page, so they count. */
.batch .button,
#reject-dialog .button {
  min-height: var(--space-6);
  min-width: var(--space-6);
}

/* What a press did, shown in the photo card or the batch section the page
   lands on, rather than at the top, out of sight on a phone (#270,
   lib/admin-page.js, adminQueuePage). */
.waiting > [role="status"],
.batch > [role="status"] {
  border-inline-start: var(--space-1) solid var(--blue);
  padding: var(--space-2) var(--space-3);
  background: var(--hull);
}

.batch > [role="status"] {
  background: var(--chalk);
  margin-block-start: var(--space-3);
}

/* ---- Admin: Move to event (#228) ------------------------------------ */

/* A batch's Move choices and a new event's fields are .album-form's fields
   (the block carries both classes). The list of events is a select with the
   same --deep edge (WCAG 1.4.11), as is the event an album is merged into on
   /admin/albums (#275), so the rule names every .album-form's select. Until
   #275 it named `.move select`, the only one. */
.album-form select {
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
  max-width: 100%;
}

/* A fieldset is never narrower than its widest field unless told, and the
   new event's title field is --measure wide: until #270 it held the queue
   717 px wide on every phone, 320 to 430. */
.move fieldset {
  min-inline-size: 0;
}

/* ---- Share: sending photos (#155) ----------------------------------- */

.sender {
  margin-block-start: var(--space-5);
}

.sender > * + * {
  margin-block-start: var(--space-3);
}

/* A field's own label, not its choices': a radio's label in the new event's
   form (#273) keeps .album-form's look, which `.sender .field label` beat
   until then by coming later. */
.sender .field > label,
.photo label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* The same field edge as .album-form's: --deep reads 3:1 and more against
   the page and a card, where the --spray hairline does not (WCAG 1.4.11). */
.sender select,
.photo-caption {
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
  max-width: 100%;
}

.sender select {
  width: var(--measure);
}

/* "Add photos" is the file input's label. The input is clipped out of sight
   but stays in the keyboard order and speaks its label's name, so the label
   draws the ring the input would have drawn, and only when the input would
   have: on keyboard focus. :focus-within also matched the focus a tap leaves
   behind when the photo picker closes, which ringed the button on a phone
   (Android Chrome 154, measured on #155). */
.pick {
  position: relative;
}

.pick input {
  position: absolute;
  inset: 0;
  clip-path: inset(50%);
}

.pick:has(:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* A browser without :has() rings it on any focus: a ring after a tap beats
   none after a Tab. */
@supports not selector(:has(*)) {
  .pick:focus-within {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
  }
}

/* A button that is not the page's action: Remove sits beside Try again in
   every photo, and thirty solid blue buttons would shout over the photos. */
.button-quiet {
  background: transparent;
  color: var(--blue-deep);
  border: 1px solid var(--blue);
}

/* Hover only where a device can hover (#200, shared/css/base.css). */
@media (hover: hover) {
  .button-quiet:hover {
    background: var(--blue);
    color: var(--chalk);
  }
}

/* ---- Share: a new event (#273) -------------------------------------- */

/* The form is .album-form's fields. A fieldset is never narrower than its
   widest content unless told, which held the queue's Move 717 px wide on a
   phone (#270), so each of its fieldsets is told. */
.event-form fieldset {
  min-inline-size: 0;
}

/* "Is it one of these?": one event a row. A title is as typed, one long word
   included, so its button wraps rather than widening the page, as does "No,
   create" with the title in it. */
.event-matches {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  margin-block: var(--space-2);
}

.event-form .button {
  overflow-wrap: anywhere;
  text-align: start;
}

/* A field with a reason beside it, as on /ask: the thicker edge is a second
   sign beside the words, never the only one (WCAG 1.4.1). */
.event-form input[aria-invalid="true"]:not([type="radio"]) {
  border-width: 3px;
}

/* One column on a phone, as many as fit on a wider screen. */
.photo-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(3 * var(--space-8))), 1fr));
  gap: var(--space-4);
}

.photo {
  background: var(--chalk);
  border: var(--border-hair);
  padding: var(--space-3);
}

/* A square the preview fits inside, there from the moment the photo is
   chosen, so the card does not grow when the preview arrives. */
.photo-frame {
  aspect-ratio: 1;
  background: var(--hull);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* A clip's square holds its name and length as text (#198): nothing of a
   clip is decoded on the phone, and the CSP refuses a blob: video. */
.clip-frame {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.photo-state {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin-block: var(--space-2);
}

.photo[data-state="failed"] .photo-state,
.photo[data-state="unreadable"] .photo-state {
  font-weight: 500;
}

.photo-caption {
  width: 100%;
}

.photo-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  margin-block-start: var(--space-1);
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-2);
}

/* ---- Public: the albums (#157) -------------------------------------- */

/* An album title is 1 to 80 characters as the owner typed it, and one long
   word would push a 360 px page sideways. */
.page-head h1,
.album-row h2 {
  overflow-wrap: anywhere;
}

/* Kind, day and count under a title, as the sailing logs set their dates. */
.meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--blue);
}

/* The list and the grid follow the page head closely: base.css pads every
   section of main by --space-7, which would leave a gap of twice that. */
.album-list,
.album-photos {
  padding-block-start: 0;
}

/* The lists at / (a row per team) and in each team's section (a row per
   album, #227): the cover beside the words, as on the sailing logs index.
   The cover is cropped to 4:3, a thumbnail for the row, not the photo. */
.album-rows {
  list-style: none;
  padding: 0;
}

.album-row {
  display: grid;
  grid-template-columns: calc(2 * var(--space-8)) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
  border-top: var(--border-hair);
  padding-block: var(--space-4);
}

.album-cover img,
.album-cover-none {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: var(--border-hair);
  background: var(--chalk);
}

.album-row h2 {
  font-size: var(--text-xl);
  margin-block-end: var(--space-1);
}

.album-row h2 a {
  text-decoration: none;
}

@media (hover: hover) {
  .album-row h2 a:hover {
    text-decoration: underline;
  }
}

/* An album's photos: square tiles in fixed columns, 2 on a phone and 5 at
   the widest (owner's choice at #157's pickup). The trip logs' justified
   rows need an inline style on every figure, which this site's CSP refuses.
   The fewest columns, a phone's 2, are lib/public-page.js's FIRST_ROW, the
   photos in the first row at every width, which load at once, and
   test/public.test.js fails if the two disagree. The lightbox shows each
   photo whole. */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-2);
}

.gallery figure {
  margin: 0;
  min-width: 0;
}

.gallery .frame {
  display: block;
  border: var(--border-hair);
  background: var(--chalk);
}

/* The width and height attributes are the stored grid size; the square here
   is set before the picture arrives, so nothing below it moves. */
.gallery .frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

/* A clip's tile (#286): plain, with no still until #326 (owner, at #286's
   pickup), the same square a photo's tile is, on night water, with the
   sailing logs' play mark in its middle and how long the clip runs in a
   corner. The mark and its scrim are the sailing site's .play-badge, copied
   rather than shared: white on a dark scrim, never the accent red, which the
   design brief spends once per viewport. */
.gallery .frame.is-video {
  position: relative;
}

.clip-tile {
  display: block;
  aspect-ratio: 1;
  background: var(--deep);
  color: var(--hull);
}

.play-badge {
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  pointer-events: none;
}

.play-badge svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
  /* A triangle's optical centre sits left of its box, so a centred mark
     reads as leaning back (sailing/css/site.css, the same nudge). */
  margin-left: 0.15rem;
}

.gallery .frame.is-video:focus-visible .play-badge {
  background: rgb(0 0 0 / 0.75);
}

@media (hover: hover) {
  .gallery .frame.is-video:hover .play-badge {
    background: rgb(0 0 0 / 0.75);
  }
}

.clip-length {
  position: absolute;
  inset: auto var(--space-2) var(--space-2) auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

/* The lightbox plays a clip in the slot a photo fills, capped by the stage in
   both axes as .lightbox-img is in base.css. gallery.js sets the player's
   width and height to the clip's frame, so without the cap a portrait clip
   ran the window's full height, over the stage's padding: 720 x 960 in a
   1280 x 900 window, measured on #286's first build. The sailing logs carry
   the same rule in their own site.css (#72); the photo site had no clip to
   play until #286. */
.lightbox-video {
  max-width: 100%;
  max-height: 100%;
}

/* What the lightbox shows in a clip's place when it cannot play (#286;
   shared/js/gallery.js, cannotPlay): a line saying why and, unless the clip
   is gone, its Download, in the bar's colours, where the player was. Only the
   photo site's clips ever show it, so it is styled here rather than in
   base.css. */
.lightbox-cannot {
  max-width: var(--measure);
  color: var(--hull);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: center;
}

.lightbox-cannot p + p {
  margin-block-start: var(--space-3);
}

.lightbox-cannot a {
  display: inline-block;
  padding-block: var(--space-1);
  color: var(--hull);
}

.gallery figcaption {
  margin-block-start: var(--space-1);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.caption-text {
  display: block;
}

/* The same 24 px box as "Remove this photo" below it (#158): the link is 16 px
   tall on its own, and with the button 3 px under it the spacing exception
   no longer holds, so axe read target-size (WCAG 2.5.8) on every Download
   until the link had a box of its own. */
.download {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding-block: var(--space-1);
}

/* Choose, beside Download (#204): a native checkbox and its word, in
   Download's type. The box is 24 px, the least a target may be without
   counting on its spacing (WCAG 2.5.8), and the size a thumb wants. Hidden
   until js/save.js shows it. Middle-aligned in the line: an inline-flex
   box's baseline is the checkbox's foot, which sat it above Download's
   words. */
.choose {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-inline-start: var(--space-2);
  vertical-align: middle;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
}

.choose input {
  width: var(--space-4);
  height: var(--space-4);
  margin: 0;
  accent-color: var(--blue);
}

/* Save for the photos chosen (#204), with how many and Clear: pinned to the
   foot of the screen while any is chosen, over the photos it passes, and in
   its own place under the last of them at the end of the album. Above the
   clip tiles' play marks, which are positioned. */
.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-block-start: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--chalk);
  border: var(--border-hair);
}

/* While the bar shows, a control focused near the foot of the screen sat
   wholly under it: Download, Choose and Remove for photos 6 to 8 at 1280 px
   (WCAG 2.4.11; ux-design's audit at #204). Padding the page's scroll at the
   foot makes the browser bring a focused control clear of the bar instead.
   It is more than the bar's tallest, two rows at 320 px. */
html:has(.save-bar:not([hidden])) {
  scroll-padding-bottom: calc(var(--space-8) + var(--space-5));
}

.save-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.save-actions {
  display: flex;
  gap: var(--space-2);
  margin: 0;
}

/* Save in the lightbox (#204; shared/js/gallery.js makes it, for a photo
   only): a word in the bar beside the counter, edged as the lightbox's
   buttons are, so it reads as a control on the photo's dark ground. */
.lightbox-save {
  flex: none;
  margin-inline-start: auto;
  padding: var(--space-1) var(--space-3);
  border: var(--border-hair);
  background: var(--deep);
  color: var(--hull);
  text-decoration: none;
}

@media (hover: hover) {
  .lightbox-save:hover {
    background: var(--blue);
    color: var(--hull);
  }
}

/* The counter takes the free space before it (base.css) unless Save is
   showing, which takes it instead, so the two sit together at the end. */
.lightbox-save:not([hidden]) ~ .lightbox-counter {
  margin-inline-start: 0;
}

/* What Save is doing when it takes a moment (js/save.js): a line above the
   bar, so the bar's own row never moves. Empty, it shows nothing. */
.lightbox-save-note {
  position: absolute;
  inset-inline: 0;
  bottom: 100%;
  padding-inline: var(--space-3);
  text-align: center;
}

.lightbox-save-note:not(:empty) {
  padding-block: var(--space-1);
  background: var(--deep);
}

@media (min-width: 30rem) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 46rem) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 60rem) {
  .gallery { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---- Public: the policy (#159) -------------------------------------- */

/* A page of prose in short sections. They follow each other closely:
   base.css pads every section of main by --space-7 at both ends, which
   would leave twice that between two of them. The reset takes every margin
   and a list's indent, so both are put back here. */
.policy {
  padding-block-start: 0;
}

.policy > * + * {
  margin-block-start: var(--space-3);
}

.policy ul {
  padding-inline-start: var(--space-4);
}

.policy li + li {
  margin-block-start: var(--space-1);
}

/* A release quoted word for word (#253): set off by a rule at its start edge,
   so it reads as the release's words and not the site's. --blue on --hull
   clears the 3:1 a non-text mark needs. */
.policy blockquote {
  border-inline-start: 4px solid var(--blue);
  padding-inline-start: var(--space-3);
}

/* ---- Public: "Remove this photo" (#158) ----------------------------- */

/* Under each photo, below Download. It is a button, because it posts (to
   the confirmation page, without JavaScript), dressed as a quiet link, so a
   grid of them does not shout over the photos. The block padding makes its
   target at least 24 px tall (WCAG 2.5.8) with no layout of its own. */
.remove {
  display: block;
}

.remove-open {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--blue);
  background: none;
  border: none;
  padding: var(--space-1) 0;
  text-decoration: underline;
  cursor: pointer;
}

/* The note, in the dialog and on the confirmation page. The field's edge is
   --deep, as the admin forms' are, for WCAG 1.4.11. */
.remove-form .field {
  margin-block: var(--space-3);
}

.remove-form label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.remove-form textarea {
  display: block;
  width: 100%;
  max-width: var(--measure);
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
  resize: vertical;
}

.hint {
  display: block;
  font-size: var(--text-sm);
}

/* The confirmation page follows its head closely, as the album grid does. */
.remove-confirm {
  padding-block-start: 0;
}

/* The photo on the confirmation page, and each on /admin/removals, at its
   stored grid size or narrower. */
.remove-picture img,
.remove-picture video,
.removal-picture img {
  display: block;
  max-width: 100%;
  height: auto;
  border: var(--border-hair);
  background: var(--chalk);
}

/* A hidden clip on /admin/removals (#310) plays as its queue card does, on
   night water until Play, at a photo row's size: the page gives the player
   its frame scaled to a grid image's 480 px long edge (clipBox, in
   lib/admin-page.js), so a portrait clip is 270 x 480 as a portrait photo is
   (the owner's choice at #310's review), and base.css's max-width keeps it
   within a narrower row. No width is set here: one would undo that size. */
.removal-clip video {
  background: var(--deep);
}

/* ---- Admin: removal requests (#158) --------------------------------- */

.removals {
  list-style: none;
  padding: 0;
}

.removal {
  border-top: var(--border-hair);
  padding-block: var(--space-4);
}

.removal > * + * {
  margin-block-start: var(--space-2);
}

.removal h2 {
  font-size: var(--text-xl);
}

.removal-picture {
  display: inline-block;
}

/* The album's title, the sender's name and the caption are each as typed,
   and one long word in any of them made the page 657 px wide at 320 until
   they could wrap (#271). */
.removal-facts,
.removal-caption {
  overflow-wrap: anywhere;
}

.removal-note-heading {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* A note keeps the line breaks it was written with; they are text, never
   markup, so the stylesheet keeps them. */
.removal-note {
  white-space: pre-line;
  max-width: var(--measure);
  overflow-wrap: anywhere;
}

/* ---- Admin: people (#221) ------------------------------------------- */

.people {
  list-style: none;
  padding: 0;
}

.people,
.people-empty {
  margin-block-start: var(--space-3);
}

.person {
  border-top: var(--border-hair);
  padding-block: var(--space-4);
}

.person > * + * {
  margin-block-start: var(--space-2);
}

.person h3 {
  font-size: var(--text-xl);
}

/* An email address is one unbroken word, which can be wider than a 360 px
   screen; so is a name or a note with no spaces. A 40-character name made
   the page 590 px wide at 320 until the heading was in this rule (#221's
   ux-design audit, 1.4.10). */
.person h3,
.person-facts,
.admin-log li {
  overflow-wrap: anywhere;
}

/* A note keeps its line breaks, as a takedown's does. */
.person-note {
  white-space: pre-line;
  max-width: var(--measure);
  overflow-wrap: anywhere;
}

/* Each team's box is its label as well, padded past 24 px as the request
   form's are (WCAG 2.5.8). Since #225 a box's label can carry the person's
   name or address ("… replied to confirm"), one unbroken word that made
   /admin/people 485 px wide at 320 until it could wrap (#225's ux-design
   audit, 1.4.10). */
.person-form .choices label {
  padding-block: var(--space-1);
  overflow-wrap: anywhere;
}

.person-form .choices input {
  accent-color: var(--blue);
  margin-inline-end: var(--space-1);
}

/* The same field edge as .album-form's inputs: --deep reads 3:1 and more
   against the page (WCAG 1.4.11). */
.person-form select {
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
  max-width: 100%;
}

/* "Revoke, hide their photos or delete" (#225): a native <details> under
   each person, in the type of an album's "Edit" disclosure, padded as it is,
   so its summary is a target past 44 px (#271; it was 24 px for WCAG 2.5.8
   until then). */
.person-more summary {
  cursor: pointer;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding-block: var(--space-3);
}

.person-more > * + * {
  margin-block-start: var(--space-3);
}

.admin-log {
  padding-inline-start: var(--space-4);
  max-width: var(--measure);
}

.admin-log li + li {
  margin-block-start: var(--space-2);
}

/* ---- Admin: people, albums and removals at a thumb's size (#271) ---- */

/* Every button on the three pages is at least 48 px square (--space-6), past
   the 44 px #271 asks for a thumb on a phone, at every width, as the queue's
   are (#270): a taller button costs a mouse nothing. The removals dialog's
   two are on the page, so they count. .album-form's include "Add album",
   "Let it ask again" and /admin/mail's one button. */
.album .button,
.album-form .button,
.person .button,
.removal .button,
#delete-dialog .button {
  min-height: var(--space-6);
  min-width: var(--space-6);
}

/* ---- Public: asking for an account (#220) --------------------------- */

/* The form follows its head closely, as the album grid does, at the width
   of the text above it. Since #222 the sign-in, reset and set-password
   forms and the account page take the same classes (lib/sign-in-page.js). */
.ask {
  padding-block-start: 0;
}

.ask-form,
.error-summary {
  max-width: var(--measure);
}

.ask-form .field {
  margin-block-end: var(--space-4);
}

.ask-form fieldset {
  border: none;
  padding: 0;
}

.ask-form label,
.ask-form legend {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* Each choice is its label as well as its box, so the whole line is the
   target: the block padding takes it past 24 px (WCAG 2.5.8). */
.ask-form .choices label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding-block: var(--space-1);
  margin-inline-end: var(--space-4);
}

.ask-form .choices input {
  accent-color: var(--blue);
  margin-inline-end: var(--space-1);
}

/* The same field edge as .album-form's: --deep reads 3:1 and more against
   the page, where the --spray hairline does not (WCAG 1.4.11). */
.ask-form input[type="text"],
.ask-form input[type="email"],
.ask-form input[type="password"],
.ask-form textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--deep);
  background: var(--chalk);
  border: 1px solid var(--deep);
  padding: var(--space-1) var(--space-2);
}

.ask-form textarea {
  resize: vertical;
}

/* A field with a reason beside it. The thicker edge is a second sign beside
   the words, never the only one (WCAG 1.4.1), and it is --deep: the send
   button is the page's one accent. */
.ask-form input[aria-invalid="true"]:not([type="radio"]):not([type="checkbox"]) {
  border-width: 3px;
}

.field-error {
  display: block;
  font-weight: 600;
}

/* The reasons above the form. It takes the focus when the page loads, so it
   shows the ring it holds, from a script or a key. */
.error-summary {
  border: 3px solid var(--deep);
  background: var(--chalk);
  padding: var(--space-3) var(--space-4);
  margin-block-end: var(--space-4);
}

.error-summary:focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.error-summary h2 {
  font-size: var(--text-xl);
}

.error-summary ul {
  padding-inline-start: var(--space-4);
  margin-block-start: var(--space-2);
}

/* Turnstile's widget is 65 px tall in its flexible size (its widget
   configurations page). Its room is kept before the script draws it, so the
   button below does not move when it arrives. */
.cf-turnstile {
  min-height: var(--space-7);
  margin-block-end: var(--space-3);
}

.ask-policy {
  margin-block-start: var(--space-4);
}

/* ---- Footer ---------------------------------------------------------
   .footer-inner is in shared/css/base.css since #169. */

/* ---- Narrow --------------------------------------------------------- */

@media (max-width: 46rem) {
  .page-head .lede { font-size: var(--text-base); }

  /* A smaller cover still beside the words, so a season of albums stays a
     list a thumb can scan rather than a column of pictures. */
  .album-row {
    grid-template-columns: calc(2 * var(--space-6)) minmax(0, 1fr);
    gap: var(--space-3);
  }
}

/* ---- Phone: the approval queue (#270) ------------------------------- */

@media (max-width: 30rem) {
  /* Each waiting photo's screen size runs edge to edge, the most a phone can
     give a face (owner, at #270's pickup): the list steps out over the
     page's margin, and the card's words and buttons step back in. */
  .queue {
    margin-inline: calc(-1 * var(--space-4));
  }

  .waiting {
    border-inline: none;
    padding-inline: 0;
  }

  /* The clip's box (#198) is left out as the photo's link is. One :not()
     with a list, not two chained: two would outrank .waiting > .actions
     below, and put the sticky buttons back inside the margin. */
  .waiting > :not(.waiting-screen, .waiting-clip) {
    margin-inline: var(--space-4);
  }

  .waiting-screen {
    display: block;
  }

  /* The ring goes inside the picture, since outside it would be off the
     screen's edge, and inside it falls on the photo, any colour at all. So
     it is two rings: --chalk on the link's edge, --deep just inside it on
     the picture. The two read 14.87:1 against each other, so one of them
     reads at least 3:1 against any photo (WCAG technique C40). One --blue
     ring read 1.14:1 on deep water (review-fanout at #270's review). */
  .waiting-screen:focus-visible {
    outline-color: var(--chalk);
    outline-offset: calc(-1 * var(--space-1) / 2);
  }

  .waiting-screen:focus-visible img {
    outline: calc(var(--space-1) / 2) solid var(--deep);
    outline-offset: calc(-1 * var(--space-1));
  }

  /* A clip runs edge to edge as a photo does (#198), so it takes the same
     two rings inside it: --chalk on the edge of the box around it, and
     --deep, the clip's own ring, just inside that. The clip is what takes
     the focus, so the box finds it with :has(). The box's ring is a layer
     laid over the clip, not an outline on the box: Chrome paints the
     player above its box's outline, so that ring never showed, and the
     --deep ring alone read 1.2:1 on the player's #333 (measured at 390 px
     in Chrome, at #198's review). Not chosen: one --blue ring, the photo's
     1.14:1 on deep water again once the clip plays. */
  .waiting-clip {
    position: relative;
  }

  .waiting-clip:has(video:focus-visible)::after {
    content: '';
    position: absolute;
    inset: 0;
    border: calc(var(--space-1) / 2) solid var(--chalk);
    pointer-events: none;
  }

  .waiting-clip video:focus-visible {
    outline-color: var(--deep);
    outline-offset: calc(-1 * var(--space-1));
  }

  /* A browser without :has() rings the box on any focus inside it, as
     .pick does: a ring after a tap beats none after a Tab. */
  @supports not selector(:has(*)) {
    .waiting-clip:focus-within::after {
      content: '';
      position: absolute;
      inset: 0;
      border: calc(var(--space-1) / 2) solid var(--chalk);
      pointer-events: none;
    }
  }

  /* Approve and Move, or a batch's other buttons, fill their rows; Reject
     and Reject all sit alone on the last row, at its end, apart from Approve
     (owner, at #270's pickup). The ::after is the line break: Reject comes
     after it by order, as it does in the markup, so reading and Tab order
     are the page's own. Reject's rule names .button too, so it outranks the
     rule above wherever either moves. */
  .batch .actions .button {
    flex: 1 1 auto;
  }

  .batch .actions .button[data-reject] {
    order: 2;
    flex: 0 0 auto;
    margin-inline-start: auto;
  }

  .batch .actions:has([data-reject])::after {
    content: '';
    flex-basis: 100%;
    order: 1;
  }

  /* Each photo's buttons stay at the bottom of the screen while its card is
     on it, so after a press they are under the thumb whatever the photo's
     shape (owner, at #270's review: an upright photo put Approve 211 to 418
     px below the screen). Full width, on the card's own ground. */
  .waiting > .actions {
    position: sticky;
    bottom: 0;
    margin-inline: 0;
    padding: var(--space-2) var(--space-4);
    background: var(--chalk);
    border-top: var(--border-hair);
  }

  /* And nothing focused is left under them (WCAG 2.4.11): scrolling to a
     focused field stops their height above the screen's bottom. Two rows of
     buttons, the break's two row gaps and the row's own padding. */
  html:has(.queue) {
    scroll-padding-bottom: calc(2 * var(--space-6) + 4 * var(--space-2));
  }
}

/* ---- Phone: people, albums and removals (#271) ---------------------- */

@media (max-width: 30rem) {
  /* Every field runs the screen's full width: the date and the role, as the
     text fields already do, and since #275 the event an album is merged
     into. The queue's Move fields (.move) stay as #270 shipped them. */
  .album-form:not(.move) input[type="date"],
  .album-form:not(.move) select,
  .person-form select {
    width: 100%;
  }

  /* Each team, kind or tick box is a row of its own, 48 px tall, the whole
     row its target (owner, at #271's pickup). A flex row drops the space
     between the box and its words, so the gap puts it back. */
  .album-form:not(.move) .choices label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--space-6);
    margin-inline-end: 0;
  }

  /* "Delete permanently" sits alone on the row below "Put it back", at its
     end (owner, at #271's pickup), as Reject does on the queue (#270). Its
     dialog is still the confirm. */
  .removal .actions form {
    flex: 1 1 100%;
  }

  .removal .actions form .button {
    width: 100%;
  }

  .removal .actions [data-delete] {
    margin-inline-start: auto;
  }

  /* Revoke, hide and delete wait behind their disclosure, which stands a
     step further from the everyday buttons above it, over a rule. */
  .person > .person-more {
    margin-block-start: var(--space-4);
    border-top: var(--border-hair);
  }
}

/* ---- Phone: the code step's remember row (#274) ---------------------- */

@media (max-width: 30rem) {
  /* "Remember this phone for 30 days" is a row of its own, 48 px tall, the
     whole row its target, as the admin pages' tick boxes are (#271; the
     owner's choice at #274's pickup). The code step's alone: /ask and the
     other sign-in forms keep their padded labels. A flex row drops the space
     between the box and its words, so the gap puts it back. The .ask-form
     in front ties `.ask-form .choices label`, which this then follows and
     beats. */
  .ask-form .code-remember label {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--space-6);
    margin-inline-end: 0;
  }
}
