/*
 * 4D Vision Design System - Pubblico
 * Landing, showcase e chrome del viewer.
 * Caricare dopo i CSS base del viewer/showcase e PRIMA dei CSS custom del tour.
 */

body#body,
body.viewer-public,
body.svt-public,
.landing-public,
.site-public {
    color: var(--4d-text);
    background-color: var(--4d-bg);
    font-family: var(--4d-font-family);
}

body#body {
    background-image: radial-gradient(circle at 50% 0%, rgba(6, 107, 251, 0.13), transparent 42%), linear-gradient(180deg, #070B14 0%, #0A101E 100%);
}

.landing-public,
.site-public {
    min-height: 100vh;
    background-image: var(--4d-gradient-hero);
}

.public-skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: var(--4d-z-toast);
    padding: 0.65rem 0.9rem;
    color: var(--4d-bg-deep);
    background: var(--4d-cyan);
    border-radius: var(--4d-radius);
    font-weight: var(--4d-font-weight-semibold);
    transform: translateY(-160%);
    transition: transform var(--4d-duration-fast) var(--4d-ease);
}

.public-skip-link:focus {
    color: var(--4d-bg-deep);
    transform: translateY(0);
}

.public-header {
    position: sticky;
    top: 0;
    z-index: var(--4d-z-sticky);
    padding: 0.85rem 0;
    background: rgba(7, 11, 20, 0.82);
    border-bottom: 1px solid var(--4d-border);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.public-nav,
.public-header__inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--4d-space-3);
    align-items: center;
    justify-content: space-between;
}

.public-brand {
    display: inline-flex;
    gap: 0.7rem;
    align-items: center;
    color: var(--4d-text);
    font-weight: var(--4d-font-weight-semibold);
    letter-spacing: 0.03em;
}

.public-brand:hover,
.public-brand:focus {
    color: var(--4d-text);
}

.public-brand img {
    width: auto;
    height: 2rem;
}

.public-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.public-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.45rem 0.7rem;
    color: var(--4d-text-muted);
    border: 1px solid transparent;
    border-radius: var(--4d-radius);
    font-size: var(--4d-font-size-sm);
    font-weight: var(--4d-font-weight-medium);
}

.public-menu a:hover,
.public-menu a:focus,
.public-menu a[aria-current="page"] {
    color: var(--4d-text);
    background: var(--4d-surface-interactive);
    border-color: var(--4d-border);
    text-decoration: none;
}

.public-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
    overflow: hidden;
    padding-top: clamp(3.5rem, 8vw, 7rem);
    padding-bottom: clamp(3.5rem, 8vw, 7rem);
}

.public-hero::before {
    position: absolute;
    top: -18%;
    right: -10%;
    width: min(40rem, 65vw);
    aspect-ratio: 1;
    content: "";
    background: conic-gradient(from 160deg, rgba(6, 107, 251, 0.18), rgba(21, 223, 239, 0.08), rgba(70, 48, 143, 0.22), rgba(6, 107, 251, 0.18));
    border-radius: 50%;
    filter: blur(54px);
    pointer-events: none;
}

.public-hero__content,
.public-hero__panel {
    position: relative;
    z-index: 1;
}

.public-hero h1 {
    max-width: 14ch;
    margin-bottom: var(--4d-space-5);
    font-size: var(--4d-font-size-display);
    font-weight: var(--4d-font-weight-semibold);
    line-height: 1.02;
}

.public-hero__lead {
    max-width: 62ch;
    color: var(--4d-text-muted);
    font-size: clamp(1rem, 1.4vw, 1.2rem);
}

.public-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--4d-space-3);
    margin-top: var(--4d-space-5);
}

.public-hero__panel {
    padding: clamp(1.25rem, 2.5vw, 2rem);
}

.public-section {
    position: relative;
    padding-top: clamp(2.5rem, 6vw, 5rem);
    padding-bottom: clamp(2.5rem, 6vw, 5rem);
}

.public-section__header {
    max-width: 66ch;
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.public-section__header h2 {
    margin-bottom: var(--4d-space-3);
}

.public-section__header p {
    color: var(--4d-text-muted);
}

.public-card {
    padding: clamp(1.1rem, 2.2vw, 1.5rem);
    background: linear-gradient(145deg, rgba(23, 33, 45, 0.88), rgba(10, 16, 30, 0.82));
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-lg);
    box-shadow: var(--4d-shadow-sm);
}

.public-card--interactive {
    transition: transform var(--4d-duration) var(--4d-ease), border-color var(--4d-duration) var(--4d-ease), box-shadow var(--4d-duration) var(--4d-ease);
}

