/* Course site theme. Dark background, Inter body font (Google Fonts),
   red-orange accent. rheo 0.5.0 auto-wires this file (root style.css) into every
   page. Code stays in Berkeley Mono, which is proprietary and not committed — see
   fonts/README.md; the stack falls back to the system monospace when the TTFs
   are absent. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Oblique.ttf') format('truetype');
  font-weight: 400;
  font-style: oblique;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('./fonts/BerkeleyMono-Bold-Oblique.ttf') format('truetype');
  font-weight: 700;
  font-style: oblique;
}

/* ============================================
   CSS Variables
   ============================================ */
:root {
  --background-color: #1c1c1c;
  --text-color: #e0e0e0;
  --link-color: #e8562d;
  --border-color: #e8562d;
  --muted-color: #999999;
}

/* ============================================
   Base Layout
   ============================================ */
body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Inter', sans-serif;
  font-size: 1em;
  line-height: 1.3;
  letter-spacing: -0.03em;
  margin: 0 auto;
  padding: 50px;
  max-width: 38em;
}

/* ============================================
   Navigation
   ============================================ */
.site-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0;
}

.site-nav + hr {
  margin-top: 0;
  height: 5px;
}

.site-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted-color);
  font-size: 0.8em;
  text-transform: uppercase;
}

.site-nav a:hover {
  color: var(--text-color);
  text-decoration: underline;
  text-decoration-color: var(--text-color);
}

.site-title {
  font-size: 0.9em;
  color: var(--text-color);
}

.site-nav li.active a,
.site-title.active {
  color: var(--border-color);
  font-weight: 600;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  color: var(--border-color);
  font-weight: 500;
  text-transform: uppercase;
  text-align: left;
  margin-top: 1.25em;
  margin-bottom: 0.25em;
}

/* ============================================
   Links
   ============================================ */
a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.25s ease;
}

a:hover {
  text-decoration-color: var(--link-color);
}

/* ============================================
   Lists
   ============================================ */
ul, ol {
  padding-left: 2em;
  margin: 0.5em 0;
}

/* ============================================
   Media
   ============================================ */
img, video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em 0;
}

/* ============================================
   Code
   ============================================ */
code {
  font-family: 'Berkeley Mono', monospace;
  background-color: rgba(0, 0, 0, 0.06);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}

/* ============================================
   Tables
   ============================================ */
/* Break out wider than the 38em content column — analogous to the tables in
   spec/index.css. Because body is `margin: 0 auto`, its center is the viewport
   center; `margin-left: 50%` puts the table's left edge there and
   `translateX(-50%)` re-centers the wider box on the viewport, independent of
   the narrow content column. */
table {
  table-layout: fixed;
  width: 80vw;
  max-width: 1000px;
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 1.5em;
  margin-bottom: 2em;
  border-collapse: collapse;
  font-size: 0.9em;
  letter-spacing: normal;
}

/* Grid lines are a dimmed variation of the orange accent (--border-color,
   #e8562d) rather than a neutral gray, so they read as part of the theme on the
   dark background. Low alpha keeps a full-grid table from turning loud. */
th, td {
  border: 1px solid rgba(232, 86, 45, 0.3);
  padding: 0.5em 0.7em;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

/* Unequal columns: slim Date (Week label + date, kept on their own lines),
   generous Concepts for bullet lists. Widths live here because Typst emits a
   bare <table> with no <col> widths, so the `table-layout: fixed` above would
   otherwise split all four columns equally. The header row's cells fix the
   column widths; the Spring Recess colspan cell just fills its span. */
th:nth-child(1), td:nth-child(1) { width: 11%; white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { width: 25%; }
th:nth-child(3), td:nth-child(3) { width: 40%; }
th:nth-child(4), td:nth-child(4) { width: 24%; }

th {
  background: rgba(232, 86, 45, 0.12);
  color: var(--border-color);
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.85em;
  border-bottom: 2px solid rgba(232, 86, 45, 0.6);
}

/* ============================================
   Blockquotes
   ============================================ */
blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 2px solid var(--border-color);
  color: var(--muted-color);
  font-style: italic;
}

/* ============================================
   Rules
   ============================================ */
hr {
  height: 1px;
  background-color: var(--border-color);
  border: none;
  margin: 1.25em 0;
}

/* ============================================
   Endnotes
   ============================================ */
section[role="doc-endnotes"] {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--border-color);
}

section[role="doc-endnotes"] ol li a[role="doc-backlink"] {
  padding-right: 0.2em;
}

/* ============================================
   Hamburger (hidden on desktop)
   ============================================ */
.nav-toggle {
  display: none;
}

.nav-hamburger {
  display: none;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
  body {
    padding: 12px;
    font-size: 0.9em;
  }

  .site-nav {
    position: sticky;
    top: 0;
    background: var(--background-color);
    z-index: 100;
    flex-wrap: wrap;
    border-bottom: 5px solid var(--border-color);
  }

  .site-nav + hr {
    display: none;
  }

  .nav-hamburger {
    display: block;
    cursor: pointer;
    color: var(--muted-color);
    font-size: 0;
    user-select: none;
  }

  .nav-hamburger::before {
    content: '☰';
    font-size: 1.1rem;
    display: inline-block;
    transition: transform 0.25s ease;
  }

  .nav-toggle:checked ~ .nav-hamburger::before {
    content: '✕';
    transform: rotate(90deg);
  }

  .site-nav ul {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.5em;
    padding: 0.5em 0;
  }

  .nav-toggle:checked ~ ul {
    display: flex;
  }

  /* No breakout on narrow screens — full content width instead. */
  table {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    transform: none;
  }
}
