/* Public site components. Derived from campaign e367f5a4, mock
   public-1-editorial-justified-rows. Colours, type and spacing all come from
   tokens.css: no literal colour appears in this file.

   The justified-rows gallery is pure CSS. Each tile carries its aspect ratio
   as --ar and flexes by it; #grid::after with a huge flex-grow keeps the last
   row from stretching. No JavaScript is involved in the layout (R10.4). */

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Photos get a white-on-black ring so it reads over any image. */
.photo-link:focus-visible {
  outline: 2px solid var(--focus-photo-inner);
  outline-offset: 0;
  box-shadow: 0 0 0 4px var(--focus-photo-outer);
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; --motion-base: 0ms; }
  html { scroll-behavior: auto; }
}

* { box-sizing: border-box }
html { background: var(--bg) }
body { margin: 0; font: var(--text-body); background: var(--bg); color: var(--text) }
a { color: inherit }
img { display: block }
button { font: inherit; color: inherit }

.btn { min-height: var(--target); padding: 0 var(--space-4); background: transparent; border: 1px solid var(--border-control); border-radius: var(--radius-sm); cursor: pointer }
.btn:hover { background: var(--raised) }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); font-weight: var(--weight-bold) }
.btn-primary:hover { filter: brightness(1.06) }
.ghost { min-height: var(--target); padding: 0 var(--space-3); background: none; border: 0; cursor: pointer; color: var(--text-muted); font: var(--text-small) }
.ghost:hover { color: var(--text) }

/* ---- the masthead MOVED ----
   .site, .site-name and .site nav now live in internal/tokens/chrome.css,
   moved verbatim, because the ADMIN loads that file too. The admin used to
   carry its own header (.bar: bold wordmark hard left, ten links in one flex
   row) and Nicholas read the result as "two completely different apps" on
   2026-11-21. One component cannot drift from itself.

   Nothing about the gallery's rendering changed in the move, and the order is
   preserved: chrome.css is linked before this file in base.html, so any rule
   here still wins over the component, exactly as it did when both sets lived
   in this file. */

/* The filter row is navigation, not furniture: same quiet tracked caption as
   the masthead nav, centred under it, with the count on the right. */
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
           gap: var(--space-5);
           max-width: var(--page-max); margin: 0 auto;
           padding: 0 var(--page-pad) var(--space-7); position: relative }
.filters [data-menu] { padding: 0; font: var(--text-caption);
                       letter-spacing: var(--track-caption); text-transform: uppercase }
.filters .count { position: absolute; right: var(--page-pad); color: var(--text-muted);
                  font: var(--text-caption); letter-spacing: var(--track-caption);
                  text-transform: uppercase; font-variant-numeric: tabular-nums }
@media (max-width: 900px) { .filters .count { position: static } }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); list-style: none;
         max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad) var(--space-6) }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-full); font: var(--text-small); text-decoration: none }
.chip:hover { background: var(--raised) }
.chip.clear { border-color: transparent; color: var(--text-muted); text-decoration: underline }

/* ---- facet menus ----
   The native popover attribute needs no JavaScript: the popovertarget button
   opens it on its own. WHERE it opens is the part that needed fixing.

   A top-layer popover with `inset: auto` and no anchor is positioned against
   the VIEWPORT, not against the button that opened it, so it landed in the
   top-left corner of the window — which is exactly what Nicholas reported
   ("the options pop up on the far left which is not what should be
   intended"). The fix is CSS anchor positioning: each button declares an
   anchor-name, its own menu points at that name, and `position-area` puts the
   menu directly under it.

   The anchor names are written out by hand rather than generated, because the
   set of menus is fixed (internal/web/view.go buildMenus) and because a
   generated name would have to arrive as an inline style attribute.

   position-try-fallbacks is what keeps the right-hand menus on screen: the
   Lens button sits near the right edge on a narrow window, so the menu flips
   to align its right edge instead of overflowing.

   app.js does the same job by hand on Safari and Firefox, which do not
   support anchor positioning yet. It checks for support and stays out of the
   way when the browser can do it natively. */
