/* Page header shared by every page (views/app/_header.ejs): title and bets
   summary on the left; contestant picker or page heading, then the menu, on
   the right. Uses the colour tokens (--ink, --rail, --chalk, --brass) that
   each page's own stylesheet defines. */

/* Page header: title and pool on the left; contestant picker and menu on
   the right. The menu's bar drops over the top of the grid rather than
   pushing it down, so the grid still fits the screen. */

.meet {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.45rem 0.4rem 0.6rem;
}

.meet__title {
  flex: 1;
  min-width: 0;
}

.meet h1 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(1.15rem, 5vw, 2.25rem);
  font-weight: 850;
  font-stretch: 62%;
  line-height: 1;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool {
  margin: 0.1rem 0 0;
  font-size: clamp(0.75rem, 2.6vw, 1rem);
  font-stretch: 85%;
  line-height: 1.2;
}

.pool strong {
  font-weight: 800;
  font-stretch: 70%;
}

a:focus-visible,
select:focus-visible,
summary:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Contestant picker */

.picker { flex: none; }

.picker select {
  max-width: 42vw;
  height: 2.5rem;
  padding: 0 2rem 0 0.7rem;
  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.65rem center / 0.7rem no-repeat,
    var(--chalk);
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming in on focus */
  font-weight: 650;
  font-stretch: 85%;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Menu */

.menu { flex: none; }

.menu summary {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 3px;
  background: var(--ink);
  color: var(--chalk);
  list-style: none;
  cursor: pointer;
}

.menu summary::-webkit-details-marker { display: none; }

.icon {
  width: 1.4rem;
  height: 1.4rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon circle[r="1"] { fill: currentColor; }

.menu .icon--close,
.menu[open] .icon--open { display: none; }

.menu[open] .icon--close { display: block; }

.menu__bar {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.45rem 0.6rem;
  border-bottom: 3px solid var(--ink);
  background: var(--rail);
  box-shadow: 0 10px 18px -8px rgb(15 36 25 / 0.45);
}

.menu__bets {
  display: flex;
  gap: 0.35rem;
}

.menu__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
}

.menu__icon:hover { background: var(--ink); color: var(--chalk); }

.menu__icon[aria-disabled="true"] {
  border-color: rgb(15 36 25 / 0.3);
  color: rgb(15 36 25 / 0.3);
  cursor: not-allowed;
}

.menu__icon[aria-disabled="true"]:hover { background: none; }

.menu__sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-left: auto;
  font-stretch: 85%;
}

.menu__sort-label {
  margin-right: 0.2rem;
  font-size: 0.9rem;
}

.menu__sort-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.menu__sort a {
  padding: 0.35rem 0.55rem;
  border-radius: 3px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.menu__sort a:hover { background: rgb(15 36 25 / 0.1); }

.menu__sort a[aria-current="true"] {
  background: var(--ink);
  color: var(--chalk);
}

/* Phones: icons with "Sort by" on the first row, the five sort options
   spread across the second */
@media (max-width: 599px) {
  .menu__bar {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "bets label" "sort sort";
    row-gap: 0.45rem;
  }
  .menu__bets { grid-area: bets; }
  .menu__sort { display: contents; }
  .menu__sort-label {
    grid-area: label;
    align-self: end;
    justify-self: end;
    margin: 0;
  }
  .menu__sort-options {
    grid-area: sort;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.15rem;
  }
  .menu__sort a {
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
  }
}

.meet h1 a {
  color: inherit;
  text-decoration: none;
}

.meet h1 a:hover { text-decoration: underline; }

/* All bets page: "Bet List" sits where the contestant picker is on the home page */
.meet__page {
  flex: none;
  margin: 0;
  font-size: clamp(1.15rem, 4.8vw, 2rem);
  font-weight: 850;
  font-stretch: 62%;
  line-height: 1;
  white-space: nowrap;
}

.menu__icon[aria-current="page"] {
  background: var(--ink);
  color: var(--chalk);
}
