/* The "white walls" design: an austere gallery where the photos speak for themselves.
   Photos keep their own proportions, centered on a shared line like works hung at eye level,
   each within at most 700x700 points, with a small caption beneath. Dark mode is the same room
   with charcoal walls. */

/* Sizes are in rem, and 1rem is 10 design pixels: 1.4rem is 14px. Up to the width of an 11-inch
   iPad in landscape (about 1210 points) the site is drawn at exactly those sizes; on wider
   screens everything grows together, like a browser's zoom, reaching 115% at 1440 points and
   staying there, except the largest a photo is shown (--max-photo), which stays 700. Phones and tablets are unchanged. 62.5% of the browser's default text size
   (16px unless the visitor changed it) is 10px. */
:root { font-size: clamp(62.5%, 62.5% + (100vw - 1220px) * 0.0068, 71.875%); }

:root {
  --wall: #ffffff; --ink: #161616; --muted: #6e6e6e; --line: #ebebe8; --tone: #e8e8e5;
  --max-photo: 700px; /* in plain pixels: no photo is ever shown larger, whatever the screen */
  --offset: 1.6rem; /* the grey rectangle behind each photo: how far right and down */
  color-scheme: light;
}
/* Lights: "auto" follows the device; "off" and "on" are the visitor's own choice. */
:root[data-lights="off"] {
  --wall: #141413; --ink: #ebeae6; --muted: #a09f9a; --line: #2b2b29; --tone: #282826;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-lights="auto"] {
    --wall: #141413; --ink: #ebeae6; --muted: #a09f9a; --line: #2b2b29; --tone: #282826;
    color-scheme: dark;
  }
}

/* Show the switch that makes sense: "Turn off the lights" in a light room, and back. */
.lights { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.6rem; }
.lights form { display: contents; }
.lights .turn-on { display: none; }
:root[data-lights="off"] .lights .turn-on { display: inline; }
:root[data-lights="off"] .lights .turn-off { display: none; }
@media (prefers-color-scheme: dark) {
  :root[data-lights="auto"] .lights .turn-on { display: inline; }
  :root[data-lights="auto"] .lights .turn-off { display: none; }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--wall); color: var(--ink);
  font: 1.5rem/1.5 "Instrument Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.4rem; text-decoration-thickness: 1px; }
:focus-visible, label.button:focus-within, label.link:focus-within { outline: 0.2rem solid var(--ink); outline-offset: 0.3rem; }
h1, h2, p { margin: 0; }

.page { max-width: 136rem; margin: 0 auto; padding: 0 4rem 5.6rem; }