[popover].menu {
  position: fixed;
  inset: auto;
  margin: 0;
  min-width: 240px;
  max-height: 60vh;
  overflow: auto;
  padding: var(--space-2);
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  position-area: block-end span-inline-end;
  position-try-fallbacks: block-end span-inline-start, block-start span-inline-end, flip-block;
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}
#fb-Date     { anchor-name: --fa-date }
#m-Date      { position-anchor: --fa-date }
#fb-Tags     { anchor-name: --fa-tags }
#m-Tags      { position-anchor: --fa-tags }
#fb-Album    { anchor-name: --fa-album }
#m-Album     { position-anchor: --fa-album }
#fb-Location { anchor-name: --fa-location }
#m-Location  { position-anchor: --fa-location }
#fb-Camera   { anchor-name: --fa-camera }
#m-Camera    { position-anchor: --fa-camera }
#fb-Lens     { anchor-name: --fa-lens }
#m-Lens      { position-anchor: --fa-lens }
#fb-Sort     { anchor-name: --fa-sort }
#m-Sort      { position-anchor: --fa-sort }
.opts { list-style: none; margin: 0; padding: 0 }
.opts a, .opts .zero { display: flex; align-items: center; gap: var(--space-2); min-height: var(--target); padding: 0 var(--space-3); border-radius: var(--radius-sm); text-decoration: none; font: var(--text-small) }
.opts a:hover { background: var(--surface) }
.opts .n { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums }
.opts a[aria-current] { color: var(--accent-text); font-weight: var(--weight-bold) }
/* A year links straight to that whole year, and its months sit under it,
   indented and already visible. Nicholas's complaint was that picking a year
   just to reveal its months put the year itself two clicks away.
   A nested <details> inside the popover was tried first and dropped: the menu
   is only 240 px wide, and `display: contents` on the <details> did not let
   the month list break onto its own row. Flat and indented is simpler and
   needs no JavaScript. */
.opts .opt-child { margin-left: var(--space-4); padding-left: var(--space-3);
                   border-left: 1px solid var(--border); color: var(--text-muted) }
.opts .opt-child:hover { color: var(--text) }
.opts .opt-child-2 { margin-left: var(--space-6) }
/* A facet value with no public photos is text, not a link (R11.6). */
.opts .zero { color: var(--text-muted) }
.mark { display: inline-block; width: 1em }

.more { display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
        padding: var(--space-6) var(--space-5) }
.foot { max-width: var(--page-max); margin: var(--space-8) auto 0; padding: var(--space-7) var(--page-pad);
        color: var(--text-muted); font: var(--text-caption);
        letter-spacing: var(--track-caption); text-align: center; border-top: 1px solid var(--border) }
.foot p { margin: var(--space-1) 0 }
.foot a { color: var(--text-muted) }

.photo-link { display: block; position: relative; text-decoration: none; background: var(--surface) }
/* height: auto, not 100%, and no object-fit: cover. `cover` crops whenever the
   frame and the file disagree by even a rounding step, and with the frame now
   taking its shape FROM the file there is nothing left for cover to do except
   trim edges off photographs. The <img>'s own width/height attributes give it
   an aspect-ratio, and that only applies while height is auto. */
.photo-link img { width: 100%; height: auto }
.photo-link:focus-visible { z-index: 2 }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }

/* ---- the gallery ----
   Staggered columns, the way psweddingstudio.com lays photographs out — and
   the way that site actually does it, which is NOT CSS multi-column. It has no
   column-count anywhere; it positions a flat list of items into columns.

   This used to be `column-count: 3` with column-fill at its `balance` default
   and break-inside: avoid on every tile. That derives ONE shared height from
   the TOTAL content and fills columns up to it, which has two consequences:

     1. appending is not an append. Page 2 changes the total, so the shared
        height changes, so the WHOLE block is re-fragmented and tiles already
        on screen move. The workaround was one grid block per loaded page,
        which traded the jump for a ragged seam every 48 photographs.
     2. reading order runs DOWN each column, so a newest-first gallery put its
        newest third down the left edge.

   Three real containers, one per column, remove fragmentation from the layout
   entirely: appending a child extends one column downward and touches nothing
   else. The server decides which column each photograph belongs to
   (internal/web/layout.go), so the first paint is correct with JavaScript off.

   Deleted with the column-count: the `line-height: 0` hack, which addressed
   whitespace between block-level <li>s that generates no line boxes anyway,
   and both break-inside declarations, which have no meaning outside a
   fragmented flow. */
