/* ============================================
   Components
   I Pericoli dell'Intelligenza Artificiale
   ============================================ */

/* === Reading Progress Bar === */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: var(--z-top);
}

.reading-progress__bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
    transition: width 100ms linear;
    box-shadow: 0 0 10px var(--color-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER — Museum Navigation Band (Stile pericoli.html)
   Layout: [Menu][Atrio] — Brand Centrato — [Font][Tema][Lingua]
   ═══════════════════════════════════════════════════════════════════════════ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 2rem;
    height: 64px;

    background: linear-gradient(180deg,
            rgba(8, 8, 8, 0.96) 0%,
            rgba(5, 5, 5, 0.92) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    border-bottom: 1px solid rgba(197, 160, 89, 0.12);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.02) inset,
        0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   LEFT SECTION — Menu + Atrio Navigation
   ═══════════════════════════════════════════════════════════ */
.header__nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Menu Button */
.header__menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 4px;
    background: rgba(197, 160, 89, 0.04);
    border: 1px solid rgba(197, 160, 89, 0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.header__menu-btn:hover {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.4);
}

.header__menu-icon {
    position: relative;
    width: 16px;
    height: 2px;
    background: rgba(197, 160, 89, 0.8);
    border-radius: 1px;
    transition: background 0.2s;
}

.header__menu-icon::before,
.header__menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(197, 160, 89, 0.8);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.header__menu-icon::before {
    top: -5px;
}

.header__menu-icon::after {
    bottom: -5px;
}

.header__menu-btn:hover .header__menu-icon,
.header__menu-btn:hover .header__menu-icon::before,
.header__menu-btn:hover .header__menu-icon::after {
    background: #C5A059;
}

/* Atrio Link — Styled like pericoli.html */
.header__atrio {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(245, 245, 245, 0.8);
    text-decoration: none;

    display: flex;
    align-items: center;
    gap: 0.5rem;

    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid rgba(197, 160, 89, 0.2);
    background: rgba(197, 160, 89, 0.04);

    transition: all 0.3s ease;
}

.header__atrio::before {
    content: '←';
    font-size: 0.85rem;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.header__atrio:hover {
    color: #C5A059;
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.4);
}

.header__atrio:hover::before {
    opacity: 1;
    transform: translateX(-3px);
}

.header__atrio svg {
    display: none;
    /* Hide SVG, using ::before arrow instead */
}

/* ═══════════════════════════════════════════════════════════
   CENTER SECTION — Museum Brand (Absolute Positioned)
   Editorial luxury aesthetic · Archival institution presence
   Layout: [◆ M.V.S.] — Museo delle Voci Sintetiche
   ═══════════════════════════════════════════════════════════ */
.header__brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);

    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* ─── M.V.S. Logo Section ─── */
.header__logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-right: 1.25rem;
    border-right: 1px solid rgba(197, 160, 89, 0.25);
}

/* Diamond icon - frame with inner solid diamond */
.header__logo-diamond {
    position: relative;
    width: 14px;
    height: 14px;
    background: transparent;
    border: 1.5px solid #C5A059;
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(197, 160, 89, 0.3);
    transition: all 0.4s ease;
}

.header__logo-diamond::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #C5A059 0%, #D4B56A 50%, #C5A059 100%);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(197, 160, 89, 0.5);
    transition: all 0.4s ease;
}

.header__brand:hover .header__logo-diamond {
    border-color: #D4B56A;
    box-shadow: 0 0 12px rgba(197, 160, 89, 0.5);
}

.header__brand:hover .header__logo-diamond::before {
    background: linear-gradient(135deg, #D4B56A 0%, #E5C97A 50%, #D4B56A 100%);
    box-shadow: 0 0 10px rgba(197, 160, 89, 0.7);
}

/* M.V.S. text */
.header__logo-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    color: #C5A059;
    text-shadow: 0 0 20px rgba(197, 160, 89, 0.3);
    transition: all 0.4s ease;
}

.header__brand:hover .header__logo-text {
    color: #D4B56A;
    text-shadow: 0 0 25px rgba(197, 160, 89, 0.5);
}

/* ─── Main Brand Text ─── */
.header__brand-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.1em;
    color: #D4B56A;
    white-space: nowrap;
    text-shadow:
        0 0 35px rgba(197, 160, 89, 0.4),
        0 0 60px rgba(197, 160, 89, 0.2),
        0 1px 2px rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease;
    position: relative;
}

