/* ============================================================================
   Shared stylesheet for migrated course pages (see MIGRATION.md).
   Each page sets its course identity via CSS variables in a small inline
   <style> block:
     --primary-color   dark shade: links, bullets, tag, accents
     --course-bright   bright shade: sub-nav bar background
     --course-faded    visited links
     --course-btn      contact-button hover
     --nav-hover       sub-nav link hover (dark where the bar is light)
     --skip-label-col  "Skip to:" label on project pages
     --cal-band, --cal-class, --cal-event, --cal-exam, --cal-exam-text
   plus the page background tint on body.
   ========================================================================== */

.widget-header { border-bottom-color: var(--primary-color); }
/* Site nav links hover in their own section colors (course pages use
   ../../../ paths); the base rule below keeps any other link off the
   course color */
#main-nav .nav-links a:hover { color: #007bff; }
#main-nav .nav-links a[href="../../../research.html"]:hover { color: #e7210e; }
#main-nav .nav-links a[href="../../../design.html"]:hover { color: #13b272; }
#main-nav .nav-links a[href="../../../education.html"]:hover { color: #1d5adc; }
#main-nav .nav-links a[href="../../../strategy.html"]:hover { color: #b8860b; }
#main-nav .nav-links a[href="../../../contact.html"]:hover { color: #7a2fc2; }
#main-nav .nav-links a[href="https://hanusa.xyz/blog"]:hover { color: #d81b8c; } /* insights magenta */

/* --- Course tag + sub-nav bar --- */
.course-tag {
    display: block;
    font-size: 0.95em;
    color: var(--primary-color);
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.course-nav {
    background: var(--course-bright);
    border-radius: 8px;
    padding: 8px 16px;
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 18px;
}
.course-nav a, .course-nav a:visited {
    color: #000;
    text-decoration: none;
    font-size: 1em;
}
.course-nav a:hover { color: var(--nav-hover, #fff); }
.course-nav a.here {
    background: #000;
    color: #fff;
    font-weight: bold;
    padding: 2px 12px;
    border-radius: 12px;
}
@media (max-width: 700px) {
    .course-nav { padding: 6px 12px; gap: 3px 16px; }
    .course-nav a { font-size: 0.95em; }
}
/* On mobile the layout stacks and the sub-nav bar covers navigation,
   so the sidebar widget is redundant */
@media (max-width: 1000px) {
    .sidebar { display: none; }
}

/* --- Course-colored links; visited slightly lighter --- */
.section-block a { color: var(--primary-color); }
.section-block a:visited { color: var(--course-faded); }
.hero-section a { color: var(--primary-color); }
.hero-section a:visited { color: var(--course-faded); }

/* --- Hero intro (explanatory text under the page heading) --- */
.hero-section .hero-intro
    { font-size: 1.15em; color: #666; text-align: left; max-width: 90%; margin-bottom: 10px; }
.hero-section .hero-intro p
    { font-size: 1em; color: inherit; max-width: none; margin-bottom: 10px; }

/* --- Legacy course content, restyled --- */
.course-content { line-height: 1.6; }
.course-content h2 { margin: 25px 0 10px; }
.course-content h3 { font-size: 1.35em; margin: 18px 0 8px; color: var(--text-dark); }
/* a header that opens a block should not add space on top of the card padding */
.course-content > :first-child { margin-top: 0; }
.course-content > a[name]:first-child + * { margin-top: 0; }
.course-content p { margin-bottom: 12px; }
.course-content ul, .course-content ol { margin: 0 0 12px 25px; }
.course-content li { margin-bottom: 6px; }
.course-content blockquote { margin: 10px 25px; }
/* keep long unbreakable content (code, URLs) inside the card */
.section-block .text-side { min-width: 0; }
.course-content { overflow-wrap: break-word; }
.course-content pre { white-space: pre-wrap; overflow-x: auto; }
/* anchor jumps clear the fixed site nav + card padding */
.course-content a[name] { scroll-margin-top: 120px; }

.course_letter {
    border: 1px solid #ccc;
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
    background: #fff;
    padding: 12px 18px;
    margin-bottom: 20px;
}
.notes_section { font-size: 1.5em; font-weight: 700; margin-top: 25px; }
.date { font-size: 1.25em; margin-top: 12px; }
.defn { font-weight: 700; padding-left: 20px; margin-top: 5px; }

/* Red call-out edge on each letter block */
.section-block.letter { border-left: 4px solid var(--primary-color); }

/* --- Project pages --- */
.skip-label { font-weight: bold; color: var(--skip-label-col, #fff); }
.course-content .project-heading {
    font-size: 3em;
    color: var(--primary-color);
    margin: 0 0 15px;
    line-height: 1.1;
}

/* --- Sidebar --- */
.sidebar .course-links { list-style: none; }
.sidebar .course-links li { border-bottom: 1px solid #eee; }
.sidebar .course-links li:last-child { border-bottom: none; }
.sidebar .course-links a {
    display: block;
    padding: 10px 5px;
    color: var(--text-dark);
    text-decoration: none;
}
.sidebar .course-links a:hover { color: var(--primary-color); }
.sidebar .btn { margin-top: 18px; }
.btn:hover { background-color: var(--course-btn); } /* darker course shade, not blue */

/* --- Calendar (data-driven) --- */
.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;
}
.cal-legend { font-size: 0.95em; color: #555; }
.legend-swatch {
    display: inline-block; width: 14px; height: 14px;
    border: 1px solid #000; vertical-align: -2px;
}
.swatch-class { background: var(--cal-class); }
.swatch-exam { background: var(--cal-exam); }
.swatch-event { background: var(--cal-event, #eee); }

.cal-grid-wrap { overflow-x: auto; }
table.calendar {
    border-collapse: collapse;
    background: #fff;
    width: 100%;
}
table.calendar caption { text-align: left; font-weight: bold; padding-bottom: 8px; }
table.calendar th, table.calendar td { color: #000; }
table.calendar th, table.calendar td {
    border: 1px solid #000;
    padding: 6px 8px;
    text-align: center;
    vertical-align: top;
}
table.calendar thead th, table.calendar tbody th { background: var(--cal-band); }
table.calendar tbody th { font-weight: normal; white-space: nowrap; }
table.calendar td.day { min-width: 85px; min-height: 60px; }
table.calendar td.class-day { background: var(--cal-class); }
table.calendar td.exam-day { background: var(--cal-exam); }
table.calendar td.exam-day * { color: var(--cal-exam-text, #fff); }
table.calendar td.event-day { background: var(--cal-event, #eee); }
table.calendar td.notes { text-align: left; font-size: 0.9em; max-width: 220px; }
.cal-date { display: block; font-size: 0.75em; color: #000; }
td.day .cal-topic { display: block; margin-top: 4px; font-weight: bold; }

.cal-list-wrap { display: none; }
.cal-week { margin-bottom: 18px; }
.cal-week h3 {
    background: var(--cal-band); border: 1px solid #000;
    padding: 4px 10px; font-size: 1.05em; display: inline-block;
}
.cal-week ul { list-style: none; margin: 8px 0 0; }
.cal-week li { padding: 4px 0 4px 10px; }
.cal-week li.class-day { border-left: 5px solid var(--cal-class); }
.cal-week li.exam-day { border-left: 5px solid var(--cal-exam); }
.cal-week li.event-day { border-left: 5px solid #999; }
.cal-week .cal-note { font-style: italic; color: #555; padding-left: 10px; }
@media (max-width: 700px) {
    .cal-grid-wrap { display: none; }
    .cal-list-wrap { display: block; }
}
