/* --- VARIABILI DI COLORE (Gestione Temi) --- */
:root {
    --bg-color: #fffff0;
    --bg-secondary: #f5f0e8;
    --text-color: #000000;
    --text-secondary: #777777;
    --muted-text: #888888;
    --card-bg: #ffffff;
    --border-color: #f9f9f9;
    --modal-border: #111111;
    --dropdown-border: #f0f0f0;
    --dropdown-hover: #f9f9f9;
    --shadow-color: rgba(0, 0, 0, 0.06);
    --overlay-bg: rgba(0, 0, 0, 0.3);
    --switch-bg: #e4e4e4;
    --icon-filter: none;
    --red-accent: #ff0000;
    --z-dropdown: 1000;
    --z-overlay: 1010;
    --z-modal: 1020;
}

[data-theme="dark"] {
    --bg-color: #000000;
    --bg-secondary: #111111;
    --text-color: #fffff0;
    --text-secondary: #888888;
    --muted-text: #aaaaaa;
    --card-bg: #0a0a0a;
    --border-color: #111111;
    --modal-border: #ffffff;
    --dropdown-border: #222222;
    --dropdown-hover: #111111;
    --shadow-color: rgba(255, 255, 255, 0.04);
    --overlay-bg: rgba(255, 255, 255, 0.15);
    --switch-bg: #333333;
    --icon-filter: invert(1);
    --red-accent: #ff0000;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}




canvas {
    display: inline-block;
    vertical-align: middle;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.red-accent {
    color: var(--red-accent); 
}

/* --- HEADER --- */
.top-bar {
    width: 100%;
    display: flex;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.top-bar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
}

.brand-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
}

.brand-roix {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-roix-img {
    height: 2em;
    width: auto;
    display: block;
    margin-left: -4px;
}

#brandHome:hover .brand-roix {
    opacity: 1;
}



@keyframes letterReveal {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.top-bar-brand .brand-ch,
.top-bar-brand .brand-letter {
    display: inline-block;
    opacity: 0;
    animation: letterReveal 0.35s ease forwards;
}

.brand-letter {
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.top-bar-brand .brand-ch { animation-delay: 0s; }
.brand-group .brand-letter:nth-child(1) { animation-delay: 0.3s; }
.brand-group .brand-letter:nth-child(2) { animation-delay: 0.5s; }
.brand-group .brand-letter:nth-child(3) { animation-delay: 0.7s; }
.brand-group .brand-letter:nth-child(4) { animation-delay: 0.9s; }

#brandHome:hover .brand-letter {
    opacity: 0 !important;
    transform: translateY(-6px) scale(0.5);
    transition: opacity 0.25s ease, transform 0.25s ease;
    animation: none !important;
}

/* --- CONTROLLI --- */
.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: opacity 0.2s ease;
    padding: 0.25rem;
}

.control-btn:hover {
    opacity: 0.6;
}

.control-btn svg {
    width: 22px;
    height: 22px;
}

.theme-icon-light { display: none; }
.theme-icon-dark path, .theme-icon-light path { fill: var(--text-color); }
[data-theme="dark"] .theme-icon-dark { display: block; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="dark"] .brand-roix-img { filter: invert(1); }

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    background: none;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.05em;
}

.dropdown-trigger::after {
    content: "";
    border: solid var(--text-color);
    border-width: 0 1.5px 1.5px 0;
    display: inline-block;
    padding: 2.5px;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

/* ==========================================================================
   DROPDOWN
   ========================================================================== */
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--dropdown-border);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    min-width: 200px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s 0.35s;
}

.dropdown-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
}

.lang-dropdown .dropdown-menu-up,
.legal-dropdown .dropdown-menu-up {
    top: auto;
    bottom: 100%;
    transform: translateY(5px);
    left: 0;
    right: auto;
}

.lang-dropdown .dropdown-menu-up {
    min-width: 140px;
}

.legal-dropdown .dropdown-menu-up {
    min-width: 220px;
}

.lang-dropdown:hover .dropdown-menu-up,
.legal-dropdown:hover .dropdown-menu-up {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
}

