:root {
  --bg: #ffffff;
  --bg-alt: #f8f8f8;
  --panel: #ffffff;
  --line: #e2e2e2;
  --line-strong: #cfcfcf;
  --text: #111111;
  --muted: #818181;
  --muted-strong: #555555;
  --accent: #111111;
  --accent-soft: #f0f0f0;
  --radius: 2px;
  --site-header-height: 84px;
  --sticky-controls-clearance: 16rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--site-header-height) + var(--sticky-controls-clearance));
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Raleway", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.875;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.site-header,
.hero,
.shell {
  width: min(1366px, calc(100% - 80px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--site-header-height);
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.site-brand {
  color: var(--text);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 20px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow-x: auto;
  scrollbar-width: thin;
}

.site-nav a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--muted-strong);
  border-bottom-color: var(--line-strong);
}

.hero {
  padding: 60px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hero__copy {
  max-width: 760px;
}

.eyebrow,
.course-panel__eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  font-family: "Raleway", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
}

h1 {
  font-size: 42px;
  line-height: 1.2;
}

.lede {
  margin: 18px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.875;
}

.hero__stats {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  min-width: 190px;
  padding: 14px 30px 14px 0;
  margin-right: 30px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
  margin-right: 0;
}

.stat strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
}

.stat span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toolbar {
  position: sticky;
  top: var(--site-header-height);
  z-index: 30;
  margin-top: 32px;
  padding: 12px 0 14px;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  column-gap: 20px;
  align-items: start;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
}

.searchbox {
  max-width: 960px;
}

.searchbox input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 13px 15px;
  color: var(--text);
  background: var(--panel);
  outline: none;
  font-size: 15px;
  line-height: 1.5;
}

.searchbox input::placeholder {
  color: var(--muted);
}

.searchbox input:focus {
  border-color: var(--text);
}

.searchbox__help {
  margin: 6px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.view-switch {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.view-switch__btn,
.chip,
.card__copy,
.card__link {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.view-switch__btn {
  cursor: pointer;
  padding: 9px 13px;
  color: var(--muted-strong);
  background: var(--panel);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.view-switch__btn:hover,
.view-switch__btn:focus-visible {
  border-color: var(--text);
  color: var(--text);
}

.view-switch__btn.is-active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-chip-row,
.bookmark-row {
  grid-column: 1 / -1;
  margin-top: 8px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.bookmark-row[hidden] {
  display: none;
}

.bookmark-row::before {
  content: attr(data-label);
  flex: 0 0 auto;
  min-width: 58px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.category-anchor {
  display: block;
  height: 1px;
  margin-top: -1px;
  scroll-margin-top: calc(var(--site-header-height) + var(--sticky-controls-clearance));
}

.course-panel {
  scroll-margin-top: calc(var(--site-header-height) + var(--sticky-controls-clearance));
}

.chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--muted-strong);
  background: var(--panel);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
}

.chip:hover,
.chip:focus-visible,
.chip.is-active {
  color: var(--text);
  border-color: var(--text);
  background: var(--accent-soft);
}

.content {
  padding: 40px 0 80px;
}

.library-grid,
.course-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  min-height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.card:hover {
  border-color: var(--line-strong);
}

.card h3 {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 400;
}

.card__description {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.card__top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.card__copy,
.card__link {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.card__copy {
  padding: 8px 10px;
  color: var(--muted-strong);
  background: var(--panel);
}

.card__copy:hover,
.card__copy:focus-visible {
  color: var(--text);
  border-color: var(--text);
}

.card__link {
  padding: 9px 12px;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.card__link:hover,
.card__link:focus-visible {
  color: var(--text);
  background: var(--panel);
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: auto;
}

.course-panel {
  padding: 0 0 42px;
  margin-bottom: 42px;
  border-bottom: 1px solid var(--line);
}

.course-panel:last-child {
  margin-bottom: 0;
}

.course-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.course-panel h2 {
  font-size: 30px;
  line-height: 1.25;
}

.course-panel__meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
  white-space: nowrap;
}

.course-group {
  margin-top: 20px;
}

.course-group h3 {
  margin-bottom: 12px;
  color: var(--muted-strong);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
}

.course-group__empty {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.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;
}

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--panel);
  color: var(--muted);
}

.empty-state {
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  :root {
    --site-header-height: 112px;
    --sticky-controls-clearance: 21rem;
  }

  .site-header,
  .hero,
  .shell {
    width: min(100% - 40px, 1366px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .site-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .hero {
    padding: 44px 0 24px;
  }

  .toolbar {
    display: block;
  }

  .view-switch {
    justify-content: flex-start;
    margin-top: 14px;
  }

  h1 {
    font-size: 34px;
  }

  .hero__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat {
    min-width: 0;
    margin-right: 0;
    padding-right: 16px;
  }

  .stat:nth-child(2n) {
    border-right: 0;
  }

  .course-panel__header {
    flex-direction: column;
    align-items: start;
  }

  .course-panel__meta {
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .site-header,
  .hero,
  .shell {
    width: min(100% - 28px, 1366px);
  }

  .site-brand {
    font-size: 22px;
  }

  .site-nav {
    gap: 12px;
    font-size: 12px;
  }

  h1 {
    font-size: 30px;
  }

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

  .stat,
  .stat:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat:last-child {
    border-bottom: 0;
  }

  .card__footer,
  .card__top {
    flex-direction: column;
    align-items: stretch;
  }

  .card__link,
  .card__copy {
    width: 100%;
    text-align: center;
  }
}
