/* ==========================================================================
   PORTALE ISTITUZIONALE - MULTI-THEME DESIGN TOKENS & BOOTSTRAP 5.3+
   ========================================================================== */
:root,
[data-portal-theme="indigo"] {
    --bs-primary: #4338ca;
    --bs-primary-rgb: 67, 56, 202;
    --bs-primary-bg-subtle: #eef2ff;
    --bs-primary-text-emphasis: #312e81;

    --bs-body-bg: #f8fafc;
    --bs-body-color: #0f172a;
    --bs-secondary-color: #334155;
    --bs-border-color: #cbd5e1;

    --bs-body-font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;

    --bs-link-color: #3730a3;
    --bs-link-hover-color: #312e81;

    --ds-btn-hover: #3730a3;
    --ds-btn-active: #312e81;
    --ds-glass-bg: rgba(248, 250, 252, 0.94);
    --ds-hero-gradient: radial-gradient(circle at top right, rgba(67, 56, 202, 0.09), transparent 52%),
                        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --ds-brochure-banner: linear-gradient(135deg, rgba(67, 56, 202, 0.08) 0%, rgba(248, 250, 252, 0.95) 100%);
}

[data-portal-theme="nordic"] {
    --bs-primary: #0f766e;
    --bs-primary-rgb: 15, 118, 110;
    --bs-primary-bg-subtle: #ccfbf1;
    --bs-primary-text-emphasis: #115e59;

    --bs-body-bg: #f4f7f6;
    --bs-body-color: #132a27;
    --bs-secondary-color: #334e4a;
    --bs-border-color: #cbd9d5;

    --bs-link-color: #115e59;
    --bs-link-hover-color: #134e4a;

    --ds-btn-hover: #115e59;
    --ds-btn-active: #134e4a;
    --ds-glass-bg: rgba(244, 247, 246, 0.94);
    --ds-hero-gradient: radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 54%),
                        linear-gradient(180deg, #ffffff 0%, #f4f7f6 100%);
    --ds-brochure-banner: linear-gradient(135deg, rgba(15, 118, 110, 0.09) 0%, rgba(244, 247, 246, 0.95) 100%);
}

[data-portal-theme="mediterranean"] {
    --bs-primary: #1e3a5f;
    --bs-primary-rgb: 30, 58, 95;
    --bs-primary-bg-subtle: #fae8e0;
    --bs-primary-text-emphasis: #9a3412;

    --bs-body-bg: #f8f6f1;
    --bs-body-color: #171a21;
    --bs-secondary-color: #44403c;
    --bs-border-color: #d6d0c4;

    --font-heading: "Cormorant Garamond", Georgia, serif;

    --bs-link-color: #1e3a5f;
    --bs-link-hover-color: #9a3412;

    --ds-btn-hover: #162c49;
    --ds-btn-active: #0f1f35;
    --ds-glass-bg: rgba(248, 246, 241, 0.94);
    --ds-hero-gradient: radial-gradient(circle at top right, rgba(194, 65, 12, 0.09), transparent 54%),
                        linear-gradient(180deg, #ffffff 0%, #f8f6f1 100%);
    --ds-brochure-banner: linear-gradient(135deg, rgba(30, 58, 95, 0.08) 0%, rgba(248, 246, 241, 0.95) 100%);
}

[data-portal-theme="obsidian"] {
    color-scheme: dark;
    --bs-primary: #38bdf8;
    --bs-primary-rgb: 56, 189, 248;
    --bs-primary-bg-subtle: rgba(56, 189, 248, 0.16);
    --bs-primary-text-emphasis: #7dd3fc;

    --bs-body-bg: #0b1120;
    --bs-body-color: #f1f5f9;
    --bs-secondary-color: #cbd5e1;
    --bs-border-color: #1e293b;

    --bs-link-color: #7dd3fc;
    --bs-link-hover-color: #bae6fd;

    --ds-btn-hover: #0ea5e9;
    --ds-btn-active: #0284c7;
    --ds-glass-bg: rgba(11, 17, 32, 0.92);
    --ds-hero-gradient: radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 52%),
                        linear-gradient(180deg, #0f172a 0%, #0b1120 100%);
    --ds-brochure-banner: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%);
}

