@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

/* --- CUSTOM VARIABLES & THEMING --- */
:root {
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* HSL Color System - Default Premium Light Theme */
  --bg-hue: 215;
  --bg-saturation: 24%;
  
  --bg-primary: hsl(var(--bg-hue), var(--bg-saturation), 97%);
  --bg-secondary: hsl(var(--bg-hue), 20%, 93%);
  --bg-tertiary: hsl(var(--bg-hue), 16%, 88%);
  
  --text-primary: hsl(var(--bg-hue), 40%, 12%);
  --text-secondary: hsl(var(--bg-hue), 20%, 30%);
  --text-muted: hsl(var(--bg-hue), 15%, 52%);

  /* Accent Colors */
  --accent-hue: 256; /* Indigo/Royal Violet */
  --accent-saturation: 70%;
  --accent: hsl(var(--accent-hue), var(--accent-saturation), 54%);
  --accent-hover: hsl(var(--accent-hue), var(--accent-saturation), 44%);
  --accent-glow: hsla(var(--accent-hue), var(--accent-saturation), 54%, 0.08);
  
  --accent-secondary-hue: 190; /* Cyan */
  --accent-secondary: hsl(var(--accent-secondary-hue), 85%, 42%);

  /* Glassmorphism & Borders - Light Mode */
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-shadow: rgba(15, 23, 42, 0.04);
  
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-elastic: all 0.5s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

/* --- DARK THEME OVERRIDE --- */
[data-theme="dark"] {
  --bg-primary: hsl(var(--bg-hue), 24%, 6%);
  --bg-secondary: hsl(var(--bg-hue), 20%, 10%);
  --bg-tertiary: hsl(var(--bg-hue), 16%, 15%);
  
  --text-primary: hsl(0, 0%, 95%);
  --text-secondary: hsl(var(--bg-hue), 10%, 75%);
  --text-muted: hsl(var(--bg-hue), 8%, 55%);
  
  --accent: hsl(var(--accent-hue), 75%, 62%);
  --accent-hover: hsl(var(--accent-hue), 75%, 52%);
  --accent-glow: hsla(var(--accent-hue), var(--accent-saturation), 62%, 0.18);
  --accent-secondary: hsl(var(--accent-secondary-hue), 90%, 55%);
  
  --glass-bg: rgba(13, 17, 23, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.35);
}

/* --- RESET & BASIC STYLES --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
}

p {
  color: var(--text-secondary);
  font-weight: 400;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-smooth);
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border: 2px solid var(--bg-primary);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* --- REUSABLE UTILITIES & LAYOUTS --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.6rem;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px hsla(var(--accent-hue), var(--accent-saturation), 60%, 0.3);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 2rem;
  box-shadow: 0 8px 32px var(--glass-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  transform: translateY(-5px);
  border-color: hsla(var(--accent-hue), var(--accent-saturation), 60%, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-glow);
}

/* Grid System */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* --- HEADER & NAVIGATION --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition-smooth);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  opacity: 0.8;
}

.nav-links a:hover {
  opacity: 1;
  color: var(--accent);
}

/* --- SECTIONS --- */
section {
  padding: 8rem 0 4rem;
  position: relative;
}

/* Background Gradients */
.glow-effect {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 1s ease forwards;
}

/* --- TOOL SPECIFIC STYLES --- */
.tool-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.input-field {
  width: 100%;
  padding: 0.8rem;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Password Strength Bar */
.pwd-meter-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.pwd-meter-bar {
  height: 100%;
  width: 0%;
  transition: width 0.4s ease-in-out, background-color 0.4s ease-in-out;
}

/* Google SEO Snippet Simulator */
.seo-preview-card {
  background: #ffffff;
  color: #1a0dab;
  border-radius: 8px;
  padding: 1.2rem;
  font-family: Arial, sans-serif;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-top: 1rem;
}

.seo-preview-url {
  color: #202124;
  font-size: 12px;
  margin-bottom: 4px;
  word-break: break-all;
}

.seo-preview-title-text {
  font-size: 20px;
  line-height: 1.3;
  margin-bottom: 4px;
  font-weight: normal;
  color: #1a0dab;
  cursor: pointer;
  word-break: break-word;
}

.seo-preview-title-text:hover {
  text-decoration: underline;
}

.seo-preview-desc-text {
  color: #4d5156;
  font-size: 14px;
  line-height: 1.58;
  word-break: break-word;
}

/* HSL Sliders & Swatches */
.hsl-slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hsl-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: var(--transition-smooth);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-secondary);
}

