/* Dig on the web.
 *
 * The brand is kraft paper and a serif — the same palette and type the iOS
 * app uses, so the two read as one thing. Colours match the design tokens in
 * crate-ios/CLAUDE.md; keep them in step.
 */

:root {
  --kraft: #f0e6d2;
  --ink: #1a1a1a;
  --grey: #999;             /* true asides only — it is faint on kraft */
  --grey-read: #6d6353;     /* secondary text a person actually has to read */
  --gold: #b5a48a;
  --hot: #c4a265;
  --gem: #6a9a5a;
  --gem-bg: rgba(106, 154, 90, 0.08);
  --tricky: #c49a3a;
  --tricky-bg: rgba(196, 154, 58, 0.08);
  --buried: #c47a5a;
  --buried-bg: rgba(196, 122, 90, 0.1);
  --hair: rgba(0, 0, 0, 0.1);

  --serif: Georgia, "Times New Roman", serif;
  --radius: 15px;
  --radius-thumb: 10px;
}

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

html { background: var(--kraft); }

body {
  margin: 0;
  background: var(--kraft);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding-inline: 20px;
  padding-block: 0 40px;
}

h1, h2, h3 { font-weight: normal; text-wrap: balance; }

/* ── Buttons and fields ──────────────────────────────────── */

.btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--kraft);
  font: inherit;
  cursor: pointer;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hair);
}

.btn.small {
  display: inline-block;
  width: auto;
  padding: 9px 15px;
  font-size: 15px;
  border-radius: 14px;
}

.btn:disabled { opacity: 0.5; cursor: default; }

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--grey-read);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link.ink { color: var(--ink); }

.field {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  font: inherit;
}

.field::placeholder { color: var(--grey); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ── Welcome ─────────────────────────────────────────────── */

.welcome {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  max-width: 420px;
  margin: 0 auto;
  padding-block: 8vh 0;
}

.welcome > .btn { margin-top: 12px; }

.wordmark { font-size: 46px; line-height: 1; margin: 0; }
.tagline { font-style: italic; color: var(--gold); margin: 0; font-size: 17px; }
.lead { margin: 6px 0 0; font-size: 17px; }

.notice { margin: 0; color: var(--buried); min-height: 1.5em; }
.notice.waiting-note { color: var(--grey-read); font-style: italic; }
.fine { margin: 0; color: var(--grey-read); font-size: 14px; }

/* ── Local dev affordance (never reachable on the deployed site) ── */

.dev {
  width: 100%;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}

.dev summary { color: var(--grey-read); font-size: 14px; cursor: pointer; }
.dev > * + * { margin-top: 10px; }

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

/* ── Layout: crate on the left, the record you picked on the right ──
 * One markup, two postures. On a phone the panes take turns.
 */

.panes { display: flex; min-width: 0; }
.pane { flex: 1; min-width: 0; }
.pane-detail { display: none; }
.layout.has-selection .pane-list { display: none; }
.layout.has-selection .pane-detail { display: block; }

@media (min-width: 820px) {
  /* Each pane scrolls on its own. With 437 records, scrolling the crate
     should not drag the record you are reading off the screen — they are
     two things being looked at, not one long page.

     The page itself stops scrolling here, so the heights come from the
     viewport: the app fills it, the tabs take what they need, and the
     panes take the rest. No hardcoded bar height to drift out of date. */
  .app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding-block: 0;
  }

  .layout { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .panes { flex: 1; min-height: 0; }

  .layout .pane-list,
  .layout.has-selection .pane-list {
    display: block;
    flex: 0 0 56%;
    padding-right: 28px;
    border-right: 1px solid var(--hair);
    overflow-y: auto;
    /* Room to scroll past the last row rather than jamming it against
       the window edge. */
    padding-bottom: 40px;
  }

  .layout .pane-detail,
  .layout.has-selection .pane-detail {
    display: block;
    padding-left: 28px;
    overflow-y: auto;
    padding-bottom: 40px;
  }

  /* Both panes are on screen, so there is nothing to go back from. */
  .album .back { display: none; }
}

.waiting { padding-block: 24px; }

/* ── Crate ───────────────────────────────────────────────── */

.crate-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.screen-title { font-size: 28px; margin: 0; }
.count { margin: 0; color: var(--gold); font-size: 14px; text-align: right; }

.sorts { display: flex; gap: 16px; margin: 12px 0 18px; }
.sort { padding: 0; border: 0; background: none; color: var(--grey-read); font: inherit; font-size: 15px; cursor: pointer; }
.sort[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; }

@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tile-title, .tile-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-title { font-size: 14px; }
.tile-artist { font-size: 13px; color: var(--grey-read); }
.tile[aria-current="true"] .tile-art { outline: 2px solid var(--ink); outline-offset: 2px; }

.tile-art, .art-missing {
  width: 100%;
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: var(--radius-thumb);
  background: rgba(0, 0, 0, 0.05);
  object-fit: cover;
  display: block;
}

.art-missing {
  display: grid;
  place-items: center;
  padding: 8px;
  color: var(--grey-read);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  overflow: hidden;
}

.crate-foot { margin-top: 32px; text-align: right; }
.empty { padding-block: 48px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.empty h2 { font-size: 21px; margin: 0; }
.quiet { color: var(--grey-read); margin: 0; }
.pane-hint { font-style: italic; padding-top: 40px; }

/* ── One record ──────────────────────────────────────────── */

.album { padding-bottom: 16px; }
.back { margin: 0 0 14px; }

.album-art, .album .art-missing {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  border-radius: 14px;
}

.album-art { object-fit: cover; display: block; }

.album-title { font-size: 26px; margin: 18px 0 0; line-height: 1.15; }
.album-artist { font-size: 17px; margin: 2px 0 0; }
.album-meta { color: var(--gold); font-size: 14px; margin: 4px 0 0; }
.album-desc { margin: 18px 0 0; max-width: 56ch; }

.tracks { margin-top: 22px; }
.label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 6px; font-weight: normal; }
.label.hot { color: var(--hot); }
.label.gem { color: var(--gem); }
.label.side { color: var(--gold); }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; }
.track { display: flex; gap: 12px; }
.track-pos { flex: 0 0 2.4em; color: var(--gold); font-variant-numeric: tabular-nums; }

