/* Tema enciclopedico originale, Vector-inspired */

:root {
    --bg: #f8f9fa;
    --surface: #fff;
    --text: #202122;
    --muted: #54595d;
    --border: #a2a9b1;
    --border-light: #c8ccd1;
    --blue: #36c;
    --blue-dark: #2a4b8d;
    --panel: #f8f9fa;
    --max-content: 1040px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Lato, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

body.font-small { font-size: 14px; }
body.font-large { font-size: 18px; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
button, input { font: inherit; }
img { max-width: 100%; }
cite { font-style: italic; }

.clear {
    clear: both;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(320px, 520px) minmax(220px, 1fr);
    align-items: center;
    gap: 24px;
    min-height: 64px;
    padding: 8px 24px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255,255,255,.98);
}

.header-left { display: flex; align-items: center; gap: 12px; }

.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
}

.icon-button:hover { border-color: var(--border-light); background: var(--panel); }

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.site-brand:hover { text-decoration: none; }

.site-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    font: 700 28px/1 Georgia, "Times New Roman", serif;
}

.site-brand span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.site-brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 18px; }
.site-brand small { color: var(--muted); font-size: 12px; }

.site-search { display: flex; width: 100%; }
.site-search input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-right: 0; }
.site-search button { padding: 9px 16px; border: 1px solid var(--border); background: var(--panel); font-weight: 600; cursor: pointer; }

.header-tools { display: flex; justify-content: flex-end; gap: 16px; font-size: 14px; }

.site-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 210px;
    max-width: 1600px;
    margin: 0 auto;
}

.left-rail, .right-rail { padding: 28px 18px; }
.left-rail { border-right: 1px solid var(--border-light); }
.right-rail { border-left: 1px solid var(--border-light); }
.sticky-panel { position: sticky; top: 92px; }

.sticky-panel h2 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.left-rail nav { display: flex; flex-direction: column; gap: 4px; }
.left-rail nav a { padding: 5px 7px; border-radius: 2px; font-size: 14px; }
.left-rail nav a:hover { background: #eaecf0; text-decoration: none; }

.article-shell {
    min-width: 0;
    padding: 28px 40px 72px;
    background: var(--surface);
}

.article-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.namespace { margin: 0 0 2px; color: var(--muted); font-size: 13px; }

.article-toolbar h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 400;
    line-height: 1.1;
}

.article-actions { display: flex; gap: 8px; }
.article-actions a, .article-actions button { padding: 7px 10px; border: 0; background: transparent; color: var(--blue); cursor: pointer; }
.article-actions .active { color: var(--text); font-weight: 600; }

.article-tabs {
    display: flex;
    gap: 20px;
    margin-top: 18px;
    border-bottom: 1px solid var(--border);
}

.article-tabs a { padding: 9px 0 8px; color: var(--text); font-size: 14px; }
.article-tabs a.active { border-bottom: 2px solid var(--text); font-weight: 600; }

.article-content { max-width: var(--max-content); margin: 0 auto; padding-top: 24px; }

.wiki-section { clear: both; margin-top: 42px; }

.wiki-section > h2 {
    margin: 0 0 16px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.8rem;
    font-weight: 400;
}

.article-subtitle {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 400;
}

.profession-line { margin: 6px 0 18px; color: var(--muted); font-style: italic; }

.infobox {
    float: right;
    width: 310px;
    margin: 0 0 24px 28px;
    border: 1px solid var(--border);
    background: var(--panel);
    font-size: 14px;
}

