/* styles.css — Editorial Theme */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;500;600&display=swap');

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg:     #fafaf8;
    --text:   #111111;
    --text-2: #555555;
    --text-3: #999999;
    --rule:   #e5e5e5;
    --accent: #111111;
    --highlight-bg: rgba(180,140,11,0.08);
    --highlight:    #b8860b;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Header & Navigation
   ============================================================ */
header {
    padding: 0 3rem;
    border-bottom: 1px solid var(--rule);
    background: var(--bg);
}

.header-nav {
    max-width: 1020px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.logo {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.logo:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-right {
    display: flex;
    gap: 2rem;
}

.nav-right a {
    color: var(--text-2);
    font-size: .8125rem;
    text-decoration: none;
    letter-spacing: .01em;
    transition: color .15s;
}

.nav-right a:hover {
    color: var(--text);
}

/* ============================================================
   Typography
   ============================================================ */
h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
    margin: 0 0 .875rem;
    line-height: 1.12;
}

h2 {
    font-family: 'Inter', sans-serif;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.005em;
    margin: 1.75rem 0 .625rem;
    line-height: 1.3;
}

h3 {
    font-family: 'Inter', sans-serif;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.25rem 0 .375rem;
    letter-spacing: -.005em;
}

p {
    margin: 0 0 .875rem;
    color: var(--text);
}

ul, ol {
    padding-left: 1.375rem;
    margin: 0 0 .875rem;
}

li {
    margin-bottom: .25rem;
}

a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--text-2);
}

/* ============================================================
   Listing Pages  (courses.html / projects.html)
   ============================================================ */
.page-header {
    max-width: 760px;
    margin: 0 auto;
    padding: 3.5rem 3rem 0;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1.5rem;
    margin-bottom: 0;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: .25rem;
}

.page-header p {
    color: var(--text-3);
    margin: 0;
    font-size: .875rem;
}

/* Listing rows */
.listing {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 3rem 5rem;
}

.list-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 1.125rem 0;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: var(--text);
    transition: color .15s;
    gap: 2rem;
}

.list-row:first-child {
    border-top: none;
}

.list-row:hover {
    color: var(--text-2);
    text-decoration: none;
}

.list-row:hover .list-title {
    color: var(--text-2);
}

.list-title {
    font-size: .9375rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    transition: color .15s;
}

.list-meta {
    font-size: .8125rem;
    color: var(--text-3);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Legacy card-grid / card-link (fallback, kept for compat) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .875rem;
    padding: 0 3rem 5rem;
    max-width: 760px;
    margin: 0 auto;
}

.card-link {
    display: block;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: var(--text);
    transition: color .15s;
}

.card-link:hover {
    color: var(--text-2);
    text-decoration: none;
}

.card-link .card-title {
    font-size: .9375rem;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 .2rem;
}

.card-link .card-meta {
    font-size: .8125rem;
    color: var(--text-3);
}

/* ============================================================
   Notes Page — Sidebar + Content Layout
   ============================================================ */
.page-layout {
    display: flex;
    max-width: 1020px;
    margin: 0 auto;
    padding: 2.5rem 3rem 5rem;
    gap: 3.5rem;
    align-items: flex-start;
}

.sidebar {
    width: 190px;
    flex-shrink: 0;
    position: sticky;
    top: 72px;
    height: fit-content;
}

.toc {
    border-top: 2px solid var(--text);
    padding-top: .75rem;
}

.toc h2 {
    font-family: 'Inter', sans-serif;
    font-size: .625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-3);
    margin: 0 0 .75rem;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0;
}

.toc a {
    display: block;
    text-decoration: none;
    color: var(--text-2);
    font-size: .8125rem;
    padding: .25rem 0;
    line-height: 1.4;
    letter-spacing: -.005em;
    border-left: none;
    transition: color .15s;
}

.toc a:hover {
    color: var(--text);
    text-decoration: none;
}

/* ============================================================
   Notes Content Area
   ============================================================ */
.content {
    flex: 1;
    min-width: 0;
    max-width: 680px;
}

.course-header {
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1.5rem;
}

.course-header h1 {
    margin-bottom: .375rem;
    font-size: 2rem;
}

.course-meta {
    font-size: .8125rem;
    color: var(--text-3);
}

.course-portal {
    color: var(--text-2);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.course-portal:hover {
    color: var(--text);
}

/* ============================================================
   Collapsible Sections
   ============================================================ */
.collapsible-section {
    border-bottom: 1px solid var(--rule);
    margin-bottom: 0;
    overflow: hidden;
}

.section-header {
    background: transparent;
    padding: .9375rem 0;
    cursor: pointer;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.005em;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color .15s;
}

.section-header::after {
    content: "+";
    font-size: 1.125rem;
    font-weight: 300;
    color: var(--text-3);
    line-height: 1;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.collapsible-section.active .section-header {
    color: var(--text);
}

.collapsible-section.active .section-header::after {
    content: "−";
    color: var(--text-2);
}

.section-content {
    padding: 0 0 1.5rem;
    display: none;
}

.collapsible-section.active .section-content {
    display: block;
}

/* ============================================================
   Fact / Callout Cards
   ============================================================ */
.fact-card {
    background: var(--highlight-bg);
    border-left: 2px solid var(--highlight);
    padding: .875rem 1.125rem;
    margin: 1.125rem 0;
}

.fact-card h3 {
    margin-top: 0;
}

.fact-card p {
    margin-bottom: 0;
}

/* ============================================================
   Images
   ============================================================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.25rem 0;
}

/* ============================================================
   Equations & Components
   ============================================================ */
.equation {
    margin: 1rem 0;
    overflow-x: auto;
}

.component {
    margin-left: 1.5rem;
    margin-bottom: .5rem;
}

/* ============================================================
   Section spacing
   ============================================================ */
section {
    margin-bottom: 2rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    header {
        padding: 0 1.25rem;
    }

    .page-header {
        padding: 2.5rem 1.25rem 1.25rem;
    }

    .listing {
        padding: 0 1.25rem 3rem;
    }

    .page-layout {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem 1.25rem 3rem;
    }

    .sidebar {
        width: 100%;
        position: static;
    }

    h1 {
        font-size: 1.75rem;
    }
}
