/* Photomosaic: what is particular to this page, over /shared/base.css (tokens, frame, controls,
   file button, problems, out-of-date results and the narrow layout). */

/* Three cards on the left (photos, target, matching) beside the mosaic. */
@media (min-width: 1000px) {
  .layout { grid-template-rows: auto auto 1fr; }
}

.progress { display: block; width: 100%; height: 0.6rem; margin: 0.5rem 0; accent-color: var(--primary); }
.progress[hidden] { display: none; }
#photo-status, #target-status { margin: 0.5rem 0; }

/* ---------- Photos ---------- */

.file-button[hidden] { display: none; } /* the folder picker, where the browser has none */
.photo-preview summary { cursor: pointer; font-weight: 600; }
.photo-preview[open] summary { margin-bottom: 0.5rem; }

.contact-scroll {
  max-height: 13.5rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.contact-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.contact-sheet { display: block; width: 100%; }
.contact-key { font-size: 0.88rem; margin: 0.4rem 0 0; }
/* the key's sample: a faded square struck through, as unused photos are drawn */
.unused-key {
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  vertical-align: -0.12rem;
  border: 1px solid var(--muted);
  background: linear-gradient(to top right, transparent calc(50% - 1px), var(--text) calc(50% - 1px), var(--text) calc(50% + 1px), transparent calc(50% + 1px)), var(--surface-2);
  opacity: 0.7;
}

/* ---------- Target ---------- */

.target-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-start; }
.target-preview { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #ffffff; }
.target-row p { margin: 0; flex: 1 1 12rem; }

/* In one column the mosaic comes after these two cards, so the photos and target are shown
   smaller there: the photos in a shorter scroll, the target beside its description. */
@media (max-width: 999px) {
  .contact-scroll { max-height: 7.5rem; }
  .target-preview { max-width: 7.5rem; }
}

/* ---------- Mosaic ---------- */

.choice { border: 0; padding: 0; margin: 0 0 0.6rem; min-width: 0; }
.choice legend { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.3rem; }
.choice-list { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.choice-list label { display: inline-flex; gap: 0.35rem; align-items: baseline; }

.mosaic-wrap { position: relative; line-height: 0; }
.mosaic { display: block; max-width: 100%; height: auto; cursor: crosshair; background: #ffffff; }
.mosaic:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
/* The selected cell: a white ring inside a black one, visible on any photo. */
.cell-marker {
  position: absolute;
  pointer-events: none;
  box-shadow: 0 0 0 2px #000000, inset 0 0 0 2px #ffffff;
}
.hint { font-size: 0.88rem; margin: 0.4rem 0 0; }
.display-settings { margin-top: 0.6rem; }
.input-row output { min-width: 6.5rem; color: var(--text); font-variant-numeric: tabular-nums; }

.detail-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-start; }
.detail { display: block; width: min(100%, 20rem); height: auto; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.detail-info { flex: 1 1 12rem; min-width: 0; }
.detail-info p { margin: 0 0 0.6rem; }
.swatches { font-size: 0.92rem; line-height: 1.9; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 1.1rem; height: 1.1rem; vertical-align: -0.2rem; border: 1px solid var(--border); border-radius: 3px; }
.inline-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.92rem; color: var(--muted); }
.inline-field select, .inline-field input { color: var(--text); max-width: 8rem; }
.inline-field .input-row { align-items: center; flex-wrap: wrap; }

.terms { width: 100%; border-collapse: collapse; border: 1px solid var(--border); font-size: 0.92rem; }
.terms th, .terms td { padding: 0.3rem 0.5rem; text-align: left; vertical-align: top; }
.terms th { color: var(--muted); font-weight: 500; width: 40%; }
.terms tr + tr > * { border-top: 1px solid var(--border); }

/* ---------- Matching ---------- */

.grid-note { margin: 0.75rem 0 0; }
.grid-note.problem::before { content: "⚠ "; color: var(--alert); font-weight: 700; }
