@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
    --bg: #fff;
    --accent-bg: #f5f7ff;
    --text: #212121;
    --text-light: #585858;
    --accent: #0d47a1;
    --accent-hover: #1266e2;
    --accent-text: var(--bg);
    --code: #d81b60;
    --preformatted: #444;
    --marked: #ffdd33;
    --disabled: #efefef;
  }
}

/* CSS Variables */
:root {
  --text-white: rgba(254, 253, 250, 1);
  --light-bg: #F2F5F7;
  --dark-bg: rgb(39, 39, 39);

  --header-background-color: rgba(189, 199, 255, 0.75);
  --footer-background-color: rgba(28, 26, 26, 1);
  --signature-race-background-color: rgba(197, 227, 255, 1);

  --header-z-index: 10;
  --center-z-index: 2;
  --backdrop-z-index: 1;
}

/* Utility CSS */
.container {
  min-width: 400px;
  max-width: 75rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  z-index: var(--center-z-index);
}

.mobile-hidden {
  @media screen and (max-width: 720px) {
    display: none;
  }
}

.desktop-hidden {
  @media screen and (min-width: 720px) {
    display: none;
  }
}

/* Overrides */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > header {
  display: flex;
  position: sticky;
  background-color: rgba(20, 20, 20, 0.6);
  z-index: var(--header-z-index);
  top: 0;
  backdrop-filter: blur(4px);
  padding: 0 0 1rem;
}

body > header > *:only-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 75rem;
}

body > header h1 {
  margin: 0;
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

header nav ul {
  display: flex;
  flex-direction: row;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

header nav a, header nav a:visited {
  margin: 0 0.5rem;
  color: var(--text-white);
}

.nav-social a, .nav-social a:visited {
  display: flex;
  align-items: center;
  border: none;
  padding: 0;
  opacity: 0.8;
}

.nav-social a:hover {
  opacity: 1;
}

main {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding-top: 0;
}

main > section {
  margin: 0;
}

main > section:last-of-type {
  padding: 0;
  flex-grow: 1;
}

body > footer {
  background-color: var(--footer-background-color);
  color: var(--text-white);
  margin-top: 0;
}

body > footer > p {
  margin: 0;
}

.logo {
  max-height: 60dvh;
  margin: 0 auto;
}

/* Custom Classes */
.main-description {
  color: var(--text-white);
  padding: 0;
  background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url('../images/wide-bg.jpg');
  background-size: cover;
  background-attachment: contain;
  background-position: bottom;

  @media screen and (max-width: 720px) {
      background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url('../images/portrait-bg.jpg');
  }
}

.main-description h2 {
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.main-description .container {
  min-width: 400px;
  max-width: 100%;
  max-height: 60dvh;
  margin: 0 auto;
  padding: 0 5rem;

  @media screen and (max-width: 920px) {
    max-height: max-content;
    padding: 0 1rem;
  }
}

.main-description-top {
  display: grid;
  grid-template-columns: 1fr 0.75fr;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  
  @media screen and (max-width: 720px) {
    display: flex;
    flex-direction: column-reverse;
  }
}

.main-description-top img {
  margin: 0 auto;
  height: 100%;

  @media screen and (max-width: 720px) {
    height: 65dvh;
  }
}

.main-about {
  background-color: var(--light-bg);
}

.main-about h1 {
  margin: 2rem auto;
}

.main-about a.button {
  font-size: 2rem;
  margin: 0 auto;
}

.main-upcoming {
  background-color: var(--signature-race-background-color);
}

.races-container {
  display: grid;
  grid-auto-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 4rem;
}

.race {
  background-color: rgb(250, 250, 250);
  border: 2px solid rgba(0, 0, 255, 0.35);
  border-radius: 12px;
  padding: 2rem;
}

.race .race-title {
  margin: 0 0 0.5rem;
}

.race .race-location {
  font-style: italic;
  margin: 1rem 0;
}

.race .race-date {
  margin: 0;
}

.race a {
  background-color: orange;
  color: #000;
  text-decoration: none;
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 0;
  font-size: 1.25rem;
  font-weight: normal;
  line-height: 1.428571429;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px;
}

/*
  About
*/
.about-description {
  background-color: var(--dark-bg);
  color: var(--text-white);
}

.about-description p {
  font-size: 1.5rem;
  line-height: 1.5;
}

.board-section {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
}

.board-section-item h2,
.board-section-item h4,
.board-section-item p {
  margin: 0 0 0.5rem;
}

/*
  Races
*/
.races-hero {
  background-color: var(--dark-bg);
  color: var(--text-white);
  padding: 3rem 0 !important;
}

.races-hero h1 {
  margin: 0;
}

.race-detail {
  background-color: var(--light-bg);
}

.race-detail .container {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.race-detail-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;

  @media screen and (max-width: 720px) {
    flex-direction: column;
  }
}

.race-detail-header .race-title {
  margin: 0 0 0.5rem;
}

.race-detail-header .race-date {
  margin: 0;
}

.race-detail-header .race-location {
  font-style: italic;
  margin: 0.5rem 0 0.25rem;
}

.race-detail-header .race-checkin {
  margin: 0.25rem 0 0;
  color: var(--text-light);
  font-size: 0.95rem;
}

.race-register-btn {
  display: inline-block;
  flex-shrink: 0;
  background-color: orange;
  color: #000;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  font-size: 1.25rem;
  font-weight: bold;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  align-self: center;

  @media screen and (max-width: 720px) {
    align-self: flex-start;
  }
}

.race-register-btn:visited {
  color: #000;
}

.race-register-btn:hover {
  background-color: #e69500;
}

.race-description {
  margin-bottom: 2.5rem;
}

.race-description h3,
.race-faq h3 {
  margin-bottom: 1rem;
}

.race-description p {
  font-size: 1.1rem;
  line-height: 1.6;
}

.race-faq details {
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.race-faq details:first-of-type {
  border-top: 1px solid rgba(0, 0, 0, 0.15);
}

.race-faq details summary {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.race-faq details summary::-webkit-details-marker {
  display: none;
}

.race-faq details summary::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 300;
  flex-shrink: 0;
  margin-left: 1rem;
  transition: transform 0.2s ease;
}

.race-faq details[open] summary::after {
  transform: rotate(45deg);
}

.race-faq details p {
  margin: 0 0.25rem 1rem;
  line-height: 1.6;
}