.public-card--interactive:hover,
.public-card--interactive:focus-within {
    border-color: var(--4d-border-glow);
    box-shadow: var(--4d-shadow-glow);
    transform: translateY(-3px);
}

.public-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: var(--4d-space-4);
    color: var(--4d-cyan);
    background: rgba(6, 107, 251, 0.14);
    border: 1px solid var(--4d-border-glow);
    border-radius: var(--4d-radius);
}

.public-card h3 {
    margin-bottom: var(--4d-space-2);
    font-size: var(--4d-font-size-xl);
}

.public-card p:last-child {
    margin-bottom: 0;
    color: var(--4d-text-muted);
}

.public-stat {
    padding: var(--4d-space-4) var(--4d-space-5);
    background: rgba(18, 26, 39, 0.74);
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-md);
}

.public-stat__value {
    display: block;
    color: var(--4d-text);
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    font-weight: var(--4d-font-weight-semibold);
    line-height: 1.1;
}

.public-stat__label {
    display: block;
    margin-top: 0.35rem;
    color: var(--4d-text-muted);
    font-size: var(--4d-font-size-sm);
}

.public-cta {
    position: relative;
    overflow: hidden;
    padding: clamp(1.75rem, 4vw, 3rem);
    border: 1px solid var(--4d-border-glow);
    border-radius: var(--4d-radius-lg);
    background: linear-gradient(135deg, rgba(42, 27, 94, 0.72) 0%, rgba(10, 16, 30, 0.9) 54%, rgba(6, 107, 251, 0.22) 100%);
    box-shadow: var(--4d-shadow);
}

.public-cta::after {
    position: absolute;
    right: -10%;
    bottom: -70%;
    width: 34rem;
    height: 34rem;
    content: "";
    background: radial-gradient(circle, rgba(21, 223, 239, 0.16), transparent 64%);
    pointer-events: none;
}

.public-cta > * {
    position: relative;
    z-index: 1;
}

.public-footer {
    padding-top: var(--4d-space-5);
    padding-bottom: var(--4d-space-5);
    color: var(--4d-text-muted);
    background: rgba(7, 11, 20, 0.72);
    border-top: 1px solid var(--4d-border);
}

.public-footer a {
    color: var(--4d-text-muted);
}

.public-footer a:hover,
.public-footer a:focus {
    color: var(--4d-cyan);
}

.public-empty-state,
.public-error,
.public-loading {
    display: flex;
    flex-direction: column;
    gap: var(--4d-space-3);
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    padding: var(--4d-space-5);
    color: var(--4d-text-muted);
    text-align: center;
    background: rgba(18, 26, 39, 0.72);
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-lg);
}

.public-error {
    color: #FFDCE1;
    background: rgba(143, 24, 48, 0.2);
    border-color: rgba(255, 91, 110, 0.44);
}

.public-error__title {
    color: #FFFFFF;
    font-size: var(--4d-font-size-lg);
    font-weight: var(--4d-font-weight-semibold);
}

.public-spinner {
    width: 2.4rem;
    height: 2.4rem;
    border: 2px solid rgba(21, 223, 239, 0.18);
    border-top-color: var(--4d-cyan);
    border-right-color: rgba(6, 107, 251, 0.8);
    border-radius: 50%;
    animation: public-spin 0.9s linear infinite;
}

@keyframes public-spin {
    to { transform: rotate(360deg); }
}

/* Landing con markup storico Bootstrap: superfici leggibili */
.landing-public .jumbotron {
    color: var(--4d-text);
    background: var(--4d-gradient-surface);
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-lg);
}

.landing-public .card,
.landing-public .list-group-item,
.landing-public .modal-content,
.landing-public .dropdown-menu {
    color: var(--4d-text);
    background-color: var(--4d-surface);
    border-color: var(--4d-border);
}

.landing-public .list-group-item:hover,
.landing-public .list-group-item:focus {
    background-color: var(--4d-surface-interactive);
}

.landing-public .card-header,
.landing-public .card-footer {
    color: var(--4d-text);
    background-color: rgba(7, 11, 20, 0.22);
    border-color: var(--4d-border);
}

.landing-public .list-group {
    color: var(--4d-text);
    background: transparent;
    border-radius: var(--4d-radius-md);
}

.landing-public .list-group-item-action:hover,
.landing-public .list-group-item-action:focus {
    color: var(--4d-text);
    background-color: var(--4d-surface-interactive);
    border-color: var(--4d-border-glow);
}