/* Contrasto WCAG AA/AAA garantito su testi secondari e accenti */
.text-muted,
.text-secondary {
    color: var(--bs-secondary-color) !important;
}

.text-primary,
.text-primary-emphasis {
    color: var(--bs-primary-text-emphasis) !important;
}

.bg-primary-subtle {
    background-color: var(--bs-primary-bg-subtle) !important;
}

[data-portal-theme="obsidian"] .bg-white,
[data-portal-theme="obsidian"] .card,
[data-portal-theme="obsidian"] .modal-content,
[data-portal-theme="obsidian"] .dropdown-menu {
    background-color: #111827 !important;
    color: #f1f5f9;
}

[data-portal-theme="obsidian"] .bg-body,
[data-portal-theme="obsidian"] .bg-light {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

[data-portal-theme="obsidian"] .text-dark {
    color: #f8fafc !important;
}

[data-portal-theme="obsidian"] .text-muted,
[data-portal-theme="obsidian"] .text-secondary {
    color: #cbd5e1 !important;
}

[data-portal-theme="obsidian"] .border,
[data-portal-theme="obsidian"] .border-top,
[data-portal-theme="obsidian"] .border-bottom,
[data-portal-theme="obsidian"] .border-end {
    border-color: #1e293b !important;
}

[data-portal-theme="obsidian"] .btn-primary {
    --bs-btn-color: #082f49;
    --bs-btn-hover-color: #082f49;
    --bs-btn-active-color: #082f49;
}

[data-portal-theme="obsidian"] .btn-outline-dark {
    --bs-btn-color: #e2e8f0;
    --bs-btn-border-color: #334155;
    --bs-btn-hover-bg: #1e293b;
    --bs-btn-hover-border-color: #475569;
    --bs-btn-hover-color: #ffffff;
}

[data-portal-theme="obsidian"] .form-control,
[data-portal-theme="obsidian"] .form-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-portal-theme="obsidian"] .form-control::placeholder {
    color: #94a3b8;
}

[data-portal-theme="obsidian"] .navbar-toggler-icon,
[data-portal-theme="obsidian"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-portal-theme="obsidian"] .dropdown-item {
    color: #e2e8f0;
}

[data-portal-theme="obsidian"] .dropdown-item:hover,
[data-portal-theme="obsidian"] .dropdown-item:focus {
    background-color: #1e293b;
    color: #ffffff;
}

[data-portal-theme="obsidian"] .flatpickr-calendar {
    background: #111827;
    border-color: #1e293b;
    color: #f1f5f9;
}

[data-portal-theme="obsidian"] .flatpickr-months .flatpickr-month,
[data-portal-theme="obsidian"] .flatpickr-current-month .flatpickr-monthDropdown-months,
[data-portal-theme="obsidian"] span.flatpickr-weekday {
    background: #111827;
    color: #e2e8f0;
    fill: #e2e8f0;
}

[data-portal-theme="obsidian"] .flatpickr-day {
    color: #e2e8f0;
}

[data-portal-theme="obsidian"] .flatpickr-day.flatpickr-disabled,
[data-portal-theme="obsidian"] .flatpickr-day.prevMonthDay,
[data-portal-theme="obsidian"] .flatpickr-day.nextMonthDay {
    color: #64748b;
}

.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--ds-btn-hover);
    --bs-btn-hover-border-color: var(--ds-btn-hover);
    --bs-btn-active-bg: var(--ds-btn-active);
    --bs-btn-active-border-color: var(--ds-btn-active);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary-text-emphasis);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-active-bg: var(--ds-btn-active);
    --bs-btn-active-border-color: var(--ds-btn-active);
}

.btn-outline-secondary {
    --bs-btn-color: var(--bs-secondary-color);
    --bs-btn-border-color: var(--bs-border-color);
}

/* Focus Ring ad alta visibilità per accessibilità da tastiera */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   TIPOGRAFIA, SPAZIATURE & ANCHOR SCROLL
   ========================================================================== */
.scroll-smooth {
    scroll-behavior: smooth;
}

.font-heading {
    font-family: var(--font-heading);
}

