/* DIRTSIM site template. Colors are taken from the DIRTSIM logo:
   charcoal plate, orange frame, white letters with black outlines. */

@font-face {
  font-family: "Saira";
  src: url("../fonts/saira-latin-wdth-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Saira";
  src: url("../fonts/saira-latin-wdth-italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-style: italic;
  font-display: swap;
}

:root,
[data-bs-theme="dark"] {
  --ds-bg: #1e1e22;
  --ds-surface: #27272b;
  --ds-raise: #2f2f35;
  --ds-line: #3b3b42;
  --ds-frame: #4a4a52;
  --ds-text: #f1f1f3;
  --ds-muted: #a7a7b0;
  --ds-accent: #ff6b1a;
  --ds-orange: #fa5900;
  --ds-ink: #0c0c0e;
  --ds-up: #6fd38a;
  --ds-down: #ff6b81;
  --ds-display: "Saira", "Arial Narrow", system-ui, sans-serif;
  --ds-body: "Saira", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1200px;
  --gutter: 16px;

  /* Bootstrap in the same colors, for articles, forms and lists Joomla makes. */
  --bs-body-bg: var(--ds-bg);
  --bs-body-color: var(--ds-text);
  --bs-body-font-family: var(--ds-body);
  --bs-body-font-size: 1.0625rem;
  --bs-body-line-height: 1.6;
  --bs-emphasis-color: #fff;
  --bs-secondary-color: var(--ds-muted);
  --bs-secondary-bg: var(--ds-surface);
  --bs-tertiary-bg: var(--ds-raise);
  --bs-border-color: var(--ds-line);
  --bs-heading-color: var(--ds-text);
  --bs-link-color: var(--ds-accent);
  --bs-link-color-rgb: 255, 107, 26;
  --bs-link-hover-color: #ff9a5c;
  --bs-link-hover-color-rgb: 255, 154, 92;
  --bs-primary: var(--ds-orange);
  --bs-primary-rgb: 250, 89, 0;
  --bs-focus-ring-color: rgba(255, 107, 26, 0.45);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.site {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

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

a {
  color: var(--ds-accent);
}

:focus-visible {
  outline: 3px solid var(--ds-accent);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 768px) {
  :root {
    --gutter: 28px;
  }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--ds-orange);
  color: var(--ds-ink);
  font-weight: 700;
}

.skip-link:focus {
  left: 1rem;
}

/* Headings: wide, heavy and slanted like the logo lettering. */
h1,
h2,
h3,
.h1,
.h2,
.h3 {
  font-family: var(--ds-display);
  font-style: italic;
  font-stretch: 118%;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
  color: var(--ds-text);
}

h1,
.h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

h2,
.h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
}

h3,
.h3 {
  font-size: 1.35rem;
}

/* Header */

.site-header {
  position: relative;
  background: var(--ds-bg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding-block: 0.6rem;
}

.brand {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
}

.brand-logo {
  display: block;
  width: clamp(170px, 30vw, 250px);
  height: auto;
}

/* On the home page the big logo is right below, so the header keeps only the menu. */
.is-home .brand {
  visibility: hidden;
}

/* The stripe from the logo: a white streak that runs into an orange bar. */
.speed-stripe {
  position: relative;
  height: 8px;
  display: flex;
  gap: 10px;
}

.speed-stripe span:first-child {
  flex: 0 0 58%;
  background: var(--ds-text);
  clip-path: polygon(0 72%, 100% 0, 100% 100%, 0 100%);
}

.speed-stripe span:last-child {
  flex: 1 1 auto;
  background: var(--ds-orange);
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);
}

/* Menu */

.site-nav {
  position: relative;
}

.nav-toggle {
  display: none;
}

.site-menu ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-menu li {
  margin: 0;
}

.site-menu a {
  display: block;
  padding: 0.4rem 0;
  border-bottom: 3px solid transparent;
  color: var(--ds-text);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}

.site-menu a:hover {
  color: var(--ds-accent);
}

.site-menu .current > a,
.site-menu .active > a,
.site-menu a[aria-current="page"] {
  border-bottom-color: var(--ds-orange);
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border: 2px solid var(--ds-text);
    border-radius: 4px;
    background: transparent;
    color: var(--ds-text);
    font: 600 1rem var(--ds-body);
    cursor: pointer;
  }

  .nav-toggle[aria-expanded="true"] {
    border-color: var(--ds-orange);
    color: var(--ds-accent);
  }

  .site-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    z-index: 50;
    min-width: 220px;
    padding: 0.5rem 1rem;
    background: var(--ds-surface);
    border: 2px solid var(--ds-orange);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  }

  .site-menu.is-open {
    display: block;
  }

  .site-menu ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .site-menu a {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--ds-line);
  }

  .site-menu li:last-child a {
    border-bottom: 0;
  }

  .site-menu .current > a,
  .site-menu a[aria-current="page"] {
    color: var(--ds-accent);
  }
}

/* Home page hero */

.hero {
  position: relative;
  padding: clamp(1.5rem, 5vw, 3.5rem) 0 clamp(2rem, 5vw, 3.5rem);
  /* The glow of the track lights, from up and to the right. */
  background:
    radial-gradient(ellipse 70% 90% at 90% -20%, rgba(255, 228, 190, 0.11), transparent 60%),
    var(--ds-bg);
  border-bottom: 1px solid var(--ds-line);
}

.hero.has-image {
  background:
    linear-gradient(90deg, rgba(20, 20, 23, 0.94) 0%, rgba(20, 20, 23, 0.78) 50%, rgba(20, 20, 23, 0.55) 100%),
    var(--hero-image) center / cover no-repeat,
    var(--ds-bg);
}

.hero-inner {
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 960px) {
  .hero-inner.has-side {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
    gap: 3.5rem;
  }
}