.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.2rem 2.8rem; padding: 2.2rem 0; font-size: 1.4rem; }
.wordmark { font-size: 1.5rem; font-weight: 500; letter-spacing: 0.02em; }
.home { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 2rem; }
.up { color: var(--muted); }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 2.4rem; color: var(--muted); }
.top nav a[aria-current="page"] { color: var(--ink); }
/* The lights switch: words on wide screens, a light bulb on phones. */
.lights .bulb { display: none; width: 2rem; height: 2rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.link { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 0.4rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 4.4rem;
  padding: 1.2rem 1.8rem; border: 1px solid var(--ink); background: var(--wall); color: var(--ink);
  font: inherit; font-size: 1.4rem; cursor: pointer; text-align: center;
}
.button.solid { background: var(--ink); color: var(--wall); }

.label { font-size: 1.1rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.people, .people ul { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.8rem; margin: 0; padding: 0; list-style: none; }
.people li { white-space: nowrap; }
div.people { column-gap: 1rem; } /* "Inactive:" sits closer to its names than they do to each other */
.people a { color: inherit; text-decoration: underline; text-underline-offset: 0.4rem; text-decoration-thickness: 1px; text-decoration-color: var(--muted); }

.intro { padding-top: 2.8rem; display: flex; flex-direction: column; gap: 0.8rem; max-width: 76rem; }
.intro h1 { font-size: 3.4rem; font-weight: 400; letter-spacing: -0.01em; line-height: 1.1; }

.exhibit { padding-top: 5.6rem; display: flex; flex-direction: column; gap: 2.2rem; }
/* Jumping to an edition (enlarging a photo, an #edition- or #photo- link) skips most of the
   space above it, so its date sits just under the top of the window. */
.exhibit { scroll-margin-top: -4rem; }
.exhibit-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.8rem 2.4rem; font-size: 1.3rem; color: var(--muted); }
.exhibit-head .title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem 1.6rem; }
.exhibit-head h2 { font-size: 2rem; font-weight: 500; color: var(--ink); }
.exhibit-head.edition { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.exhibit-head.edition h2 { font-size: 1.1rem; letter-spacing: 0.16em; text-transform: uppercase; }
.count { font-variant-numeric: tabular-nums; }

/* The wall: photos centered on one line. Fewer members hang larger, never above --max-photo. */
.wall {
  --hang: 30rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  column-gap: 4rem; row-gap: 3.2rem;
}
.wall.n2 { --hang: 44rem; --n: 2; }
.wall.n3 { --hang: 38rem; --n: 3; }
.wall.n4 { --hang: 33rem; --n: 4; }
.wall.n5 { --n: 5; }
/* Wide screens: each photo keeps the size equal columns gave it (its own width at the row's
   height, --nat, but no more than an equal share of the row), and the space left over is
   shared out evenly (space-evenly): the spaces either side of every place are equal, so a
   narrow photo isn't nearer one neighbour than the other, and the ends get the same share
   less the 4rem gap. Photos never grow into that space: it's the row's breathing room. A row
   whose places all take their whole share is exactly as before, and too many for the width
   wrap below 18rem a place, as before. Phones keep one photo per line. */
@media (min-width: 641px) {
  .wall {
    --n: 5;
    display: flex; flex-wrap: wrap; justify-content: space-evenly; align-items: flex-start;
  }
  .wall > .work {
    --nat: min(var(--w, var(--max-photo)), var(--max-photo), calc(min(var(--hang), var(--max-photo)) * var(--ratio, 1)));
    flex: 0 1 min(var(--nat), calc((100% - (var(--n) - 1) * 4rem) / var(--n)));
    max-width: var(--nat); min-width: min(18rem, var(--nat));
  }
  /* Empty places: 4:5 at 64% of the row's height (as .reserved draws them). */
  .wall > .work.empty { --nat: calc(min(var(--hang), var(--max-photo)) * 0.512); }
}
.work { display: flex; flex-direction: column; gap: calc(1rem + var(--offset)); min-width: 0; scroll-margin-top: 2.4rem; }
/* An experiment: a grey rectangle the photo's size behind each photo, offset right and down
   (a shadow with no blur, so the layout doesn't change), in the empty places' grey. An
   enlarged photo has none, from the moment it starts to grow. */
.hang img { box-shadow: var(--offset) var(--offset) 0 var(--tone); }
.wall.open .work.open .hang img { box-shadow: none; }

/* A photo shown smaller than its full size grows in place when clicked (gallery.js). */
/* Room below the last row (with whatever follows it on the page) so that, like every other row,
   it can scroll to the top of the window before a photo in it grows. Phones don't grow photos. */
@media (min-width: 641px) { .tail { min-height: 100vh; } }
img.can-grow { cursor: zoom-in; }
/* While a photo is enlarged (or moving), gallery.js sets the columns, the row's height (--open),
   its normal height (--closed) and each photo's height limit (--h) on every frame. */
.wall.open .hang { height: var(--open); }
.wall.open .hang img { max-height: var(--h); }
/* Empty places keep their 4:5 shape and normal size, shrinking evenly if their column narrows. */
.wall.open .reserved { height: auto; width: min(100%, calc(var(--closed) * 0.512)); }
.wall.open .work.open img { cursor: zoom-out; }
.hang { height: min(var(--hang), var(--max-photo)); display: flex; align-items: center; justify-content: center; }
.hang img { display: block; width: auto; height: auto; max-width: min(100%, var(--max-photo)); max-height: 100%; }
/* A photo whose size is known (--w, its width; --ratio, width / height) gets its box before it
   loads, so nothing moves as photos arrive: never wider than itself, the column or 700 points,
   nor taller than its row. */
.hang img.sized {
  width: min(100%, var(--w), var(--max-photo), calc(min(var(--hang), var(--max-photo)) * var(--ratio)));
  height: auto; aspect-ratio: var(--ratio); max-width: none; max-height: none;
}
.wall.open .hang img.sized { width: min(100%, var(--w), var(--max-photo), calc(var(--h) * var(--ratio))); max-height: none; }
.reserved { height: 64%; aspect-ratio: 4 / 5; max-width: 100%; background: var(--tone); }
.reserved.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 1.6rem; text-align: center; }
.hint { font-size: 1.25rem; color: var(--muted); max-width: 18rem; line-height: 1.45; }
/* Captions are wall labels: right-aligned to the photo's own right edge (gallery.js sets
   --inset to the gap between the photo and its column's edge), all on one shared line. */