.lang-dropdown:hover .dropdown-trigger-up::after {
    transform: rotate(-135deg);
}

.dropdown-menu li a, .dropdown-menu li button {
    color: var(--muted-text);
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: background-color 0.15s ease, color 0.15s ease;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-menu li button.is-active-lang {
    color: var(--text-color);
    font-weight: 600;
}

.icon-wrapper {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.icon-wrapper--lg {
    width: 22px;
    height: 22px;
}

@media (min-width: 769px) {
    .icon-wrapper > canvas,
    .icon-wrapper > img {
        position: absolute;
        top: 0;
        left: 0;
        pointer-events: none;
    }
}

.menu-canvas, .legal-btn-icon, .world-btn-icon, #mailIcon, #legalCanvas, #worldCanvas, #menuTriggerCanvas, #menuTriggerIcon {
    filter: var(--icon-filter);
    transition: filter 0.3s;
}

.menu-icon, .legal-btn-icon, .world-btn-icon, #mailIcon, #menuTriggerIcon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: var(--icon-filter);
    transition: filter 0.3s ease;
    pointer-events: none;
}

.legal-btn-icon, .world-btn-icon, #mailIcon {
    width: 22px;
    height: 22px;
}

.dropdown-menu li a:hover, .dropdown-menu li button:hover {
    background-color: var(--dropdown-hover);
    color: var(--text-color);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--dropdown-border);
    margin: 0.3rem 0.6rem;
}

/* --- CONTENT MAIN SPA --- */
.center-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 2rem;
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
    min-height: 0;
}

.content-view {
    display: none;
    text-align: center;
    width: 100%;
    min-width: 0;
    animation: fadeIn 0.4s ease forwards;
    margin: auto;
}

.content-view.is-active {
    display: block;
}

#view-legal.is-active {
    display: flex;
    flex-direction: column;
    text-align: left;
    max-height: 100%;
    overflow: hidden;
    margin: 0;
}

.site-identity {
    text-align: center;
}

.site-title {
    font-size: 3.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.35em;
    line-height: 1.1;
    color: var(--text-color); 
    margin-right: -0.35em;
    user-select: none;
}

.site-description {
    font-size: 0.95rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-color); 
    margin-top: 1rem;
    margin-right: -0.15em;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 1.5rem;
}

.section-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--muted-text);
    max-width: 600px;
    margin: 0 auto;
}

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

.section-text a:hover {
    text-decoration: underline;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- FOOTER --- */
.bottom-bar {
    width: 100%;
    display: flex;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-controls-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-element {
    color: var(--muted-text);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: color 0.15s ease-in-out;
}

.footer-element:hover {
    color: var(--text-color);
}

/* --- POPUP COOKIE --- */
.cookie-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.exit-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.exit-overlay.is-open {
    display: flex;
}

.exit-modal {
    background: var(--bg-color);
    border: 1px solid var(--modal-border);
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    transition: background-color 0.3s, border-color 0.3s;
}

.exit-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.exit-text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--muted-text);
    margin-bottom: 1.5rem;
}

.exit-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.cookie-modal {
    background: var(--bg-color);
    border: 1px solid var(--modal-border);
    width: 100%;
    max-width: 500px;
    padding: 2.2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    transition: background-color 0.3s, border-color 0.3s;
}

.cookie-title {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.cookie-text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--muted-text);
    margin-bottom: 1.5rem;
}

.cookie-options {
    border-top: 1px solid var(--dropdown-border);
    margin-bottom: 1.8rem;
}

.cookie-option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--dropdown-border);
}

.cookie-label-block {
    display: flex;
    flex-direction: column;
}

.cookie-label-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.cookie-label-desc {
    font-size: 0.78rem;
    color: var(--muted-text);
    margin-top: 0.15rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--switch-bg);
    transition: .2s;
    border-radius: 20px;
}

.slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--bg-color);
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--text-color);
}

input:disabled + .slider {
    opacity: 0.5;
}