.hero-title {
  margin: 0;
  line-height: 0;
}

.hero-logo {
  display: block;
  width: min(600px, 100%);
  height: auto;
  margin-left: -1.5%;
}

.hero-tag {
  max-width: 34ch;
  margin: 1.25rem 0 0;
  color: var(--ds-text);
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  font-weight: 500;
  line-height: 1.4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
  margin-top: 1.75rem;
}

/* Buttons are slanted like the "DIRT TRACK RACING" tag on the logo. */
.btn-ds {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: 2px solid var(--ds-ink);
  transform: skewX(-12deg);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-ds > span {
  display: inline-block;
  transform: skewX(12deg);
}

.btn-ds-primary {
  background: var(--ds-orange);
  color: var(--ds-ink);
  box-shadow: 0 0 0 2px var(--ds-orange);
}

.btn-ds-primary:hover {
  background: #ff7a2b;
  color: var(--ds-ink);
}

.btn-ds-ghost {
  border-color: var(--ds-text);
  color: var(--ds-text);
}

.btn-ds-ghost:hover {
  background: var(--ds-text);
  color: var(--ds-ink);
}

.hero-side .ds-panel {
  margin: 0;
}

/* Main area */

.site-main {
  flex: 1 0 auto;
  padding: clamp(1.75rem, 4vw, 3rem) 0 3.5rem;
}

.main-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 992px) {
  .main-grid.has-sidebar {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.main-content {
  min-width: 0;
}

.pos-top,
.pos-bottom {
  display: grid;
  gap: 2rem;
}

.pos-top {
  margin-bottom: 2.5rem;
}

.pos-bottom {
  margin-top: 3rem;
}

@media (min-width: 900px) {
  .pos-bottom:has(> .ds-panel + .ds-panel) {
    grid-template-columns: 1fr 1fr;
  }
}

/* Module boxes: the logo's frame, an orange edge with a thin gray line inside. */
.ds-panel {
  min-width: 0;
}

.ds-panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.45rem;
}

/* Articles (news) */

/* The home page already has the logo as its heading. */
.is-home .blog-featured > .page-header {
  display: none;
}

.main-content .item-page,
.main-content .blog-item,
.main-content .com-content-article {
  max-width: 72ch;
}

.main-content .page-header h1,
.main-content .page-header h2,
.main-content .item-title {
  margin-bottom: 0.5rem;
}

.main-content .item-title a,
.main-content .page-header a {
  color: var(--ds-text);
  text-decoration: none;
}

.main-content .item-title a:hover,
.main-content .page-header a:hover {
  color: var(--ds-accent);
}

.main-content .article-info {
  margin: 0 0 1rem;
  color: var(--ds-muted);
  font-size: 0.95rem;
}

.main-content .article-info dt {
  display: none;
}

.main-content .article-info dd {
  display: inline;
  margin: 0 1rem 0 0;
}

.blog-featured .blog-item,
.blog .blog-item {
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--ds-line);
}

.readmore .btn,
.btn-primary {
  --bs-btn-bg: var(--ds-orange);
  --bs-btn-border-color: var(--ds-orange);
  --bs-btn-color: var(--ds-ink);
  --bs-btn-hover-bg: #ff7a2b;
  --bs-btn-hover-border-color: #ff7a2b;
  --bs-btn-hover-color: var(--ds-ink);
  --bs-btn-active-bg: #e05000;
  --bs-btn-active-border-color: #e05000;
  --bs-btn-active-color: var(--ds-ink);
  font-weight: 700;
}

.btn-secondary {
  --bs-btn-bg: var(--ds-raise);
  --bs-btn-border-color: var(--ds-frame);
  --bs-btn-color: var(--ds-text);
  --bs-btn-hover-bg: var(--ds-frame);
  --bs-btn-hover-border-color: var(--ds-frame);
}

.pagination {
  --bs-pagination-bg: var(--ds-surface);
  --bs-pagination-color: var(--ds-text);
  --bs-pagination-border-color: var(--ds-line);
  --bs-pagination-hover-bg: var(--ds-raise);
  --bs-pagination-hover-color: var(--ds-accent);
  --bs-pagination-hover-border-color: var(--ds-line);
  --bs-pagination-active-bg: var(--ds-orange);
  --bs-pagination-active-border-color: var(--ds-orange);
  --bs-pagination-active-color: var(--ds-ink);
  --bs-pagination-disabled-bg: var(--ds-bg);
  --bs-pagination-disabled-color: var(--ds-frame);
  --bs-pagination-disabled-border-color: var(--ds-line);
  flex-wrap: wrap;
}

.form-control,
.form-select {
  background-color: var(--ds-surface);
  border-color: var(--ds-line);
  color: var(--ds-text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ds-orange);
  box-shadow: 0 0 0 0.2rem rgba(255, 107, 26, 0.3);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--ds-line);
  background: #19191c;
  color: var(--ds-muted);
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.75rem;
}

.footer-logo {
  width: 150px;
  height: auto;
  opacity: 0.9;
}

.footer-mods ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-mods a {
  color: var(--ds-muted);
}

.footer-copy {
  margin: 0;
}

/* Error page */

.error-box {
  padding-block: 3rem 5rem;
}

.error-code {
  margin: 0;
  color: var(--ds-orange);
  font-family: var(--ds-display);
  font-style: italic;
  font-stretch: 125%;
  font-weight: 900;
  font-size: clamp(5rem, 18vw, 9rem);
  line-height: 0.9;
  -webkit-text-stroke: 0.04em var(--ds-ink);
  paint-order: stroke fill;
}

.error-title {
  margin: 1rem 0 0.5rem;
}

.error-msg {
  margin: 0 0 2rem;
  color: var(--ds-muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
