/* Winners (/winners). Builds on print.css for the page header, colours and
   the saddlecloth. One panel per place: its prize, a dropdown to choose the
   horse, then the horse and who backed it. */

/* Under the shared header, with the same rule line as the print page's bar */
.winners-intro {
  max-width: 76rem;
  margin: 0 auto 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-stretch: 88%;
}

.places {
  display: grid;
  /* All four places in a row on desktops, 2 x 2 on tablets, stacked on phones */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  align-items: start;
  gap: 1rem;
  max-width: 76rem;
  margin: 0 auto;
}

.place {
  background: var(--paper);
}

.place__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.75rem 0.5rem;
  border-top: 3px solid var(--brass);
  background: var(--ink);
  color: var(--rail);
}

.place__head h2 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 850;
  font-stretch: 62%;
  line-height: 1;
}

.place__prize {
  margin: 0;
  color: var(--brass);
  font-size: 1.5rem;
  font-weight: 850;
  font-stretch: 70%;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.place__prize span {
  display: block;
  color: rgb(242 244 238 / 0.6);
  font-size: 0.8rem;
  font-weight: 500;
  font-stretch: 88%;
}

.place__pick {
  display: block;
  width: calc(100% - 1.5rem);
  height: 2.75rem;
  margin: 0.75rem;
  padding: 0 2.25rem 0 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 3px;
  appearance: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230F2419' stroke-width='2'/%3E%3C/svg%3E")
    right 0.8rem center / 0.75rem no-repeat,
    var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming in on focus */
  font-weight: 650;
  font-stretch: 85%;
  cursor: pointer;
}

.place__pick:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* The chosen horse, large: silks, saddlecloth, name */
.place__horse {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.75rem 0.6rem;
}

.place__silk {
  display: grid;
  flex: none;
  place-items: center;
  width: 3.75rem;
  height: 4.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper);
}

.place__silk img {
  width: 3.3rem;
  height: auto;
}

.place__horse .cloth {
  min-width: 2.2rem;
  font-size: 1.9rem;
}

.place__name {
  min-width: 0;
  overflow: hidden;
  font-size: 1.6rem;
  font-weight: 800;
  font-stretch: 68%;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place__note {
  margin: 0;
  padding: 0 0.75rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-stretch: 88%;
}

/* Who backed the horse, and what they win */

.winners {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.winners th,
.winners td {
  padding: 0.35rem 0.5rem;
  font-size: 1rem;
  font-stretch: 85%;
  text-align: right;
  white-space: nowrap;
}

.winners th:first-child {
  padding-left: 0.75rem;
  font-weight: 700;
  text-align: left;
}

.winners td:last-child { padding-right: 0.75rem; }

.winners thead th {
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 500;
}

.winners thead th:first-child { font-weight: 500; }

.winners tbody tr + tr { border-top: 1px solid var(--rule); }

.winners .winners__payout {
  font-size: 1.1rem;
  font-weight: 850;
  font-stretch: 70%;
}

.winners tfoot th,
.winners tfoot td {
  border-top: 2px solid var(--ink);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
}

.winners tfoot .winners__payout {
  color: var(--ink);
  font-size: 1rem;
}

/* Total winnings across all places */

.payouts {
  max-width: 76rem;
  margin: 1.5rem auto 0;
}

.payouts h2 {
  margin: 0 0 0.4rem;
  font-size: 1.9rem;
  font-weight: 850;
  font-stretch: 62%;
  line-height: 1;
}

.payouts__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  border-top: 3px solid var(--brass);
  background: var(--rule);
  list-style: none;
}

.payouts__list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.75rem;
  background: var(--paper);
  font-size: 1.05rem;
  font-weight: 700;
  font-stretch: 85%;
}

.payouts__amount {
  font-size: 1.15rem;
  font-weight: 850;
  font-stretch: 70%;
  font-variant-numeric: tabular-nums;
}

@media print {
  .place__pick { display: none; }
  .place { break-inside: avoid; border: 1px solid var(--rule); }
  .place__head { background: none; color: var(--ink); border-top-color: var(--ink); }
  .place__prize { color: var(--ink); }
  .place__prize span { color: var(--ink-soft); }
}