.fw-extrabold {
    font-weight: 800;
}

.tracking-tight {
    letter-spacing: -0.025em;
}

.tracking-wide {
    letter-spacing: 0.08em;
}

.max-w-680 {
    max-width: 680px;
}

.portal-section {
    scroll-margin-top: 76px;
}

@media (min-width: 992px) {
    .portal-section {
        min-height: calc(100vh - 76px);
    }

    .py-lg-6 {
        padding-top: 5.5rem;
        padding-bottom: 5.5rem;
    }
}

/* ==========================================================================
   THEME SWATCHES (AREA RISERVATA - PROFILO)
   ========================================================================== */
.theme-dot,
.theme-swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block;
    border: 1px solid rgba(15, 23, 42, 0.2);
    flex-shrink: 0;
}

.theme-dot--indigo,
.theme-swatch--indigo-primary {
    background-color: #4338ca;
}

.theme-swatch--indigo-bg {
    background-color: #f8fafc;
}

.theme-swatch--indigo-ink {
    background-color: #0f172a;
}

.theme-dot--nordic,
.theme-swatch--nordic-primary {
    background-color: #0f766e;
}

.theme-swatch--nordic-bg {
    background-color: #f4f7f6;
}

.theme-swatch--nordic-ink {
    background-color: #132a27;
}

.theme-dot--obsidian,
.theme-swatch--obsidian-primary {
    background-color: #38bdf8;
}

.theme-swatch--obsidian-bg {
    background-color: #0b1120;
}

.theme-swatch--obsidian-ink {
    background-color: #f1f5f9;
}

.theme-dot--mediterranean,
.theme-swatch--mediterranean-primary {
    background-color: #c2410c;
}

.theme-swatch--mediterranean-bg {
    background-color: #f8f6f1;
}

.theme-swatch--mediterranean-ink {
    background-color: #1e3a5f;
}