.grid {
  display: flex;
  align-items: flex-start;        /* tracks must NOT stretch to match each other */
  gap: var(--gallery-gap);
  max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad);
}
/* :not([hidden]) is not decoration. The UA rule `[hidden] { display: none }`
   carries no !important, so an author `display: flex` here would cancel it by
   ORIGIN -- not specificity -- and a track the script hides would stay
   visible. That exact conflict killed the old lightbox. The rule is: never
   declare display unconditionally on an element whose visibility the platform
   controls; gate it on the platform's own state selector. */
.track:not([hidden]) {
  flex: 1 1 0;
  min-width: 0;                   /* without this one wide photograph blows the track out */
  display: flex;
  flex-direction: column;
  gap: var(--gallery-gap);
  /* align-items is deliberately left at `stretch`. Setting it to flex-start
     here — which is right on .grid, so the three COLUMNS do not stretch to
     each other's height — makes every tile shrink to its own content width
     instead of filling the column, so photographs inside one column render at
     different widths. Caught in the browser; it is invisible in the CSS. */
  margin: 0; padding: 0; list-style: none;
}
.track > .tile { width: 100% }

/* Below the breakpoints the tracks stack. Every photograph is still present,
   still uncropped and every track top still aligns; the cost is that a reader
   with JavaScript off gets column-major order, newest third first. app.js
   redistributes into the real column count on load and on every breakpoint
   change, so that cost lands only on a no-JS phone's first paint. */
@media (max-width: 1100px) {
  .grid { display: block }
  .track + .track { margin-top: var(--gallery-gap) }
}

.tile {
  line-height: 1.5;
  margin: 0 0 var(--gallery-gap);
  display: block;
}
/* The box is reserved by the <img>'s OWN width and height attributes, which
   the HTML Standard maps to an aspect-ratio. That applies only while height is
   auto, which is why the old `height: 100%` below had to go.

   This replaced `aspect-ratio: var(--ar)`, where --ar arrived in a style
   ATTRIBUTE. The site's CSP is `style-src 'self'` with no 'unsafe-inline' and
   no 'unsafe-hashes', so every one of those attributes was stripped, var(--ar)
   resolved to nothing, the declaration was invalid at computed-value time and
   aspect-ratio fell back to `auto`. The frame was then sized BY the image
   rather than before it. The CSP is not loosened; the dependency is gone.

   WHAT CHANGED, and why it is a trade rather than a fix.

   Nicholas, twice with screenshots: "the 2 horizontal photos are still not
   aligned with the vertical photo", then "can we set how big horizontal could
   be and how tall vertical photos should be and ensure that 2 horizontal
   photos = 1 vertical photo row wise?"

   With a fixed column width and every frame at its own ratio, that alignment
   is ARITHMETICALLY IMPOSSIBLE. A 3:2 landscape is 0.667 of the column tall,
   a 4:3 is 0.750. Two stacked land anywhere between 1.33 and 1.50; a portrait
   lands between 1.33 and 1.50 too. Close, never equal -- which is exactly
   what the screenshots show.

   So the heights are QUANTISED instead. A landscape occupies one slot, a
   portrait exactly two slots plus the gap between them. Every tile boundary
   in every column then falls on a multiple of (slot + gap), so independent
   columns line up without anything having to coordinate them.

   THE GAP HAS TO BE PROPORTIONAL for that to hold at every width, so it is a
   percentage margin rather than --gallery-gap. A percentage margin resolves
   against the containing block's WIDTH, which is well defined; a percentage
   row-gap on an auto-height flex column is not.

   THE COST, stated plainly: object-fit: cover, so a frame that is not 3:2
   is trimmed to fill its slot. A 4:3 photograph loses about 11 % of its
   height. This file used to say "nothing is ever cropped"; that is no longer
   true, and it is the price of the alignment Nicholas asked for twice. */
