/* phone-reader.css: one work per screen on a phone (review/phone-reader, trial 2026-11-23).
   Used only by _shared/phone-reader.js (Catalogue, ?read=on, below 768px). Every rule is scoped to .pr or
   html.pr-open, so the Catalogue is untouched while the reader is off, and nothing here applies at 768px+.

   Settled state: Chrome/Edge read it from the scroll container itself (scroll-state(snapped: y)); other
   browsers get .is-snapped from the script. The two never both style a page (@supports / @supports not).
   Reduced motion: no dimming, no arrival, everything visible. */

@media (max-width: 767px) {
  html.pr-open, html.pr-open body { overflow: hidden !important; }
  /* The Catalogue under the reader is not drawn at all while the reader is open: measured 2026-11-23, with
     all 1,077 plates beneath it a 4x-slowed phone scrolled the reader at 24 ms a frame (median), 17 ms without.
     The script keeps the Catalogue's scroll position for when the reader closes. */
  html.pr-open body > :not(#phone-reader) { content-visibility: hidden !important; }
  /* Nor its idle ambient layers (ambient-closeup.js): unseen under the reader, they cost the first work ~0.6 MB. */
  html.pr-open #ambient-reflection, html.pr-open #ambient-reflection-2 { display: none !important; }

  .pr {
    --pr-bar: calc(44px + env(safe-area-inset-top, 0px));
    --pr-cap: calc(132px + env(safe-area-inset-bottom, 0px));
    position: fixed; inset: 0; z-index: 2147483000;
    background: var(--paper, #131315); color: var(--ink, #e5e1e4);
  }
  .pr[hidden] { display: none; }

  .pr-bar {
    position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: var(--pr-bar);
    box-sizing: border-box; padding: env(safe-area-inset-top, 0px) 4px 0 16px;
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(var(--paper, #131315) 70%, transparent);
    pointer-events: none;
  }
  .pr-bar > * { pointer-events: auto; }
  .pr .mono { font-family: var(--mono); }
  .pr p.pr-facts { font-family: var(--mono) !important; }   /* the site sets every p to EB Garamond !important */
  .pr-where, .pr-count { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
  .pr-where { color: var(--accent); text-transform: none; }
  /* The decade: a button that opens the list of decades. The 1980s (the decade of the loss) and the Register of
     Loss keep the Catalogue's loss colour. */
  .pr-dec {
    min-height: 44px; margin-left: -10px; padding: 0 6px 0 10px;
    display: inline-flex; align-items: center; gap: 2px;
    background: none; border: 0; border-radius: 2px; cursor: pointer; color: var(--accent);
  }
  .pr-dec .pr-chev { color: var(--grey); margin-left: 4px; transition: rotate .2s ease; }
  .pr-dec[aria-expanded="true"] .pr-chev { rotate: 180deg; }
  .pr-dec.is-loss, .pr-dec.is-loss .pr-where { color: var(--color-loss); }
  .pr-dec:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
  @media (prefers-reduced-motion: no-preference) {
    .pr-where.is-new { animation: pr-dec-in .5s cubic-bezier(.2, .8, .3, 1); }
    @keyframes pr-dec-in { from { opacity: 0; translate: 0 6px; } }
  }

  .pr-decades {
    position: absolute; z-index: 3; left: 8px; top: calc(var(--pr-bar) - 2px);
    min-width: 176px; padding: 6px; box-sizing: border-box;
    display: grid; gap: 2px;
    background: var(--paper, #131315); border: 1px solid var(--rule); border-radius: 2px;   /* opaque: the work must not show through the list */
    box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  }
  .pr-decades[hidden] { display: none; }
  .pr-go {
    min-height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
    font-size: 13px; letter-spacing: .06em; color: var(--ink); background: none; border: 0; border-radius: 2px; cursor: pointer;
    text-align: left; text-transform: none;
  }
  .pr-go .pr-go-n { color: var(--grey); font-size: 11px; font-variant-numeric: tabular-nums; }
  .pr-go[aria-current="true"] { background: rgba(233, 195, 73, .12); color: var(--accent); }
  .pr-go.is-loss, .pr-go.is-loss .pr-go-n { color: var(--color-loss); }
  .pr-go.is-loss[aria-current="true"] { background: rgba(200, 111, 96, .16); }
  .pr-go:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  /* Turn: offered on wide works only (the space is kept on the others, so the count never moves). */
  .pr-turn {
    margin-left: auto; min-height: 44px; padding: 0 8px;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--grey); background: none; border: 0; border-radius: 2px; cursor: pointer;
  }
  .pr-turn[aria-pressed="true"] { color: var(--accent); }
  .pr:not(.pr-at-wide) .pr-turn { visibility: hidden; }
  .pr-turn:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
  .pr-turn + .pr-count { margin-left: 0; }
  .pr-count { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .pr-close {
    width: 44px; height: 44px; display: grid; place-items: center;
    background: none; border: 0; color: var(--ink); cursor: pointer; border-radius: 2px;
  }
  .pr-close:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

  .pr-scroll {
    position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
    scroll-snap-type: y mandatory; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; outline: none;
    scroll-behavior: auto;   /* the site sets smooth; here only the script chooses (glide one work, jump far) */
  }

  /* One work per screen. The slide is a size container (the image is fitted in its units) and, where the
     browser knows it, a scroll-state container (the settled state). A browser that does not know
     scroll-state drops the second declaration and keeps the first. */
  .pr-slide {
    position: relative; height: 100%; width: 100%;
    box-sizing: border-box; padding: var(--pr-bar) 0 0;
    display: flex; flex-direction: column; justify-content: center;
    scroll-snap-align: start; scroll-snap-stop: always;
    container-name: pr-slide;
    container-type: size;
    container-type: size scroll-state;
    content-visibility: auto; contain-intrinsic-size: auto 100vw auto 100vh;
  }

  /* The work: whole, its own proportion, as large as the stage allows. A landscape work on a portrait
     phone runs the full width; a tall one meets the caption band. Never cropped (no object-fit cover,
     no overflow clip on the image). */
  .pr-stage { flex: none; display: flex; justify-content: center; }
  /* The work and its caption travel together, centred below the bar, like a work and its wall label: a tall
     work fills the height above the caption band, a wide one sits with its caption just under it. */
  .pr-work {
    position: relative; display: block; line-height: 0;
    width: min(100cqw, (100cqh - var(--pr-cap)) * var(--ar));   /* cq units: the slide's content box, below the bar */
    aspect-ratio: var(--ar);
    background: rgba(229, 225, 228, .04);
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none; user-select: none;   /* a long press must not select the work (the site paints ::selection gold over it) */
  }
  .pr-work img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }   /* no-fade (JS): the site's image fade-in must not hold the dim */
  .pr-work:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  /* Wide works (1.2 to 1 or wider) get explicit sizes, so Turn can move between the two. Upright: as above.
     Turned: the work's long side runs down the screen, as long as the stage allows (--pr-L), whole and in
     proportion; the box is its turned footprint, the image is turned a quarter turn about the box's centre.
     The caption is not turned. */
  .pr-wide .pr-work {
    --pr-w: min(100cqw, (100cqh - var(--pr-cap)) * var(--ar));
    --pr-L: min(100cqh - var(--pr-cap), 100cqw * var(--ar));
    aspect-ratio: auto; width: var(--pr-w); height: calc(var(--pr-w) / var(--ar));
  }
  .pr-wide .pr-work img {
    inset: auto; left: 50%; top: 50%; translate: -50% -50%;
    max-width: none; max-height: none;   /* the site's img max-width: 100% would hold a turned work to the box's width */
    width: var(--pr-w); height: calc(var(--pr-w) / var(--ar));
  }
  .pr.is-turned .pr-wide .pr-work { width: calc(var(--pr-L) / var(--ar)); height: var(--pr-L); }
  .pr.is-turned .pr-wide .pr-work img { width: var(--pr-L); height: calc(var(--pr-L) / var(--ar)); rotate: 90deg; }

  /* The last screen: the Register of Loss. No photograph exists, so the frame stays empty: a dashed edge in the
     loss colour and the Catalogue's own words, no image, no effect. */
  .pr-absence {
    width: min(100cqw - 64px, (100cqh - var(--pr-cap)) * var(--ar)); line-height: 1.6;
    display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none;
    border: 1px dashed var(--color-loss); background: transparent; box-sizing: border-box; padding: 24px;
  }
  .pr-vlabel { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--grey); max-width: 22ch; }
  .pr-vlabel b { display: block; margin-bottom: 8px; font-style: normal; font-weight: 400; font-size: 24px; color: var(--color-loss); }
  /* Composites are disclosed on the work itself, always, never only in the caption that waits for the settle. */
  .pr-comp {
    position: absolute; left: 8px; top: 8px; line-height: 1;
    padding: 4px 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--color-red, #ff6b6b); border: 1px solid currentColor; background: rgba(19, 19, 21, .82);
  }

  .pr-cap { flex: none; height: var(--pr-cap); box-sizing: border-box; padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px)); overflow: hidden; }
  .pr-t {
    margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.22;
    color: var(--ink); overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .pr-facts {
    margin: 0; display: flex; flex-wrap: wrap; gap: 2px 0;
    font-size: 11px; line-height: 1.6; letter-spacing: .06em; color: var(--grey); text-transform: none;
  }
  .pr-facts > span:not([hidden]):not(:empty) + span:not([hidden]):not(:empty)::before { content: "\00b7"; margin: 0 .6em; color: var(--faint); font-style: normal; display: inline-block; }
  .pr-facts .u-est { color: var(--ink); }
  .pr-facts .pr-flag { color: var(--color-red, #ff6b6b); text-transform: uppercase; letter-spacing: .12em; }
  .pr-facts .loss-mark { color: var(--color-loss); }
  .pr-voice {
    margin-top: 8px; min-height: 40px; padding: 0 14px 0 10px;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--accent); background: none; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer;
  }
  .pr-voice svg { flex: none; }
  .pr-voice[aria-pressed="true"] { border-color: var(--accent); }
  .pr-voice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* Waiting, then arriving. Before the settle: the work dim, the caption not yet there. */
  @media (prefers-reduced-motion: no-preference) {
    .pr-work img, .pr-absence { transition: opacity .45s ease; }
    .pr-cap > * { transition: opacity .38s ease, translate .38s cubic-bezier(.2, .8, .3, 1); }
    .pr-cap > :nth-child(2) { transition-delay: .06s; }
    .pr-cap > :nth-child(3) { transition-delay: .12s; }
    /* Turn: the work on screen swings a quarter turn as its box reshapes. Only that one (.pr-turning, set for the
       swing): the others are already turned when they arrive, never turning as they come into view. */
    .pr-turning.pr-wide .pr-work { transition: width .55s cubic-bezier(.2, .8, .2, 1), height .55s cubic-bezier(.2, .8, .2, 1); }
    .pr-turning.pr-wide .pr-work img { transition: opacity .45s ease, rotate .55s cubic-bezier(.2, .8, .2, 1), width .55s cubic-bezier(.2, .8, .2, 1), height .55s cubic-bezier(.2, .8, .2, 1); }

    @supports (container-type: scroll-state) {
      .pr-work img, .pr-absence { opacity: .28; }
      .pr-cap > * { opacity: 0; translate: 0 8px; }
      @container pr-slide scroll-state(snapped: y) {
        .pr-work img, .pr-absence { opacity: 1; }
        .pr-cap > * { opacity: 1; translate: 0 0; }
      }
    }
    @supports not (container-type: scroll-state) {
      .pr-work img, .pr-absence { opacity: .28; }
      .pr-cap > * { opacity: 0; translate: 0 8px; }
      .pr-slide.is-snapped .pr-work img, .pr-slide.is-snapped .pr-absence { opacity: 1; }
      .pr-slide.is-snapped .pr-cap > * { opacity: 1; translate: 0 0; }
    }
  }
  /* The first screen while the Catalogue is still arriving (phone-reader-boot.js): one work, laid out as a
     reader slide, shown in full (nothing here settles or dims). The reader replaces it when it opens. */
  .prb-slide {
    position: absolute; inset: 0; box-sizing: border-box; padding: var(--pr-bar) 0 0;
    display: flex; flex-direction: column; justify-content: center;
    container-name: pr-slide; container-type: size;
  }
  .prb { z-index: 2147482999; }   /* under the reader, should both ever be there at once */
  .prb .pr-work img, .prb .pr-cap > * { opacity: 1 !important; translate: 0 0 !important; }
  .prb .pr-work:empty { visibility: hidden; }

  /* Keyboard focus on a work always shows it in full. */
  .pr-slide:focus-within .pr-work img, .pr-slide:focus-within .pr-cap > * { opacity: 1; translate: 0 0; }
}

@media (min-width: 768px) {
  .pr { display: none !important; }
}

/* The Read button makes five view chips on one line; on a phone narrower than 375 "Plates" needs a little less
   side padding to fit its chip (360: 2px short at the page's 12px). */
@media (max-width: 374px) {
  .search-section .slim-bar .view-toggle .vt:not(#vt-x):not(#vt-y) { padding-left: 6px !important; padding-right: 6px !important; }
}