.header__brand:hover .header__brand-text {
    color: #E5C97A;
    text-shadow:
        0 0 45px rgba(197, 160, 89, 0.5),
        0 0 80px rgba(197, 160, 89, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   RIGHT SECTION — Controls
   ═══════════════════════════════════════════════════════════ */
.header__controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {
    .header {
        padding: 0 1.5rem;
    }

    .header__logo {
        display: none;
    }

    .header__brand-text {
        font-size: 1rem;
        letter-spacing: 0.08em;
    }
}

/* Mobile Large */
@media (max-width: 768px) {
    .header {
        padding: 0 1.25rem;
        height: 58px;
    }

    .header__brand {
        display: none;
    }

    .header__atrio {
        font-size: 0.65rem;
    }
}

/* Mobile Small */
@media (max-width: 480px) {
    .header {
        padding: 0 1rem;
    }

    .header__atrio span {
        display: none;
    }

    .header__atrio {
        padding: 0.4rem 0.6rem;
    }

    .header__menu-btn {
        width: 34px;
        height: 34px;
    }
}

/* === Language Switcher === */
.header__lang {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 4px;
    background: rgba(197, 160, 89, 0.06);
    border: 1px solid rgba(197, 160, 89, 0.15);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.header__lang:hover {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.25);
}

.header__lang-btn {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: rgba(245, 245, 245, 0.5);
    background: transparent;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.header__lang-btn:hover:not(.active) {
    color: rgba(245, 245, 245, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.header__lang-btn.active {
    color: #0a0a0a;
    background: linear-gradient(135deg, #C5A059 0%, #D4B56A 100%);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(197, 160, 89, 0.3);
}

/* Responsive language switcher */
@media (max-width: 480px) {
    .header__lang-btn {
        font-size: 0.65rem;
        padding: 0.35rem 0.5rem;
    }
}

/* === Font Controls === */
.font-controls {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.font-controls__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out);
}

.font-controls__btn:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

.font-controls__btn span {
    font-weight: var(--weight-medium);
}

.font-controls__btn sup {
    font-size: 0.7em;
    margin-left: 1px;
}

/* === Theme Toggle === */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: all var(--duration-normal) var(--ease-out);
}

.theme-toggle:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.theme-toggle:hover .theme-toggle__icon {
    stroke: var(--color-white);
}

.theme-toggle__icon {
    stroke: var(--text-secondary);
    transition: stroke var(--duration-fast);
}

.theme-toggle__icon--moon {
    display: block;
}

.theme-toggle__icon--sun {
    display: none;
}

[data-theme="light"] .theme-toggle__icon--moon {
    display: none;
}

[data-theme="light"] .theme-toggle__icon--sun {
    display: block;
}

/* === Navigation Sidebar === */
.nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    transition: transform var(--duration-slow) var(--ease-out);
    z-index: var(--z-modal);
    overflow-y: auto;
}

.nav-sidebar.is-open {
    transform: translateX(0);
}

.nav-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-sidebar__label {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--text-muted);
}

.nav-sidebar__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-sidebar__close:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

.nav-sidebar__content {
    padding: var(--space-6);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section__title {
    display: block;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--color-accent);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-link {
    display: block;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-2) 0;
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
    color: var(--color-accent);
    padding-left: var(--space-2);
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-out);
    z-index: var(--z-overlay);
}

.nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* === Section Headers === */
.section__header {
    text-align: center;
    margin-bottom: var(--space-16);
}

.section__label {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--color-accent);
    margin-bottom: var(--space-4);
}

.section__title {
    font-size: var(--text-3xl);
    color: var(--text-primary);
}

.section__cta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-accent);
    padding: var(--space-4) var(--space-8);
    margin-top: var(--space-12);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-full);
    transition: all var(--duration-normal) var(--ease-out);
}

.section__cta:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

.section__cta svg {
    transition: transform var(--duration-normal) var(--ease-out);
}

.section__cta:hover svg {
    transform: translateX(4px);
}

/* === Table of Contents === */
.toc {
    display: grid;
    gap: var(--space-8);
}

.toc__part {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.toc__part:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-lg);
}

