/* Public collection view.
   Tokens and rules follow vault/05-style/design-system.md: paper, not white;
   one accent; 8px space; 76ch reading column; 44px targets; no cards, no
   shadows; object names in the serif.

   Everything new here is progressive. A browser without a feature gets the
   same readable page, just without the movement. */

:root {
  color-scheme: light dark;

  --paper: light-dark(#fcfbf8, #191816);
  --paper-sunk: light-dark(#f3f1eb, #21201d);
  --rule: light-dark(#e2ded4, #33312c);
  --rule-strong: light-dark(#8b8375, #6f6a5f);
  --ink: light-dark(#1c1b18, #edeae3);
  --ink-muted: light-dark(#5e5b52, #a8a49a);
  --accent: light-dark(#1f5c8b, #8fc3ea);
  --display: 1.75rem;

  /* Fallbacks only. The page emits the chosen values from
     PublicView.Theme, so this file holds structure and one palette source. */
  --s1: 0.5rem;
  --s2: 0.75rem;
  --s3: 1rem;
  --s4: 1.5rem;
  --s5: 2.5rem;
  --s6: 4rem;
  --radius: 6px;
  --column: 76ch;
  --image-ratio: 4 / 3;
  --line: 1.55;
  --header-rule: 1px solid var(--rule);
  --header-position: sticky;
  --footer-rule: 1px solid var(--rule);

  --serif: ui-serif, Georgia, "Iowan Old Style", "Source Serif 4", serif;
  --sans: ui-sans-serif, system-ui, "Inter", sans-serif;
  --mono: ui-monospace, "IBM Plex Mono", "SFMono-Regular", monospace;

  interpolate-size: allow-keywords;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  padding: var(--s3);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: var(--line);
  text-rendering: optimizeLegibility;
  min-block-size: 100dvh;
}

body > header,
main,
body > footer {
  max-inline-size: var(--column);
  margin-inline: auto;
}

body > header {
  position: var(--header-position);
  inset-block-start: 0;
  z-index: 1;
  background: var(--paper);
  border-block-end: var(--header-rule);
  padding-block: var(--s2);
  margin-block-end: var(--s4);
  animation: header-rule linear both;
  animation-timeline: scroll();
  animation-range: 0 6rem;
}

@keyframes header-rule {
  from {
    border-block-end-color: var(--rule);
  }
  to {
    border-block-end-color: var(--ink-muted);
  }
}

header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s3);
}

.identity {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-family: var(--serif);
  font-size: 1.125rem;
  text-decoration: none;
  color: var(--ink);
  view-transition-name: museum-name;
}

header nav img {
  max-block-size: 2.5rem;
  max-inline-size: 9rem;
  inline-size: auto;
  vertical-align: middle;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: color-mix(in oklab, var(--accent) 78%, var(--ink));
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: color-mix(in oklab, var(--accent) 22%, var(--paper));
}

h1,
h2 {
  font-family: var(--serif);
  text-wrap: balance;
  line-height: 1.2;
  margin-block: 0 var(--s3);
}

h1 {
  font-size: 1.375rem;
  text-box: trim-both cap alphabetic;
}

h2 {
  font-size: 1.125rem;
  margin-block-start: var(--s5);
}

p {
  text-wrap: pretty;
  margin-block: 0 var(--s3);
}

main > p:first-of-type {
  font-size: 1.125rem;
}

/* Search */

/* Label above the field, button to its right. The markup is three siblings,
   so the layout is a two-row grid rather than a wrapper. */
form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--s1) var(--s2);
  margin-block: var(--s4);
}

form > label {
  grid-column: 1;
  grid-row: 1;
}

form > input {
  grid-column: 1;
  grid-row: 2;
}

form > button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: end;
}

label {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

input {
  font: inherit;
  inline-size: 100%;
  min-inline-size: 0;
  padding: var(--s1) 0;
  border: 0;
  border-block-end: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: inherit;
}

@supports (field-sizing: content) {
  input {
    field-sizing: content;
  }
}

input:focus-visible {
  outline: none;
  border-block-end-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}

button {
  font: inherit;
  min-block-size: 44px;
  padding: var(--s1) var(--s3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--paper);
  cursor: pointer;
}

button:hover {
  background: color-mix(in oklab, var(--accent) 85%, var(--ink));
}

button.secondary {
  background: transparent;
  color: var(--accent);
}

/* Lists of objects */

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: var(--s2) var(--s4);
  container-type: inline-size;
}

li {
  border-block-start: 1px solid var(--rule);
  padding-block: var(--s2);
}

li > a {
  display: block;
  text-decoration: none;
  color: inherit;
}

li img {
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: var(--image-ratio);
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--paper-sunk);
  margin-block-end: var(--s1);
}

li strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.0625rem;
}