/* THE SLOT, AND WHY THE FIRST ATTEMPT WAS STILL WRONG.
   It used aspect-ratio and counted only the gap between stacked tiles. What is
   actually between two stacked photographs is the first one's CAPTION, then
   the gap, then the second one's TITLE line. Measured off Nicholas's
   screenshot: 0.1776 of the column width, against the 0.02 the formula
   allowed. internal/layout/layout.go already carries the same number as
   CaptionUnits = 0.1509, derived by an earlier campaign; 0.1509 + 0.02 is the
   0.1776 that was measured, which is the two numbers agreeing.

   The text blocks are LENGTHS, not fractions: a caption is type and does not
   scale with the column. Mixing a ratio with a length needs the column's width
   as a number, which is what container units give -- 100cqw is the track's
   own width -- so this is exact at every screen size rather than at one. */
.track { container-type: inline-size; gap: 0 }
.tile { margin-bottom: var(--slot-gap) }
.tile .photo-link { display: block; overflow: hidden }
.tile.land .photo-link { height: calc(var(--slot-h) * 100cqw) }
.tile.port .photo-link {
  height: calc(2 * var(--slot-h) * 100cqw
               + var(--cap-block) + var(--slot-gap) + var(--title-block));
}
.tile picture { display: block; height: 100% }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover;
            background: var(--raised) }
/* The one piece of motion on the gallery: the photograph itself grows very
   slightly inside its frame, and nothing else moves. 1.03 and 600 ms is
   deliberately below the threshold where it reads as an effect. */
.tile img { transition: transform 600ms var(--ease) }
@media (hover: hover) {
  .tile .photo-link:hover img { transform: scale(1.03) }
  .tile:hover .tile-cap { color: var(--text) }
}
/* Date on the left, exposure on the right, under each photograph. Nicholas
   asked for both. They are set as small tracked uppercase so they read as a
   print caption under the frame rather than as data about it. */
.tile-cap { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3);
            height: var(--tile-line); margin: var(--space-3) 0 0; font: var(--text-caption);
            letter-spacing: var(--track-caption); text-transform: uppercase;
            color: var(--text-muted); transition: color var(--motion-base) var(--ease) }
.tile-shot { font-variant-numeric: tabular-nums; white-space: nowrap }

/* THE TITLE, ABOVE THE PHOTOGRAPH, AT THE TOP RIGHT.

   Nicholas, in three steps: first "on the top left corner of each photo
   should be the title", then "it should not be in the photo it should be
   outside ... in the same font and size", then "it should not be above the
   date it should be above the picture on the top right corner".

   and finally "its supposed to be top left on tiles just like how its top
   left on the photo page".

   So: outside the picture, above it, LEFT-aligned. Above rather than below
   because it then reads as a heading for the photograph instead of a third
   caption line competing with the date and the exposure. Left because the
   single-photo page puts it left, and a label that moves corner depending on
   which page you are looking at is a label you have to hunt for.

   Every value is INHERITED from .tile-cap, not approximated: same font
   shorthand, same tracking, same case, same muted colour, same hover. */
.tile-title { display: block; height: var(--tile-line); margin: 0 0 var(--space-2);
              text-align: left;
              font: var(--text-caption);
              letter-spacing: var(--track-caption); text-transform: uppercase;
              color: var(--text-muted); transition: color var(--motion-base) var(--ease);
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.tile:hover .tile-title { color: var(--text) }

/* The same label on the single-photo page, at the top LEFT -- Nicholas:
   "title in the top left if it has one". Left here because it sits directly
   above the date, and the two share an edge. */
.photo-title { display: block; margin: 0 0 var(--space-2); text-align: left;
               font: var(--text-caption);
               letter-spacing: var(--track-caption); text-transform: uppercase;
               color: var(--text-muted);
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
@media (max-width: 620px) {
  .tile-cap, .tile-title, .photo-title { font-size: .6875rem }
}

/* Tiles fade up as they come into view. The class is added by app.js, so with
   JavaScript off every tile is simply visible from the start — the default
   state here is the visible one, and .reveal is only ever applied by script. */
.reveal { opacity: 0; transform: translateY(12px);
          transition: opacity 700ms var(--ease), transform 700ms var(--ease) }
.reveal.in { opacity: 1; transform: none }
@media print {
  .reveal { opacity: 1; transform: none }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none }
  .tile img { transition: none }
  .tile .photo-link:hover img { transform: none }
}

/* ---- the phone filter tray ----
   <details> rather than <dialog>, so it opens with JavaScript off. */
.tray { display: none }
.tray > summary { display: flex; align-items: center; min-height: var(--target); padding: 0 var(--space-3); margin: 0 var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-sm); font: var(--text-small); cursor: pointer; list-style: none }
.tray > summary::-webkit-details-marker { display: none }
.tray-body { padding: var(--space-2) var(--space-4) }
.tray-body summary { display: flex; align-items: center; min-height: var(--target); font-weight: var(--weight-medium); cursor: pointer }

