/* Typography & Colors Utilities */
        .text-penna-red { color: var(--rosso) !important; }
        .text-penna-grey { color: var(--grigio) !important; }
        .text-penna-black { color: var(--nero) !important; font-family: var(--font_testo), sans-serif; font-weight: 500; }
        .bg-penna-red { background-color: var(--rosso) !important; }
        .bg-penna-card { background-color: var(--sfondo-carta) !important; }
        .bg-penna-brown { background-color: var(--marrone) !important; }
        
        .border-penna-brown { border-color: var(--marrone) !important; }
        .border-penna-red { border-color: var(--rosso) !important; }

        /* Custom Button Styles */
        .btn-penna-primary {
            background-color: var(--rosso);
            color: white;
            border: none;
            padding: 12px 30px;
            font-weight: 600;
            border-radius: 8px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 10px rgba(251, 90, 89, 0.2);
            line-height: 1.5;
        }
        .btn-penna-primary:hover {
            background-color: #e04847;
            color: white;
            transform: translateY(-2px);
        }

        .btn-penna-outline {
            background-color: white;
            color: var(--nero);
            border: 1px solid var(--marrone);
            padding: 12px 30px;
            font-weight: 600;
            border-radius: 8px;
            transition: all 0.3s ease;
             line-height: 1.5;
        }
        .btn-penna-outline:hover {
            background-color: var(--sfondo-carta);
            border-color: var(--nero);
        }

        /* Navbar */
        .navbar-custom {
            background-color: rgba(251, 249, 245, 0.95);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid var(--marrone);
        }
        .nav-link {
            color: var(--grigio);
            font-weight: 500;
            font-size: 0.95rem;
        }
        .nav-link:hover, .nav-link.active {
            color: var(--rosso);
        }

        /* Hero Highlights */
        .marker-highlight {
            position: relative;
            display: inline-block;
            z-index: 10;
        }
        .marker-highlight::after {
            content: '';
            position: absolute;
            bottom: 2px;
            left: -2px;
            right: -2px;
            height: 35%;
            background-color: var(--evidenziiatore);
            z-index: -1;
            transform: skewX(-10deg);
        }

        /* Abstract Blobs Animation */
        .blob-container {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 100%;
            height: 100%;
            z-index: -1;
            pointer-events: none;
            overflow: hidden;
        }
        .blob {
            position: absolute;
            border-radius: 50%;
            filter: blur(80px);
            opacity: 0.5;
        }
        .blob-1 { background-color: var(--marrone); width: 400px; height: 400px; top: -100px; right: -100px; }
        .blob-2 { background-color: var(--sfondo); width: 500px; height: 500px; bottom: -100px; left: -100px; }

        /* Service Cards & Tabs */
        .service-btn {
            background-color: white;
            border: 1px solid var(--marrone);
            color: var(--grigio);
            border-radius: 50px;
            padding: 10px 25px;
            font-weight: 600;
            font-size: 0.9rem;
            transition: all 0.3s;
            margin-bottom: 10px;
        }
        .service-btn:hover {
            border-color: var(--rosso);
            color: var(--rosso);
        }
        .service-btn.active {
            background-color: var(--rosso);
            color: white;
            border-color: var(--rosso);
            box-shadow: 0 4px 12px rgba(251, 90, 89, 0.3);
        }
        
        .service-card {
            border-radius: 20px;
            border: 1px solid var(--marrone);
            box-shadow: 0 10px 30px rgba(0,0,0,0.03);
            background: white;
            transition: opacity 0.3s ease-in-out;
        }

        /* --- PORTFOLIO STYLES (GRID) --- */
        .portfolio-flex {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 1.5rem;
            align-items: start;
        }
        
        /* Video orizzontali occupano 1 colonna */
        .portfolio-card {
            grid-column: span 1;
        }
        
        /* Video verticali occupano meno spazio */
        .portfolio-card.portfolio-vertical {
            max-width: 250px;
            justify-self: center;
        }
        
        @media (max-width: 768px) {
            .portfolio-flex {
                grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
                gap: 1rem;
            }
            .portfolio-card.portfolio-vertical {
                max-width: 200px;
            }
        }
        
        @media (max-width: 576px) {
            .portfolio-flex {
                grid-template-columns: 1fr;
            }
            .portfolio-card.portfolio-vertical {
                max-width: 280px;
            }
        }
        
        .portfolio-flex .portfolio-empty {
            grid-column: 1 / -1;
        }
        .portfolio-item {
            cursor: pointer;
            transition: transform 0.3s ease;
        }
        .portfolio-item:hover {
            transform: translateY(-8px);
        }
        .video-thumbnail {
            position: relative;
            background-color: var(--nero);
            border-radius: 12px;
            overflow: hidden;
            width: 100%;
            aspect-ratio: 4/5;
            box-shadow: 0 4px 12px rgba(0,0,0,0.12);
            transition: box-shadow 0.3s ease;
        }
        .portfolio-item:hover .video-thumbnail {
            box-shadow: 0 8px 24px rgba(0,0,0,0.2);
        }
        .video-thumbnail.video-vertical {
            aspect-ratio: 9/16;
            max-height: 400px;
            margin: 0 auto;
        }
        .portfolio-card.portfolio-vertical {
            max-width: none;
        }
        .video-thumbnail video.portfolio-video {
            pointer-events: none;
        }
        .video-overlay {
            position: absolute;
            top: 0; 
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.3s ease;
            z-index: 1;
        }
        .portfolio-item:hover .video-overlay {
            background: rgba(0,0,0,0.2);
        }
        .play-btn {
            width: 70px;
            height: 70px;
            background: rgba(251, 90, 89, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding-left: 4px;
            color: white;
            font-size: 1.8rem;
            transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
            border: 3px solid white;
            box-shadow: 0 8px 20px rgba(251, 90, 89, 0.4);
        }
        .portfolio-item:hover .play-btn {
            transform: scale(1.2);
            background: var(--rosso);
            box-shadow: 0 12px 32px rgba(251, 90, 89, 0.6);
        }
        .filter-btn {
            color: var(--grigio);
            font-weight: 500;
            background: none;
            border: none;
            padding: 5px 15px;
            transition: color 0.3s;
        }
        .filter-btn.active, .filter-btn:hover {
            color: var(--rosso);
            font-weight: 700;
        }
        .bg-penna-bg {
            background-color: var(--sfondo-carta) !important;
        }
        /* Process Steps */
        .step-item {
            position: relative;
            padding-bottom: 3rem;
        }
        .step-icon {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.3rem;
            z-index: 2;
            position: relative;
            background-color: white;
            border: 3px solid var(--marrone);
            color: var(--grigio);
            transition: all 0.3s ease;
            box-shadow: 0 3px 10px rgba(0,0,0,0.08);
        }

        .step-item:last-child .step-icon {
            color: var(--grigio);
        }

        .step-number {
            font-weight: 700;
            color: var(--rosso);
            font-size: 1.2rem;
            margin-right: 1.5rem;
            min-width: 35px;
            text-align: right;
        }
        .step-connector {
            position: absolute;
            left: 0px;
            top: 60px;
            bottom: -3rem;
            width: 3px;
            background: linear-gradient(to bottom, var(--rosso) 0%, var(--rosso) 80%, transparent 100%);
            z-index: 0;
        }
        .step-item:last-child .step-connector {
            display: none;
        }
        @media (min-width: 768px) {
            .step-item { padding-left: 0; }
            .step-content { padding-left: 2rem; }
            .step-icon-container {
                display: flex; 
                flex-direction: column; 
                align-items: center; 
                width: 70px;
            }
            .step-row { 
                display: flex; 
                align-items: center; 
            }
            .step-connector { 
                left: 30px;
            }
        }

        /* Chart Container */
        .chart-wrapper {
            position: relative;
            height: 300px;
            width: 100%;
        }
        
        .stat-box {
            background: white;
            border: 1px solid var(--marrone);
            border-radius: 12px;
            padding: 1.5rem;
            height: 100%;
        }

        section { padding: 5rem 0; }

        /* Fullscreen video modal */
        .video-fullscreen-holder {
            width: 100%;
            min-height: 100vh;
            background: rgba(0,0,0,0.1);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .video-fullscreen-holder video {
            max-height: 90vh;
        }

        /* --- SINGLE VIDEO POST TEMPLATE --- */
        .video-single-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 3rem 1.5rem;
        }

        .video-post {
            background: transparent;
        }

        .video-header {
            padding: 2rem 1.5rem;
            text-align: center;
            margin-bottom: 2rem;
        }

        .video-title {
            font-size: 2.5rem;
            font-weight: 700;
            color: var(--nero);
            margin-bottom: 1rem;
            line-height: 1.2;
            text-align: center;
        }

        .video-meta-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            margin-bottom: 1.5rem;
            justify-content: center;
        }

        .video-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.6rem 1.2rem;
            background: white;
            border-radius: 50px;
            border: 1px solid var(--marrone);
            font-size: 0.9rem;
            transition: all 0.3s ease;
        }

        .video-badge i {
            color: var(--rosso);
        }

        .video-badge-label {
            font-weight: 600;
            color: var(--rosso);
        }

        .video-badge-value {
            color: var(--grigio);
        }

        .video-meta-info {
            display: flex;
            flex-wrap: wrap;
            gap: 1.5rem;
            font-size: 0.9rem;
            color: var(--grigio);
            justify-content: center;
        }

        .video-meta-info span {
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        .video-meta-info i {
            color: var(--rosso);
        }

        .video-player-section {
            position: relative;
            margin-bottom: 3rem;
        }

        .video-player-wrapper {
            width: 100%;
            max-width: 100%;
            margin: 0 auto;
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0,0,0,0.15);
            background: var(--nero);
        }

        .video-player-container {
            position: relative;
            width: 100%;
            padding-bottom: 56.25%;
            cursor: pointer;
            overflow: hidden;
        }

        .video-player-container.loaded {
            cursor: default;
        }

        .video-thumbnail-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            z-index: 2;
        }

        .video-player-container:hover .video-thumbnail-overlay {
            background: rgba(0,0,0,0.2);
        }

        .video-player-container.loaded .video-thumbnail-overlay {
            display: none;
        }

        .video-play-button {
            width: 80px;
            height: 80px;
            background: rgba(251, 90, 89, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 2rem;
            padding-left: 6px;
            transition: all 0.3s ease;
            border: 4px solid white;
            box-shadow: 0 10px 30px rgba(251, 90, 89, 0.5);
        }

        .video-player-container:hover .video-play-button {
            transform: scale(1.15);
            background: var(--rosso);
            box-shadow: 0 15px 40px rgba(251, 90, 89, 0.7);
        }

        .video-thumbnail-img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            z-index: 1;
        }

        .video-embed,
        .video-html5 {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 3;
        }

        .video-embed iframe,
        .video-embed object,
        .video-embed embed,
        .video-html5 video {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .video-content-section {
            padding: 3rem 2.5rem;
        }

        .video-description-card {
            background: var(--sfondo-carta);
            border: 1px solid var(--marrone);
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 2.5rem;
        }

        .video-description-card h2 {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--nero);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .video-description-card h2:before {
            content: '';
            width: 4px;
            height: 24px;
            background: var(--rosso);
            border-radius: 2px;
        }

        .video-description-content {
            color: var(--grigio);
            line-height: 1.8;
            font-size: 1rem;
        }

        .video-main-content {
            color: var(--grigio);
            line-height: 1.8;
            font-size: 1.05rem;
        }

        .video-main-content h2,
        .video-main-content h3 {
            color: var(--nero);
            font-weight: 700;
            margin-top: 2rem;
            margin-bottom: 1rem;
        }

        .video-footer-section {
            padding: 2rem 2.5rem;
            background: var(--sfondo-carta);
            border-top: 2px solid var(--marrone);
        }

        .video-taxonomy {
            display: flex;
            flex-wrap: wrap;
            gap: 2rem;
        }

        .video-taxonomy-group {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            flex-wrap: wrap;
        }

        .video-taxonomy-label {
            font-weight: 600;
            color: var(--nero);
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        .video-taxonomy-label i {
            color: var(--rosso);
        }

        .video-taxonomy-group a {
            display: inline-block;
            padding: 0.4rem 1rem;
            background: white;
            border: 1px solid var(--marrone);
            border-radius: 50px;
            color: var(--grigio);
            text-decoration: none;
            font-size: 0.85rem;
            transition: all 0.3s ease;
        }

        .video-taxonomy-group a:hover {
            background: var(--rosso);
            color: white;
            border-color: var(--rosso);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(251, 90, 89, 0.3);
        }

        .video-comments-wrapper {
            margin-top: 3rem;
            padding: 3rem 2.5rem;
            background: white;
            border-radius: 20px;
            border: 1px solid var(--marrone);
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }
        .container-pulsanti {
          text-align: center;
        }
        /* Responsive Single Video */
        @media (max-width: 768px) {
            .video-single-container {
                padding: 1.5rem 1rem;
            }
            
            .video-header,
            .video-content-section,
            .video-footer-section,
            .video-comments-wrapper {
                padding: 1.5rem;
            }
            
            .video-title {
                font-size: 1.8rem;
            }
            
            .video-meta-badges {
                gap: 0.75rem;
            }
            
            .video-description-card {
                padding: 1.5rem;
            }

            .video-taxonomy {
                gap: 1rem;
            }
        }

/* ── Video Overlay ─────────────────────────────────────────── */
#videoOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  align-items: center;
  justify-content: center;
}

#videoOverlay.active {
  display: flex;
}

#videoOverlay .video-overlay__inner {
  position: relative;
  width: 90vw;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

#videoOverlay .video-overlay__inner iframe,
#videoOverlay .video-overlay__inner video {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#videoOverlay .video-overlay__close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

#videoOverlay .video-overlay__close:hover {
  opacity: 0.7;
}

@media (max-width: 768px) {
  #videoOverlay .video-overlay__inner {
    width: 95vw;
  }
}
