/*
 * League organiser portal: baize-green On The Baize styling (#3400). Loaded after portal.css, and only
 * by the organiser _base.html, so the venue portal and admin console never see it.
 *
 * Contrast rules (WCAG, computed at scoping). Only these pairings are used:
 *   - on baize (#0d4309): cream text 10.47:1, paper text 11.33:1. Nothing else: chalk 1.80, loss 1.66,
 *     brass 2.29 and mute 1.87 all fail on baize.
 *   - on paper or cream: ink 15.70, baize 10.47, chalk 5.81, loss 6.30.
 *   - never cream text on sage (1.57:1), never --focus (chalk) outlines on baize: they are cream.
 * Sign-in pages (body.organiser-auth) are a full baize surface with paper boxes for inputs and
 * messages; signed-in pages (body.organiser-app) use the shared ink shell from portal.css (sidebar and
 * top bar), so this file holds no rules for them beyond what a page needs for itself.
 */

/* ---- Sign-in, password reset and error pages: full baize surface ---- */

body.organiser-auth {
  background: var(--baize);
  color: var(--cream);
}

/* The card dissolves into the baize page; the roundel sits above the heading. */
.organiser-auth .card {
  background: transparent;
  border: 0;
  padding: var(--space-5) var(--space-4);
}

.organiser-auth .card::before {
  content: "";
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 0 var(--space-4);
  border-radius: var(--radius-card);
  background: url("/portal/static/otb-logo.png") center / cover no-repeat;
}

.organiser-auth h1,
.organiser-auth label,
.organiser-auth p {
  color: var(--cream);
}

.organiser-auth a {
  color: var(--cream);
  text-decoration: underline;
}

.organiser-auth a:hover {
  color: var(--paper);
}

.organiser-auth a:focus-visible,
.organiser-auth button:focus-visible,
.organiser-auth input:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 2px;
}

/* Inputs stay paper with ink text; focus is a cream ring on the baize around them. */
.organiser-auth input[type="email"],
.organiser-auth input[type="password"],
.organiser-auth input[type="text"] {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--paper);
}

.organiser-auth input:focus {
  outline: 3px solid var(--cream);
  outline-offset: 2px;
  border-color: var(--paper);
}

/* Primary button: cream with baize text (10.47:1), like the app's sign-in screen. */
.organiser-auth button,
.organiser-auth input[type="submit"] {
  background: var(--cream);
  color: var(--baize);
  border: 1px solid var(--cream);
}

.organiser-auth button:hover,
.organiser-auth input[type="submit"]:hover {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--baize);
}

/* Messages sit in a paper box: errors loss on paper, notices ink on paper. Never loss on baize. */
.organiser-auth .error,
.organiser-auth .notice {
  background: var(--paper);
  border-color: var(--paper);
}

.organiser-auth .error {
  color: var(--loss);
  border-left-color: var(--loss);
}

.organiser-auth .notice {
  color: var(--ink);
  border-left-color: var(--brass);
}

.organiser-auth .error p,
.organiser-auth .notice p {
  color: inherit;
}

.organiser-auth .error a,
.organiser-auth .notice a {
  color: var(--chalk);
}

.organiser-auth .error a:focus-visible,
.organiser-auth .notice a:focus-visible {
  outline-color: var(--baize);
}

/* The authenticator QR code needs a light quiet zone to scan; the manual key is ink on cream. */
.organiser-auth .mfa-qr {
  display: inline-block;
  padding: var(--space-3);
  background: var(--paper);
  border-radius: var(--radius-control);
}

.organiser-auth .mfa-secret {
  background: var(--cream);
  color: var(--ink);
}

/* ---- Phone width (#3561) ---- */

/* The feedback page prints the page you came from, a long path with no spaces; let it wrap rather than push
   the page wider than the screen. */
.section-card .explainer {
  overflow-wrap: anywhere;
}

/* Android browsers size a file input to its "Choose files / No file chosen" label, wider than a phone. */
.shell-main input[type="file"] {
  max-width: 100%;
}

/* ---- Cup knockout brackets (#3701): rounds side by side on a wide screen, stacked on a phone ---- */

.bracket-rounds {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 900px) {
  .bracket-rounds {
    grid-auto-flow: column;
    grid-auto-columns: minmax(18rem, 1fr);
    overflow: auto;
  }
}

.bracket-ties {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bracket-tie {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--brass);
  overflow-wrap: anywhere;
}

.bracket-tie .result-card {
  margin-bottom: var(--space-2);
}

.bracket-tie p {
  margin: 0 0 var(--space-2);
}

.week-progress,
.round-progress {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.bracket-round form select,
.bracket-round form input {
  max-width: 100%;
}

/* ---- League pages (rules, honours, announcements): form-control widths and inline forms ---- */

.announcements-page textarea {
  width: 100%;
  box-sizing: border-box;
}

.announcement-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announcement + .announcement {
  border-top: 1px solid var(--rule);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

.announcement-actions form,
.rules-actions form,
.honour-card form {
  display: inline;
}

.rules-page input[type="file"] {
  max-width: 100%;
}

.honours-page select,
.honours-page input[type="text"],
.honours-page input[type="search"] {
  max-width: 100%;
}
