.year-list {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
}

.year-section {
  display: grid;
  grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr);
  gap: 1.5rem clamp(2rem, 5vw, 4rem);
  padding-top: 0.25rem;
}

.year-heading {
  position: sticky;
  top: 6rem;
  align-self: start;
}

.year-heading h2 {
  margin-bottom: 0.3rem;
}

.course-list {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.8rem 1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.course-code {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.28rem 0.48rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-strong);
  color: var(--text);
  font-family:
    "Cascadia Code", "Roboto Mono", Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.course-code:hover {
  color: var(--accent-dark);
  text-decoration: none;
}

.course-title {
  display: inline-block;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 750;
  text-decoration: none;
}

.course-title:hover {
  color: var(--accent-dark);
}

.course-meta,
.course-summary {
  color: var(--muted);
  font-size: 0.94rem;
}

.course-meta {
  margin: 0.15rem 0;
}

.course-summary {
  margin: 0.25rem 0 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.5rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.92rem;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  margin-left: 0.35rem;
  color: #9aa4b2;
  content: "/";
}

.course-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem 2rem;
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.course-header h1 {
  margin-bottom: 0.65rem;
}

.course-header p {
  color: var(--muted);
}

.course-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family:
    "Cascadia Code", "Roboto Mono", Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.course-badge:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--accent-dark);
  text-decoration: none;
}

.course-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  align-items: start;
  gap: clamp(2rem, 5vw, 4rem);
}

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

.course-section {
  scroll-margin-top: 6rem;
}

.course-section + .course-section {
  margin-top: 2.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}

.course-section p,
.course-section li {
  max-width: var(--reading);
}

.course-nav {
  position: sticky;
  top: 6rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.course-nav h2 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.course-nav ul {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-nav a {
  display: block;
  padding: 0.32rem 0;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 650;
  text-decoration: none;
}

.course-nav a:hover {
  color: var(--accent-dark);
}

.materials-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.material-link {
  display: flex;
  height: 100%;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.material-link:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--accent-dark);
  text-decoration: none;
}

.material-title {
  display: block;
  font-weight: 720;
}

.material-meta {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.file-type {
  flex: 0 0 auto;
  padding: 0.18rem 0.38rem;
  border-radius: 0.35rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.schedule-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.schedule-table th,
.schedule-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.schedule-table thead th {
  background: var(--surface);
  color: var(--text);
  font-weight: 750;
}

.schedule-table tbody tr:last-child > * {
  border-bottom: 0;
}

.schedule-table tbody th {
  width: 5rem;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.lesson-date {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.lesson-topic {
  display: block;
  color: var(--text);
  font-weight: 650;
}

.lesson-note {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 58rem) {
  .course-layout {
    grid-template-columns: 1fr;
  }

  .course-nav {
    position: static;
    grid-row: 1;
  }

  .course-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
  }
}

@media (max-width: 47.5rem) {
  .year-section {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .year-heading {
    position: static;
  }

  .course-header {
    grid-template-columns: 1fr;
  }

  .course-badge {
    justify-self: start;
  }

  .materials-list {
    grid-template-columns: 1fr;
  }

  .schedule-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .schedule-table,
  .schedule-table tbody {
    display: block;
  }

  .schedule-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .schedule-table tr {
    display: grid;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .schedule-table tbody th,
  .schedule-table td {
    display: grid;
    grid-template-columns: minmax(7rem, 0.36fr) minmax(0, 1fr);
    gap: 0.75rem;
    width: auto;
    padding: 0.72rem 0.8rem;
    border-bottom: 1px solid var(--border);
    white-space: normal;
  }

  .schedule-table tbody th {
    background: var(--surface-strong);
    color: var(--text);
  }

  .schedule-table tbody th::before {
    color: var(--muted);
    content: "Týden";
    font-weight: 650;
  }

  .schedule-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-weight: 650;
  }

  .schedule-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .schedule-table tbody tr:last-child > *,
  .schedule-table tbody tr > *:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 32rem) {
  .course-card {
    grid-template-columns: 1fr;
  }

  .course-code {
    justify-self: start;
  }

  .schedule-table tbody th,
  .schedule-table td {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
