/* ==========================================================================
   The Race Lab - Main Stylesheet
   ========================================================================== */

/* Self-hosted Inter variable font */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #1a1f36;
  --navy-light: #252b48;
  --navy-mid: #2d3456;
  --white: #ffffff;
  --off-white: #f7f8fa;
  --grey-light: #e8eaed;
  --grey-mid: #9ba3b5;
  --grey-dark: #5f6880;
  --text: #2c3040;
  --text-light: #5f6880;
  --accent: #3d7fff;
  --accent-hover: #2a6ae8;
  --accent-subtle: #edf3ff;
  --green: #2d9f6f;
  --red: #d94052;
  --max-width: 1120px;
  --content-width: 740px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--off-white);
  line-height: 1.65;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--white);
  text-decoration: none;
}

.site-logo:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 2rem;
}

.site-nav a {
  color: var(--grey-mid);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--white);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
    gap: 0;
    border-bottom: 3px solid var(--accent);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--navy-light);
  }

  .site-nav a:last-child {
    border-bottom: none;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--navy);
  color: var(--grey-mid);
  padding: 3rem 0;
  margin-top: 4rem;
}

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

.footer-tagline {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.footer-legal {
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.footer-copyright {
  font-size: 0.8rem;
}

/* ==========================================================================
   Homepage
   ========================================================================== */

.hero {
  background: var(--navy);
  padding: 4rem 0 3.5rem;
  margin-top: -1px;
}

.hero h1 {
  color: var(--white);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1rem;
  max-width: 640px;
}

.hero p {
  color: var(--grey-mid);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 560px;
}

@media (max-width: 768px) {
  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 1rem;
  }
}

.home-section {
  padding: 3rem 0;
}

.home-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--navy);
}

.home-section h2 a {
  color: inherit;
  text-decoration: none;
}

.home-section h2 a:hover {
  color: var(--accent);
}

/* Article cards */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--white);
  border-radius: 6px;
  padding: 1.75rem;
  border: 1px solid var(--grey-light);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.article-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(26, 31, 54, 0.08);
}

.article-card .card-section {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.article-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.6rem;
}

.article-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.article-card h3 a:hover {
  color: var(--accent);
}

.article-card .card-summary {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.article-card .card-meta {
  font-size: 0.8rem;
  color: var(--grey-mid);
}

@media (max-width: 640px) {
  .article-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Content Pages
   ========================================================================== */

.page-header {
  background: var(--navy);
  padding: 3rem 0 2.5rem;
  margin-top: -1px;
}

.page-header h1 {
  color: var(--white);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  max-width: var(--content-width);
}

.page-header .page-meta {
  color: var(--grey-mid);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

@media (max-width: 768px) {
  .page-header {
    padding: 2rem 0 1.5rem;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }
}

.content-wrap {
  max-width: var(--content-width);
  padding: 2.5rem 0 4rem;
}

/* Prose content styling */
.prose {
  font-size: 1.05rem;
  line-height: 1.72;
}

.prose h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.prose h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.prose p {
  margin-bottom: 1.25rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(61, 127, 255, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

.prose ul, .prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--accent-subtle);
  color: var(--text);
  font-style: normal;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.prose thead {
  background: var(--navy);
  color: var(--white);
}

.prose th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prose td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--grey-light);
}

.prose tbody tr:hover {
  background: var(--accent-subtle);
}

.prose code {
  background: var(--off-white);
  border: 1px solid var(--grey-light);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.88em;
}

.prose pre {
  background: var(--navy);
  color: var(--grey-light);
  padding: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--grey-light);
  margin: 2rem 0;
}

/* Table responsive wrapper */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.table-wrap table {
  margin: 0;
}

/* ==========================================================================
   Section List Pages
   ========================================================================== */

.section-intro {
  max-width: var(--content-width);
  padding: 2rem 0;
  color: var(--text-light);
  font-size: 1.05rem;
  line-height: 1.65;
}

.section-list {
  padding-bottom: 3rem;
}

/* ==========================================================================
   Course Guide Specific
   ========================================================================== */

.course-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--grey-light);
  border-radius: 6px;
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--grey-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Data highlight boxes
   ========================================================================== */

.data-callout {
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 4px 4px 0;
}

.data-callout .callout-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.data-callout p {
  margin: 0;
  font-size: 0.95rem;
}

/* ==========================================================================
   Utility
   ========================================================================== */

.text-muted {
  color: var(--text-light);
}

.text-small {
  font-size: 0.875rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