.palette-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-top: 1rem;
}

.swatch {
  height: 80px;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.5rem;
  color: #fff;
  font-size: 0.65rem;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  border: 1px solid var(--glass-border);
}

.swatch-label {
  pointer-events: none;
}

.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  padding: 0.8rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--accent-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  margin-top: 1rem;
}

/* --- MULTILANGUAGE SWITCHER --- */
html.lang-en .lang-it { display: none !important; }
html.lang-it .lang-en { display: none !important; }

/* --- PRIVACY & COOKIE BANNER --- */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  width: 90%;
  max-width: 600px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 40px var(--glass-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition-smooth);
  opacity: 0;
  pointer-events: none;
}

.cookie-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* --- ABOUT PAGE & CV TIMELINE --- */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  height: 100%;
  width: 2px;
  background: var(--glass-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 45px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-date {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.timeline-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.timeline-org {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
}

.cv-image-container {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin: 3rem 0;
}

.cv-image {
  max-width: 100%;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px var(--glass-shadow);
  transition: var(--transition-smooth);
}

.cv-image:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

/* --- PAGE OVERRIDES (MULTI-STYLE DESIGN) --- */

/* 1. SERVICES PAGE: Reverted to Homepage design, no overrides needed */


/* 2. TOOLS PAGE: Warm Ivory & Sand Theme (Minimalist) */
body.tools-page {
  --bg-primary: #fdfbf7;
  --bg-secondary: #f6f3ed;
  --bg-tertiary: #ebe7dd;
  
  --text-primary: #2b2520;
  --text-secondary: #5a524a;
  --text-muted: #8d837a;
  
  --accent: #d36a3b; /* Burnt Sienna */
  --accent-hover: #b45125;
  --accent-glow: rgba(211, 106, 59, 0.12);
  --accent-secondary: #3b7d8c; /* Muted Teal */
  
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(43, 37, 32, 0.08);
  --glass-shadow: rgba(43, 37, 32, 0.04);
}

body.tools-page .glass-card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.tools-page .glass-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 30px var(--glass-shadow), 0 0 15px var(--accent-glow);
}

body.tools-page .input-field {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
}

/* 3. CONTACT PAGE: Frosted Glass & Dynamic Blob Theme */
body.contact-page {
  --bg-primary: #0a0e1a;
  --bg-secondary: #11172a;
  --bg-tertiary: #19223f;
  
  --text-primary: #ffffff;
  --text-secondary: #9cb0d4;
  --text-muted: #647b9b;
  
  --accent: #00f2fe; /* Cyber Cyan */
  --accent-hover: #4facfe;
  --accent-glow: rgba(0, 242, 254, 0.25);
  --accent-secondary: #9b51e0;
  
  --glass-bg: rgba(15, 23, 42, 0.45);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: rgba(0, 0, 0, 0.45);
}

body.contact-page .glass-card {
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

body.contact-page .glass-card:hover {
  border-color: var(--accent);
  box-shadow: 0 15px 45px rgba(0, 242, 254, 0.2);
}

/* Floating Blobs for Contact Page */
.blob-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: floatBlob 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 380px;
  height: 380px;
  background: var(--accent);
  top: 15%;
  left: 10%;
}

.blob-2 {
  width: 480px;
  height: 480px;
  background: #a18cd1;
  bottom: 15%;
  right: 10%;
  animation-duration: 25s;
}

@keyframes floatBlob {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(70px, 40px) scale(1.15); }
}

/* --- SLIDER SHOWCASE STYLES --- */
.slider-container {
  position: relative;
  overflow: hidden;
}
.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}
.slide.active {
  opacity: 1;
  visibility: visible;
  position: relative;
  z-index: 2;
}
.slider-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: var(--transition-smooth);
}
.slider-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.1);
}
.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.indicator.active {
  width: 25px;
  border-radius: 5px;
  background: var(--accent);
}
@media (max-width: 768px) {
  .slide {
    flex-direction: column;
    padding: 2rem 1.5rem !important;
    text-align: center;
    justify-content: center;
    height: auto;
  }
  .slider-container {
    height: auto !important;
    min-height: 520px;
  }
  .slide-visual {
    margin-top: 1.5rem;
    transform: scale(0.85);
  }
}



