/* RBRL Custom Styles */

/* Visually hidden but available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus ring for keyboard users */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--rbrl-blue, #284090);
  outline-offset: 2px;
  border-radius: 2px;
}

/* On dark backgrounds (header / footer / nav), use a white ring */
.bg-dark-blue a:focus-visible,
.bg-dark-blue button:focus-visible,
.bg-black a:focus-visible,
.bg-black button:focus-visible,
nav a:focus-visible,
nav button:focus-visible,
footer a:focus-visible,
footer button:focus-visible {
  outline-color: #fff;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rbrl-blue);
  color: #fff;
  padding: 0.5rem 1.5rem;
  z-index: 10000;
  font-weight: bold;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   Team Grid
   ============================================ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.5rem;
}

.team-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: block;
}

.team-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.team-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.team-logo-wrapper img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.team-page-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

/* ============================================
   Sponsor Grid
   ============================================ */
.sponsor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.sponsor-logo-placeholder {
  min-height: 80px;
}

.sponsor-logo {
  max-width: 200px;
  max-height: 100px;
  object-fit: contain;
}

/* ============================================
   Sponsor Ticker (Homepage Footer)
   ============================================ */
.sponsor-ticker-track {
  overflow: hidden;
  width: 100%;
}

.sponsor-ticker-inner {
  display: flex;
  align-items: center;
  animation: ticker-scroll 20s linear infinite;
  width: max-content;
}

