/* Find Lost Art: a gallery wall. Readings hang as museum wall labels.
   Feature views use these classes; add to this file only what no class here
   covers, and keep the tokens. */

:root {
  --wall: #efebe3;
  --card: #fbfaf7;
  --sunk: #e6e1d7;
  --line: #d8d2c6;
  --ink: #1d1b18;
  --muted: #655f56;
  --gilt: #a8894a;
  --gilt-shade: #7d6532;
  --on-gilt: #1d1b18;
  --ok: #2f6b45;
  --warn: #8a5a12;
  --bad: #9b2c22;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 0.5rem;
  --gap: 1rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wall: #191816;
    --card: #23211e;
    --sunk: #141311;
    --line: #38352f;
    --ink: #ece8e0;
    --muted: #a8a196;
    --gilt: #b89c5e;
    --gilt-shade: #6f5a2c;
    --on-gilt: #191816;
    --ok: #7fc29a;
    --warn: #e0b061;
    --bad: #ef8a80;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--wall);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
}
#app { flex: 1; display: flex; flex-direction: column; }
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 0.15em; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-size: 0.85em; overflow-wrap: anywhere; }
/* One tap selects the whole code, the fallback when Copy can't write. */
.code { -webkit-user-select: all; user-select: all; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- page frame ------------------------------------------------------------ */

.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 1.15rem/1 var(--serif); text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 1rem; height: 1.25rem;
  border: 0.22rem solid var(--gilt);
  box-shadow: 0 0 0 1px var(--gilt-shade);
}
.topbar-spacer { flex: 1; }
.topbar nav { display: flex; gap: 0.75rem; align-items: center; }
/* On a phone the bar stays one line: the worker pill shrinks to its dot,
   its words kept for screen readers (the .visually-hidden rules). */
@media (max-width: 30rem) {
  .topbar, .topbar nav { gap: 0.5rem; }
  .topbar .pill { padding: 0.3rem; gap: 0; }
  .topbar .pill-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}

.page {
  width: 100%; max-width: 44rem; margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.site-foot {
  padding: 0 1rem 1rem; text-align: center;
  font: 0.75rem/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere;
}
.site-foot span { display: inline-block; margin: 0 0.6em; }

/* --- surfaces --------------------------------------------------------------- */

/* The wall label: the card every reading and prompt sits on. */
.label {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  padding: 1.1rem 1.25rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.label .medium { font-family: var(--serif); font-style: italic; color: var(--muted); }
.label hr { border: 0; border-top: 1px solid var(--line); margin: 0.25rem 0; width: 100%; }

/* A picture hung in a gilt frame. */
.framed {
  border: 0.6rem solid var(--gilt);
  box-shadow: inset 0 0 0 1px var(--gilt-shade), 0 0 0 1px var(--gilt-shade),
              0 1rem 1.5rem -1rem rgb(0 0 0 / 0.5);
  background: var(--sunk);
}
.framed img { width: 100%; height: auto; }

.banner {
  border-left: 0.25rem solid var(--muted);
  background: var(--card);
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
}
.banner.ok   { border-color: var(--ok); }
.banner.warn { border-color: var(--warn); }
.banner.bad  { border-color: var(--bad); }
/* The reading asks for one more photo: the gilt of the frame it will join. */
.banner.ask  { border-color: var(--gilt); }
.banner.ask h2 { font-size: 1rem; margin: 0 0 0.3rem; }
.banner.ask ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.banner.ask .btn { max-width: 100%; }

/* --- controls -------------------------------------------------------------- */

.btn {
  appearance: none; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  font: 600 1rem/1.2 var(--sans);
  padding: 0.7rem 1rem; min-height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--gilt); border-color: var(--gilt-shade); color: var(--on-gilt); }
.btn.quiet { background: transparent; border-color: transparent; padding-inline: 0.4rem; }
.btn.big { width: 100%; min-height: 3.5rem; font-size: 1.1rem; }
.btn:focus-visible, .chip:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gilt); outline-offset: 2px;
}
/* A file input styled as a button: <label class="btn">…<input type=file class="visually-hidden"></label> */
label.btn { position: relative; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  appearance: none; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink);
  font: 0.9rem/1 var(--sans); padding: 0.5rem 0.8rem; min-height: 2.25rem;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--wall); border-color: var(--ink); }

textarea, input[type="text"] {
  width: 100%; font: 1rem/1.4 var(--sans); color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font: 0.8rem/1 var(--sans); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.6rem;
}
.pill::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted); }
.pill.ok::before { background: var(--ok); }
.pill.warn::before { background: var(--warn); }
.pill.bad::before { background: var(--bad); }

.spinner {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--gilt);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* --- frames and finds ------------------------------------------------------ */

/* A strip of sampled frames before sending. */
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); }

/* The list of finds: a thumbnail beside its headline and status. */
.finds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.find {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 0.75rem; align-items: center;
  background: var(--card); border: 1px solid var(--line); padding: 0.5rem;
  text-decoration: none;
}
.find img { width: 4rem; height: 4rem; object-fit: cover; }
.find .headline { font-family: var(--serif); font-weight: 600; }

/* --- the reading ----------------------------------------------------------- */

.reading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem;
           grid-template-areas: "facts" "picture" "rest"; }
.reading > .facts { grid-area: facts; }
.reading > .pictures { grid-area: picture; }
.reading > .rest { grid-area: rest; }
.facts .row { column-gap: 0.75rem; }
/* On a phone the verdict comes first and the picture leaves room for it. */
@media (max-width: 45.99rem) {
  .reading h1 { font-size: 1.35rem; }
  .reading .framed img { max-height: 45vh; object-fit: contain; }
}
@media (min-width: 46rem) {
  .reading { grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); align-items: start; }
  /* The facts and the rest join into one wall label beside the picture. */
  .reading { grid-template-areas: "picture facts" "picture rest";
             grid-template-rows: auto 1fr; row-gap: 0; }
  .reading > .facts { border-bottom: 0; padding-bottom: 0; box-shadow: none; }
  .reading > .rest { border-top: 0; padding-top: 0.75rem; }
}
.reading section { display: flex; flex-direction: column; gap: 0.4rem; }
.reading h3 { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.06em;
              text-transform: uppercase; color: var(--muted); }
.reading ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; }
.confidence { font: 600 0.8rem/1 var(--sans); padding: 0.25rem 0.5rem; border-radius: 999px;
              border: 1px solid currentColor; align-self: flex-start; }
.confidence.high { color: var(--ok); }
.confidence.medium { color: var(--warn); }
.confidence.low { color: var(--bad); }
.leads { list-style: none; padding: 0; }
.leads li { display: flex; flex-direction: column; gap: 0.2rem; }
.leads .links { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.9rem; }
.refs { list-style: none; padding: 0; }
.refs li { display: flex; flex-direction: column; gap: 0.2rem; }
