/* Buyer-facing pages. Every brand surface reads one of the four variables an
   operator sets (see BrandHelper#brand_css); no brand colour is written here. */
.buyer {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  margin: 0;
  color: var(--brand-text);
  background: var(--brand-background);
}

.buyer a {
  color: var(--brand-text);
  text-underline-offset: 0.15em;
}

.buyer a:hover {
  text-decoration-color: var(--brand-accent);
  text-decoration-thickness: 2px;
}

.buyer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 4px solid var(--brand-accent);
}

.buyer-header h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
}

.buyer-header h1 a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.buyer-logo {
  display: block;
  max-height: 3rem;
  max-width: 14rem;
  width: auto;
  height: auto;
}

.buyer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.buyer-nav form {
  margin: 0;
}

.buyer-nav-primary,
.buyer .staff-button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--brand-accent);
  border-radius: 4px;
  background: var(--brand-accent);
  color: var(--brand-accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.buyer a.buyer-nav-primary {
  color: var(--brand-accent-text);
}

.buyer-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.buyer-footer {
  margin-top: 2rem;
  padding: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--brand-text) 20%, transparent);
  font-size: 0.9rem;
  text-align: center;
}

.buyer .form-input {
  color: var(--brand-text);
  background: var(--brand-background);
  border-color: color-mix(in srgb, var(--brand-text) 45%, transparent);
}

.buyer .form-input:focus,
.buyer .staff-button:focus-visible,
.buyer a:focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
}

.buyer .staff-table th,
.buyer .staff-table td {
  border-color: color-mix(in srgb, var(--brand-text) 20%, transparent);
}

/* Words never push a page wider than its screen. */
.buyer h2,
.buyer h3,
.buyer li,
.buyer p,
.buyer td,
.buyer dd {
  overflow-wrap: anywhere;
}

.buyer h2 {
  margin: 0.5rem 0 1rem;
  font-size: 1.6rem;
  line-height: 1.25;
}

.buyer img {
  max-width: 100%;
}

.buyer .form-group {
  max-width: 30rem;
}

.buyer .staff-button {
  min-height: 2.75rem;
}

/* Search: the field takes the room, the button keeps its size. */
.catalogue-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.catalogue-search label {
  flex-basis: 100%;
}

.catalogue-search input[type="search"] {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 2.75rem;
  box-sizing: border-box;
  padding: 0.4rem 0.6rem;
  font: inherit;
  color: var(--brand-text);
  background: var(--brand-background);
  border: 1px solid color-mix(in srgb, var(--brand-text) 45%, transparent);
  border-radius: 4px;
}

.catalogue-filters p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0.4rem 0;
}

/* Auctions on the front page, and lots in an auction: cards in a grid that
   becomes one column on a phone. */
.auction-list,
.lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.auction-list li,
.lot-grid li {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--brand-text) 20%, transparent);
  border-top: 3px solid var(--brand-accent);
  border-radius: 4px;
}

.auction-list img,
.lot-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 0.4rem;
}

.auction-list a,
.lot-grid a {
  font-weight: 700;
}

.lot-grid a {
  display: flex;
  flex-direction: column;
}

.staff-table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

/* A lot: on a phone the bidding comes first, then the photos; on a wide
   screen they sit side by side. */
.lot-top {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lot-top > [data-controller="live-lot"] {
  order: -1;
}

.lot-photos > img {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 60rem) {
  .lot-top {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(18rem, 2fr);
    align-items: start;
    gap: 2rem;
  }

  .lot-top > [data-controller="live-lot"] {
    order: 0;
  }

  .lot-top > [data-controller="live-lot"] .lot-bidding {
    margin-top: 0;
  }
}

/* The bidding panel in the operator's colours. Leading and outbid are said in
   words and a mark; their green and red are mixed towards the page's own text
   colour, so they stay readable on a light page and on a dark one. */
.buyer .lot-bidding {
  border-color: var(--brand-text);
  border-top: 5px solid var(--brand-accent);
}

.buyer .lot-own-position [data-leading="true"] strong,
.buyer .lot-row [data-leading="true"] strong {
  color: color-mix(in srgb, #0b7a3b 55%, var(--brand-text));
}

.buyer .lot-own-position [data-leading="false"] strong,
.buyer .lot-row [data-leading="false"] strong {
  color: color-mix(in srgb, #b3261e 55%, var(--brand-text));
}

.buyer .lot-row {
  border-bottom-color: color-mix(in srgb, var(--brand-text) 20%, transparent);
}

.buyer dl[data-specifications] {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.3rem 1rem;
}

.buyer dl[data-specifications] dt {
  font-weight: 600;
}

.buyer dl[data-specifications] dd {
  margin: 0;
}

@media (max-width: 40rem) {
  .buyer-header {
    padding: 0.7rem 1rem;
  }

  .buyer-main {
    padding: 1rem 1rem 2.5rem;
  }

  .buyer dl[data-specifications] {
    grid-template-columns: 1fr;
  }
}

/* The operator fixes this page's colours, so a notice or an error is drawn in
   the page's own text colour, whatever colour scheme the visitor's device
   prefers (the plain sheet's dark-mode colours would be pale on a white page). */
.buyer .staff-notice,
.buyer .form-errors {
  padding: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--brand-text) 35%, transparent);
  border-left: 6px solid var(--brand-accent);
  border-radius: 4px;
  color: var(--brand-text);
  background: var(--brand-background);
}

.buyer .form-errors {
  border-left-color: #b3261e;
  font-weight: 600;
}