.site-public .card,
.site-public .list-group-item,
.site-public .modal-content,
.site-public .dropdown-menu {
    color: var(--4d-text);
    background-color: var(--4d-surface);
    border-color: var(--4d-border);
}

/* Showcase: usa la palette del tour, senza nascondere loghi configurati */
.showcase {
    color: var(--4d-text);
    background-color: var(--4d-bg);
    background-image: radial-gradient(circle at 50% 0%, rgba(6, 107, 251, 0.12), transparent 36%);
}

.showcase .header {
    color: var(--4d-text);
    background-color: var(--4d-bg-deep);
}

.showcase .header:after {
    background: linear-gradient(to bottom, rgba(7, 11, 20, 0.1) 12%, rgba(7, 11, 20, 0.92) 100%);
}

.showcase .info h1 {
    color: #FFFFFF;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.56), 0 0 34px rgba(21, 223, 239, 0.14);
}

.showcase .logo img {
    max-width: min(260px, 60vw);
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.32));
}

.showcase .categories button {
    min-height: 2.5rem;
    padding: 0.45rem 0.85rem;
    color: var(--4d-text) !important;
    background: var(--4d-surface-raised) !important;
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-pill);
}

.showcase .categories button:hover,
.showcase .categories button:focus,
.showcase .categories button.active {
    color: #FFFFFF !important;
    background: var(--4d-surface-interactive) !important;
    border-color: var(--4d-border-glow);
}

.showcase .vt-card {
    color: var(--4d-text);
    background: var(--4d-gradient-surface);
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-lg);
    box-shadow: var(--4d-shadow-sm);
    transition: transform var(--4d-duration) var(--4d-ease), border-color var(--4d-duration) var(--4d-ease), box-shadow var(--4d-duration) var(--4d-ease);
}

.showcase .vt-card:hover,
.showcase .vt-card:focus-within {
    border-color: var(--4d-border-glow);
    box-shadow: var(--4d-shadow-glow);
    transform: translateY(-3px);
}

.showcase .vt-card .card-title,
.showcase .vt-card h1,
.showcase .vt-card h2,
.showcase .vt-card h3 {
    color: var(--4d-text);
}

.showcase .vt-card .card-text,
.showcase .vt-card p {
    color: var(--4d-text-muted);
}

.showcase .custom_footer {
    color: var(--4d-text-muted);
    background: rgba(7, 11, 20, 0.92);
    border-top: 1px solid var(--4d-border);
}

.showcase .frame_banner {
    color: var(--4d-text);
    background: var(--4d-bg-deep);
    border-bottom: 1px solid var(--4d-border);
}

.showcase .frame_banner:after {
    background: linear-gradient(90deg, rgba(7, 11, 20, 0.9), rgba(18, 26, 39, 0.74), rgba(7, 11, 20, 0.9));
}

.showcase .vt_viewer {
    background-color: var(--4d-bg-deep);
}

.showcase .loading_icon {
    color: var(--4d-cyan);
    filter: drop-shadow(0 0 12px rgba(21, 223, 239, 0.36));
}

/* Chrome del viewer: i CSS custom del tour restano autoritativi */
body#body .controls_btn {
    color: var(--4d-text);
    background-color: rgba(10, 16, 30, 0.78);
    border: 1px solid rgba(21, 223, 239, 0.24);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: color var(--4d-duration-fast) var(--4d-ease), background-color var(--4d-duration-fast) var(--4d-ease), border-color var(--4d-duration-fast) var(--4d-ease), transform var(--4d-duration-fast) var(--4d-ease);
}

body#body .controls_btn:hover,
body#body .controls_btn:focus,
body#body .controls_btn.active {
    color: var(--4d-bg-deep);
    background-color: var(--4d-cyan);
    border-color: var(--4d-cyan);
    box-shadow: 0 0 0 3px rgba(21, 223, 239, 0.18), 0 8px 22px rgba(0, 0, 0, 0.24);
}

body#body .controls_btn:focus-visible,
body#body .p_control:focus-visible,
body#body .nav_control i:focus-visible,
body#body .arrows_nav i:focus-visible,
body#body .menu_controls p:focus-visible {
    outline: 2px solid var(--4d-cyan);
    outline-offset: 2px;
}

body#body .p_control {
    color: var(--4d-text);
    background-color: rgba(10, 16, 30, 0.78);
    border: 1px solid rgba(21, 223, 239, 0.24);
    border-radius: 50%;
    box-shadow: var(--4d-shadow-sm);
}

