/* ── SELF-HOSTED LITERATA ── */
@font-face {
    font-family: 'Literata';
    font-style: normal;
    font-weight: 100 900;
    font-display: optional;
    src: url('fonts/literata-normal-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Literata';
    font-style: normal;
    font-weight: 100 900;
    font-display: optional;
    src: url('fonts/literata-normal-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Literata';
    font-style: italic;
    font-weight: 100 900;
    font-display: optional;
    src: url('fonts/literata-italic-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Literata';
    font-style: italic;
    font-weight: 100 900;
    font-display: optional;
    src: url('fonts/literata-italic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

/* ── TOKENS ── */
:root {
    --white:    #FFFFFF;
    --ink:      #111110;
    --muted:    #787873;
    --rule:     #E5E4E0;
    --accent:   #9b001a;
    --bg-book:  #F6F5F2;
    --font-display: 'DM Serif Display', 'Georgia', serif;
    --font-prose: 'Literata', 'Georgia', serif;
    --font-ui:    system-ui, -apple-system, sans-serif;
}

body {
    font-family: var(--font-prose);
    background: var(--white);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    text-decoration: underline;
}

/* ── HOMEPAGE LAYOUT ── */

.home-container {
    max-width: 580px;
    margin: 0 auto;
    padding: 40px 32px 100px;
}

/* ── MASTHEAD ── */

.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 44px;
}

.masthead h1 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.masthead h1 a {
    color: inherit;
    text-decoration: none;
}

.site-nav {
    font-family: var(--font-ui);
    font-size: 13px;
    display: flex;
    gap: 20px;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.1s;
}

.site-nav a:hover {
    color: var(--ink);
    text-decoration: none;
}

.site-nav a.active {
    color: var(--ink);
}

/* ── VIEWS ── */

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ── SECTIONS ── */

.home-section {
    border-top: 1px solid var(--rule);
    padding: 26px 0;
}

.home-section h2 {
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 14px;
}

.home-section p {
    font-size: 14px;
    line-height: 1.8;
    color: #333330;
    margin-bottom: 10px;
}

.home-section p:last-child {
    margin-bottom: 0;
}

/* Intro layout */
.intro-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333330;
    margin-bottom: 14px;
}

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

.intro-text a:hover {
    color: var(--accent);
}

.about-body {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.intro-left {
    flex: 1;
    min-width: 0;
}

.about-photo {
    flex: 0 0 26%;
}

.about-photo img {
    width: 100%;
    display: block;
}

.about-photo .caption {
    font-family: var(--font-ui);
    font-size: 11px;
    font-style: italic;
    color: var(--muted);
    text-align: center;
    margin-top: 6px;
    line-height: 1.4;
}

/* Social links */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}

.social-links svg {
    width: 11px;
    height: 11px;
    fill: var(--muted);
    display: block;
    transition: fill 0.15s ease;
}

.social-links a:hover svg {
    fill: var(--ink);
}

.project-links {
    margin-top: 10px;
}

.project-links a {
    display: block;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 12.5px;
    line-height: 1.9;
}

.social-links a {
    line-height: 0;
}

/* Misc list */
.home-section ul {
    list-style: none;
    padding: 0;
}

.home-section li {
    font-size: 14px;
    line-height: 1.8;
    color: #333330;
    padding-left: 16px;
    position: relative;
    margin-bottom: 2px;
}

.home-section li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--muted);
    font-size: 12px;
    top: 3px;
}

/* ── WRITING PAGE ── */

.writing-item {
    margin-bottom: 18px;
}

.writing-item:last-child {
    margin-bottom: 0;
}

.writing-title {
    font-size: 14px;
    line-height: 1.5;
}

.writing-title a {
    color: var(--ink);
}

.writing-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.writing-meta {
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--muted);
    margin-top: 2px;
}

.writing-note {
    font-family: var(--font-ui);
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted);
    margin-top: 3px;
}

.writing-note a {
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: var(--rule);
    text-underline-offset: 2px;
}

.writing-note a:hover {
    color: var(--ink);
}

/* ── BOOKS SECTION (homepage) ── */