.sponsor-ticker-item {
  flex-shrink: 0;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sponsor-ticker-item img {
  max-height: 50px;
  max-width: 150px;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.7;
  transition: all 0.3s ease;
}

.sponsor-ticker-item:hover img {
  filter: grayscale(0%);
  opacity: 1;
}

.sponsor-placeholder {
  white-space: nowrap;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.sponsor-ticker-item:hover .sponsor-placeholder {
  opacity: 1;
}

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

/* Pause animation on hover or keyboard focus */
.sponsor-ticker-track:hover .sponsor-ticker-inner,
.sponsor-ticker-track:focus-within .sponsor-ticker-inner {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .sponsor-ticker-inner {
    animation: none;
  }
}

/* ============================================
   Social Embeds
   ============================================ */
.social-embed {
  display: flex;
  justify-content: center;
}

.social-embed iframe {
  border-radius: 8px;
}

/* ============================================
   Article Images
   ============================================ */
.article-image {
  shape-outside: margin-box;
}

/* Auto-float article images (applied via shortcode) */
.article-image {
  float: left;
  max-width: 250px;
  height: auto;
  margin: 0 1.5rem 1rem 0;
  border-radius: 6px;
  shape-outside: margin-box;
}

/* Ensure container clears floated images */
article, .nested-copy-line-height, .lh-copy {
  overflow: hidden;
}

@media (max-width: 600px) {
  .article-image {
    float: none !important;
    max-width: 100% !important;
    margin: 0 0 1rem 0 !important;
  }
}

/* ============================================
   News Articles
   ============================================ */
.nested-links a {
  color: var(--rbrl-blue);
  text-decoration: underline;
}

.nested-links a:hover {
  color: var(--rbrl-blue-dark);
}

/* ============================================
   General Overrides
   ============================================ */

/* Header logo in nav */
.rbrl-header-logo {
  max-height: 120px;
  width: auto;
}

/* Constrain nav logo size */
nav a img.w100 {
  max-height: 60px;
  width: auto;
}

/* Tighten homepage headline spacing */
h1.f-subheadline-l,
h1.f2 {
  margin: 0 !important;
}

header .tc.pv3 {
  padding-top: 0.5rem;
  padding-bottom: 1rem;
}
header .pv6 {
  padding-top: 2rem !important;
  padding-bottom: 2rem !important;
}

/* Standardize content width to mw8 on theme pages */
main .mw7 {
  max-width: 64em !important;
}
main .pv5 {
  padding-top: 1rem !important;
}

/* Remove excessive bottom padding from main content area */
main.pb7 {
  padding-bottom: 0 !important;
}

/* RBRL brand colors extracted from logo */
:root {
  --rbrl-blue: #284090;
  --rbrl-blue-dark: #1e3070;
  --rbrl-blue-light: #3a52a8;
  --rbrl-red: #e03038;
}

/* Apply brand blue throughout */
.bg-dark-blue {
  background-color: var(--rbrl-blue) !important;
}

/* Make header heading text heavier for readability */
.bg-dark-blue .fw2 {
  font-weight: 400 !important;
}
.bg-dark-blue .fw1 {
  font-weight: 400 !important;
}

.dark-blue {
  color: var(--rbrl-blue) !important;
}

a.dark-blue:hover {
  color: var(--rbrl-blue-dark) !important;
}

.b--dark-blue {
  border-color: var(--rbrl-blue) !important;
}

.bg-dark-blue a.no-underline {
  transition: opacity 0.2s ease;
}

/* Red accent for NL division header */
.dark-red {
  color: var(--rbrl-red) !important;
}

.b--dark-red {
  border-color: var(--rbrl-red) !important;
}

/* Better table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 0.5rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

th {
  background-color: #f5f5f5;
  font-weight: 600;
}

tr:hover {
  background-color: #f9f9f9;
}

/* ============================================
   Sticky footer — keep footer at bottom of viewport
   on short pages
   ============================================ */
html, body {
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

body > main {
  flex: 1 0 auto;
}

body > footer {
  flex-shrink: 0;
}

/* ============================================
   Recent Results (homepage)
   ============================================ */
.recent-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 30em) {
  .recent-results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 60em) {
  .recent-results-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.result-card {
  border: 1px solid #e0e0e0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.result-card:hover {
  transform: translateY(-2px);
}

.result-date {
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.5rem;
}

.result-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid #f0f0f0;
}

.result-row:last-of-type {
  border-bottom: none;
}

.result-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.result-team {
  flex: 1;
  margin-left: 0.75rem;
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.result-score {
  font-size: 1.5rem;
  font-weight: 400;
  color: #888;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}

.result-winner {
  font-weight: 700;
  color: var(--rbrl-blue);
}

.result-loser .result-team,
.result-loser .result-logo {
  opacity: 0.7;
}

/* ============================================
   Line Scores
   ============================================ */
.line-score {
  width: auto;
  margin: 1.5rem 0;
  border: 2px solid var(--rbrl-blue);
  border-radius: 6px;
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.line-score th,
.line-score td {
  padding: 0.4rem 0.7rem;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.9rem;
}

.line-score thead tr {
  background-color: var(--rbrl-blue);
  color: white;
}

.line-score thead th {
  background-color: var(--rbrl-blue);
  color: white;
  font-weight: 600;
}

.line-score .line-score-team {
  text-align: left;
  font-weight: 700;
  padding-right: 1.5rem;
  white-space: nowrap;
}

.line-score .line-score-total {
  font-weight: 700;
  border-left: 2px solid #ccc;
}

.line-score thead .line-score-total {
  border-left: 2px solid rgba(255,255,255,0.4);
}

.line-score tbody tr:last-child td {
  border-bottom: none;
}

/* GameChanger embed card */
.gamechanger-embed {
  border: 2px solid #e0e0e0;
}

/* ============================================
   Standings Tables
   ============================================ */
.standings-card {
  border: 1px solid #e0e0e0;
}

.standings-header.bg-dark-red {
  background-color: var(--rbrl-red) !important;
}

.standings-table {
  border-collapse: collapse;
}

.standings-table th {
  background-color: transparent;
  border-bottom: 1px solid #eee;
}

.standings-table thead th {
  background-color: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.standings-table td {
  border-bottom: 1px solid #eee;
}

.standings-row:hover {
  background-color: #f8f8ff;
}

.standings-leader td,
.standings-leader th {
  background-color: #fffef0;
}

.standings-leader:hover td,
.standings-leader:hover th {
  background-color: #fdfce8;
}

/* ============================================
   Mobile Hamburger Menu
   ============================================ */
.hamburger {
  display: none;
}

.mobile-menu {
  display: none;
  overflow: hidden;
}

.mobile-menu.open {
  display: block;
}

@media (min-width: 60em) {
  .mobile-menu {
    display: none !important;
  }
}

@media (max-width: 60em) {
  .hamburger {
    display: block;
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .sponsor-grid {
    grid-template-columns: 1fr;
  }

  .social-embed iframe {
    width: 100% !important;
  }
}

/* ============================================
   Rules Page Sections
   ============================================ */
.page-rules .nested-copy-line-height h2 {
  border-left: 4px solid var(--rbrl-blue);
  padding-left: 0.75rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--rbrl-blue);
}

.page-rules .nested-copy-line-height h2:first-child {
  margin-top: 0;
}

.page-rules .nested-copy-line-height hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 2rem 0;
}

/* ============================================
   Bat Certification Cards (Rules page)
   ============================================ */
.bat-cert-grid {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.bat-cert-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 180px;
  padding: 1.25rem 1rem 1rem;
  border-radius: 10px;
  border: 3px solid;
  text-align: center;
}

.bat-cert-approved {
  border-color: #2e7d32;
  background-color: #f1f8f1;
}

.bat-cert-rejected {
  border-color: var(--rbrl-red);
  background-color: #fdf0f0;
}

.bat-cert-img {
  width: 140px;
  height: 56px;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.7;
  margin-bottom: 0.75rem;
}

.bat-cert-rejected .bat-cert-img {
  opacity: 0.3;
}

.bat-cert-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--rbrl-red);
  line-height: 1;
  pointer-events: none;
  opacity: 0.8;
}

.bat-cert-status {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bat-cert-approved .bat-cert-status {
  color: #2e7d32;
}

.bat-cert-rejected .bat-cert-status {
  color: var(--rbrl-red);
}

/* Flex helpers for older Tachyons */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

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

.flex-column {
  flex-direction: column;
}

@media (min-width: 60em) {
  .flex-row-l {
    flex-direction: row;
  }

  .w-50-l {
    width: 50%;
  }

  .pr2-l {
    padding-right: 0.5rem;
  }

  .pl2-l {
    padding-left: 0.5rem;
  }

  .mb0-l {
    margin-bottom: 0;
  }
}
