:root {
  /* Colors - Dark Theme Base */
  --bg-primary: #020617;
  --bg-secondary: #0f172a;
  --bg-slate-800: #1e293b;
  --bg-slate-700: #334155;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-slate-400: #94a3b8;
  --text-slate-500: #64748b;

  /* Accent Colors (Orange from Logo) */
  --accent-orange: #f97316;
  --accent-yellow: #fbbf24;
  --accent-orange-dark: #ea580c;
  
  /* Brand Blue (if still needed) */
  --pc-blue-600: #2563eb;
  --pc-blue-700: #1d4ed8;

  --border-color: rgba(51, 65, 85, 0.5);
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- RESET E BASE --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- LOADER --- */
body:not(.loaded) {
  overflow: hidden;
}

body:not(.loaded)::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
}

body:not(.loaded)::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border: 3px solid rgba(249, 115, 22, 0.1);
  border-top: 3px solid var(--accent-orange);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  z-index: 10000;
}

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

/* --- TYPOGRAPHY --- */
h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.3;
  text-wrap: balance;
}

p {
  font-size: clamp(1rem, 1.1vw, 1.125rem);
  line-height: 1.6;
  max-width: 65ch; /* Optimal line length for readability */
}

.text-sm {
  font-size: clamp(0.875rem, 0.9vw, 1rem);
  line-height: 1.5;
}

/* --- UTILITIES --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- FADE IN ANIMATIONS --- */
.fade-in-observer {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-in-observer.visible {
  opacity: 1;
  transform: translateY(0);
}

/* REVEAL LEFT ANIMATION */
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}

.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal-left, .fade-in-observer {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* --- HERO ACCENT EFFECT (VENATURE) --- */
.hero-accent {
  background: linear-gradient(135deg, 
    var(--accent-orange) 0%, 
    var(--accent-yellow) 25%, 
    var(--accent-orange) 50%, 
    var(--accent-yellow) 75%, 
    var(--accent-orange) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 4s linear infinite;
  text-shadow: 0 0 30px rgba(249, 115, 22, 0.2);
  position: relative;
  display: inline-block;
}

@keyframes shine {
  to { background-position: 200% center; }
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-slate-800);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-slate-700);
}

/* --- NAV GLASS --- */
.nav-glass {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* --- SERVICE CARDS --- */
.service-card {
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.service-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  text-wrap: balance;
  line-height: 1.2;
}

.service-card p {
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
  max-width: 45ch; /* Limit character length for mobile readability */
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* --- CAROUSEL (VETRINA) --- */
.pro-carousel {
  position: relative;
  width: 100%;
  height: 280px; /* Altezza stabile per evitare layout shift */
  background: var(--bg-slate-800);
  overflow: hidden;
  user-select: none;
}

@media (min-width: 768px) {
  .pro-carousel { height: 320px; }
}

.pro-carousel-inner {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.pro-carousel-item {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
}

.pro-carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- TECH SKILLS CARDS OPTIMIZATION --- */
/* Optimized typography for Hardware & Support section */

.tech-skill-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1.5rem !important; /* Force balanced padding */
  min-height: 140px; /* Consistent height */
  height: 100%;
  transition: var(--transition-smooth);
}

.tech-skill-title {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  color: var(--accent-orange);
  margin-bottom: 0.25rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  /* Advanced text wrap rules */
  text-wrap: balance;
  /* Robust fallbacks */
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
  font-size: 1.125rem; /* Mobile-first font size (18px) */
}

.tech-skill-subtitle {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text-slate-500);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  line-height: 1.4;
  /* Advanced text wrap rules */
  text-wrap: balance;
  /* Robust fallbacks */
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
  font-size: 0.625rem; /* 10px */
}

/* Tablet & Desktop Adjustments */
@media (min-width: 768px) {
  .tech-skill-title {
    font-size: 1.25rem; /* 20px */
  }
  .tech-skill-subtitle {
    font-size: 0.6875rem; /* 11px */
  }
  .tech-skill-card {
    min-height: 150px;
  }
}

/* Fallback for browsers that don't support text-wrap: balance */
@supports not (text-wrap: balance) {
  .tech-skill-title, 
  .tech-skill-subtitle {
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Section Header Optimization (Hardware & Support) */
.tech-section-header {
  text-wrap: balance;
  line-height: 1.2;
  overflow-wrap: anywhere;
  /* Fallback for balance */
  max-width: 100%;
}

/* Frecce Evidenti */
.pro-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.pro-carousel-btn:hover {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  transform: translateY(-50%) scale(1.1);
}

.pro-carousel-btn:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 2px;
}

.pro-carousel-btn.prev { left: 12px; }
.pro-carousel-btn.next { right: 12px; }

/* Play/Pause Button */
.pro-carousel-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.pro-carousel-toggle:hover {
  background: rgba(15, 23, 42, 0.9);
}

/* Indicatori (Puntini) */
.pro-carousel-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 20;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.pro-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pro-dot.active {
  background: var(--accent-orange);
  width: 20px;
  border-radius: 4px;
}

.pro-dot:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 2px;
}

/* Fallback Image */
.img-fallback {
  background: var(--bg-slate-800);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
}

/* Hidden elements for single image */
.pro-carousel.single-slide .pro-carousel-btn,
.pro-carousel.single-slide .pro-carousel-dots,
.pro-carousel.single-slide .pro-carousel-toggle {
  display: none !important;
}

/* --- FOOTER --- */
footer {
  background-color: #020617;
}

/* --- CUSTOM TAILWIND COLORS (if needed in JS) --- */
.text-pc-blue-600 { color: var(--accent-orange); }
.bg-pc-blue-600 { background-color: var(--accent-orange); }
.hover\:bg-pc-blue-700:hover { background-color: var(--accent-orange-dark); }