.theme-option-card {
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.theme-option-card:hover {
    border-color: var(--bs-primary) !important;
    background-color: var(--bs-body-bg) !important;
}

/* ==========================================================================
   COMPONENTI & MICRO-INTERAZIONI
   ========================================================================== */
.bg-glass {
    background-color: var(--ds-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.bg-hero-gradient {
    background: var(--ds-hero-gradient);
}

/* Brand Logo nella Navbar */
.portal-brand-mark {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background-color: #0b1120;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 35%, transparent);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.navbar-brand:hover .portal-brand-mark,
.navbar-brand:focus-visible .portal-brand-mark {
    border-color: var(--bs-primary);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
}

.portal-brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nav-link {
    color: var(--bs-body-color);
}

.nav-link.is-current {
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
}

.profile-frame {
    width: 100%;
    max-width: 290px;
}

.profile-avatar {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center 15%;
}

.icon-box {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.project-thumb {
    height: 200px;
}

.curiosity-media-aside {
    border-bottom: 1px solid var(--bs-border-color);
}

@media (min-width: 768px) {
    .curiosity-media-aside {
        border-bottom: 0;
        border-left: 1px solid var(--bs-border-color);
    }
}

.curiosity-cover-img {
    max-height: 260px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* Hover statico a cambio colore */
.hover-lift {
    transition: border-color 0.2s ease,
                background-color 0.2s ease,
                box-shadow 0.2s ease;
}

.hover-lift:hover,
.hover-lift:focus-within {
    border-color: var(--bs-primary) !important;
    background-color: var(--bs-body-bg) !important;
    box-shadow: 0 6px 18px -6px rgba(var(--bs-primary-rgb), 0.16);
}

[data-portal-theme="obsidian"] .hover-lift:hover,
[data-portal-theme="obsidian"] .hover-lift:focus-within {
    border-color: var(--bs-primary) !important;
    background-color: #162033 !important;
    box-shadow: 0 6px 18px -6px rgba(var(--bs-primary-rgb), 0.22);
}

/* Stato transizione griglia durante filtro HTMX */
#projectsGrid {
    transition: opacity 0.2s ease-in-out;
}

#projectsGrid.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

/* Brochure Soluzioni & Aree di Intervento */
.brochure-cover {
    height: 190px;
}

.brochure-modal-cover {
    max-height: 260px;
}

.brochure-header-banner {
    background: var(--ds-brochure-banner);
}

/* Calendario Prenotazione Call & Slot Picker (min-height elimina CLS) */
.calendar-picker-shell #inlineCallCalendarMount {
    min-height: 310px;
}

.calendar-picker-shell .flatpickr-calendar.inline {
    width: 100%;
    box-shadow: none;
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    margin-inline: auto;
}

.calendar-picker-shell .flatpickr-day.selected,
.calendar-picker-shell .flatpickr-day.selected:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

.slot-pill-btn {
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

@media (prefers-reduced-motion: reduce) {
    .scroll-smooth {
        scroll-behavior: auto;
    }

    .portal-brand-mark,
    .hover-lift,
    .theme-option-card,
    .slot-pill-btn,
    #projectsGrid {
        transition: none;
    }
}

/* Taglio testo multi-linea per descrizione card progetti */
.text-truncate-3-lines {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Rich-Text Editor (Backoffice) & Safe HTML Content (Public Portal)
   ========================================================================== */
.portal-rte-wrapper {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.portal-rte-wrapper:focus-within {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.portal-rte-editor {
    line-height: 1.6;
    overflow-y: auto;
    color: var(--bs-body-color);
}

.portal-rte-editor:focus {
    outline: none;
}

[data-portal-theme="obsidian"] .portal-rte-toolbar .btn-outline-secondary {
    color: #cbd5e1;
}

[data-portal-theme="obsidian"] .portal-rte-toolbar .btn-outline-secondary:hover,
[data-portal-theme="obsidian"] .portal-rte-toolbar .btn-outline-secondary.active {
    background-color: #1e293b;
    color: #ffffff;
}

.portal-rich-content {
    line-height: 1.65;
}

.portal-rich-content p {
    margin-bottom: 0.75rem;
}

.portal-rte-editor p:last-child,
.portal-rte-editor ul:last-child,
.portal-rte-editor ol:last-child,
.portal-rich-content p:last-child,
.portal-rich-content ul:last-child,
.portal-rich-content ol:last-child {
    margin-bottom: 0;
}

.portal-rich-content ul,
.portal-rich-content ol {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.portal-rich-content li + li {
    margin-top: 0.25rem;
}

.portal-rich-content code {
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: 0.875em;
}

/* ==========================================================================
   Drag-and-Drop Reorder Handle (Backoffice)
   ========================================================================== */
.portal-drag-handle {
    cursor: grab;
    user-select: none;
    transition: color 0.15s ease-in-out;
}

.portal-drag-handle:hover {
    color: var(--bs-primary) !important;
}

.portal-drag-handle:active {
    cursor: grabbing;
}

/* ==========================================================================
   Carosello Orizzontale Progetti (Riga Singola + Card 2 Colonne)
   ========================================================================== */
.portal-projects-track {
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.portal-projects-track::-webkit-scrollbar {
    display: none;
}

.portal-project-slide {
    scroll-snap-align: start;
    width: 100%;
}

@media (min-width: 992px) {
    .portal-project-slide {
        width: calc(50% - 0.75rem);
    }
}

.portal-project-icon-box {
    width: 68px;
    height: 68px;
}

.portal-project-mini-thumb {
    width: 68px;
    height: 68px;
}

/* Calendario Prenotazione Call & Slot Picker */
.calendar-picker-shell #inlineCallCalendarMount {
    width: 100%;
}

.calendar-picker-shell .flatpickr-calendar.inline {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none;
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    margin-inline: auto;
    top: 0 !important;
}

.calendar-picker-shell .flatpickr-rContainer,
.calendar-picker-shell .flatpickr-weekdays,
.calendar-picker-shell .flatpickr-days,
.calendar-picker-shell .dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

.calendar-picker-shell .flatpickr-day {
    max-width: none !important;
    flex-basis: 14.2857% !important;
}

/* ==========================================================================
   INTRO HERO CON SFONDO ANIMATO EVOLUTIVO: ERE 2000s -> FUTURO (DESKTOP + MOBILE)
   ========================================================================== */
.portal-intro-hero {
    background-color: var(--bs-body-bg);
}

@media (min-width: 992px) {
    .portal-intro-hero {
        min-height: calc(100vh - 74px);
    }

    .min-vh-lg-75 {
        min-height: 72vh;
    }
}

.portal-intro-backdrop {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.portal-intro-ai-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--bs-primary) 9%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--bs-primary) 9%, transparent) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 75% at 70% 45%, #000 25%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 75% at 70% 45%, #000 25%, transparent 100%);
}

.portal-intro-ai-glow {
    position: absolute;
    top: -10%;
    right: 6%;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        color-mix(in srgb, var(--bs-primary) 16%, transparent) 0%,
        transparent 70%
    );
    filter: blur(42px);
    animation: portalGlowDrift 10s infinite alternate ease-in-out;
}

.portal-intro-neural-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0.55;
}

.portal-intro-stage-stack {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 62%;
    overflow: hidden;
}

.portal-intro-stage-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    will-change: opacity, transform;
    animation: portalFaceEvolution 16s infinite ease-in-out;
}

.portal-intro-stage-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
}

.portal-intro-era-tint {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.portal-intro-stage-1 {
    animation-delay: 0s;
}

.portal-intro-stage-2 {
    animation-delay: 4s;
}

.portal-intro-stage-3 {
    animation-delay: 8s;
}

.portal-intro-stage-4 {
    animation-delay: 12s;
}

/* ATMOSFERA 1: Anni 2000 (Calore analogico, seppia morbido, luce pellicola) */
.portal-intro-era-1 .portal-intro-stage-img {
    filter: sepia(0.34) saturate(0.85) contrast(0.96) brightness(1.04);
}

.portal-intro-era-1 .portal-intro-era-tint {
    background: radial-gradient(circle at 65% 35%, rgba(217, 119, 6, 0.16), rgba(120, 53, 15, 0.14));
    mix-blend-mode: multiply;
}

/* ATMOSFERA 2: Anni 2010 (Era Cloud, luce fredda indaco/ardesia, contrasto nitido) */
.portal-intro-era-2 .portal-intro-stage-img {
    filter: saturate(0.82) contrast(1.12) brightness(0.98) hue-rotate(-14deg);
}

.portal-intro-era-2 .portal-intro-era-tint {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.28) 0%, rgba(56, 189, 248, 0.14) 100%);
    mix-blend-mode: color;
}

