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

:root {
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --teacher: #7c3aed;
    --teacher-hover: #6d28d9;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header .subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

header nav {
    margin-bottom: 1rem;
    text-align: left;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

header nav a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

header nav a:hover {
    text-decoration: underline;
}

main {
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex: 1;
}

/* Homepage year groups */

.year-group {
    margin-bottom: 2rem;
}

.year-group h2 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.course-list {
    display: flex;
    flex-direction: column;
}

.course-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.course-item:hover {
    background: var(--surface);
}

.course-name {
    font-size: 1.05rem;
    font-weight: 500;
}

.course-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 1rem;
}

/* Course page table */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

thead {
    background: var(--bg);
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: #f9fafb;
}

tr.block-row {
    background: var(--bg);
}

tr.block-row:hover {
    background: var(--bg);
}

tr.block-row td {
    font-size: 0.95rem;
    font-weight: 600;
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

tr.section-row {
    background: var(--bg);
}

tr.section-row:hover {
    background: var(--bg);
}

tr.section-row td {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding-top: 0.75rem;
    border-bottom: 1px solid var(--border);
}

td.date {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.dl-link {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--accent);
    border: 1px solid var(--accent);
    transition: background 0.15s, color 0.15s;
}

.dl-link:hover {
    background: var(--accent);
    color: #fff;
}

.dl-teacher {
    color: var(--teacher);
    border-color: var(--teacher);
}

.dl-teacher:hover {
    background: var(--teacher);
    color: #fff;
}

/* Footer */

footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent);
}

/* Responsive */

@media (max-width: 600px) {
    header {
        padding: 2rem 1rem 1.5rem;
    }

    main {
        padding: 0 1rem;
    }

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

    th, td {
        padding: 0.5rem 0.6rem;
    }

    .dl-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}