.caption {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem;
  padding-right: var(--inset, 0px); text-align: right; font-size: 1.25rem; color: var(--muted);
}
.caption .who { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.caption .name { font-size: 1.35rem; font-weight: 500; color: var(--ink); }
/* Read by screen readers only: the grey place says it to everyone else. */
.no-photo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem 1.4rem; }

/* A file input inside a label: the label is what shows; choosing a file submits the form. */
.file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
form.upload { display: contents; }
label.button, label.link { position: relative; }

.more { padding-top: 4.8rem; display: flex; justify-content: center; }
.foot { padding-top: 7.2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.2rem 3.2rem; font-size: 1.25rem; color: var(--muted); }
.foot form { display: inline; }
.foot .chosen { color: var(--ink); }

.narrow { max-width: 44rem; padding-top: 4rem; display: flex; flex-direction: column; gap: 2.8rem; }
.narrow h1 { font-size: 3.2rem; font-weight: 400; letter-spacing: -0.01em; line-height: 1.15; }
.stack { display: flex; flex-direction: column; gap: 1.8rem; }
.field { display: flex; flex-direction: column; gap: 0.8rem; font-size: 1.3rem; font-weight: 500; }
.field input {
  border: 0; border-bottom: 1px solid var(--ink); padding: 1rem 0; font: inherit; font-size: 1.7rem;
  color: var(--ink); background: transparent; min-height: 4.4rem; border-radius: 0;
}
.field input:focus-visible { outline: none; border-bottom-width: 0.2rem; }
.error { color: var(--ink); font-weight: 500; }

/* The account page. */
.account { max-width: 76rem; display: flex; flex-direction: column; gap: 4.8rem; }
.account .intro { padding-top: 2.8rem; }
.account .intro h1 { font-size: 3.4rem; }
.small { font-size: 1.3rem; }
.notice { font-weight: 500; }
.narrow-form { max-width: 44rem; padding-top: 2rem; }
.pair { display: flex; flex-wrap: wrap; gap: 1.8rem 2.4rem; }
.pair .field { flex: 1 1 16rem; min-width: 0; }
.narrow-form .field input { width: 100%; box-sizing: border-box; }
.buttons { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.quiet-link, .reveal summary { color: var(--ink); text-decoration: underline; text-underline-offset: 0.4rem; text-decoration-thickness: 1px; text-decoration-color: var(--muted); }
.reveal summary { cursor: pointer; list-style: none; width: fit-content; }
.reveal summary::-webkit-details-marker { display: none; }
.reveal[open] summary { color: var(--muted); }
.reveal p { margin: 0.8rem 0 0; }
.reveal code { font: 1.3rem ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.label-heading { margin: 0 0 0.8rem; font-size: 1.1rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; }
.account-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1.4rem 3.2rem; padding: 2.2rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 3.2rem; }
.account-row-info { flex: 1 1 24rem; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.account-row-title { font-size: 1.8rem; font-weight: 500; }
.account-row.is-hidden .account-row-title { color: var(--muted); }
.account-row-switches { display: flex; flex-direction: column; gap: 1rem; font-size: 1.4rem; }
.account-note { margin-top: 2rem; }
/* Hidden galleries on the home page: quiet, one per row, each row easy to tap. */
.hidden-list { margin: 0; padding: 0; list-style: none; max-width: 56rem; color: var(--muted); }
.hidden-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 1.6rem; border-bottom: 1px solid var(--line); }
.hidden-list a { flex: 1; padding: 1.2rem 0; color: inherit; }
.hidden-list a:hover { color: var(--ink); }
.hidden-list span { font-size: 1.25rem; white-space: nowrap; }
.switch { display: flex; align-items: center; gap: 1.2rem; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; min-height: 3.2rem; font: inherit; }
.switch .track { position: relative; width: 3.6rem; height: 2rem; border-radius: 999px; background: var(--line); flex: none; }
.switch .knob { position: absolute; top: 0.3rem; left: 0.3rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--wall); box-shadow: 0 0 0 1px var(--muted); }
.switch[aria-checked="true"] .track { background: var(--ink); }
.switch[aria-checked="true"] .knob { left: 1.9rem; box-shadow: none; }