body#body .p_control:hover,
body#body .p_control:focus {
    color: var(--4d-bg-deep);
    background-color: var(--4d-cyan);
}

body#body .nav_control {
    background-color: rgba(7, 11, 20, 0.58);
    border: 1px solid rgba(21, 223, 239, 0.2);
    box-shadow: var(--4d-shadow-sm);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

body#body .nav_control i {
    color: rgba(245, 248, 252, 0.78);
}

body#body .nav_control i:hover {
    color: var(--4d-cyan);
}

body#body .arrows_nav .prev_arrow,
body#body .arrows_nav .next_arrow,
body#body .list_slider #list_left,
body#body .list_slider #list_right {
    color: var(--4d-text);
    background-color: rgba(10, 16, 30, 0.76);
    border: 1px solid rgba(21, 223, 239, 0.22);
    box-shadow: var(--4d-shadow-sm);
}

body#body .arrows_nav .prev_arrow:hover,
body#body .arrows_nav .next_arrow:hover,
body#body .list_slider #list_left:hover,
body#body .list_slider #list_right:hover {
    color: var(--4d-bg-deep);
    background-color: var(--4d-cyan);
}

body#body .menu_controls .dropdown {
    color: var(--4d-text);
    background: rgba(18, 26, 39, 0.97);
    border: 1px solid var(--4d-border-glow);
    border-radius: var(--4d-radius-md);
    box-shadow: var(--4d-shadow-lg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

body#body .menu_controls .arrow {
    border-bottom-color: rgba(18, 26, 39, 0.97);
}

body#body .menu_controls p {
    color: var(--4d-text-muted);
}

body#body .menu_controls p:hover,
body#body .menu_controls p:focus {
    color: var(--4d-text);
    background: var(--4d-surface-interactive);
}

body#body .menu_controls .active {
    color: var(--4d-success);
}

body#body .menu_controls .not_active {
    color: var(--4d-text-muted);
}

body#body .list_alt_menu .dropdown {
    color: var(--4d-text);
    background: var(--4d-surface-raised);
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius-md);
    box-shadow: var(--4d-shadow);
}

body#body .loading {
    color: var(--4d-text);
    font-size: clamp(1.15rem, 2.4vw, 1.5rem);
}

body#body .loading h2,
body#body .loading h3,
body#body #name_virtualtour,
body#body #author_virtualtour {
    color: var(--4d-text);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.52);
}

body#body #author_virtualtour {
    color: var(--4d-text-muted);
    font-size: var(--4d-font-size-base);
    font-weight: var(--4d-font-weight-regular);
}

body#body .progress {
    height: auto;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

body#body .progress img {
    height: auto;
    max-height: 80px;
    object-fit: contain;
}

body#body #pbar {
    height: 4px;
    overflow: hidden;
    background: rgba(245, 248, 252, 0.12);
    border: 0;
    border-radius: var(--4d-radius-pill);
}

body#body .progress-circle,
body#body .loading_vr {
    color: var(--4d-cyan);
}

body#body .loading_vr {
    background: rgba(7, 11, 20, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

body#body #loading_pano {
    color: var(--4d-cyan);
    filter: drop-shadow(0 0 10px rgba(21, 223, 239, 0.4));
}

body#body #loading_pano svg path {
    stroke: var(--4d-cyan);
}

body#body #loading_pano svg circle {
    fill: var(--4d-cyan);
}

body#body .background_opacity {
    background-color: rgba(7, 11, 20, 0.42);
}

body#body .intro_img img {
    max-width: min(400px, 72vw);
    border: 1px solid var(--4d-border-glow);
    border-radius: var(--4d-radius-lg);
    box-shadow: var(--4d-shadow-lg);
}

body#body .logo img {
    max-width: min(220px, 48vw);
    object-fit: contain;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.4));
}

body#body .info_box_content {
    max-height: calc(100vh - 4rem);
    overflow: auto;
    color: var(--4d-text);
    background: rgba(18, 26, 39, 0.97);
    border: 1px solid var(--4d-border-glow);
    border-radius: var(--4d-radius-lg);
    box-shadow: var(--4d-shadow-lg);
    scrollbar-color: #40516A var(--4d-bg-deep);
    scrollbar-width: thin;
}

body#body #vt_password {
    min-height: 2.75rem;
    padding: 0.55rem 0.8rem;
    color: var(--4d-text);
    background: var(--4d-surface);
    border: 1px solid var(--4d-border);
    border-radius: var(--4d-radius) 0 0 var(--4d-radius);
}