/* ---- the single photo page ----
   The photograph is the page. The earlier version put it in a 1fr column
   beside a 320 px metadata panel, which left a landscape frame floating in
   the middle of the left half with a column of labels beside it and a screen
   of nothing underneath. Now the image is centred and as large as the viewport
   allows, and everything else is a quiet line below it. */
.photo-page { max-width: var(--page-max); margin: 0 auto;
              padding: 0 var(--page-pad) var(--space-8) }
/* A portrait photo used to render column-width and metres tall, so you had to
   scroll to see it. Bound it by the viewport HEIGHT as well as the width and
   let the aspect ratio do the rest. 100dvh, not vh, so the phone's collapsing
   address bar does not clip it. */
.photo-stage { display: flex; align-items: center; justify-content: center; min-width: 0; margin: 0 }

/* The photograph needs ONE shrink-wrapped, positioned ancestor so the corner
   labels and the close control anchor to the picture rather than to the full
   page width. .photo-stage is a centring flex container and cannot do it.

   A gilt frame lived here briefly. Nicholas: "the frame is ugly scrap the
   idea and move on." The holder stays because the labels still need it. */
.photo-stage .photo-holder { position: relative; display: inline-block; max-width: 100% }
.photo-stage .frame-link { display: block; line-height: 0 }
.photo-stage img {
  max-width: 100%;
  /* AS BIG AS IT CAN GET. Nicholas: "it should look like this except as big
     as it can get". What has to be left is the masthead and nav (about
     8.5rem), one caption line above, one below, and the page's bottom
     padding -- not the 14rem that was reserved when a metadata panel still
     shared this screen. */
  max-height: calc(100dvh - 11rem);
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--surface);
}

/* The close control. A real link to the list, upgraded by app.js into a real
   history step so the gallery comes back where it was left. 44x44, because a
   control you have to aim at is the one you miss. */
.ph-close {
  position: absolute; z-index: 3; top: var(--space-3); right: var(--space-3);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--target); min-height: var(--target);
  background: var(--photo-scrim); color: var(--on-scrim);
  text-decoration: none; font-size: 1.5rem; line-height: 1;
  border-radius: var(--radius-full);
}
/* The OVERLAY version of .tile-title used to live here, and it sat LATER in
   the file than the caption version above -- so it would have won the cascade
   and put the title back on the photograph, silently undoing the change that
   was just made. Deleted rather than reordered: two rules for one class in
   one stylesheet is the bug, not their order.

   The hover rule that darkened this button to a literal #000 went with it;
   nothing outside tokens.css names a colour. */

/* The rail, under the facts: previous on the left, next on the right, "all
   photographs" in the middle. Arrow keys do the same thing. It shares
   --measure-wide with the bands above and below it, so the three line up
   against the same two edges. A hairline separates it from the facts, which
   is the only thing that makes three stacked bands read as a sequence rather
   than as a pile. */
.photo-rail { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
              gap: var(--space-4); margin: var(--space-4) auto 0;
              max-width: var(--measure-wide);
              padding-top: var(--space-3); border-top: 1px solid var(--border) }