input:checked + .slider::before {
    transform: translateX(16px);
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.cookie-btn {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.cookie-btn.btn-secondary {
    border-color: var(--muted-text);
    color: var(--muted-text);
}

.cookie-btn.btn-secondary:hover {
    border-color: var(--text-color);
    color: var(--text-color);
}

.cookie-btn.btn-primary {
    background: var(--text-color);
    color: var(--bg-color);
}

.cookie-btn.btn-primary:hover {
    opacity: 0.8;
}

.cookie-version {
    margin-top: 1.5rem;
    font-size: 0.65rem;
    color: var(--muted-text);
    text-align: center;
    opacity: 0.5;
    user-select: none;
}

/* --- LEGAL CONTENT --- */
.legal-content {
    overflow-y: auto;
    flex-grow: 1;
    max-width: 793px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    color: var(--text-color);
    width: 100%;
    font-size: 0.95rem;
    line-height: 1.7;
}

.legal-content h1 {
    font-size: 1.7rem;
    font-weight: 700;
    margin: 0 0 1rem;
    line-height: 1.3;
}

.legal-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 1.4rem 0 0.6rem;
}

.legal-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 1.5rem 0 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.legal-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.2rem 0 0.5rem;
}

.legal-content p {
    margin-bottom: 0.8rem;
}

.legal-content ul, .legal-content ol {
    padding-left: 1.5rem;
    margin-bottom: 0.8rem;
}

.legal-content li {
    list-style: disc;
    margin-bottom: 0.3rem;
}

.legal-content a {
    color: var(--text-color);
    text-decoration: underline;
}

.legal-content a:hover {
    opacity: 0.7;
}

.legal-content strong, .legal-content b {
    font-weight: 700;
}


/* --- UTILITY --- */
.is-hidden {
    display: none;
}

@media (max-width: 768px) {
    .top-bar { padding: 1.5rem; }
    .bottom-bar { padding: 1.5rem; flex-direction: column; gap: 1.5rem; justify-content: center; }
    .footer-controls-left { justify-content: center; }
    .site-title { font-size: 2.4rem; }
}
/* Layout mobile (schermi sotto 768px) */
@media only screen and (max-width: 768px) {
    .top-bar-brand .brand-ch,
    .top-bar-brand .brand-letter {
        opacity: 1;
        animation: none;
    }
    .control-btn {
        -webkit-appearance: none;
        appearance: none;
        min-width: 22px;
        min-height: 22px;
    }
    .icon-wrapper > canvas {
        display: none !important;
    }
    .icon-wrapper > img {
        position: static;
        display: block !important;
        width: 22px;
        height: 22px;
        object-fit: contain;
        filter: var(--icon-filter);
    }
    body {
        min-height: 100dvh;
    }
}

/* ==========================================================================
   SOCIAL POST CARDS (a&o)
   ========================================================================== */

.social-post-page {
    max-width: 680px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feed-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
}

.top-bar-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.nav-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.nav-back:hover {
    color: var(--text-color);
    background: var(--bg-secondary);
}

.social-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--red-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

.author-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.author-name {
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
}

.author-name:hover {
    text-decoration: underline;
}

.author-handle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.post-body {
    padding: 0.75rem 1rem 0.5rem;
}

.post-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    line-height: 1.3;
    color: var(--text-color);
}

.post-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
    font-style: italic;
}

.post-description {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 0.75rem;
    color: var(--text-color);
}

.post-manufatto {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.8rem;
}

.badge-manufatto {
    display: inline-block;
    padding: 0.15em 0.5em;
    background: var(--red-accent);
    color: #fff;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    font-size: 0.8rem;
    color: var(--red-accent);
    text-decoration: none;
    opacity: 0.85;
}

.tag:hover {
    opacity: 1;
    text-decoration: underline;
}

.post-engagement {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

.eng-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.eng-btn:hover {
    color: var(--red-accent);
    background: var(--bg-secondary);
}

.eng-like:hover {
    color: #e74c3c;
}

.author-profile-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--red-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 auto 0.75rem;
    line-height: 1;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
}

.profile-handle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-bio {
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0.5rem 0;
    color: var(--text-color);
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-stats strong {
    color: var(--text-color);
}

.social-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}
