/* CollageHero collection pages. Restrained on purpose: the photos are the colour.
   The look is not settled yet (PROJECT.md, step 3); these are neutral tokens. */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1b1b1d;
  --ink-2: #5d5d63;
  --ink-3: #8b8b92;
  --line: #e2e0db;
  --tile: #e9e7e2;
  --accent: #1b1b1d;
  --on-accent: #ffffff;
  --ok: #2f7d4f;
  --bad: #b3261e;
  --radius: 14px;
  --gap: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416;
    --surface: #1e1e21;
    --ink: #f2f2f3;
    --ink-2: #b2b2b8;
    --ink-3: #85858c;
    --line: #2f2f33;
    --tile: #2a2a2e;
    --accent: #f2f2f3;
    --on-accent: #141416;
    --ok: #63c08a;
    --bad: #f2867e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[hidden] { display: none !important; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
}
.page.wide { max-width: 980px; }

.brand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 4px 0 18px;
}
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0; }
p { margin: 0 0 12px; }
.lede { color: var(--ink-2); }
#message { white-space: pre-line; }
.small { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }
.muted { color: var(--ink-3); }

/* Buttons. A label styled as a button opens the file picker without script. */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.secondary { background: var(--tile); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible, .link:focus-visible, .thumb:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ink) 35%, transparent); outline-offset: 2px;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; background: var(--tile); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600;
  border: 0; cursor: pointer;
}
.link { background: none; border: 0; padding: 10px 0; margin: -10px 0; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* First arrival: the tip in its own panel, the reassurances as a short list below a rule. */
.tip {
  display: flex; gap: 10px; align-items: baseline;
  margin: 16px 0 0; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 15px; line-height: 1.4; color: var(--ink);
}
.tip p { margin: 0; }
.tip-label {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--on-accent); background: var(--accent); border-radius: 6px; padding: 2px 6px;
  position: relative; top: -1px;
}
.assure {
  list-style: none; margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line);
  display: grid; gap: 10px; font-size: 14px; line-height: 1.4; color: var(--ink-2);
}
.assure li { display: flex; gap: 10px; align-items: flex-start; }
.assure svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-3); }

/* Selection heading: count on the left, the quiet action on the right. */
.selhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.selhead b { font-size: 18px; }

