:root {
    --parchment: #f9f7f2;
    --ink: #1c1c1c;
    --accent: #7a1f1f;
    --rule: #d1cdc0;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--parchment);
    color: var(--ink);
    font-family: 'EB Garamond', serif;
    line-height: 1.6;
    margin: 0;
    display: flex;
    justify-content: center;
    padding: 4rem 1rem;
}

@media (max-width: 600px) {
    body {
        padding: 2rem 1rem;
    }
}

.container {
    max-width: 650px;
    width: 100%;
}

header {
    margin-bottom: 5rem;
    text-align: center;
}

@media (max-width: 600px) {
    header {
        margin-bottom: 3rem;
    }
}

h1 {
    font-family: 'IM Fell English', serif;
    font-weight: 400;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.1rem;
    }
}

.subtitle {
    font-style: italic;
    color: var(--accent);
    font-size: 1.1rem;
}

.toc {
    list-style: none;
    padding: 0;
}

.toc-item {
    margin-bottom: 3rem;
    position: relative;
}

.toc-number {
    font-family: 'IM Fell English', serif;
    font-size: 1.2rem;
    color: var(--accent);
    display: block;
    margin-bottom: 0.2rem;
}

.toc-title {
    font-size: 1.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px dashed transparent;
    cursor: pointer;
    display: inline-block;
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
}

@media (max-width: 600px) {
    .toc-title {
        font-size: 1.5rem;
    }
}

.toc-title:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.toc-description {
    margin-top: 0.8rem;
    font-size: 1.1rem;
    max-width: 90%;
    color: #444;
}

.marginalia {
    font-family: 'Ms Madi', cursive;
    font-size: 1.5rem;
    color: #666;
    display: block;
    margin-top: 1rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 2rem 0;
}

footer {
    margin-top: 6rem;
    font-size: 0.9rem;
    text-align: center;
    font-style: italic;
    opacity: 0.7;
}

.fade-in {
    animation: fadeIn 1.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#projects-section {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
}

#projects-section.expanded {
    max-height: 2000px;
    opacity: 1;
}

.project-list {
    list-style: none;
    padding: 0;
    margin-top: 1.5rem;
}

.project-item {
    margin-bottom: 2.5rem;
}

.project-item h3 {
    font-family: 'IM Fell English', serif;
    font-size: 1.5rem;
    color: var(--ink);
    margin-bottom: 0.4rem;
}

@media (max-width: 600px) {
    .project-item h3 {
        font-size: 1.3rem;
    }
}

.project-item .metadata {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.95rem;
    color: #666;
    margin-top: 0;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.project-item p {
    font-size: 1.05rem;
    color: var(--ink);
    margin-bottom: 0.8rem;
    text-align: justify;
}

@media (max-width: 600px) {
    .project-item p {
        text-align: left;
    }
}

.project-item a {
    color: var(--ink);
    text-decoration: none;
    position: relative;
    font-size: 1rem;
    display: inline-block;
    transition: color 0.3s ease;
}

.project-item a::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent);
    visibility: hidden;
    transform: scaleX(0);
    transition: all 0.3s ease-in-out;
}

.project-item a:hover {
    color: var(--accent);
}

.project-item a:hover::before {
    visibility: visible;
    transform: scaleX(1);
}