/* Art gallery app: shared styles. Version 2026-10-02 d. */

:root {
  --wall: #f2f3f0;
  --panel: #ffffff;
  --ink: #14232b;
  --muted: #55666d;
  --line: #cfd6d3;
  --good: #0b6e69;
  --wait: #6a5a12;
  --bad: #9a3b2e;
  --focus: #0b6e69;
  --shadow: 0 1px 0 rgba(20, 35, 43, .18), 0 .7rem 1rem -.7rem rgba(20, 35, 43, .5);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wall: #101b20;
    --panel: #17262c;
    --ink: #e6ecea;
    --muted: #a3b3b6;
    --line: #2c3f46;
    --good: #63cdc2;
    --wait: #e3cf7a;
    --bad: #f29a88;
    --focus: #63cdc2;
    --shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 .7rem 1rem -.7rem rgba(0, 0, 0, .9);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  padding:
    calc(env(safe-area-inset-top, 0px) + 1.25rem)
    1.25rem
    calc(env(safe-area-inset-bottom, 0px) + 2.5rem);
}
.wrap { max-width: 44rem; margin: 0 auto; }
.wrap.narrow { max-width: 34rem; }

[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -999rem; top: 0;
  background: var(--panel); color: var(--ink);
  padding: .6rem .9rem; border: 2px solid var(--focus);
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

a { color: var(--good); text-underline-offset: .15em; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }

h1 {
  margin: 0 0 .75rem;
  font: 400 clamp(2.1rem, 8vw, 3.25rem)/1.08 var(--serif);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
h2 { margin: 2rem 0 .75rem; font: 400 1.5rem/1.2 var(--serif); }
.name { margin: 0 0 2.5rem; color: var(--muted); }
.lead { margin: 0 0 2.5rem; max-width: 34rem; color: var(--muted); }

footer { margin-top: 3rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; }
footer p { margin: 0; }

/* Buttons */
.button, button {
  display: inline-block;
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  min-height: 3rem; padding: .7rem 1.2rem;
  color: var(--wall); background: var(--ink);
  border: 1px solid var(--ink); border-radius: .35rem; cursor: pointer;
}
button.quiet, .button.quiet { color: var(--ink); background: transparent; }
button[disabled] { opacity: .6; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 0 0 1rem; }

/* Notices */
.notice {
  margin: 0 0 1.5rem; padding: .9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: .3rem solid var(--bad);
}
.notice.good { border-left-color: var(--good); }
.notice p { margin: 0; }
.notice ul { margin: .5rem 0 0; padding-left: 1.2rem; }

/* ----- Gallery wall ----- */
.masthead { margin: 0 0 2rem; }
.masthead h1 { margin: 0; }
.wall {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.75rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 40rem) { .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile a { display: block; color: inherit; text-decoration: none; }
.mat {
  display: block; position: relative;
  aspect-ratio: 4 / 5;
  background: var(--panel);
  border: 1px solid var(--line);
}
/* The picture sits whole inside the mat, never cropped. */
.mat-inner {
  position: absolute; inset: 9%;
  display: flex; align-items: center; justify-content: center;
}
.mat-inner img {
  display: block; max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  box-shadow: var(--shadow);
}
.tile-title { display: block; margin: .6rem 0 0; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tile a:hover .tile-title, .tile a:focus-visible .tile-title { text-decoration: underline; text-underline-offset: .15em; }
.tile-price { display: block; color: var(--muted); }

/* ----- Piece page ----- */
.back { display: inline-block; margin: 0 0 1.5rem; padding: .5rem 0; }
.hang { margin: 0 0 1.25rem; }
.hang img {
  display: block; max-width: 100%; height: auto;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.hang figcaption { margin: .6rem 0 0; color: var(--muted); text-align: center; }
.piece-title { margin-top: 2rem; }
.price { margin: 0 0 1.25rem; font-size: 1.2rem; font-weight: 600; }
.facts { margin: 0 0 1.5rem; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 6rem 1fr; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.description { max-width: 34rem; white-space: pre-line; }

/* ----- Connection check ----- */
.parts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.part {
  display: grid; grid-template-columns: 1.5rem 1fr; column-gap: .75rem;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.part svg { width: 1.25rem; height: 1.25rem; margin-top: .2rem; }
.part-name { margin: 0; font-weight: 600; }
.part-state { font-weight: 600; }
.part-note { margin: .15rem 0 0; color: var(--muted); }
.part[data-state="ok"]   .part-state, .part[data-state="ok"]   svg { color: var(--good); }
.part[data-state="wait"] .part-state, .part[data-state="wait"] svg { color: var(--wait); }
.part[data-state="bad"]  .part-state, .part[data-state="bad"]  svg { color: var(--bad); }
.part[data-state="busy"] .part-state, .part[data-state="busy"] svg { color: var(--muted); }
.part button { margin-top: .6rem; }
.summary { margin: 1.25rem 0 0; font-weight: 600; }
.translated { margin: .6rem 0 0; padding: 0; list-style: none; }
.translated span { color: var(--muted); }
.grid {
  list-style: none; margin: 1.25rem 0 0; padding: 0;
  display: grid; gap: 1.25rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 40rem) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid var(--line); }
.grid h3 { margin: .6rem 0 0; font: 600 1rem/1.3 var(--sans); }
.grid p { margin: .1rem 0 0; color: var(--muted); }

/* ----- Editor ----- */
.settings { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--line); }
.settings li {
  display: grid; grid-template-columns: 1.5rem 1fr; column-gap: .75rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line);
}
.settings svg { width: 1.25rem; height: 1.25rem; margin-top: .2rem; }
.settings code { font: 600 .95rem/1.4 var(--mono); overflow-wrap: anywhere; }
.settings .state { font-weight: 600; }
.settings li[data-state="ok"] .state, .settings li[data-state="ok"] svg { color: var(--good); }
.settings li[data-state="wait"] .state, .settings li[data-state="wait"] svg { color: var(--wait); }
.address {
  display: block; margin: 0 0 .6rem; padding: .7rem .8rem;
  background: var(--panel); border: 1px solid var(--line);
  font: .95rem/1.4 var(--mono); overflow-wrap: anywhere;
}
.copied { color: var(--good); font-weight: 600; }
details { margin: 1.5rem 0 0; border-top: 1px solid var(--line); padding-top: 1rem; }
summary { cursor: pointer; font-weight: 600; min-height: 2.75rem; display: flex; align-items: center; }

.signed {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  margin: 0 0 1.5rem; padding: 0 0 1rem; border-bottom: 1px solid var(--line);
}
.signed p { margin: 0; overflow-wrap: anywhere; }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li {
  display: grid; grid-template-columns: 4rem 1fr auto; gap: .9rem; align-items: center;
  padding: .8rem 0; border-bottom: 1px solid var(--line);
}
.rows img, .rows .no-photo {
  width: 4rem; height: 4rem; object-fit: cover; display: block;
  background: var(--panel); border: 1px solid var(--line);
}
.rows .row-title { font-weight: 600; overflow-wrap: anywhere; }
.rows .row-sub { color: var(--muted); }

.field { margin: 0 0 1.4rem; }
.field label, legend { display: block; font-weight: 600; margin: 0 0 .3rem; padding: 0; }
.hint { display: block; color: var(--muted); margin: 0 0 .4rem; }
.field-error { display: block; color: var(--bad); font-weight: 600; margin: .35rem 0 0; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  font: inherit; color: var(--ink);
  min-height: 3rem; padding: .6rem .7rem;
  background: var(--panel);
  border: 1px solid var(--muted); border-radius: .25rem;
}
textarea { min-height: 7rem; resize: vertical; }
[aria-invalid="true"] { border: 2px solid var(--bad); }
fieldset { border: 0; margin: 0 0 1.4rem; padding: 0; min-width: 0; }
.cols { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols label { font-weight: 400; color: var(--muted); }
.cols .wide { grid-column: 1 / -1; }

.photo-slots { list-style: none; margin: 0 0 .75rem; padding: 0; }
.photo-slots li {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: .9rem;
  padding: .8rem 0; border-top: 1px solid var(--line);
}
.photo-slots li:last-child { border-bottom: 1px solid var(--line); }
.photo-slots img { width: 5.5rem; height: 5.5rem; object-fit: cover; display: block; border: 1px solid var(--line); background: var(--panel); }
.photo-slots .slot-name { font-weight: 600; margin: 0 0 .4rem; }
.photo-slots label { font-weight: 400; color: var(--muted); }
.photo-slots button { margin-top: .6rem; }
.file-pick { position: relative; display: inline-block; }
.file-pick input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.file-pick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.file-pick span {
  display: inline-block; font-weight: 600;
  min-height: 3rem; padding: .7rem 1.2rem;
  color: var(--ink); border: 1px solid var(--ink); border-radius: .35rem;
}
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 2rem 0 1rem; }
.actions button { flex: 1 1 10rem; }