/* The admin pages: plain tables and forms, for one person. */
.admin { display: flex; flex-direction: column; gap: 4rem; padding-bottom: 4rem; }
.admin .intro { padding-top: 0.8rem; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.6rem 2.4rem; padding-top: 2rem; font-size: 1.4rem; color: var(--muted); }
.admin-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.4rem; }
/* The email mode, on every admin page: a quiet panel in testing, a firmer one once live. */
.email-mode { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.2rem 2.4rem; padding: 1.4rem 1.8rem; border: 1px solid var(--line); font-size: 1.4rem; }
.email-mode p { margin: 0; max-width: 64rem; line-height: 1.5; }
.email-mode.live { border-color: var(--ink); }
.email-mode form { margin: 0; }
.table-wrap { overflow-x: auto; }
.admin-table { border-collapse: collapse; width: 100%; font-size: 1.4rem; }
.admin-table th { text-align: left; font-size: 1.1rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 0 1.6rem 1rem 0; border-bottom: 1px solid var(--line); }
.admin-table td { vertical-align: top; padding: 1.2rem 1.6rem 1.2rem 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.admin-table tr.quiet td { color: var(--muted); }
.admin-table .num { font-variant-numeric: tabular-nums; }
.admin-table .member { display: inline-block; margin-right: 1.4rem; white-space: nowrap; }
.admin-table .actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; white-space: nowrap; }
.admin-table code { font: 1.25rem ui-monospace, Menlo, monospace; }
.tag { font-size: 1.1rem; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--line); padding: 0 0.5rem; white-space: nowrap; }
.check { display: flex; align-items: baseline; gap: 1rem; font-size: 1.4rem; }
.admin-form { max-width: 76rem; }
.admin-form fieldset { border: 0; margin: 0; padding: 0; }
.member-line { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1.2rem 1.6rem; }
.member-line .field input, .admin-form .field input, .admin-form .field select { width: 100%; box-sizing: border-box; }
.field select { font: inherit; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--muted); min-height: 4.4rem; }

/* Phones: one photo after another down the page, each at full width. */
@media (max-width: 640px) {
  .page { padding: 0 2rem 4rem; }
  /* The header stays on one line: a bulb for the lights, Sign out only on the account page,
     no "← Galleries" (the wordmark goes to the same page),
     and a long name shrinks a little, then is cut short. */
  .top { padding: 1.4rem 0; flex-wrap: nowrap; gap: 1.6rem; }
  .home { flex-wrap: nowrap; gap: 1.4rem; white-space: nowrap; }
  .top nav { flex-wrap: nowrap; gap: 1.4rem; min-width: 0; }
  .lights .bulb { display: block; }
  .lights .words, .top .signout, .top .up { display: none; }
  .member-line { grid-template-columns: 1fr 1fr; }
  /* Admin tables: each row becomes a small block, its cells one under another. */
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; }
  .admin-table tr { padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
  .admin-table td { padding: 0.2rem 0; border: 0; }
  .admin-table .actions { padding-top: 0.8rem; gap: 1rem; }
  .admin-table td[data-label]::before { content: attr(data-label) " "; color: var(--muted); }
  .member-line .field:first-child { grid-column: 1 / -1; }
  .top .me { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.3rem; }
  .intro { padding-top: 1.6rem; }
  .intro h1 { font-size: 2.8rem; }
  .exhibit { padding-top: 4rem; gap: 1.6rem; scroll-margin-top: -2.8rem; }
  .wall { grid-template-columns: minmax(0, 1fr); row-gap: 2.4rem; }
  :root { --offset: 1rem; }
  .work { gap: calc(0.8rem + var(--offset)); }
  .hang { height: auto; }
  .hang img { max-height: min(70vh, var(--max-photo)); }
  .hang img.sized { width: min(100%, var(--w), var(--max-photo), calc(min(70vh, var(--max-photo)) * var(--ratio))); }
  /* Empty places keep their grey, landscape-shaped and inset (as on wide screens) so they
     weigh less than photos and a run of them stays short. */
  .reserved, .reserved.add { width: 64%; height: auto; aspect-ratio: 3 / 2; }
  /* ...but their names stay at the screen's right edge, not the inset place's. */
  .work:has(> .hang > .reserved) .caption { padding-left: 0; padding-right: 0; }
  /* A row with three positions: your Remove on the left, "Not yet" / "No photo"
     centered where the photo would hang, and the name always on the right. */
  .caption {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: baseline; column-gap: 1.2rem; min-height: 0;
    padding-left: var(--inset, 0px); /* photos are centered, so this mirrors the right edge */
  }
  .caption .who { grid-column: 3; grid-row: 1; justify-self: end; flex-direction: row-reverse; align-items: baseline; gap: 1.2rem; }
  .caption .no-photo { grid-column: 2; grid-row: 1; }
  .caption .actions { grid-column: 1; grid-row: 1; justify-self: start; justify-content: flex-start; }
  .narrow { padding-top: 2.4rem; }
}