li > a:hover strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

li p {
  margin-block: var(--s1) 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

li:not(:has(img)) {
  min-block-size: 44px;
}

@container (min-width: 34rem) {
  li {
    padding-block: var(--s3);
  }
}

/* The museum's own photograph, with the words it wrote for it. */
.site-figure {
  margin-block: var(--s5);
}

.site-figure img {
  inline-size: 100%;
  block-size: auto;
  border-radius: var(--radius);
  background: var(--paper-sunk);
}

.site-figure figcaption {
  margin-block-start: var(--s2);
  color: var(--ink-muted);
  font-size: 0.9375rem;
  max-inline-size: var(--column);
}

.site-figure figcaption p {
  margin: 0;
}

.site-figure .figure-credit {
  font-family: var(--mono);
  font-size: 0.8125rem;
  margin-block-start: var(--s1);
}

/* Data and reuse: the published addresses, printed in full so a reuser can
   copy one without following a link. */
.feed-list li {
  display: grid;
  gap: var(--s1);
}

.feed-address {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.licence-line {
  margin-block-start: var(--s3);
}

/* A collection view is the same list at collection scale. Grid keeps the
   responsive columns; rows put one object per line for a museum that reads
   better in a single column. */
.collection-view-rows ul {
  grid-template-columns: 1fr;
}

/* The embed: a chromeless frame another site puts in its own page.

   The snippet quotes the frame height, because a cross-origin frame cannot
   report its own height without script and this product refuses script on the
   museum's page. So the page reflows inside the quoted height and never
   scrolls sideways; a row is one strip that scrolls horizontally when the
   frame is narrow, and a grid fits two columns at 320 pixels. */
.embed-main {
  max-inline-size: 72rem;
}

.embed-identity {
  margin-block: 0 var(--s3);
  padding-block-end: var(--s2);
  border-block-end: 1px solid var(--rule);
}

.embed-identity img {
  max-block-size: 2.25rem;
  max-inline-size: 8rem;
  inline-size: auto;
  vertical-align: middle;
  margin-inline-end: var(--s1);
}

.embed-list.embed-row {
  grid-auto-flow: column;
  grid-auto-columns: 8.5rem;
  grid-template-columns: none;
  overflow-x: auto;
  padding-block-end: var(--s2);
  scroll-snap-type: x proximity;
}

.embed-list.embed-row li {
  scroll-snap-align: start;
}

.embed-list.embed-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 18rem) {
  .embed-list.embed-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 34rem) {
  .embed-list.embed-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 48rem) {
  .embed-list.embed-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.embed-link {
  margin-block: var(--s3) 0;
}

/* Home: the editorial page.

   The masthead is the museum, the featured object is one plate and one reason,
   the exhibition opens with a heavier rule, and the page ends with one data
   line. No cards, no shadows, nothing that has to be maintained. */

.home-masthead {
  border-block-end: 1px solid var(--rule);
  padding-block-end: var(--s4);
  margin-block-end: var(--s5);
}

.home-masthead h1 {
  font-size: var(--display);
  line-height: 1.05;
  margin-block-end: var(--s3);
  text-wrap: balance;
}

.home-sentence {
  font-size: 1.1875rem;
  max-inline-size: 56ch;
  white-space: pre-wrap;
  margin: 0;
}

.featured {
  margin-block: var(--s5) var(--s6);
}

.featured h2,
.exhibition h2 {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-block: 0 var(--s2);
}

.featured figure {
  margin: 0;
}

.featured img {
  inline-size: 100%;
  block-size: auto;
  object-fit: contain;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

@supports (aspect-ratio: 1) {
  .featured img:not([width]) {
    aspect-ratio: var(--image-ratio);
  }
}

.featured figcaption {
  display: grid;
  gap: var(--s1);
  margin-block-start: var(--s3);
}

.featured-title {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.2;
  margin: 0;
}

.featured-title a {
  color: var(--ink);
  text-decoration: none;
}

.featured-title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.featured-meta {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin: 0;
}

.featured-reason {
  font-size: 1.125rem;
  max-inline-size: 56ch;
  margin: var(--s1) 0 0;
}

.featured-why {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Image left, label right once the viewport can hold both without crowding
   the reason to a narrow ribbon. Below that it is one column, image first. */

@media (min-width: 48rem) {
  .featured figure:has(img) {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--s4);
    align-items: start;
  }

  .featured figure:has(img) figcaption {
    margin-block-start: 0;
  }
}

/* A topic page is its saved query: the writer's two sentences, one plate from
   the topic's own matches, then every object carrying the term. The rule is
   the same hairline that opens every new subject. */

.topic-standfirst {
  font-size: 1.1875rem;
  max-inline-size: 56ch;
  white-space: pre-wrap;
  margin-block: var(--s2) var(--s4);
}

.topic-objects {
  border-block-start: 1px solid var(--rule);
  padding-block-start: var(--s3);
  margin-block-start: var(--s5);
}

/* The plate reads as a plate, not a wall: a tall photograph never pushes the
   list below the fold on a phone. */
.topic-hero img {
  max-block-size: 60vh;
}

/* Topic links: saved queries as a short row of plates. Same tokens as the
   collection strip; no second accent, no card shadow. */

.topic-links {
  border-block-start: 1px solid var(--rule);
  padding-block-start: var(--s3);
  margin-block-start: var(--s5);
}

.topic-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
}

.topic-links-list a {
  display: grid;
  gap: var(--s1);
  color: var(--ink);
  text-decoration: none;
}

.topic-links-list a:hover strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.topic-links-list img {
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: var(--image-ratio);
  object-fit: contain;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.topic-links-count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.exhibition {
  border-block-start: 2px solid var(--rule-strong);
  padding-block-start: var(--s3);
}

.exhibition h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
  margin-block: 0 var(--s2);
  text-wrap: balance;
}

.exhibition h3 a {
  color: var(--ink);
  text-decoration: none;
}

.exhibition h3 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.exhibition-place {
  color: var(--ink-muted);
  margin-block-end: var(--s3);
}

ul.gallery {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: var(--s2);
}

ul.gallery li {
  padding-block: var(--s2);
}

ul.gallery strong {
  font-size: 0.9375rem;
}

.note {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-block: 0 var(--s3);
}

.visit {
  border-block-start: 1px solid var(--rule);
  padding-block-start: var(--s3);
}

.visit dl {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  gap: var(--s1) var(--s3);
}

.visit dt {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.visit dd {
  margin: 0;
  white-space: pre-wrap;
}

/* A quotation is editorial, so it is set in the museum's voice, not as a
   record fact: serif, a hairline above, attribution in mono underneath. */

.quote {
  border-block-start: 1px solid var(--rule);
  padding-block-start: var(--s3);
  margin-block: var(--s5);
}

.quote blockquote {
  margin: 0;
}

.quote blockquote p {
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.45;
  max-inline-size: 56ch;
  margin: 0;
  text-wrap: pretty;
}

.quote-large blockquote p {
  font-size: 1.5rem;
  line-height: 1.3;
}

.quote-attribution {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-block: var(--s2) 0;
}

.site-data {
  border-block-start: var(--footer-rule);
  margin-block-start: var(--s6);
  padding-block: var(--s3) 0;
}

.site-data p {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 0;
  text-wrap: pretty;
}

.draft-status,
main > aside {
  background: var(--paper-sunk);
  border-inline-start: 2px solid var(--rule-strong);
  padding: var(--s2) var(--s3);
  margin-block-end: var(--s4);
}

.draft-status {
  font-size: 0.9375rem;
}

/* Record */

article > img {
  inline-size: 100%;
  max-inline-size: 100%;
  block-size: auto;
  object-fit: contain;
  background: var(--paper-sunk);
  border-radius: var(--radius);
  margin-block: var(--s3);
}

article > img:not([width]) {
  aspect-ratio: var(--image-ratio);
}

section {
  margin-block: var(--s5);
}

blockquote {
  margin: 0;
  padding-inline-start: var(--s3);
  border-inline-start: 2px solid var(--rule);
  color: var(--ink-muted);
}

details {
  border-block-start: 1px solid var(--rule);
  padding-block: var(--s2);
}

summary {
  cursor: pointer;
  color: var(--accent);
  min-block-size: 44px;
  display: flex;
  align-items: center;
  gap: var(--s1);
}

summary::marker {
  color: var(--ink-muted);
}

@supports (interpolate-size: allow-keywords) and selector(::details-content) {
  details::details-content {
    block-size: 0;
    overflow: clip;
    transition:
      block-size 260ms cubic-bezier(0.2, 0.7, 0.3, 1),
      content-visibility 260ms allow-discrete;
  }

  details[open]::details-content {
    block-size: auto;
  }
}

pre {
  max-inline-size: 100%;
  overflow-x: auto;
  padding: var(--s2);
  background: var(--paper-sunk);
  border-radius: var(--radius);
}

code {
  font-family: var(--mono);
  font-size: 0.875rem;
}

dl,
dd {
  margin: 0;
}

/* Pager */

nav[aria-label] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-block: var(--s4);
}

nav[aria-label] a {
  min-block-size: 44px;
  display: inline-flex;
  align-items: center;
}

/* Copy affordance: only present when the script ran. */

[data-copy-source] {
  margin-block-start: var(--s2);
}

#copy-status {
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

/* Record: the museum label */

.record-head {
  margin-block-end: var(--s3);
}

.record-head h1 {
  font-size: 1.75rem;
}

.record-type {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--ink-muted);
  margin-block: 0 var(--s2);
}

.record-museum {
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink-muted);
  margin-block: 0 var(--s1);
}

