:root {
  color-scheme: light;

  /* Permanent brand colors */
  --bfl-blue: #1c293b;
  --bfl-navy: #0b1b31;
  --bfl-red: #9e312e;
  --bfl-cream: #e9d7bc;
  --bfl-black: #111111;
  --bfl-white: #f7f2e8;

  /* Permanent font families */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", Arial, sans-serif;

  /* Light theme */
  --page-background: var(--bfl-white);
  --surface: #fffaf2;
  --surface-muted: var(--bfl-cream);
  --text-primary: var(--bfl-black);
  --text-secondary: #514b43;
  --border-color: #baa98f;
  --accent: var(--bfl-red);

  /* Header and footer remain dark in both themes */
  --header-background: var(--bfl-navy);
  --header-text: var(--bfl-white);
  --footer-background: var(--bfl-navy);
  --footer-text: var(--bfl-white);

  /* Maximum content width*/
  --site-width: 1100px;
}

/* Basic document rules */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  line-height: 1.5;
  background: var(--page-background);
  color: var(--text-primary);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

/* Shared site header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--header-background);
  color: var(--header-text);
  border-bottom: 3px solid var(--bfl-red);
}

.site-header-inner {
  width: min(var(--site-width), calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0;
}

.site-logo img {
  display: block;
  width: 70px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.site-nav a {
  padding: 0.5rem 0;
  border-bottom: 3px solid transparent;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--bfl-red);
}

.site-nav a:focus-visible,
.footer-nav a:focus-visible {
  outline: 2px solid var(--bfl-white);
  outline-offset: 4px;
}

/* League ticker */

.site-ticker {
  border-top: 1px solid rgb(247 242 232 / 18%);
  background: var(--bfl-blue);
  color: var(--bfl-white);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.site-ticker-inner {
  width: min(var(--site-width), calc(100% - 2rem));
  min-height: 2rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ticker-label {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.15rem 0.5rem;
  background: var(--bfl-red);
  color: var(--bfl-white);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.ticker-window {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 1.5rem, black calc(100% - 1.5rem), transparent);
}

.ticker-track {
  width: max-content;
  display: flex;
  animation: ticker-scroll var(--ticker-duration, 36s) linear infinite;
}

.ticker-group {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-right: 2rem;
}

.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--bfl-white);
  font-size: 0.85rem;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.ticker-item-label {
  color: var(--bfl-cream);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ticker-item-text {
  color: var(--bfl-white);
  font-size: inherit;
  line-height: inherit;
}

.ticker-item:hover .ticker-item-text {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.ticker-loading {
  color: var(--bfl-cream);
  font-size: 0.8rem;
}

.site-ticker:hover .ticker-track,
.site-ticker:focus-within .ticker-track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-window {
    overflow: visible;
    mask-image: none;
  }

  .ticker-track {
    width: auto;
    animation: none;
  }

  .ticker-group {
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    padding: 0.35rem 0;
  }

  .ticker-group[aria-hidden="true"] {
    display: none;
  }
}

/* Dark-light mode control */

.theme-toggle {
  position: fixed;
  right: calc(1rem + env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 1000;

  width: 3rem;
  height: 3rem;
  padding: 0;

  display: grid;
  place-items: center;

  border: 2px solid var(--bfl-red);
  border-radius: 50%;

  background: var(--header-background);
  color: var(--header-text);

  box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 25%);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--bfl-blue);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--bfl-white);
  outline-offset: 3px;
}

.theme-icon {
  width: 1.3rem;
  height: 1.3rem;

  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon[hidden] {
  display: none;
}

/* Shared main-page container */

.page {
  width: min(var(--site-width), calc(100% - 2rem));
  flex: 1;
  margin: 0 auto;
  padding: 4rem 0;
}

.page > h1 {
  margin-top: 0;
}

/* Reusable notice and placeholder panels */

.notice-panel,
.placeholder {
  max-width: 650px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-left: 8px solid var(--accent);
  background: var(--surface);
  color: var(--text-primary);
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Shared site footer */

.site-footer {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem 1rem;
  background: var(--footer-background);
  color: var(--footer-text);
}

.footer-inner {
  width: min(var(--site-width), 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
}

.site-footer img {
  display: block;
  width: 100px;
  margin: 0 auto;
}

.footer-identity {
  text-align: center;
}

.footer-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
}

.footer-motto {
  margin: 0.25rem 0 0;
  color: var(--bfl-cream);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem 1.25rem;
  font-size: 0.9rem;
}

.footer-nav a {
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer-meta {
  width: min(var(--site-width), 100%);
  margin: 1rem auto 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgb(247 242 232 / 25%);
  color: var(--bfl-cream);
  font-size: 0.8rem;
  text-align: center;
}

/* Smaller screens */

@media (max-width: 700px) {
  .site-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
  }

  .site-logo {
    display: none;
  }

  .site-nav {
    flex: 1;
    gap: 0.25rem 0.7rem;
    font-size: 0.82rem;
    line-height: 1.1;
  }

  .site-nav a {
    padding: 0.2rem 0;
    border-bottom-width: 2px;
  }

  .site-ticker-inner {
    min-height: 1.65rem;
    gap: 0.6rem;
  }

  .ticker-label {
    padding: 0.1rem 0.35rem;
    font-size: 0.6rem;
  }

  .ticker-item {
    font-size: 0.75rem;
  }

  .ticker-item-label {
    font-size: 0.6rem;
  }

  .ticker-item-text {
    font-size: 0.75rem;
    line-height: 1;
  }

  .theme-toggle {
    position: static;
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .theme-toggle:hover {
    background: transparent;
  }

  .theme-toggle:focus-visible {
    outline: 2px solid var(--bfl-white);
    outline-offset: 3px;
  }

  .theme-icon {
    width: 1.05rem;
    height: 1.05rem;
  }

  .page {
    padding: 2rem 0;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .footer-nav {
    justify-content: center;
  }
}

/* Manually selected dark mode */

:root[data-theme="dark"] {
  color-scheme: dark;

  --page-background: var(--bfl-black);
  --surface: var(--bfl-blue);
  --surface-muted: var(--bfl-navy);
  --text-primary: var(--bfl-white);
  --text-secondary: #cbbda8;
  --border-color: #665e52;
}

/* Use the system preference when no manual theme has been selected */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --page-background: var(--bfl-black);
    --surface: var(--bfl-blue);
    --surface-muted: var(--bfl-navy);
    --text-primary: var(--bfl-white);
    --text-secondary: #cbbda8;
    --border-color: #665e52;
  }
}