body#body #vt_password:focus {
    border-color: var(--4d-cyan);
    box-shadow: var(--4d-focus-ring);
    outline: 0;
}

body#body .password-wrapper button {
    min-height: 2.75rem;
    color: #FFFFFF;
    background-color: var(--4d-blue-electric);
    background-image: var(--4d-gradient-primary-button);
    border: 1px solid rgba(21, 223, 239, 0.3);
    border-radius: 0 var(--4d-radius) var(--4d-radius) 0;
}

body#body .password-wrapper button:hover,
body#body .password-wrapper button:focus {
    border-color: var(--4d-cyan);
    box-shadow: var(--4d-focus-ring);
}

body#body .tooltipster-sidetip.tooltipster-borderless .tooltipster-box {
    background: var(--4d-surface-raised);
    border: 1px solid var(--4d-border-glow);
    border-radius: 8px;
    box-shadow: var(--4d-shadow);
}

body#body .tooltipster-sidetip.tooltipster-borderless.tooltipster-bottom .tooltipster-arrow-background {
    border-bottom-color: var(--4d-surface-raised);
}

body#body .tooltipster-sidetip.tooltipster-borderless.tooltipster-top .tooltipster-arrow-background {
    border-top-color: var(--4d-surface-raised);
}

body#body .tooltipster-sidetip.tooltipster-borderless.tooltipster-left .tooltipster-arrow-background {
    border-left-color: var(--4d-surface-raised);
}

body#body .tooltipster-sidetip.tooltipster-borderless.tooltipster-right .tooltipster-arrow-background {
    border-right-color: var(--4d-surface-raised);
}

body#body .jconfirm .jconfirm-box {
    color: var(--4d-text);
    background: var(--4d-surface);
    border: 1px solid var(--4d-border-glow);
    border-radius: var(--4d-radius-lg);
    box-shadow: var(--4d-shadow-lg);
}

body#body .jconfirm .jconfirm-title,
body#body .jconfirm .jconfirm-content {
    color: var(--4d-text);
}

body#body .jconfirm .jconfirm-buttons .btn {
    border-radius: var(--4d-radius);
}

body#body .jconfirm .jconfirm-buttons .btn-default {
    color: var(--4d-text);
    background: var(--4d-surface-interactive);
    border-color: var(--4d-border);
}

body#body .floating-chat .chat .header button {
    color: var(--4d-text);
}

body#body .floating-chat .chat .header button:hover,
body#body .floating-chat .chat .header button:focus {
    color: var(--4d-cyan);
}

body#body .floating-chat .chat .footer {
    padding-top: var(--4d-space-3);
    background: rgba(10, 16, 30, 0.88);
    border-top: 1px solid var(--4d-border);
}

body#body .floating-chat .chat .footer .text-box {
    color: var(--4d-text);
    background: var(--4d-surface);
    border: 1px solid var(--4d-border);
}

body#body .floating-chat .chat .footer .text-box:focus {
    border-color: var(--4d-cyan);
    box-shadow: var(--4d-focus-ring);
    outline: 0;
}

@media (max-width: 991.98px) {
    .public-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .public-hero h1 {
        max-width: 18ch;
    }
}

@media (max-width: 767.98px) {
    .public-header {
        position: relative;
    }

    .public-nav,
    .public-header__inner {
        align-items: flex-start;
    }

    .public-menu {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.2rem;
    }

    .public-menu a {
        white-space: nowrap;
    }

    .public-hero__actions .btn,
    .public-cta .btn {
        width: 100%;
    }

    .showcase .header {
        min-height: 300px;
        max-height: 380px;
    }

    .showcase .info {
        padding-top: 120px;
    }

    .showcase .info h1 {
        font-size: clamp(1.7rem, 8vw, 2.4rem);
    }

    body#body .menu_controls .dropdown {
        max-width: calc(100vw - 1.25rem);
    }
}

@media (pointer: coarse) {
    body#body .controls_btn,
    body#body .p_control {
        min-width: 2.25rem;
        min-height: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .public-spinner {
        animation: none;
        border-color: var(--4d-cyan);
    }

    .public-card--interactive:hover,
    .public-card--interactive:focus-within,
    .showcase .vt-card:hover,
    .showcase .vt-card:focus-within {
        transform: none;
    }
}

@media (forced-colors: active) {
    .public-card,
    .public-header,
    .public-footer,
    .showcase .vt-card,
    body#body .controls_btn,
    body#body .menu_controls .dropdown {
        border: 1px solid CanvasText;
    }
}
