/* 12-auctions.css — /Auctions (task 074; task 149 rebuilt it: tabs, a toolbar, compact cards), scoped by .auctions-page,
   linked after 11-edit-panel.css; the «?» is not scoped — the phone's page (_Mobile) shows them too.
   Colours are the theme's tokens (task 100). Five font sizes, the /Wishlist scale; spacing 8/12/16/24. */
.auctions-page {
  --au-fs-xl: 1.6rem;   /* 24px  — h1 */
  --au-fs-lg: 1.25rem;  /* 18.75 — tile figures, the bid */
  --au-fs-md: 1rem;     /* 15px  — set name, the room line */
  --au-fs-sm: 0.9rem;   /* 13.5  — chips, buttons, limits */
  --au-fs-xs: 0.84rem;  /* 12.6  — labels, badges, «станом на» */
  --au-muted: var(--text-muted);  /* task 100: the theme's; #566275 was light-only (2.8:1 on the dark surfaces) */
  --au-worth: var(--up);
  --au-worth-bg: var(--up-bg);
  --au-worth-border: color-mix(in srgb, var(--up) 35%, var(--surface-1));
  --au-partial: var(--warn);
  --au-partial-bg: var(--warn-bg);
  --au-partial-border: color-mix(in srgb, var(--warn) 35%, var(--surface-1));
  --au-urgent: var(--down);
  --au-urgent-bg: var(--down-bg);
  padding: 24px;
  font-variant-numeric: tabular-nums;
}

.auctions-head h1 {
  margin: 0 0 4px;
  font-size: var(--au-fs-xl);
  line-height: 1.2;
}

/* Task 149: one line under the title, nothing more — how it all works is /Methodology#auctions. */
.auctions-line {
  margin: 0 0 12px;
  color: var(--au-muted);
  font-size: var(--au-fs-sm);
}

/* The tabs and, on their right, the sort: one bar under the line. */
.auctions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  box-shadow: inset 0 -1px 0 var(--border);
}

.auctions-bar .ui-tabs {
  box-shadow: none;
}

/* A 👁's count change, seen: the tab's number pulses once (auction-watch.js adds .is-bumped). */
.auctions-tabs .ui-tab.is-bumped .ui-tab__count,
.ui-m-tab.is-bumped [data-auction-tab-count] {
  animation: au-bump 600ms var(--ease);
}

@keyframes au-bump {
  30% { color: var(--accent-text); scale: 1.35; }
}

/* The search, the filters and the sort: links and a GET form, so every one works without script. */
.auctions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.auctions-search {
  flex: 0 1 260px;
}

.auctions-search .ui-input {
  width: 100%;
}

.auctions-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.auctions-chips__sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--border);
}

/* What only a catalogue set has (the ceiling, condition, my sets, «запас до стелі») is not offered on «Інші». */
.auctions-page[data-tab="others"] [data-sets-only] {
  display: none;
}

.auction-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px; /* 44 px under 900 (below); the phone's page has no chips, its filters are a sheet */
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--au-fs-sm);
  white-space: nowrap;
  transition: background-color 120ms, border-color 120ms;
}

a.auction-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.auction-chip.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface-1);
}

.auction-chip--worth:not(.active) {
  border-color: var(--au-worth-border);
  color: var(--au-worth);
}

.auction-chip--reset {
  border-style: dashed;
}

.auction-chip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* «?»: a link to /Methodology#auctions whose title says the ceilings with the reader's fees. */
.auctions-help {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  cursor: help;
}

.auctions-help:hover,
.auctions-help:focus-visible {
  border-color: var(--accent);
  color: var(--accent-text);
}

.auctions-panel[hidden] {
  display: none;
}

/* Cards (task 149): photo 120 × 90 on the left, the set, ONE tag, the bid with «станом на», the countdown; the foot —
   «Allegro ↗», the 👁 and «⋯». ~170 px tall where task 074's was 559–597. */
.auctions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.auction-card {
  position: relative;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  scroll-margin-top: 96px;
}

.auction-card:target {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.auction-card--worth {
  border-color: var(--au-worth-border);
}

.auction-card__target {
  position: absolute;
  top: 0;
  scroll-margin-top: 96px;
}

.auction-card__media {
  display: block;
  width: 120px;
  height: 90px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--photo-bg);
}