.album-actions { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ── Tabs: two places, named in words rather than icons ──── */

.layout { min-height: 0; }

.tabs {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  margin-inline: -20px;
  margin-bottom: 18px;
  padding-inline: 20px;
  background: var(--kraft);
  border-bottom: 1px solid var(--hair);
}

.tab { flex: 1; padding: 14px 8px 15px; border: 0; background: none; color: var(--grey-read); font: inherit; font-size: 17px; cursor: pointer; }
.tab[aria-current="page"] { color: var(--ink); }
.tab-count { color: var(--hot); font-size: 14px; }

@media (min-width: 820px) {
  .tabs { justify-content: flex-start; margin-bottom: 20px; }
  .tab { flex: 0 0 auto; padding: 12px 20px 13px; }
}

/* ── Dig ─────────────────────────────────────────────────── */

.entry { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.entry.compact { flex-direction: row; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }

/* A label standing in for a file input, so the control can look like the
   rest of the buttons without a click being simulated. */
.as-label { display: block; text-align: center; cursor: pointer; }
.entry.compact .as-label { display: inline-block; width: auto; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.as-label:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

.hint { color: var(--grey-read); font-size: 15px; margin: 8px 0 0; max-width: 38ch; }

@media (min-width: 820px) { .only-narrow { display: none; } }

/* Correcting a catalogue is desk work — there is no phone half of it. */
.only-wide { display: none; }
@media (min-width: 820px) { .only-wide { display: block; } }

.progress { font-size: 17px; margin: 0 0 4px; }
.crate-all { margin-top: 12px; }

.settled { border: 1px solid var(--hair); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.settled p { margin: 0 0 12px; font-size: 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.cards { display: flex; flex-direction: column; margin-top: 18px; }

.card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--hair);
}

.card-thumb .snap, .card-thumb .art-missing {
  width: 76px; height: 76px;
  border-radius: var(--radius-thumb);
  object-fit: cover;
  display: block;
  background: rgba(0, 0, 0, 0.05);
}

.thumb-button { padding: 0; border: 0; background: none; cursor: pointer; display: block; }

.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-head h3 { font-size: 17px; margin: 0; }
.card-meta { color: var(--grey-read); font-size: 14px; margin: 1px 0 0; }
.say { margin: 8px 0 0; font-size: 15px; }
.waiting-title { font-size: 17px; margin: 0; color: var(--grey-read); font-style: italic; }
.card.dusting .waiting-title { animation: breathe 1.6s ease-in-out infinite; }
.card.crated { opacity: 0.72; }

.card-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

@keyframes breathe { 50% { opacity: 0.45; } }

.badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.found { color: var(--gem); background: var(--gem-bg); }
.badge.tricky { color: var(--tricky); background: var(--tricky-bg); }
.badge.buried { color: var(--buried); background: var(--buried-bg); }
.badge.have { color: var(--grey-read); background: rgba(0, 0, 0, 0.04); }

/* Dropping photos anywhere on the page starts a dig. */
body.dropping { outline: 2px dashed var(--gold); outline-offset: -10px; }

/* ── Search the stacks ───────────────────────────────────── */

.snap-ref { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.snap-ref .snap { width: 64px; height: 64px; border-radius: var(--radius-thumb); object-fit: cover; background: rgba(0, 0, 0, 0.05); }
.ref-hint { margin-bottom: 14px; }

.results { margin-top: 14px; }

.result {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--hair);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.result:disabled { opacity: 0.5; cursor: default; }
.result-art { width: 56px; height: 56px; border-radius: var(--radius-thumb); object-fit: cover; background: rgba(0, 0, 0, 0.05); }
.result-lines { display: flex; flex-direction: column; min-width: 0; }
.result-lines > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-title { font-size: 16px; }
.result-meta { color: var(--grey-read); font-size: 13px; }

.foot-gap { color: var(--grey); padding-inline: 8px; }

/* ── Ways in: with a photo, and without one — as equals ──── */

.doors { display: flex; flex-direction: column; gap: 30px; }
.door-title { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }

@media (min-width: 820px) {
  .doors { flex-direction: row; gap: 32px; }
  .door { flex: 1; min-width: 0; }
}

/* ── Type it in ──────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 14px; color: var(--grey-read); }
.form-pair { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }

.more { border-top: 1px solid var(--hair); padding-top: 14px; }
.more summary { color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.more[open] summary { margin-bottom: 14px; }
.more > * + * { margin-top: 12px; }

.tracks-field { resize: vertical; min-height: 9em; line-height: 1.6; }
.tracks-preview:empty { display: none; }
.tracks-preview { border-left: 2px solid var(--hair); padding-left: 14px; }
.tracks-preview .label { margin-top: 10px; }

/* ── Editing a record ─────────────────────────── */

.album-edit { margin: -4px 0 18px; }
.album-note { margin: 18px 0; border-left: 2px solid var(--gold); padding-left: 14px; }
.album-note p { margin: 0; white-space: pre-wrap; }

.edit .hint { margin-bottom: 20px; }
.edit .form { max-width: 560px; gap: 22px; }

.edit-section { display: flex; flex-direction: column; gap: 16px; }
.edit-section > .label { color: var(--gold); margin: 0; }

.edit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 21px; }

/* A changed field is annotated, not alarmed: the same warm gold the app
   uses for the things it wants you to notice. */
.edit-flag { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
/* display: flex would otherwise beat the browser's own [hidden] rule, and
   every field would claim to have been modified. */
.edit-flag[hidden] { display: none; }
.edit-flag-word { color: var(--hot); letter-spacing: 0.08em; text-transform: uppercase; }
.edit-flag .revert { font-size: 12px; padding: 0; }

.edit-row.changed .field {
  border-color: var(--hot);
  background: rgba(196, 162, 101, 0.08);
}

/* What is on file, as a contact sheet: small, factual, and out of the
   way of the boxes underneath. */
.source-sheet { display: flex; flex-wrap: wrap; gap: 16px; }
.source-item { display: flex; flex-direction: column; gap: 6px; margin: 0; width: 108px; }
.source-thumb {
  width: 108px; height: 108px;
  object-fit: cover;
  border-radius: var(--radius-thumb);
  background: rgba(0, 0, 0, 0.06);
}
.source-item figcaption { display: flex; flex-direction: column; gap: 2px; }
.source-what { font-size: 14px; }
.source-item .fine { font-size: 12px; line-height: 1.35; }

.edit .tracks-preview { margin-top: -4px; }
.edit-actions { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--hair); padding-top: 18px; }
.edit-count { margin: 0; font-size: 14px; }

/* ── The other releases Discogs offered ──────────────────── */

.alts { margin-top: 14px; border-top: 1px solid var(--hair); padding-top: 10px; }
.alts-head { margin: 0 0 6px; font-size: 13px; color: var(--grey-read); font-style: italic; }

.alt {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.alt:disabled { opacity: 0.5; cursor: default; }
.alt-art { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: rgba(0, 0, 0, 0.05); }
.alt-lines { display: flex; flex-direction: column; min-width: 0; }
.alt-lines > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alt-title { font-size: 14.5px; }
.alt-meta { font-size: 12.5px; color: var(--grey-read); }

/* ── What's known about a record ─────────────────────────
 * A note on a catalogue card, not a score. Quiet on purpose: a record
 * known only as an album is a fine entry in a list.
 */

.standing {
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  max-width: 52ch;
}

.standing-head { color: var(--gold); margin: 0 0 8px; }

.standing-why { color: var(--grey-read); font-size: 14.5px; }
.standing-why li { padding: 2px 0 2px 14px; position: relative; }
.standing-why li::before { content: "·"; position: absolute; left: 2px; }
