:root {
    color-scheme: light dark;

    /* ── Palette ── */
    --bg:              light-dark(#f5f0e8, #0c0c0c);
    --surface:         light-dark(#ede7d9, #1a1919);
    --surface-alt:     light-dark(#e6dece, #151515);
    --surface-hover:   light-dark(#e0d8c8, #2a2828);
    --border:          light-dark(#d0c8b8, #2a2828);
    --text:            light-dark(#1c1812, #faf9f6);
    --text-muted:      light-dark(rgba(28,24,18,0.75), rgba(250,249,246,0.8));
    --link:        light-dark(#7a4f1e, wheat);
    
    --gold:       #9B7A2F;
    --gold-faint: rgba(155, 122, 47, 0.45);
}

body {
    margin: 0;
    color: var(--text);
    background-color: var(--bg);
    font-family: "Inter", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url('../The_School_of_Athens_by_Raffaello_Sanzio_da_Urbino_in_Vatican.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: 1;
    pointer-events: none;
    z-index: 0;
}

body.dark::before { 
    opacity: 0.06;
}

.main {
    width: 100%;
    max-width: min(800px, 92vw);
    margin: clamp(32px, 6vh, 96px) auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
    opacity: 0.9;
}

/* ---------- Header ---------- */
.header {
    text-align: center;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    background-color: var(--surface);
    padding: 24px;
    border-radius: 16px;
}

.header h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle {
    margin-top: 10px;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
}

/* ---------- Navigation ---------- */
.nav-back {
    margin: 16px 0 32px 0;
}

button {
    background-color: var(--surface);
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 12px 20px;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

button:hover {
    color: var(--text);
    background-color: var(--surface-hover);
}

/* ---------- Sections ---------- */
.shelves {
    text-align: left;
}

.section-title {
    text-align: center;
    margin: 40px 0 12px 0;
    border-bottom: 1px solid var(--border);
    background-color: var(--surface-alt);
    border-radius: 15px;
    padding: 30px;
}

.section-title h2 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.section-title h3 {
    margin-top: 6px;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--text-muted);
    margin-bottom: auto;
}

/* ---------- Shelf ---------- */
.shelf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    padding: 18px 14px 12px;
    background-color: var(--surface-alt);
    border-radius: 14px;
    margin-bottom: 20px;
}

/* ---------- Books ---------- */
.book {
    width: clamp(52px, 16vw, 70px);
    height: clamp(130px, 40vw, 170px);
    background-color: var(--surface);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 200ms, background-color 200ms;
}

@media (hover: hover) {
    .book:hover {
        background-color: var(--surface-hover);
        transform: translateY(-6px);
    }
}

.book-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: clamp(0.75rem, 2vw, 1rem);
    text-align: center;
    padding: 10%;
    color: var(--text);
    opacity: 0.9;
}