/* ATMOSFERA 3: Anni 2020 (Era Big Data & Neural, chiaroscuro ambrato/oro) */
.portal-intro-era-3 .portal-intro-stage-img {
    filter: saturate(1.18) contrast(1.14) brightness(0.96) sepia(0.14);
}

.portal-intro-era-3 .portal-intro-era-tint {
    background: radial-gradient(circle at 60% 30%, rgba(245, 158, 11, 0.22), rgba(15, 23, 42, 0.26));
    mix-blend-mode: soft-light;
}

/* ATMOSFERA 4: Futuro (Sovranità AI, luce ciano/smeraldo cristallina e futuristica) */
.portal-intro-era-4 .portal-intro-stage-img {
    filter: saturate(1.15) contrast(1.18) brightness(1.03) hue-rotate(8deg);
}

.portal-intro-era-4 .portal-intro-era-tint {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.26) 0%, rgba(16, 185, 129, 0.18) 55%, rgba(15, 23, 42, 0.22) 100%);
    mix-blend-mode: screen;
}

@keyframes portalFaceEvolution {
    0% {
        opacity: 0;
        transform: scale(1);
    }
    10% {
        opacity: 0.72;
    }
    25% {
        opacity: 0.72;
        transform: scale(1.04);
    }
    36% {
        opacity: 0;
        transform: scale(1.07);
    }
    100% {
        opacity: 0;
        transform: scale(1.07);
    }
}

.portal-intro-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        var(--bs-body-bg) 0%,
        var(--bs-body-bg) 38%,
        color-mix(in srgb, var(--bs-body-bg) 72%, transparent) 54%,
        color-mix(in srgb, var(--bs-body-bg) 18%, transparent) 78%,
        color-mix(in srgb, var(--bs-body-bg) 10%, transparent) 100%
    );
}