.toc__part-header {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-6);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
}

.toc__part-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-accent);
    background: var(--bg-primary);
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-md);
}

.toc__part-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toc__part-desc {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 0;
}

.toc__chapters {
    padding: var(--space-4) var(--space-6);
}

.toc__chapter {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    margin: 0 calc(-1 * var(--space-4));
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out);
}

.toc__chapter:hover {
    background: var(--bg-tertiary);
    color: var(--color-accent);
}

.toc__chapter-num {
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--text-muted);
    min-width: 28px;
}

.toc__chapter:hover .toc__chapter-num {
    color: var(--color-accent);
}

.toc__chapter-title {
    font-family: var(--font-body);
    font-size: var(--text-base);
}

/* === Footer — Museum Style Expandable ===
   Elegant expandable footer with 5-column layout
   ============================================== */

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
}

.site-footer__bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 0.75rem 2rem;
    background: rgba(10, 10, 10, 0.85);
    border-top: 1px solid rgba(197, 160, 89, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.site-footer__bar:hover {
    background: rgba(10, 10, 10, 0.95);
    border-top-color: rgba(197, 160, 89, 0.4);
}

.site-footer__copyright {
    font-size: 0.75rem;
    color: rgba(245, 245, 245, 0.7);
    letter-spacing: 0.05em;
}

.site-footer__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--color-accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-footer__toggle svg {
    transition: transform 0.3s ease;
}

.site-footer.expanded .site-footer__toggle svg {
    transform: rotate(180deg);
}

.site-footer__expanded {
    max-height: 0;
    overflow: hidden;
    background: rgba(10, 10, 10, 0.95);
    transition: max-height 0.4s ease;
}

.site-footer.expanded .site-footer__expanded {
    max-height: 300px;
}

.site-footer__content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr 0.9fr 0.9fr;
    gap: 2rem;
    padding: 2rem 4rem;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
}

/* Brand & Legal section */
.site-footer__brand {
    padding-right: 2rem;
    border-right: 1px solid rgba(197, 160, 89, 0.08);
}

.site-footer__brand-mark {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.site-footer__symbol {
    font-size: 1.5rem;
    color: var(--color-accent);
    opacity: 0.8;
}

.site-footer__title {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.85);
}

.site-footer__legal {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-style: italic;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

/* Navigation columns */
.site-footer__column h4 {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 1rem;
}

.site-footer__column a {
    display: block;
    color: rgba(245, 245, 245, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.3rem 0;
    transition: color 0.2s ease;
}

.site-footer__column a:hover {
    color: var(--color-accent);
}

/* Archivi section */
.site-footer__archivi a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.site-footer__archivi svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
    flex-shrink: 0;
}

.site-footer__archivi a:hover svg {
    opacity: 1;
}

.site-footer__archivi-locked {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.site-footer__archivi-locked:hover {
    color: inherit !important;
}

.site-footer__lock-icon {
    width: 10px;
    height: 10px;
    margin-left: 0.3rem;
    opacity: 0.7;
}

@media (max-width: 1100px) {
    .site-footer__content {
        grid-template-columns: 1.5fr repeat(4, 1fr);
        gap: 1.5rem;
        padding: 2rem 2.5rem;
    }
}

@media (max-width: 900px) {
    .site-footer__content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem 1.5rem;
        padding: 1.5rem 2rem;
    }

    .site-footer__brand {
        grid-column: 1 / -1;
        padding-right: 0;
        border-right: none;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid rgba(197, 160, 89, 0.08);
    }
}

@media (max-width: 600px) {
    .site-footer__content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .site-footer__column {
        padding-bottom: 1rem;
        border-bottom: 1px solid rgba(197, 160, 89, 0.05);
    }

    .site-footer__column:last-child {
        border-bottom: none;
    }

    .site-footer__bar {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Colophon & Legal Links */
.colophon {
    padding: 4rem 2rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
}

.colophon__text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-style: italic;
    color: #A0A0A0;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.colophon__signature {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #C5A059;
}

.site-footer__legal-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1.5rem;
}

.site-footer__legal-links a {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer__legal-links a:hover {
    color: #C5A059;
}

.site-footer__separator {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.2);
}

.site-footer__copyright {
    font-size: 0.65rem !important;
    opacity: 0.6;
}