.auction-card__media img {
  width: 100%;
  height: 100%;
  padding: var(--photo-inset);
  object-fit: contain;
}

.auction-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.auction-card__name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: var(--au-fs-md);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.auction-card__name:hover {
  color: var(--accent-text);
}

.auction-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.auction-badge,
.auction-cond {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--au-fs-xs);
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.auction-badge {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--au-muted);
}

.auction-badge--worth {
  border-color: var(--au-worth);
  background: var(--au-worth);
  color: #fff;
}

.auction-badge--partial {
  border-color: var(--au-partial-border);
  background: var(--au-partial-bg);
  color: var(--au-partial);
}

.auction-badge--expensive {
  color: var(--text-muted);
}

/* Condition is an outline, the verdict a fill: told apart by shape, not colour alone. Only «вживане» is shown. */
.auction-cond {
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
}

/* Why an auction is «Інші» («76785 – немає в каталозі»), in the verdict's place: cut, never wider than the card. */
.auction-reason {
  overflow: hidden;
  color: var(--au-muted);
  font-size: var(--au-fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auction-card__bid {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.auction-card__bid strong {
  font-size: var(--au-fs-lg);
  line-height: 1.2;
}

.auction-card__bid span,
.auction-card__reminder {
  color: var(--au-muted);
  font-size: var(--au-fs-xs);
}

.auction-card__time {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.auction-time {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--au-fs-sm);
  font-weight: 600;
  white-space: nowrap;
}

.auction-time--soon {
  background: var(--au-partial-bg);
  color: var(--au-partial);
}

.auction-time--urgent {
  background: var(--au-urgent-bg);
  color: var(--au-urgent);
}

.auction-card__foot {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 4px;
}

.auction-card__foot > .ui-btn:first-child {
  margin-right: auto;
}

/* «⋯»: what used to fill the card — the room, both ceilings, the market, the bidders, the listing. */
.auction-card__more-list {
  width: 300px;
  padding: 12px;
  gap: 8px;
}

.auction-card__more .ui-kv {
  font-size: var(--au-fs-sm);
}

.auction-card__more .ui-kv small {
  color: var(--au-muted);
  font-weight: 400;
}

.auction-card__room {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  font-size: var(--au-fs-sm);
}

.auction-card__room span {
  color: var(--au-muted);
  font-size: var(--au-fs-xs);
}

.auction-card__room--worth b {
  color: var(--au-worth);
}

.auction-card__room--partial b {
  color: var(--au-partial);
}

.auction-card__listing {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--au-muted);
  font-size: var(--au-fs-xs);
}

.auctions-empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-muted);
}

/* «Завершені (N)», folded at the foot of «Відстежувані» and «Каталог»: one line each. */
.auctions-fold {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.auctions-fold summary {
  min-height: 32px; /* the desktop's; the phone's page folds with .au-m-fold at the 44 px floor */
  font-size: var(--au-fs-md);
  font-weight: 600;
  cursor: pointer;
}

.auctions-fold summary span {
  color: var(--au-muted);
  font-weight: 400;
}

/* «Показати ще» under the first 50 «Інші» (task 135). */
.auctions-more {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 0;
  color: var(--au-muted);
  font-size: var(--au-fs-sm);
}

.auctions-ended__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--au-fs-sm);
}

.auctions-ended__list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 120px 110px 170px 24px;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-2);
}

.auctions-ended__list li > :first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auctions-ended__list li > span {
  color: var(--au-muted);
  white-space: nowrap;
}

.auctions-ended__list .auctions-ended__bid {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .auction-chip {
    transition: none;
  }

  .auctions-tabs .ui-tab.is-bumped .ui-tab__count,
  .ui-m-tab.is-bumped [data-auction-tab-count] {
    animation: none;
  }
}

@media (max-width: 760px) {
  .auctions-page {
    padding: 16px;
  }

  .auctions-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .auctions-ended__list li {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 2px;
  }

  .auctions-ended__list li > :first-child {
    grid-column: 1 / -1;
    white-space: normal;
  }
}

/* The phone width (task 105): a chip a finger's 44 px, a link in a line 24 px tall at least (WCAG 2.5.8). */
@media (max-width: 900px) {
  .auction-chip {
    min-height: var(--touch);
  }

  .auctions-page li > a {
    display: inline-block;
    line-height: 24px;
  }
}
