/* ==========================================================================
   Lecture Notes Stylesheet (Folder-Specific)
   Inspired by Gilles Castel's minimalist layout & Catppuccin palette
   ========================================================================== */

/* Expand main container comfortably for two-column course cards grid */
.site-header,
main,
.site-footer {
    max-width: 58rem !important;
    width: 100%;
    margin-inline: auto;
}

/* Page Intro */
.notes-header-intro {
    margin-bottom: 1.75rem;
}

.notes-header-intro p {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 0.85rem;
}

/* Intro Footnotes / Errata & Reviewer Notes */
.notes-footnotes {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--rule);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.notes-footnote {
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
    color: var(--muted);
    margin: 0 !important;
}

.notes-footnote .footnote-mark {
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 600;
    margin-right: 0.25rem;
}

.notes-footnote a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.notes-footnote a:hover {
    color: var(--accent);
}

/* -------------------------------------------------------------------------- */
/* Gilles Castel Memorial Tribute Box                                         */
/* -------------------------------------------------------------------------- */
.castel-tribute-card {
    background: rgba(132, 99, 164, 0.05);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-purple);
    border-radius: 6px;
    padding: 1.35rem 1.5rem;
    margin: 1.75rem 0 2.25rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

[data-theme="dark"] .castel-tribute-card {
    background: rgba(203, 166, 247, 0.06);
    border-color: var(--border-color);
    border-left-color: var(--accent-purple);
}

.tribute-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-purple);
    margin-bottom: 0.75rem;
}

.tribute-badge svg {
    color: var(--accent-purple);
    flex-shrink: 0;
}

.tribute-content p {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 0.65rem;
    text-align: justify;
    text-justify: inter-word;
}

.tribute-content p:last-child {
    margin-bottom: 0;
}

.tribute-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--rule);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.tribute-links a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--accent-purple);
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.tribute-links a:hover {
    color: var(--accent-purple);
}

/* -------------------------------------------------------------------------- */
/* Filter Toolbar & Live Search                                               */
/* -------------------------------------------------------------------------- */
.notes-toolbar {
    margin: 1.75rem 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.notes-search-wrapper {
    position: relative;
    width: 100%;
}

.notes-search-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.notes-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(136, 57, 239, 0.15);
}

.notes-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-pill {
    font-family: var(--font-mono);
    font-size: 0.775rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--sidebar-bg);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.filter-pill:hover {
    color: var(--ink);
    border-color: var(--accent);
}

.filter-pill.active {
    background: var(--accent);
    color: #1e1e2e;
    border-color: var(--accent);
    font-weight: 500;
}

[data-theme="dark"] .filter-pill.active {
    background: var(--accent);
    color: #1e1e2e;
    border-color: var(--accent);
}

.notes-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 0.775rem;
    color: var(--muted);
    margin: 0.5rem 0 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
}

/* -------------------------------------------------------------------------- */
/* Year Sections & Course Cards                                               */
/* -------------------------------------------------------------------------- */
.notes-year-section {
    margin-bottom: 3.5rem;
}

.notes-year-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.25rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--rule);
}

.notes-year-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.notes-year-tag {
    font-family: var(--font-mono);
    font-size: 0.775rem;
    color: var(--muted);
}

/* Two-column responsive card grid (like Gilles Castel's notes) */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 720px) {
    .notes-grid {
        grid-template-columns: 1fr;
    }
}

/* Course Card */
.course-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.course-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .course-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.course-card-header {
    padding: 1.1rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--rule);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="dark"] .course-card-header {
    background: rgba(255, 255, 255, 0.015);
}

.course-meta {
    font-family: var(--font-mono);
    font-size: 0.725rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.course-meta a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.course-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.course-card-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--ink);
}

.course-art-box {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--paper);
    border: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    color: var(--accent);
    transition: transform 0.2s ease;
}

.course-card:hover .course-art-box {
    transform: scale(1.05);
}

/* Card Body & Notes List */
.course-card-body {
    padding: 0.85rem 1.25rem 1.15rem;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.course-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.course-note-item {
    border-radius: 4px;
}

.course-note-link {
    display: block;
    text-decoration: none;
    padding: 0.5rem 0.6rem;
    margin: -0.5rem -0.6rem;
    border-radius: 5px;
    transition: background-color 0.15s ease;
    border-left: 2px solid transparent;
}

.course-note-link:hover {
    background: rgba(132, 99, 164, 0.08);
    border-left-color: var(--accent);
}

[data-theme="dark"] .course-note-link:hover {
    background: rgba(203, 166, 247, 0.1);
    border-left-color: var(--accent);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.note-item-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.35;
    transition: color 0.15s ease;
}

.course-note-link:hover .note-item-title {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}

.note-item-format {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    background: var(--paper);
    padding: 0.1em 0.45em;
    border-radius: 4px;
    border: 1px solid var(--rule);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
}

.note-item-format.format-md {
    color: #40a02b;
    border-color: rgba(64, 160, 43, 0.35);
    background: rgba(64, 160, 43, 0.08);
}

[data-theme="dark"] .note-item-format.format-md {
    color: #a6e3a1;
    border-color: rgba(166, 227, 161, 0.35);
    background: rgba(166, 227, 161, 0.1);
}

.note-item-format.format-pdf {
    color: #e64553;
    border-color: rgba(230, 69, 83, 0.35);
    background: rgba(230, 69, 83, 0.08);
}

[data-theme="dark"] .note-item-format.format-pdf {
    color: #f38ba8;
    border-color: rgba(243, 139, 168, 0.35);
    background: rgba(243, 139, 168, 0.1);
}

.note-item-format.format-book {
    color: #1e66f5;
    border-color: rgba(30, 102, 245, 0.35);
    background: rgba(30, 102, 245, 0.08);
}

[data-theme="dark"] .note-item-format.format-book {
    color: #89b4fa;
    border-color: rgba(137, 180, 250, 0.35);
    background: rgba(137, 180, 250, 0.1);
}

.note-item-format.format-lab {
    color: #df8e1d;
    border-color: rgba(223, 142, 29, 0.35);
    background: rgba(223, 142, 29, 0.08);
}

.course-book-card {
    display: block;
    padding: 0.45rem 0.6rem;
    margin: -0.45rem -0.6rem;
    border-radius: 5px;
    background: rgba(132, 99, 164, 0.03);
    border-left: 2px solid rgba(132, 99, 164, 0.2);
}

[data-theme="dark"] .course-book-card {
    background: rgba(203, 166, 247, 0.03);
    border-left: 2px solid rgba(203, 166, 247, 0.25);
}

.course-book-card .note-item-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
}

.note-item-desc {
    font-family: var(--font-serif);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--muted);
    text-align: left;
    margin: 0;
}

/* Filtering visibility */
.course-card.hidden {
    display: none !important;
}

.notes-year-section.hidden {
    display: none !important;
}

.notes-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border: 1px dashed var(--rule);
    border-radius: 8px;
    margin-top: 1.5rem;
    display: none;
}