/* Indicatori Era sincronizzati (Desktop + Mobile) */
.portal-intro-era-step {
    opacity: 0.42;
    transition: opacity 0.3s ease, color 0.3s ease;
    animation: portalEraLabelHighlight 16s infinite ease-in-out;
}

.portal-intro-era-step-1 {
    animation-delay: 0s;
}

.portal-intro-era-step-2 {
    animation-delay: 4s;
}

.portal-intro-era-step-3 {
    animation-delay: 8s;
}

.portal-intro-era-step-4 {
    animation-delay: 12s;
}

@keyframes portalEraLabelHighlight {
    0%, 34%, 100% {
        opacity: 0.42;
        color: var(--bs-secondary-color);
    }
    8%, 25% {
        opacity: 1;
        color: var(--bs-primary-text-emphasis);
    }
}

.portal-intro-timeline-bar {
    position: relative;
    width: 100%;
    height: 3px;
    background-color: color-mix(in srgb, var(--bs-primary) 16%, transparent);
    border-radius: 999px;
    overflow: hidden;
}

.portal-intro-timeline-fill {
    display: block;
    height: 100%;
    width: 100%;
    background-color: var(--bs-primary);
    transform-origin: left center;
    animation: portalTimelineCycle 16s infinite linear;
}

@keyframes portalTimelineCycle {
    0% {
        transform: scaleX(0);
    }
    100% {
        transform: scaleX(1);
    }
}

/* Tipografia fluida mobile -> desktop */
.portal-intro-title {
    font-size: clamp(1.65rem, 5.2vw, 2.95rem);
    line-height: 1.18;
    overflow-wrap: break-word;
}

.portal-intro-lead {
    font-size: clamp(0.98rem, 2.6vw, 1.18rem);
    line-height: 1.6;
}

/* Adattamento dedicato sotto 992px */
@media (max-width: 991.98px) {
    .portal-intro-hero {
        display: block !important;
        padding-top: 0.75rem;
        padding-bottom: 2rem;
    }

    .portal-intro-stage-stack,
    .portal-intro-scrim {
        display: none;
    }

    .portal-intro-neural-canvas {
        opacity: 0.22;
    }

    .portal-intro-ai-glow {
        width: 240px;
        height: 240px;
        right: -10%;
        top: 0;
    }

    .portal-intro-mobile-visual {
        position: relative;
        width: 100%;
        max-width: 340px;
        height: 250px;
        margin: 0 auto;
        overflow: hidden;
        background-color: var(--bs-tertiary-bg);
    }

    .portal-intro-mobile-visual .portal-intro-stage-img {
        object-position: 50% 24%;
    }

    .portal-intro-era-badge {
        position: absolute;
        top: 12px;
        left: 12px;
        z-index: 3;
        background-color: var(--ds-glass-bg);
        color: var(--bs-body-color);
        border: 1px solid var(--bs-border-color);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        font-size: 0.72rem;
        letter-spacing: 0.04em;
    }

    .portal-intro-mobile-visual-fade {
        position: absolute;
        inset: 0;
        background: linear-gradient(
            180deg,
            transparent 68%,
            color-mix(in srgb, var(--bs-body-bg) 65%, transparent) 100%
        );
        pointer-events: none;
    }

    .portal-intro-mobile-visual .portal-intro-timeline-bar {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        z-index: 3;
    }

    .portal-intro-cta {
        font-size: 0.96rem;
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    .portal-intro-pillar {
        font-size: 0.75rem;
        white-space: normal;
        text-align: left;
    }
}

.portal-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bs-primary);
    display: inline-block;
    flex-shrink: 0;
    animation: portalPulse 2.4s infinite ease-in-out;
}

@keyframes portalPulse {
    0%, 100% {
        transform: scale(0.95);
        opacity: 0.75;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
    }
}

@keyframes portalGlowDrift {
    0% {
        transform: translate3d(0, 0, 0) scale(0.95);
    }
    100% {
        transform: translate3d(-28px, 18px, 0) scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-pulse-dot,
    .portal-intro-ai-glow,
    .portal-intro-timeline-fill,
    .portal-intro-era-step {
        animation: none;
    }
}