.infobox img { display: block; width: calc(100% - 18px); margin: 9px auto 0; border: 1px solid var(--border-light); }
.infobox-caption { padding: 8px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td { padding: 7px 9px; border-top: 1px solid var(--border-light); vertical-align: top; }
.infobox th { background: #eaecf0; text-align: center; }
.infobox td:first-child { width: 34%; font-weight: 600; }

.toc-box {
    display: inline-block;
    min-width: 280px;
    margin: 24px 0 4px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.toc-box h2 { margin: 0 0 10px; font-size: 15px; text-align: center; }
.toc-box ol { margin: 0; padding-left: 22px; }

.bio-section { margin-bottom: 28px; }

.bio-section h3,
.encyclopedic-group h3 {
    margin: 22px 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    font-weight: 400;
}

.encyclopedic-group h4 {
    margin: 16px 0 6px;
    font-size: 1rem;
}

.bio-copy p { margin: 0 0 1em; }

.bio-figure {
    width: min(300px, 42%);
    margin-top: 4px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    background: var(--panel);
    font-size: 12px;
    line-height: 1.35;
}

.bio-figure-left { float: left; margin-right: 22px; }
.bio-figure-right { float: right; margin-left: 22px; }
.bio-figure img { display: block; width: 100%; border-bottom: 1px solid var(--border-light); }
.bio-figure figcaption { padding: 8px 10px; color: var(--muted); }
.clear { clear: both; }

.compact-tools {
    display: flex;
    gap: 8px;
    max-width: 620px;
    margin: 18px 0 8px;
}

.compact-tools input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
}

.compact-tools button {
    padding: 8px 13px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
}

.results-count { color: var(--muted); font-size: 14px; }

.encyclopedic-group {
    margin: 26px 0 30px;
}

.wiki-list {
    margin: 8px 0 16px;
    padding-left: 28px;
}

.wiki-list li {
    margin: 4px 0;
}

.production-list li,
.publication-list li {
    padding-left: 2px;
}

.list-year {
    font-weight: 600;
}

.publication-group + .publication-group {
    margin-top: 34px;
}

/* INTRODUZIONE DELLA VOCE */

.article-introduction {
    margin-top: 12px;
}

.article-introduction p {
    margin: 0 0 1em;
}

.article-lead {
    font-size: 1em;
}

.article-introduction sup {
    margin-left: 1px;
    color: var(--blue);
    font-size: 0.75em;
    line-height: 0;
    vertical-align: super;
}

.article-introduction sup:hover {
    text-decoration: underline;
    cursor: pointer;
}

.article-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    background: var(--panel);
    font-size: 14px;
}

.wikilink {
    color: var(--blue);
    text-decoration: none;
}

.wikilink:hover {
    text-decoration: underline;
}

.wikilink:visited {
    color: #795cb2;
}

/* MODULO CONDIVISIONE */

.share-panel {
    font-size: 14px;
}

.share-description {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.4;
}

.share-buttons {
    display: grid;
    gap: 8px;
}

.share-button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 2px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.share-button:hover {
    border-color: var(--border);
    background: #eaecf0;
    color: var(--text);
    text-decoration: none;
}

.share-button span {
    display: inline-grid;
    place-items: center;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    font-weight: 700;
}

.share-status {
    min-height: 20px;
    margin: 12px 0 0;
    color: #14866d;
    font-size: 12px;
}

.site-footer {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 40px 36px 270px;
    border-top: 1px solid var(--border-light);
    color: var(--muted);
    font-size: 13px;
}

.loading-message,
.empty-message {
    padding: 14px;
    border: 1px solid var(--border-light);
    background: var(--panel);
    color: var(--muted);
}

.database-error {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid #b32424;
    background: #fee7e6;
}

.search-highlight { animation: highlight 1.7s ease; }

@keyframes highlight {
    0%, 100% { background: inherit; }
    35% { background: #fff3cd; }
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 1200px) {
    .site-layout { grid-template-columns: 220px minmax(0, 1fr); }
    .right-rail { display: none; }
}

@media (max-width: 900px) {
    .site-header { grid-template-columns: auto 1fr; }
    .site-search { grid-column: 1 / -1; }
    .header-tools { display: none; }
    .site-layout { display: block; }

    .left-rail {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1200;
        width: 270px;
        height: 100vh;
        padding-top: 82px;
        background: var(--bg);
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 4px 0 18px rgba(0,0,0,.18);
    }

    .left-rail.is-open { transform: translateX(0); }
    .article-shell { padding: 24px; }
    .site-footer { padding: 20px 24px 30px; }
}

@media (max-width: 720px) {
    .site-header { padding: 8px 12px; }
    .site-brand small { display: none; }
    .article-actions { display: none; }

    .infobox {
        float: none;
        width: 100%;
        margin: 22px 0;
    }

    .toc-box { width: 100%; }

    .bio-figure,
    .bio-figure-left,
    .bio-figure-right {
        float: none;
        width: 100%;
        max-width: 420px;
        margin: 14px auto 18px;
    }

    .compact-tools { display: grid; }
}

@media print {
    .site-header,
    .left-rail,
    .right-rail,
    .compact-tools,
    .article-actions,
    .article-tabs {
        display: none !important;
    }

    .site-layout { display: block; }
    .article-shell { padding: 0; }
}