/* Thumbnail grid */
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin: 0 0 14px; }
@media (min-width: 520px) { .thumbs { grid-template-columns: repeat(5, 1fr); } }
.page.wide .thumbs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: var(--tile); border: 0; padding: 0; cursor: pointer; display: block; width: 100%;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .name {
  position: absolute; inset: auto 4px 4px; font-size: 10px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.thumb.marked img { opacity: 0.55; }
.mark {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, 0.25); display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.marked .mark { background: var(--ink); border-color: #fff; }
.mark svg { width: 14px; height: 14px; color: #fff; }
.state {
  position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.state svg { width: 14px; height: 14px; }
.state.sent { background: var(--ok); color: #fff; }
.state.failed { background: var(--bad); color: #fff; font-weight: 700; font-size: 14px; }
.state.sending::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #c9c9cc; border-top-color: #1b1b1d; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .state.sending::after { animation-duration: 2.5s; } }

/* Form */
label.field-label { display: block; font-weight: 600; font-size: 15px; margin: 18px 0 6px; }
input[type="text"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
textarea.short { min-height: 0; }
input[aria-invalid="true"] { border-color: var(--bad); }
.hint { font-size: 14px; color: var(--ink-3); margin: 6px 0 0; }
.error { font-size: 14px; color: var(--bad); margin: 6px 0 0; font-weight: 600; }
details.optional { margin: 14px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
details.optional summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  min-height: 48px; cursor: pointer; color: var(--ink-2); font-size: 15px;
}
details.optional summary::-webkit-details-marker { display: none; }
details.optional summary::after { content: "⌄"; font-size: 18px; transition: transform 0.15s; }
details.optional[open] summary::after { transform: rotate(180deg); }
details.optional > div { padding: 0 0 14px; }
details.optional label.field-label { margin-top: 4px; }

/* Progress */
.progress { height: 6px; border-radius: 3px; background: var(--tile); overflow: hidden; margin: 4px 0 6px; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.25s; }
.notice { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 10%, var(--surface)); margin: 0 0 12px; }
.notice.plain { background: var(--surface); border: 1px solid var(--line); }

/* Toast: "3 photos removed · Undo" */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: #1b1b1d; color: #fff; font-size: 15px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); z-index: 20;
  max-width: calc(100% - 32px);
}
.toast button { background: rgba(255, 255, 255, 0.16); color: #fff; border: 0; border-radius: 999px; min-height: 36px; padding: 0 14px; font: inherit; font-weight: 600; cursor: pointer; }

/* Large view */
.viewer {
  position: fixed; inset: 0; z-index: 30; background: #0d0d0e; color: #fff;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.viewer header, .viewer footer { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; gap: 8px; }
.viewer .stage { position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.viewer .stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer button { background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; border-radius: 999px; min-height: 44px; min-width: 44px; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer; }
.viewer .count { font-size: 15px; color: #c9c9cc; }
/* The organiser's large view adds a caption row, Download, and a look at actual size. */
.viewer.inspect { grid-template-rows: auto 1fr auto auto auto; }
.viewer.inspect .vextra { padding: 4px 12px 0; text-align: center; font-size: 13px; color: #c9c9cc; }
.viewer.inspect .vextra p { margin: 0; }
.viewer.inspect .vbtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.viewer.inspect .vbtns button { min-height: 40px; font-size: 14px; }
.viewer.inspect .vstatus { margin-top: 6px; min-height: 0; }
.viewer.inspect .vstatus a { color: #fff; }
.viewer.inspect .count { text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer.inspect .pillish { background: rgba(255, 255, 255, 0.14); color: #fff; border-radius: 999px; min-height: 44px; padding: 0 16px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.viewer.inspect button:disabled { opacity: 0.35; cursor: default; }
.viewer.inspect .caption { margin: 0; padding: 6px 12px 0; font-size: 13px; color: #c9c9cc; text-align: center; min-height: 1.4em; }
.viewer.inspect .stage img { cursor: zoom-in; }
.viewer.inspect .stage.actual { display: block; overflow: auto; touch-action: auto; -webkit-overflow-scrolling: touch; }
.viewer.inspect .stage.actual img { max-width: none; max-height: none; display: block; margin: auto; cursor: zoom-out; }

/* Organiser page */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.pill:disabled { opacity: 0.5; cursor: default; }
#small-info { margin: 0 0 16px; }
#small-info .small { margin: 0 0 8px; }
#small-info a { color: inherit; }
/* The tag on a small photo, and the same tag in the legend above the photos. "Small" is the
   mild case, so it is the quiet one; every tag has an outline so it holds on any photo. */
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; line-height: 1.2; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: #fff; color: #1b1b1d; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
}
.badge.is-vsmall, .badge.is-tiny, .badge.is-resolved { color: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.92), 0 1px 3px rgba(0, 0, 0, 0.4); }
.badge.is-vsmall { background: #a85d0c; }
.badge.is-tiny { background: #b3261e; }
.badge.is-resolved { background: #23693f; }
.thumb .badge { position: absolute; left: 6px; top: 6px; max-width: calc(100% - 50px); overflow: hidden; text-overflow: ellipsis; }
.thumb .badge.is-resolved { max-width: calc(100% - 12px); }
.sizekey { display: flex; gap: 14px 36px; align-items: flex-start; flex-wrap: wrap; margin: 0 0 14px; }
.posterkey { margin: 0; flex: none; color: var(--ink); }
.posterkey svg { display: block; }
.posterkey text { font-size: 12px; fill: currentColor; }
.posterkey figcaption { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; flex: 0 1 auto; min-width: 0; }
.legend li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--ink-2); }
.legend .badge { flex: none; min-width: 78px; text-align: center; }
.how { margin: 0; font-size: 15px; font-weight: 600; }

/* Choosing photos to ask about: a tick circle on each, always there */
.cell { position: relative; }
.pick { position: absolute; top: 0; right: 0; width: 44px; height: 44px; background: none; border: 0; padding: 0; cursor: pointer; }
.pick .mark { top: 7px; right: 7px; width: 26px; height: 26px; color: #fff; font-size: 15px; font-weight: 700; line-height: 1; background: rgba(0, 0, 0, 0.35); }
.cell.picked .thumb { outline: 3px solid var(--accent); outline-offset: -3px; }
.cell.picked .pick .mark { background: var(--accent); color: var(--on-accent); }
.pill.primary { background: var(--accent); color: var(--on-accent); }

/* The bar at the foot: what is ticked and the one thing to do with it, then the link that was made */
.pickbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.1); padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.pickbar > * { max-width: 980px; margin: 0 auto; }
.pickrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pickrow b { margin-right: auto; }
body.has-pickbar { padding-bottom: 240px; }
.asktitle { font-weight: 600; margin: 0 0 8px; }
.askthumbs { display: flex; gap: 6px; margin: 0 0 10px; overflow-x: auto; }
.askthumbs img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; background: var(--tile); }
.pickbar .askbox { margin: 0; }
.pickbar .askbox .small { margin: 8px 0 0; }
.askbox { margin: 12px 0 0; }
.askbox .note { margin: 0 0 10px; overflow-wrap: anywhere; }
.askbox .formrow { margin-top: 0; flex-wrap: wrap; }
.viewer.inspect .askbox { margin-top: 0; }
.viewer.inspect .askbox .note { border: 0; padding: 0; margin: 4px 0 8px; color: #fff; font-size: 13px; text-align: center; }
.viewer.inspect .askbox .formrow { justify-content: center; gap: 8px; }
.viewer.inspect .askbox .small { color: #c9c9cc; font-size: 12px; margin: 6px 0 0; }
.viewer.inspect .askbox button { min-height: 40px; font-size: 14px; }

/* An ask: the photos in question, above the request on the link page */
.askpics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; align-items: start; margin: 0 0 16px; }
.askpics.one { grid-template-columns: minmax(0, 340px); }
.askpics img { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--tile); }
.summary { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-2); margin: 0 0 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.card h2 { margin-bottom: 2px; }
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; background: var(--tile); padding: 10px 12px; border-radius: 10px; }
.note { margin: 8px 0 12px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-2); white-space: pre-wrap; }
pre.cmd { overflow-x: auto; background: var(--tile); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin: 8px 0 0; }
.formrow { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.formrow .small { margin: 0; }
.who { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