.books-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.year-tabs {
    display: flex;
    gap: 0;
}

.ytab {
    background: none;
    border: 1px solid var(--rule);
    font-family: var(--font-ui);
    font-size: 12.5px;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 12px;
    margin-left: -1px;
    position: relative;
    transition: all 0.1s;
}

.ytab:first-child {
    margin-left: 0;
}

.ytab.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--white);
    z-index: 1;
}

.ytab:hover:not(.active) {
    color: var(--ink);
}

.year-label {
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 24px 0 12px;
}

.books-loading {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--muted);
    font-style: italic;
    padding: 20px 0;
}

/* Book gallery (homepage) */
.book-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Masonry stacking for the Recs tab (heights vary — not all have pictures) */
.book-grid.book-masonry {
    display: block;
    columns: 3;
    column-gap: 14px;
}

.book-grid.book-masonry .book {
    break-inside: avoid;
    margin-bottom: 16px;
}

.book-grid .book img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border: 1px solid var(--rule);
    background: var(--bg-book);
    display: block;
}

.book-grid .book .btitle {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
    margin: 8px 0 3px;
    line-height: 1.35;
}

.book-grid .book .bnotes {
    font-family: var(--font-ui);
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.5;
}

/* ── YEAR PAGES (2024/2025/2026) ── */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #d4af37;
    border-top: 1px solid #d4af37;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.site-title,
.header h1 {
    font-size: 1em;
    color: #d4af37;
    letter-spacing: 0px;
    font-weight: 100;
    margin-bottom: 0px;
}

.nav-sections {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.nav-links {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
}

.nav-links a {
    font-size: 0.9rem;
    color: #f4f1de;
    text-decoration: none;
}

.nav-links a:hover {
    text-decoration: underline;
    color: #d4af37;
}

.nav-links a.active {
    color: #d4af37;
    text-decoration: underline;
}

.page-heading {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-heading h1,
.page-heading h2 {
    color: #d4af37;
    font-size: 1.2em;
    font-weight: 300;
}

/* Year-page gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

@media (min-width: 1280px) {
    .gallery {
        grid-template-columns: repeat(5, 1fr);
    }
}

.book-card {
    background: transparent;
    display: flex;
    flex-direction: column;
}

.book-cover {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border: 1px solid #8b4513;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.book-title {
    font-size: 0.85em;
    color: #e8d5b7;
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: 600;
    border-left: 1px solid #8b4513;
    padding-left: 10px;
}

.book-notes {
    color: #c9b896;
    line-height: 1.5;
    font-size: 0.75em;
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-left: 1px solid #5a7d9a;
}

.book-link {
    margin-top: 12px;
    font-size: 0.75em;
}

.book-link a {
    color: #d4af37;
    text-decoration: none;
    border-bottom: 1px solid #d4af37;
}

.book-link a:hover {
    color: #e8d5b7;
    border-bottom-color: #e8d5b7;
}

/* Year-page body background */
body:has(.gallery) {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f4f1de;
    padding: 20px 0;
}

/* List view (library/anti-library pages) */
.list-view #gallery {
    display: block;
    max-width: 800px;
    margin: 0 auto;
}

.list-view .book-card {
    background: transparent;
    border: none;
    padding: 6px 0;
    margin-bottom: 0;
    display: block;
}

.list-view .book-cover { display: none; }
.list-view .book-notes { display: none; }
.list-view .book-link  { display: none; }

.list-view .book-title {
    font-size: 1em;
    margin-bottom: 0;
    border-left: none;
    padding-left: 0;
    font-weight: 400;
    line-height: 1.2;
}

/* ── MOBILE ── */
@media (max-width: 600px) {
    .home-container {
        padding: 24px 20px 60px;
    }

    .masthead {
        margin-bottom: 32px;
    }

    .about-body {
        flex-direction: column;
    }

    .about-photo {
        flex: none;
        width: 55%;
        margin: 0 auto;
    }

    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .book-grid.book-masonry {
        columns: 2;
    }

    .container {
        padding: 0 15px;
    }
}