.photo-rail a { display: inline-flex; align-items: center; min-height: var(--target);
                color: var(--text-muted); font: var(--text-caption);
                letter-spacing: var(--track-caption); text-transform: uppercase;
                text-decoration: none }
.photo-rail a:hover { color: var(--text) }
.photo-rail .rail-prev { justify-self: start }
.photo-rail .rail-all  { justify-self: center }
.photo-rail .rail-next { justify-self: end; grid-column: 3 }

/* ---- the facts under the photograph ----
   Nicholas's layout, in his words: the date on the left, all of the camera
   settings on the right, the previous / all photos / next buttons under that,
   and everything else to the right.

   Three stacked bands rather than one two-column grid. The rail has to sit
   BETWEEN the facts and the rest, and in a single grid it would either have to
   live in one of the two columns or force the remaining metadata to share a
   row height with it. Each band owns its own alignment instead.

   Both columns are set as small tracked uppercase labels with their values
   beside them — the same print-caption voice as the tile captions — so the
   block reads as a cutline under the frame rather than as a data table. */
.photo-facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5);
               max-width: var(--measure-wide); margin: var(--space-6) auto 0;
               font: var(--text-caption); letter-spacing: var(--track-caption) }
.photo-facts dl { margin: 0; display: flex; flex-direction: column; gap: var(--space-2) }
.photo-facts dl > div { display: flex; align-items: baseline; gap: var(--space-2) }
.photo-facts dt { color: var(--text-muted); text-transform: uppercase; white-space: nowrap }
.photo-facts dd { margin: 0; font-variant-numeric: tabular-nums }
.pf-left  { align-items: flex-start; text-align: left }
/* The right-hand column is right-aligned, so the two blocks read as the two
   edges of the photograph above rather than as two columns of a table.
   `align-items: flex-end` right-aligns each ROW as a unit, which is what is
   wanted; the label keeps its normal place before its value.
   (This was `flex-direction: row-reverse` at first, which did right-align the
   rows but printed them backwards — "Fujifilm X-T5 CAMERA", "5152 × 7728
   SIZE". Seen in the browser, not deduced.) */
.pf-right { align-items: flex-end; text-align: right }
.pf-right > div { justify-content: flex-end; max-width: 100% }
/* A long exposure line — shutter, aperture, ISO and both focal lengths — is
   the one value that wraps, and it has to wrap under itself rather than
   pushing its own label onto a line of its own. */
.pf-right dd { text-align: right; min-width: 0 }

/* Everything else, to the right, under the rail. */
.photo-rest { max-width: var(--measure-wide); margin: var(--space-6) auto 0;
              text-align: right }
.photo-rest h1 { font: var(--text-h3); font-weight: var(--weight-light);
                 letter-spacing: var(--track-caption); margin: 0 0 var(--space-3) }
.photo-rest .caption { color: var(--text-muted); margin: 0 0 var(--space-4);
                       max-width: var(--measure); margin-left: auto }
.photo-rest .chips { justify-content: flex-end; padding: var(--space-3) 0 0; margin: 0 }

/* On a phone two columns of labels is two columns of wrapped text. One column,
   everything left, and the rest stops being right-aligned too — a right-aligned
   paragraph on a 360 px screen is just hard to read. */
@media (max-width: 620px) {
  .photo-facts { grid-template-columns: 1fr; gap: var(--space-3) }
  .pf-right { align-items: flex-start; text-align: left }
  .pf-right > div { flex-direction: row }
  .photo-rest { text-align: left }
  .photo-rest .caption { margin-left: 0 }
  .photo-rest .chips { justify-content: flex-start }
}

/* ---- the album list ---- */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-5);
          max-width: var(--page-max); margin: 0 auto; padding: var(--space-4) var(--page-pad); list-style: none }
.albums a { display: block; padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); text-decoration: none }
.albums a:hover { background: var(--raised) }
.albums h2 { font: var(--text-h3); font-weight: var(--weight-medium); margin: 0 0 var(--space-1) }
.albums p { margin: 0; color: var(--text-muted); font: var(--text-small) }

