:root {
    --bg: #fdfaf6; /* Ivory/Warm white */
    --text: #1a1a1a; /* Graphite */
    --ink: #0c2461; /* Ink blue */
    --petrol: #079992; /* Petrol green */
    --gold: #b48728; /* Muted gold */
    --muted: #636e72;
    --border: #dfe6e9;
    --accent-bg: rgba(180, 135, 40, 0.08);
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.08);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    padding: 4rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
}

header h1 {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    color: var(--ink);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--muted);
    font-size: 1.2rem;
    font-family: var(--font-serif);
    font-style: italic;
}

/* Search Bar */
.search-box {
    max-width: 700px;
    margin: 0 auto 4rem;
}

.search-box input {
    width: 100%;
    padding: 1.2rem 2rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
    background: white;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(180, 135, 40, 0.1);
}

/* Home Layout: Two Columns */
.library-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 5rem;
}

.authors-column h2, .books-column h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    margin-bottom: 2rem;
    color: var(--ink);
    border-bottom: 3px solid var(--gold);
    display: inline-block;
    padding-bottom: 0.3rem;
}

.author-item {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin-bottom: 0.3rem;
}

.author-item:hover {
    background: var(--accent-bg);
    color: var(--gold);
}

.author-item.active {
    background: var(--accent-bg);
    color: var(--gold);
    border-left-color: var(--gold);
    font-weight: 600;
}

.books-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.book-card {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.book-card:hover {
    transform: translateX(10px);
    border-color: var(--gold);
    box-shadow: var(--shadow-md);
}

.book-card h3 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.book-meta {
    font-size: 1rem;
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.book-tag {
    display: inline-block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: #f1f2f6;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.empty-msg {
    text-align: center;
    padding: 4rem;
    color: var(--muted);
    font-style: italic;
}

/* INTERNAL PAGE: SCHEDA */
.book-summary-page {
    max-width: 800px;
    margin: 4rem auto;
    background: white;
    padding: 4rem;
    border-radius: 2px; /* Square library card feel */
    box-shadow: 0 0 60px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.book-summary-header {
    border-bottom: 2px solid var(--ink);
    padding-bottom: 2rem;
    margin-bottom: 3rem;
}

.header-main {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 2rem;
}

.scheda-cover {
    width: 140px;
    height: auto;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1);
    border-radius: 3px;
}

.header-text h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.header-text .author {
    font-size: 1.4rem;
    color: var(--gold);
    font-family: var(--font-serif);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.header-text .meta {
    font-size: 0.9rem;
    color: var(--muted);
}

.summary-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-actions a {
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-back { color: var(--muted); }
.btn-back:hover { color: var(--text); }
.btn-app { 
    background: var(--ink); 
    color: white !important; 
    padding: 0.6rem 1.2rem; 
    border-radius: 4px; 
}
.btn-app:hover { background: var(--petrol); }

/* Chapters Content */
.chapter-summary {
    margin-bottom: 3.5rem;
}

.chapter-summary h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--ink);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.chapter-summary p {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    line-height: 1.8;
    color: #333;
    text-align: justify;
}

.keyword {
    text-decoration: underline;
    text-decoration-thickness: 0.12em;
    text-underline-offset: 0.18em;
    font-weight: 600;
    color: var(--ink);
}

/* Footer */
footer, .scheda-footer {
    text-align: center;
    padding: 3rem 0;
    margin-top: 5rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

footer a, .scheda-footer a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover, .scheda-footer a:hover {
    color: var(--gold);
}

/* Responsive */
@media (max-width: 850px) {
    .library-grid { grid-template-columns: 1fr; gap: 3rem; }
    .header-main { flex-direction: column; text-align: center; align-items: center; }
    .book-summary-page { padding: 2rem; margin: 1rem; }
}