.record-accession,
.label-accession,
.label-url {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.record-accession {
  margin-block: 0 var(--s3);
}

.record-lead {
  font-size: 1.125rem;
}

.record-facts {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  gap: var(--s1) var(--s3);
  margin-block: var(--s4);
  border-block-start: 1px solid var(--rule);
  padding-block-start: var(--s3);
}

.record-facts > div {
  display: contents;
}

.record-facts dt {
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.record-facts dd {
  margin: 0;
}

/* Printable case label */

.label-museum,
.label-accession,
.label-facts,
.label-url {
  margin-block: 0 var(--s1);
}

.label-qr {
  margin-block: var(--s3);
  max-inline-size: 9rem;
}

.label-qr svg {
  inline-size: 100%;
  block-size: auto;
  display: block;
}

.label-hint {
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

/* Page transitions. Chrome 126+, Safari 18.2+; elsewhere the page simply
   changes. The root cross-fade is the browser default, so only the timing and
   the shared museum name are set here. */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-group(root) {
    animation-duration: 180ms;
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1);
  }

  ::view-transition-group(museum-name) {
    animation-duration: 180ms;
  }
}

body[data-motion="off"] *,
body[data-motion="off"] *::before,
body[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Narrow phones: 320px must reflow without horizontal scrolling. */

@media (max-width: 26rem) {
  body {
    padding: var(--s2);
  }

  form {
    grid-template-columns: 1fr;
  }

  form > button {
    grid-column: 1;
    grid-row: auto;
  }

  header nav {
    gap: var(--s1) var(--s2);
  }

  /* The identity takes its own line on a phone, so the menu never leaves a
     link orphaned beside the name. */
  .identity {
    flex-basis: 100%;
  }

  .identity img {
    max-inline-size: 5rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  .record-head h1 {
    font-size: 1.5rem;
  }

  .record-facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .record-facts dt {
    margin-block-start: var(--s2);
  }

  .featured-title {
    font-size: 1.25rem;
  }

  .exhibition h3 {
    font-size: 1.25rem;
  }

  ul.gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visit dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .visit dt {
    margin-block-start: var(--s2);
  }
}

@media (prefers-contrast: more) {
  :root {
    --rule: var(--ink);
  }

  a {
    text-decoration: underline;
  }
}

/* Print: the citation travels on paper. */

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #000;
    font-family: var(--serif);
    font-size: 11pt;
    max-inline-size: none;
  }

  body > header,
  form,
  button,
  nav[aria-label],
  #copy-status {
    display: none;
  }

  a {
    color: #000;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
  }

  li img,
  article > img {
    max-block-size: 60mm;
    background: transparent;
  }

  section,
  article {
    break-inside: avoid;
  }

  /* The case label is the sheet. */

  .label-hint,
  .label-back {
    display: none;
  }

  .record-label {
    max-inline-size: none;
  }

  .record-label h1 {
    font-size: 22pt;
    margin-block-end: 3mm;
  }

  .record-label a::after {
    content: none;
  }

  .record-label img {
    display: block;
    margin-inline: auto;
  }

  .label-museum {
    font-size: 11pt;
    border-block-end: 1pt solid #000;
    padding-block-end: 2mm;
    margin-block-end: 4mm;
  }

  .label-qr,
  .label-qr svg {
    inline-size: 32mm;
    block-size: 32mm;
  }

  .record-facts {
    grid-template-columns: max-content 1fr;
  }

  .home-masthead h1 {
    font-size: 24pt;
  }

  .featured,
  .exhibition,
  .visit,
  .quote {
    break-inside: avoid;
  }
}