.page-head { max-width: var(--page-max); margin: 0 auto; padding: var(--space-5) var(--page-pad) var(--space-3) }
.page-head h1 { font: var(--text-h1); font-weight: var(--weight-medium); margin: 0 }
.page-head p { margin: var(--space-2) 0 0; color: var(--text-muted); max-width: var(--measure) }

.page-head-center { text-align: center }
.page-head-center h2 { font: var(--text-h3); font-weight: var(--weight-light);
                       letter-spacing: var(--track-wide); text-transform: uppercase; margin: 0 }
.page-head-center p { margin: var(--space-2) auto 0 }

.empty { padding: var(--space-8) var(--space-5); color: var(--text-muted); text-align: center }

/* The tucked-away ... panel MOVED to internal/tokens/chrome.css with the rest
   of the masthead, so the admin's header is the same component rather than a
   second implementation of it. Verbatim; nothing here changed. */

/* ---- the infinite scroll ----
   The script sets these classes on the "Load more" container. The link itself
   is never hidden by CSS alone: with JavaScript off it has to stay a working
   link, so only the script, having taken over, ever marks it .auto. */
/* visibility, NOT display. The link keeps its box while a fetch is in flight,
   so bringing it back cannot shift the page under the reader's finger -- and
   .auto is now removed on every path out of load(), including the
   success-with-a-next-page path the old code forgot, which is what left a
   permanent "Loading more photographs..." with nothing to click. */
.more.auto a[data-more] { visibility: hidden }
.more.auto .more-state::after {
  content: "Loading more photographs…";
  color: var(--text-muted); font: var(--text-caption);
  letter-spacing: var(--track-caption); text-transform: uppercase;
}
.more.failed a[data-more] { visibility: visible }
.more.failed .more-state::after { content: "" }
/* The terminal line is written INTO .more-state by the script, so it needs no
   ::after and no .done class. The old .more.done a[data-more] rule was
   unreachable anyway: the script replaced more.textContent, which destroyed
   the link that rule selected. */
.more-state { margin: 0; color: var(--text-muted); font: var(--text-caption);
              letter-spacing: var(--track-caption); text-transform: uppercase }
@media (prefers-reduced-motion: reduce) {
  .more.auto .more-state::after { content: "Loading…" }
}

/* One intermediate step, so the page does not go from a 4rem margin straight
   to a 1rem one the moment a laptop is not full screen. */
@media (max-width: 1100px) { :root { --page-pad: 2.5rem; --gallery-gap: 1.75rem } }

@media (max-width: 760px) {
  :root { --page-pad: 1.25rem; --gallery-gap: 1.25rem }
  /* The phone chrome -- the bottom tab bar, the tuck panel's position and the
     body padding that reserves the bar's height -- MOVED to
     internal/tokens/chrome.css with the rest of the masthead. The admin gets
     the identical bar from the identical rules. */
  .filters { padding: 0 var(--page-pad) var(--space-5); gap: var(--space-4) }
  .filters > [data-menu] { display: none }
  .photo-stage img { max-height: calc(100dvh - 11rem) }
  .photo-facts { margin-top: var(--space-5) }
  .tray { display: block; padding-bottom: var(--space-2) }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 var(--space-3) var(--space-3) }
  .chip { min-height: var(--target); white-space: nowrap }
  .more { padding: var(--space-5) var(--space-3) }
  .foot { padding: var(--space-4) var(--space-3) }
  .photo-page { padding: 0 var(--page-pad) var(--space-6) }
  .albums { grid-template-columns: 1fr; padding: var(--space-4) var(--space-3) }
  .page-head { padding: var(--space-4) var(--space-3) var(--space-2) }
}


/* ---- page transitions ----
   Cross-document view transitions: Chrome 126+ and iOS Safari 18.2+. This is
   the whole feature, and it is the reason the site needs no single-page
   framework to get a smooth navigation -- three lines of CSS against 112 KB
   of runtime.

   The reduced-motion block is NOT optional and is NOT provided by the browser.
   Grepping the View Transitions Level 1 spec finds no reduced-motion carve-out
   in the UA stylesheet, so without this an author who asked their operating
   system for less motion gets the animation anyway. */
@view-transition { navigation: auto }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}
