/* ==========================================================================
   AURI MASON - PORTFOLIO REDESIGN (Option A: Cyber-Industrial Executive)
   Core Theme: Tech-Forward, High-Contrast Bold, Slate & Cyber Gradients
   ========================================================================== */

/* Google Fonts: caricati via <link> nel <head> (piu' veloce del @import) */

/* Design Tokens & Custom CSS Variables */
:root {
  /* Color System */
  --bg-darker: #020617;        /* Very dark navy/slate base */
  --bg-dark: #0b1329;          /* Deep industrial dark */
  --bg-card: rgba(15, 23, 42, 0.45); /* Glass slate card */
  --bg-card-hover: rgba(30, 41, 59, 0.6);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  /* Cyber Accent Colors */
  --accent-cyan: #06b6d4;      /* Cyber Cyan */
  --accent-emerald: #10b981;   /* Tech Emerald */
  --accent-blue: #3b82f6;      /* Electric Blue */
  --accent-amber: #f59e0b;     /* BMW GS Gold (preserved for GS accent) */
  
  /* Gradients */
  --gradient-cyber: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-emerald) 100%);
  --gradient-text: linear-gradient(135deg, #ffffff 40%, var(--text-secondary) 100%);
  --gradient-glow: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, rgba(16, 185, 129, 0) 70%);
  
  /* Borders & Shadows */
  --border-glass: rgba(255, 255, 255, 0.04);
  --border-glass-hover: rgba(6, 182, 212, 0.3);
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --shadow-neon-cyan: 0 0 25px rgba(6, 182, 212, 0.25);
  
  /* Fonts */
  --font-title: 'Syne', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Transitions */
  --transition-bezier: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.25s ease;
}

/* Global Reset & Base Elements */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-darker);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body {
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Cyber Dot-Grid Background Overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.015) 1.5px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -2;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Glowing Ambient Blobs */
.glow-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  mix-blend-mode: screen;
  pointer-events: none;
}

.glow-blob-1 {
  top: -10%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: var(--accent-cyan);
}

.glow-blob-2 {
  top: 45%;
  right: -10%;
  width: 700px;
  height: 700px;
  background: var(--accent-emerald);
}

.glow-blob-3 {
  bottom: -5%;
  left: 15%;
  width: 600px;
  height: 600px;
  background: var(--accent-blue);
}

/* Sticky Header & Glassmorphic Nav */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 1.5rem 3rem;
  transition: var(--transition-bezier);
}

header.scrolled {
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: 1rem 3rem;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
  margin-right: 2.5rem;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 30px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.lang-btn.active {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.12);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.flag-icon {
  width: 14px;
  height: 10px;
  border-radius: 1px;
  object-fit: cover;
}

/* Navigation Links */
.nav-links {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  transition: var(--transition-fast);
  position: relative;
  padding: 0.25rem 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-cyber);
  transition: var(--transition-fast);
  border-radius: 2px;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  margin: 5px 0;
  transition: var(--transition-fast);
}

/* Cinematic Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 7rem 2rem 3rem 2rem;
  max-width: 100%;
}

.hero-content {
  text-align: center;
  max-width: 1000px;
  z-index: 10;
}

.hero-greeting {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 5px;
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
}

.hero-name {
  font-family: var(--font-title);
  font-size: 6.5rem;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -3px;
  margin-bottom: 1.25rem;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: 1.85rem;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 760px;
  margin: 0 auto 2.25rem auto;
  line-height: 1.45;
}

.hero-tagline span {
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
}

.hero-cta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.6;
}

.scroll-indicator span {
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.mouse-icon {
  width: 20px;
  height: 32px;
  border: 2px solid var(--text-secondary);
  border-radius: 12px;
  position: relative;
}

.mouse-wheel {
  width: 4px;
  height: 6px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollWheel 1.5s infinite;
}

@keyframes scrollWheel {
  0% { opacity: 1; top: 6px; }
  100% { opacity: 0; top: 18px; }
}

/* Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.5rem;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-bezier);
  cursor: pointer;
  gap: 0.6rem;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--gradient-cyber);
  color: #020617;
  border: none;
  box-shadow: var(--shadow-neon-cyan);
}

.btn-primary:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 35px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-4px);
}

/* Global Section Layouts */
section {
  padding: 9rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}

.section-header {
  margin-bottom: 5rem;
  text-align: left;
}

.section-tag {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.section-title {
  font-family: var(--font-title);
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

/* Chi Sono & Executive Grid Layout */
.profile-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 6rem;
  align-items: start;
}

.profile-text p {
  color: var(--text-secondary);
  font-size: 1.15rem;
  margin-bottom: 2rem;
  font-weight: 300;
  line-height: 1.7;
}

.profile-text p strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Highlight Box (LinkedIn Callout) */
.highlight-box {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 2.5rem;
  margin-top: 3.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
}

.highlight-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-cyber);
}

.highlight-box h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.highlight-box p {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.linkedin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: #0077b5;
  color: white;
  padding: 0.9rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-body);
  transition: var(--transition-bezier);
}

.linkedin-btn:hover {
  background: #006399;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 119, 181, 0.4);
}

.linkedin-btn svg {
  fill: currentColor;
  width: 18px;
  height: 18px;
}

/* Skills Dashboard */
.skills-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.skills-container .section-title {
  margin-bottom: 1rem;
}

.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 2rem;
  transition: var(--transition-bezier);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.skill-category:hover {
  border-color: var(--border-glass-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-premium), 0 0 20px rgba(6, 182, 212, 0.05);
  transform: translateY(-5px);
}

.skill-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.skill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  font-size: 1.25rem;
}

.skill-header h4 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skill-tag {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition-fast);
}

.skill-tag:hover {
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}

/* Editorial Passions Grid */
.passions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}

.passion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition-bezier);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-premium);
  position: relative;
}

/* Premium gradient top line for each card */
.passion-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--gradient-cyber);
  transform: scaleX(0);
  transform-origin: left;
  transition: var(--transition-bezier);
}

.passion-card.moto::after {
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-cyan));
}

.passion-card.running::after {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
}

.passion-card.famiglia::after {
  background: var(--gradient-cyber);
}

.passion-card:hover {
  transform: translateY(-12px);
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-premium), 0 10px 30px rgba(6, 182, 212, 0.08);
}

.passion-card:hover::after {
  transform: scaleX(1);
}

.passion-img-container {
  height: 250px;
  overflow: hidden;
  position: relative;
}

/* Editorial vignette overlay on images */
.passion-img-container::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to top, rgba(11, 19, 41, 0.95), transparent);
  z-index: 2;
}

.passion-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(40%) contrast(1.1);
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
}

.passion-card:hover .passion-img {
  transform: scale(1.08);
  filter: grayscale(0%) contrast(1);
}

/* la foto della moto e' verticale: inquadratura piu' alta per tenere manubrio e parabrezza */
.passion-card.moto .passion-img {
  object-position: 50% 38%;
}

.passion-info {
  padding: 2.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.passion-badge {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 0.4rem 1rem;
  border-radius: 30px;
  align-self: flex-start;
  margin-bottom: 1.5rem;
}

.moto .passion-badge {
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.running .passion-badge {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.famiglia .passion-badge {
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.passion-card h3 {
  font-family: var(--font-title);
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}

.passion-card p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 2rem;
}

.passion-stat {
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.passion-stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-weight: 500;
}

.passion-stat-value {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
}

.moto .passion-stat-value { color: var(--accent-amber); }
.running .passion-stat-value { color: var(--accent-cyan); }
.famiglia .passion-stat-value { color: var(--accent-emerald); }

/* High-Impact Contact Section */
.contact {
  text-align: center;
  max-width: 900px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 36px;
  padding: 5rem 3rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-cyber);
}

.contact-card h2 {
  font-family: var(--font-title);
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: -1px;
}

.contact-card p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  font-weight: 300;
  max-width: 650px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  padding: 1rem 2.5rem;
  border-radius: 50px;
  text-decoration: none;
  font-family: var(--font-body);
  color: var(--text-primary);
  font-weight: 600;
  transition: var(--transition-bezier);
}

.contact-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(6, 182, 212, 0.15);
}

.contact-item svg {
  fill: currentColor;
  width: 20px;
  height: 20px;
}

/* Footer Section */
footer {
  border-top: 1px solid var(--border-glass);
  background: var(--bg-darker);
  padding: 4rem 2rem;
  text-align: center;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.footer-logo {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.footer-logo span {
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Scroll Reveal Animations Class */
.reveal {
  opacity: 0;
  transform: translateY(45px);
  transition: opacity 0.9s ease-out, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Books Section Styling
   ========================================================================== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition-bezier);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-premium);
  position: relative;
}

.book-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--gradient-cyber);
  transform: scaleX(0);
  transform-origin: left;
  transition: var(--transition-bezier);
}

.book-card:hover {
  transform: translateY(-12px);
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-premium), 0 10px 30px rgba(6, 182, 212, 0.08);
}

.book-card:hover::after {
  transform: scaleX(1);
}

.book-cover-container {
  height: 380px;
  overflow: hidden;
  position: relative;
  background: #020617;
}

.book-cover-container::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(to top, rgba(11, 19, 41, 0.98), transparent);
  z-index: 2;
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(20%) contrast(1.05);
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
}

.book-card:hover .book-cover {
  transform: scale(1.06);
  filter: grayscale(0%) contrast(1);
}

.book-overlay-text {
  position: absolute;
  bottom: 1.5rem;
  left: 2rem;
  right: 2rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.book-overlay-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.book-overlay-author {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

.book-info {
  padding: 2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.book-badge {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 0.35rem 0.85rem;
  border-radius: 30px;
  align-self: flex-start;
  margin-bottom: 1rem;
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.book-card h3 {
  display: none;
}

.book-card > .book-info > .book-author {
  display: none;
}

.book-publisher {
  font-size: 0.78rem;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: var(--font-body);
}

.book-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  font-weight: 300;
  margin-bottom: 1rem;
}

.book-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.book-trait {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  padding: 0.3rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  font-family: var(--font-body);
}

.book-why {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-glass);
}

.books-year-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
  margin-top: 1rem;
}

.books-year-header h3 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  white-space: nowrap;
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.books-year-note {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  font-style: italic;
  white-space: nowrap;
  opacity: 0.85;
}

.books-year-rule {
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

.books-year-block {
  margin-bottom: 5rem;
}

.book-top-pick {
  font-size: 0.68rem;
  background: var(--gradient-cyber);
  color: #020617;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
  vertical-align: middle;
  margin-left: 6px;
}

.book-rating {
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rating-stars {
  color: #fbbf24;
  font-size: 0.9rem;
  letter-spacing: 2px;
}

.rating-rank {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* ==========================================================================
   Responsive Breakpoints & Media Queries
   ========================================================================== */

@media (max-width: 1200px) {
  .hero-name {
    font-size: 5.5rem;
  }
  
  .profile-grid {
    gap: 4rem;
  }
  
  .passions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

/* ===== FAQ / IN BREVE SECTION ===== */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.75rem 2rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.faq-item:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.faq-question {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 0.75rem;
  letter-spacing: 0.01em;
}

.faq-answer {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.faq-answer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.faq-answer a:hover {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  header {
    padding: 1.25rem 2rem;
  }
  
  header.scrolled {
    padding: 0.85rem 2rem;
  }
  
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 4rem;
  }
  
  .section-title {
    font-size: 2.8rem;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    z-index: 2000;
  }
  
  .lang-switcher {
    margin-right: 1.5rem;
  }
  
  /* Mobile Menu Slide-out Drawer */
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid var(--border-glass);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    transition: var(--transition-bezier);
    z-index: 1500;
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
  
  .hero-name {
    font-size: 3.8rem;
  }
  
  .hero-tagline {
    font-size: 1.25rem;
  }
  
  .hero-cta {
    flex-direction: column;
    width: 100%;
    padding: 0 1rem;
  }
  
  .hero-cta .btn {
    width: 100%;
  }
  
  .passions-grid {
    grid-template-columns: 1fr;
  }

  .books-grid {
    grid-template-columns: 1fr;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 2.4rem;
  }
  
  .contact-card {
    padding: 4rem 1.5rem;
  }
  
  .contact-card h2 {
    font-size: 2.2rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0.85rem 0.75rem;
  }

  header.scrolled {
    padding: 0.7rem 0.75rem;
  }

  .logo {
    font-size: 1.2rem;
    letter-spacing: -0.5px;
  }

  .hero-name {
    font-size: 3rem;
  }

  .hero-greeting {
    font-size: 0.8rem;
    letter-spacing: 3px;
  }

  .section-title {
    font-size: 2rem;
  }

  .lang-switcher {
    gap: 0.15rem;
    margin-right: 0.4rem;
  }

  .lang-btn {
    padding: 0.22rem 0.4rem;
    font-size: 0.65rem;
    gap: 0.2rem;
  }

  .flag-icon {
    width: 12px;
    height: 9px;
  }

  .menu-toggle {
    padding: 0.4rem;
  }

  section {
    padding: 5rem 1.25rem;
  }
}

/* ==========================================================================
   WOW LAYER — Effetti premium leggeri (solo CSS/JS nativo, GPU-friendly)
   ========================================================================== */

/* Selezione testo e focus accessibile */
::selection {
  background: rgba(6, 182, 212, 0.35);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Barra di progresso scroll (creata da script.js) */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-cyber);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 2001;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

/* Sequenza di entrata cinematografica del hero */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(34px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes nameSheen {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.hero-greeting {
  animation: riseIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.05s backwards;
}

.hero-name {
  background: linear-gradient(100deg, #ffffff 40%, var(--accent-cyan) 47%, var(--accent-emerald) 51%, #ffffff 58%, #94a3b8 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation:
    riseIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.18s backwards,
    nameSheen 9s linear 1.4s infinite;
}

.hero-tagline {
  animation: riseIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.34s backwards;
}

.hero-cta {
  animation: riseIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

.scroll-indicator {
  animation: riseIn 1s ease 0.9s backwards;
}

/* Deriva lenta dei glow blob (transform = compositor only) */
@keyframes blobDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(70px, 50px, 0) scale(1.08); }
}

.glow-blob-1 { animation: blobDrift 32s ease-in-out infinite; }
.glow-blob-2 { animation: blobDrift 40s ease-in-out -14s infinite reverse; }
.glow-blob-3 { animation: blobDrift 48s ease-in-out -26s infinite; }

/* Spotlight che segue il puntatore sulle card (solo desktop) */
@media (hover: hover) and (pointer: fine) {
  .skill-category,
  .faq-item {
    position: relative;
  }

  .skill-category::before,
  .book-card::before,
  .passion-card::before,
  .faq-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(560px circle at var(--mx, 50%) var(--my, 50%), rgba(6, 182, 212, 0.09), transparent 42%);
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
    z-index: 1;
  }

  .skill-category:hover::before,
  .book-card:hover::before,
  .passion-card:hover::before,
  .faq-item:hover::before {
    opacity: 1;
  }
}

/* Reveal a cascata delle card (classe .r-item aggiunta da script.js) */
.r-item {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.7s ease-out,
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.45s ease;
}

.r-item.active {
  opacity: 1;
  transform: translateY(0);
}

/* Ripristina il lift su hover dopo il reveal (specificita' pari, ordine conta) */
.book-card.r-item.active:hover,
.passion-card.r-item.active:hover {
  transform: translateY(-12px);
}

.skill-category.r-item.active:hover {
  transform: translateY(-5px);
}

.faq-item.r-item.active:hover {
  transform: translateY(-2px);
}

/* Scrollspy: link di navigazione della sezione corrente */
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  width: 100%;
}

/* Effetto "shine" sul bottone primario */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-18deg) translateX(-140%);
  transition: transform 0.75s ease;
  pointer-events: none;
}

.btn-primary:hover::before {
  transform: skewX(-18deg) translateX(450%);
}

/* Bottone back-to-top (creato da script.js) */
.back-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-glass-hover);
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s, border-color 0.25s ease, box-shadow 0.25s ease;
  z-index: 1200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.back-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-top:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.35);
}

.back-top svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
}

/* Bordo conico animato sulla contact card */
@property --ga {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes spinBorder {
  to { --ga: 360deg; }
}

.contact-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 36px;
  padding: 1.5px;
  background: conic-gradient(from var(--ga, 0deg), transparent 0% 8%, rgba(6, 182, 212, 0.75) 14%, rgba(16, 185, 129, 0.6) 20%, transparent 28% 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: spinBorder 8s linear infinite;
  pointer-events: none;
}

/* Evidenzia i libri TOP PICK con un bordo/glow dedicato */
.book-card:has(.book-top-pick) {
  border-color: rgba(6, 182, 212, 0.28);
}

.book-card:has(.book-top-pick):hover {
  box-shadow: var(--shadow-premium), 0 0 30px rgba(6, 182, 212, 0.15);
}

/* Rendering differito delle card libri (22 card = meno lavoro al load) */
.book-card {
  content-visibility: auto;
  contain-intrinsic-size: 400px 680px;
}

/* Header libri: consenti il wrap della nota su schermi stretti */
.books-year-header {
  flex-wrap: wrap;
  row-gap: 0.35rem;
}

/* Mobile: alleggerisci gli effetti pesanti e rifinisci il layout */
@media (max-width: 768px) {
  .glow-blob {
    filter: blur(70px);
    opacity: 0.09;
    animation: none;
  }

  .glow-blob-1 { width: 340px; height: 340px; }
  .glow-blob-2 { width: 380px; height: 380px; }
  .glow-blob-3 { width: 340px; height: 340px; }

  .books-year-note {
    white-space: normal;
  }

  .back-top {
    right: 1rem;
    bottom: 1rem;
    width: 44px;
    height: 44px;
  }

  /* Overlay scuro dietro al drawer di navigazione */
  .nav-links.active {
    box-shadow: 0 0 0 100vmax rgba(2, 6, 23, 0.65);
  }

  .book-card {
    contain-intrinsic-size: 340px 700px;
  }
}

/* ==========================================================================
   WOW LAYER 2.0 — Tech & Innovation (canvas, typewriter, cursor, tilt, ticker)
   ========================================================================== */

:root {
  --accent-violet: #8b5cf6;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* Terzo blob in violet: profondita' cromatica "AI-era" */
.glow-blob-3 {
  background: var(--accent-violet);
}

/* Canvas costellazione nel hero (dietro al contenuto) */
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.scroll-indicator {
  z-index: 10;
}

/* Eyebrow in mono con effetto decrypt */
.hero-greeting {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 3px;
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: currentColor;
  color: var(--accent-cyan);
}

/* Sheen del nome esteso al violet */
.hero-name {
  background: linear-gradient(105deg, #ffffff 36%, var(--accent-cyan) 45%, var(--accent-violet) 51%, var(--accent-emerald) 57%, #ffffff 66%, #94a3b8 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Riga ruoli typewriter */
.hero-roles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-secondary);
  min-height: 1.8em;
  margin-bottom: 1.75rem;
  animation: riseIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.28s backwards;
}

.hero-role-prefix {
  color: var(--accent-emerald);
  font-weight: 600;
}

.hero-role-text {
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.hero-caret {
  display: inline-block;
  width: 9px;
  height: 1.15em;
  background: var(--accent-cyan);
  animation: caretBlink 1.05s steps(1) infinite;
}

@keyframes caretBlink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0; }
}

/* Stats con contatori animati */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: center;
  gap: 2.75rem;
  margin-top: 2.5rem;
  animation: riseIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.66s backwards;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
}

.stat:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -1.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 60%;
  background: linear-gradient(to bottom, transparent, rgba(6, 182, 212, 0.35), transparent);
}

.stat-num {
  font-family: var(--font-title);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

/* Etichetta scroll in mono */
.scroll-indicator .scroll-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 4px;
  text-transform: lowercase;
  color: var(--text-secondary);
}

/* Ticker competenze a scorrimento infinito */
.tech-marquee {
  border-top: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
  padding: 1.1rem 0;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: 2.4rem;
  width: max-content;
  animation: marqueeScroll 30s linear infinite;
}

.tech-marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-track span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.marquee-track i {
  font-style: normal;
  font-size: 0.6rem;
  color: var(--accent-cyan);
  opacity: 0.7;
}

@keyframes marqueeScroll {
  to { transform: translateX(-50%); }
}

/* Numero di sezione in mono */
.section-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent-violet);
  opacity: 0.85;
  margin-bottom: 0.6rem;
}

/* Cursore personalizzato: punto + anello con inseguimento fluido */
@media (hover: hover) and (pointer: fine) {
  .cursor-dot,
  .cursor-ring {
    position: fixed;
    left: 0;
    top: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3000;
    opacity: 0;
    will-change: transform;
  }

  .cursor-dot {
    width: 6px;
    height: 6px;
    margin-left: -3px;
    margin-top: -3px;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
  }

  .cursor-ring {
    width: 34px;
    height: 34px;
    margin-left: -17px;
    margin-top: -17px;
    border: 1.5px solid rgba(6, 182, 212, 0.5);
    transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease, border-color 0.25s ease, opacity 0.3s ease;
  }

  .cursor-ring.big {
    width: 56px;
    height: 56px;
    margin-left: -28px;
    margin-top: -28px;
    border-color: rgba(139, 92, 246, 0.75);
  }
}

/* Tilt 3D: transizione rapida mentre il mouse e' sulla card */
.r-item.tilting {
  transition:
    opacity 0.7s ease-out,
    transform 0.14s ease-out,
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.45s ease;
}

/* Bottoni magnetici: ritorno elastico */
.magnet {
  transition: transform 0.28s cubic-bezier(0.33, 1.6, 0.5, 1);
}

/* Mobile: stats 2x2, ruoli piu' compatti, ticker piu' lento non serve */
@media (max-width: 768px) {
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 0;
    margin-top: 2.25rem;
    width: 100%;
  }

  .stat:not(:last-child)::after {
    display: none;
  }

  .stat:nth-child(odd)::after {
    content: '';
    display: block;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background: linear-gradient(to bottom, transparent, rgba(6, 182, 212, 0.35), transparent);
  }

  .hero-roles {
    font-size: 0.88rem;
  }

  .hero-tagline {
    font-size: 1.25rem;
  }

  .marquee-track {
    animation-duration: 22s;
  }
}

/* Riga titolo contatti con logo LinkedIn */
.contact-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.contact-title-row h2 {
  margin-bottom: 0 !important;
}

.contact-li-icon {
  width: 42px;
  height: 42px;
  fill: #0a66c2;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(10, 102, 194, 0.45));
}

@media (max-width: 480px) {
  .contact-li-icon {
    width: 32px;
    height: 32px;
  }

  .contact-title-row {
    gap: 0.75rem;
  }
}

/* ==========================================================================
   FAQ TERMINALE — la sezione "In Breve" come sessione di terminale
   ========================================================================== */

.terminal {
  max-width: 950px;
  margin: 0 auto;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
}

/* Scanline ultra-leggere per il feel CRT */
.terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid var(--border-glass);
}

.t-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.t-red { background: #ff5f57; }
.t-yellow { background: #febc2e; }
.t-green { background: #28c840; }

.t-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 0 auto;
  transform: translateX(-22px);
}

.terminal-body {
  padding: 2rem 2.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* Reset dello stile card ereditato da .faq-item */
.terminal .faq-item {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.terminal .faq-item::before {
  display: none;
}

.terminal .faq-item:hover,
.terminal .faq-item.r-item.active:hover {
  border-color: transparent;
  transform: none;
}

.faq-q-line {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.t-prompt {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-emerald);
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal .faq-question {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  max-width: 40ch;
}

/* La domanda viene "digitata" quando la riga entra in scena */
.faq-item.active .faq-question {
  animation: typeCmd 1s steps(34, end) both;
}

@keyframes typeCmd {
  from { max-width: 0; }
  to { max-width: 40ch; }
}

/* L'output appare dopo la digitazione */
.terminal .faq-answer {
  margin: 0.7rem 0 0 0.35rem;
  padding-left: 1.1rem;
  border-left: 2px solid rgba(6, 182, 212, 0.3);
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.75;
}

.faq-item.active .faq-answer {
  animation: fadeAns 0.5s ease-out 0.95s backwards;
}

@keyframes fadeAns {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* Cascata: ogni riga parte leggermente dopo la precedente */
.terminal-body .faq-item:nth-child(2).active .faq-question { animation-delay: 0.45s; }
.terminal-body .faq-item:nth-child(2).active .faq-answer { animation-delay: 1.4s; }
.terminal-body .faq-item:nth-child(3).active .faq-question { animation-delay: 0.9s; }
.terminal-body .faq-item:nth-child(3).active .faq-answer { animation-delay: 1.85s; }
.terminal-body .faq-item:nth-child(4).active .faq-question { animation-delay: 1.35s; }
.terminal-body .faq-item:nth-child(4).active .faq-answer { animation-delay: 2.3s; }
.terminal-body .faq-item:nth-child(5).active .faq-question { animation-delay: 1.8s; }
.terminal-body .faq-item:nth-child(5).active .faq-answer { animation-delay: 2.75s; }

/* Riga finale con cursore lampeggiante */
.t-endline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.t-cursor {
  width: 9px;
  height: 1.05em;
  background: var(--accent-cyan);
  animation: caretBlink 1.05s steps(1) infinite;
}

/* Terminale interattivo: input reale e cronologia comandi */
.t-input {
  flex: 1;
  min-width: 60px;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
  caret-color: var(--accent-cyan);
  padding: 0;
}

.t-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.8;
}

.terminal-body {
  cursor: text;
}

.term-cmdline {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.term-out {
  white-space: pre-line;
  margin: 0.6rem 0 0 0.35rem;
  padding-left: 1.1rem;
  border-left: 2px solid rgba(139, 92, 246, 0.35);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.75;
}

.term-out a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.term-out a:hover {
  text-decoration: underline;
}

.matrix-canvas {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* Micro-interazione: lift sugli skill tag */
.skill-tag:hover {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .terminal-body {
    padding: 1.5rem 1.1rem 1.4rem;
    gap: 1.4rem;
  }

  .faq-q-line {
    gap: 0.5rem;
  }

  .t-prompt {
    font-size: 0.75rem;
  }

  /* Su mobile le domande vanno a capo: niente clip typewriter */
  .terminal .faq-question {
    white-space: normal;
    max-width: none;
    font-size: 0.88rem;
  }

  .faq-item.active .faq-question {
    animation: fadeAns 0.5s ease-out backwards;
  }

  .terminal .faq-answer {
    font-size: 0.9rem;
    padding-left: 0.9rem;
  }
}

/* ==========================================================================
   COOKIE CONSENT BANNER — Google Analytics caricato solo dopo consenso
   ========================================================================== */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;
  background: rgba(2, 6, 23, 0.95);
  border-top: 1px solid var(--border-glass-hover);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
}

.cookie-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.cookie-banner-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 780px;
  margin: 0;
}

.cookie-banner-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.cookie-btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.6rem 1.4rem;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.cookie-btn-accept {
  background: var(--gradient-cyber);
  color: #020617;
  border: none;
}

.cookie-btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.3);
}

.cookie-btn-reject {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
}

.cookie-btn-reject:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.footer-cookie-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
  margin-top: 0.25rem;
}

.footer-cookie-link:hover {
  color: var(--accent-cyan);
}

@media (max-width: 640px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .cookie-banner-actions {
    justify-content: flex-end;
  }
}

/* ==========================================================================
   AURIBOT — chatbot terminale flottante in basso a destra
   ========================================================================== */

.abot-launcher {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-cyber);
  color: #020617;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.abot-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(6, 182, 212, 0.5);
}

.abot-glyph {
  pointer-events: none;
}

.abot-ping {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent-violet);
  animation: abotPing 2s ease-out infinite;
}

@keyframes abotPing {
  0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.abot-panel {
  position: fixed;
  right: 1.5rem;
  bottom: 5.8rem;
  width: 375px;
  max-width: calc(100vw - 2rem);
  height: 540px;
  max-height: calc(100vh - 8rem);
  background: rgba(2, 6, 23, 0.94);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: 18px;
  box-shadow: var(--shadow-premium), 0 0 40px rgba(6, 182, 212, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1399;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.abot-panel.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.abot-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.abot-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-left: 0.4rem;
}

.abot-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  transition: color 0.2s ease;
}

.abot-close:hover {
  color: var(--text-primary);
}

.abot-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.abot-msg {
  max-width: 90%;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
}

.abot-msg.bot {
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-glass);
  border-left: 2px solid rgba(139, 92, 246, 0.55);
  color: var(--text-secondary);
  white-space: pre-line;
}

.abot-msg.user {
  align-self: flex-end;
  background: rgba(6, 182, 212, 0.13);
  border: 1px solid rgba(6, 182, 212, 0.28);
  color: #e2e8f0;
}

.abot-msg a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.abot-msg a:hover {
  text-decoration: underline;
}

.abot-typing {
  display: flex;
  gap: 5px;
  padding: 0.75rem 0.9rem;
}

.abot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: abotDot 1.2s ease-in-out infinite;
}

.abot-typing span:nth-child(2) { animation-delay: 0.15s; }
.abot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes abotDot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.abot-chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.abot-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0.32rem 0.75rem;
  border-radius: 30px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.07);
  color: #67e8f9;
  cursor: pointer;
  transition: var(--transition-fast);
}

.abot-chip:hover {
  background: rgba(6, 182, 212, 0.18);
  transform: translateY(-1px);
}

.abot-inputrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.abot-prompt {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-emerald);
}

.abot-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  caret-color: var(--accent-cyan);
}

.abot-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.8;
}

/* Badge "Powered by Claude · Anthropic" nel widget */
.abot-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.claude-spark {
  width: 11px;
  height: 11px;
  color: #d97757;
  flex-shrink: 0;
}

/* Badge nel footer del sito */
.footer-powered {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-powered .claude-spark {
  width: 12px;
  height: 12px;
}

/* Il back-to-top sale sopra il launcher del bot */
.back-top {
  bottom: 6.4rem;
}

@media (max-width: 768px) {
  .abot-launcher {
    right: 1rem;
    bottom: 1rem;
    width: 50px;
    height: 50px;
  }

  .abot-panel {
    right: 0.75rem;
    bottom: 4.9rem;
    height: 62vh;
  }

  .back-top {
    right: 1rem;
    bottom: 5.6rem;
  }
}

/* Accessibilita': rispetta la preferenza per il movimento ridotto */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .r-item {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ==========================================================================
   LETTURE — cilindro 3D (modulo "Books cylinder" in script.js)
   Ogni libro e' un volume: copertina, quarta di copertina, dorso e pagine.
   L'elenco nel HTML (#books-source) resta la fonte dei dati e il fallback senza JS.
   ========================================================================== */
.bc { display: none; }

.js .bc {
  display: block;
  position: relative;
  margin-inline: -2rem;
  padding-inline: 2rem;
  overflow-x: clip;
}

.js #letture:not(.bc-failed) .books-source { display: none; }
.js #letture.bc-failed .bc { display: none; }
.js #letture:not(.bc-failed) .section-header { margin-bottom: 1.75rem; }

/* ---------- Filtri sotto il titolo ---------- */
.bc-filters {
  position: relative;
  z-index: 6;
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.3rem;
  margin-bottom: 1.25rem;
  border-radius: 40px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.bc-filter {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: 0;
  padding: 0.6rem 1rem;
  border-radius: 30px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, background 0.25s ease;
}

.bc-filter:hover { color: var(--text-primary); }
.bc-filter:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

.bc-filter[aria-selected="true"] {
  background: var(--gradient-cyber);
  color: #020617;
  font-weight: 600;
}

.bc-fs { display: none; }
.bc-n { margin-left: 0.4em; opacity: 0.55; }
.bc-filter[aria-selected="true"] .bc-n { opacity: 0.7; }

/* ---------- Scena 3D: il cilindro ---------- */
.bc-scene {
  --bc-o: 0;
  position: relative;
  width: 100%;
  height: clamp(420px, 60vh, 580px);
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.bc-scene.is-ready { --bc-o: 1; }
.bc-scene.switching { --bc-o: 0; }
.bc-scene.is-drag { cursor: grabbing; }

.bc-glow {
  position: absolute;
  left: 50%;
  top: var(--bc-cy, 50%);
  width: min(92vw, 1180px);
  height: 86%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(139, 92, 246, 0.16), rgba(6, 182, 212, 0.07) 55%, transparent 80%);
}

.bc-floor {
  position: absolute;
  left: 50%;
  top: calc(var(--bc-cy, 50%) + var(--bc-h, 340px) * 0.47);
  width: min(70vw, calc(var(--bc-w, 220px) * 4.2));
  height: calc(var(--bc-w, 220px) * 0.34);
  transform: translateX(-50%);
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(6, 182, 212, 0.26), rgba(6, 182, 212, 0.07) 60%, transparent 100%);
  filter: blur(6px);
}

.bc-ring {
  position: absolute;
  left: 50%;
  top: var(--bc-cy, 50%);
  z-index: 1;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

/* bordi del tamburo (ellissi in prospettiva, disegnate da JS) */
.bc-rim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.bc-rim-back { z-index: 0; }
.bc-rim-front { z-index: 2; }

.bc-rim path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 1;
}

.bc-rim-front path { stroke: rgba(103, 232, 249, 0.42); }
.bc-rim-back path { stroke: rgba(148, 163, 184, 0.16); }

/* ---------- Il libro: un parallelepipedo con 6 facce ---------- */
.bc-book {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--bc-w);
  height: var(--bc-h);
  margin: calc(var(--bc-h) / -2) 0 0 calc(var(--bc-w) / -2);
  transform-style: preserve-3d;
  -webkit-tap-highlight-color: transparent;
}

.bc-book[hidden] { display: none; }

.bc-book > span {
  position: absolute;
  display: block;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  opacity: var(--bc-o, 0);
  transition: opacity 0.8s ease;
}

.bc-scene.switching .bc-book > span { transition-duration: 0.18s; }

/* ogni faccia si scurisce quando il libro va verso i lati / il retro */
.bc-book > span::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: var(--bg-darker);
  opacity: var(--bc-dim, 0);
}

/* le facce non visibili da dove si guarda non occupano memoria grafica */
.bc-book[data-f="0"] .bc-front,
.bc-book[data-f="0"] .bc-top,
.bc-book[data-f="0"] .bc-hit { display: none; }
.bc-book[data-b="0"] .bc-back { display: none; }

/* copertina (davanti) */
.bc-front {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(calc(var(--bc-t) / 2));
  overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  background: var(--bg-dark);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: opacity 0.8s ease, box-shadow 0.35s ease;
  -webkit-box-reflect: below 5px linear-gradient(transparent 84%, rgba(255, 255, 255, 0.2));
}

.bc-front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

/* cerniera: bordo chiaro + piega vicino al dorso */
.bc-front::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0, rgba(255, 255, 255, 0) 2.6%, rgba(0, 0, 0, 0.24) 3.4%, rgba(0, 0, 0, 0) 8%);
}

/* riflesso che scorre mentre il cilindro gira */
.bc-shine {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.15) 50%, transparent 60%);
  background-size: 320% 100%;
  background-position: calc(50% + var(--bc-sh, 0) * -2.4%) 0;
}

.bc-book.is-active .bc-front {
  box-shadow: 0 0 0 1.5px rgba(6, 182, 212, 0.85), 0 34px 70px -22px rgba(6, 182, 212, 0.5);
}

/* quarta di copertina (dietro): tinta del libro, titolo, sinossi a righe irregolari e codice a barre */
.bc-back {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg) translateZ(calc(var(--bc-t) / 2));
  overflow: hidden;
  border-radius: 5px 2px 2px 5px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  background:
    repeating-linear-gradient(90deg, #111827 0 1px, transparent 1px 3px) right 9% bottom 6% / 24% 8% no-repeat,
    linear-gradient(#f1ede2, #f1ede2) right 9% bottom 6% / 24% 8% no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.62)) left 12% top 9% / 58% 3px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.4)) left 12% top 13% / 40% 3px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)) left 12% top 20% / 76% 1px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)) left 12% top 26% / 76% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)) left 12% top 30% / 70% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)) left 12% top 34% / 76% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)) left 12% top 38% / 64% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)) left 12% top 42% / 74% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)) left 12% top 46% / 52% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)) left 12% top 56% / 68% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)) left 12% top 60% / 76% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.22)) left 12% top 64% / 44% 2px no-repeat,
    linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 8%),
    var(--bc-bk, #1e293b);
}

/* dorso (a sinistra) con il titolo */
.bc-spine {
  left: calc(50% - var(--bc-t) / 2);
  top: 0;
  width: var(--bc-t);
  height: 100%;
  transform: rotateY(-90deg) translateZ(calc(var(--bc-w) / 2));
  overflow: hidden;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0, rgba(255, 255, 255, 0) 22%, rgba(0, 0, 0, 0.3) 100%),
    var(--bc-spine, #0f172a);
}

.bc-st {
  position: absolute;
  inset: 7% 0;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-family: var(--font-title);
  font-size: calc(var(--bc-t) * 0.34);
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* pagine: taglio anteriore (a destra), superiore e inferiore */
.bc-fore {
  left: calc(50% - var(--bc-t) / 2);
  top: 0;
  width: var(--bc-t);
  height: 100%;
  transform: rotateY(90deg) translateZ(calc(var(--bc-w) / 2));
  background:
    linear-gradient(0deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 8%, rgba(0, 0, 0, 0) 92%, rgba(0, 0, 0, 0.22)),
    linear-gradient(90deg, var(--bc-board, #0b1329) 0, var(--bc-board, #0b1329) 7%, transparent 7%, transparent 93%, var(--bc-board, #0b1329) 93%),
    repeating-linear-gradient(90deg, #f3eee2 0 1.5px, #dbd4c1 1.5px 3px);
}

.bc-pgt,
.bc-pgb {
  left: 0;
  top: calc(50% - var(--bc-t) / 2);
  width: 100%;
  height: var(--bc-t);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 6%, rgba(0, 0, 0, 0) 94%, rgba(0, 0, 0, 0.16)),
    linear-gradient(0deg, var(--bc-board, #0b1329) 0, var(--bc-board, #0b1329) 7%, transparent 7%, transparent 93%, var(--bc-board, #0b1329) 93%),
    repeating-linear-gradient(0deg, #f3eee2 0 1.5px, #dbd4c1 1.5px 3px);
}

.bc-pgt { transform: rotateX(90deg) translateZ(calc(var(--bc-h) / 2)); }
.bc-pgb { transform: rotateX(-90deg) translateZ(calc(var(--bc-h) / 2)); }

/* coccarda dorata TOP PICK, in alto a destra della copertina (SVG creato da script.js) */
.bc-top {
  top: calc(var(--bc-w) * -0.09);
  right: calc(var(--bc-w) * -0.095);
  width: max(38px, calc(var(--bc-w) * 0.21));
  transform: translateZ(calc(var(--bc-t) / 2 + 4px)) rotate(7deg);
  transform-origin: 50% 35%;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)) brightness(calc(1 - var(--bc-dim, 0) * 0.85));
  pointer-events: none;
}

.bc-top svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* la coccarda ha una sagoma irregolare: si scurisce con brightness, non con il velo rettangolare */
.bc-book > span.bc-top::after { display: none; }

/* bottone trasparente sopra la copertina: tastiera, focus e lettori di schermo */
.bc-hit {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: transparent;
  cursor: inherit;
  transform: translateZ(calc(var(--bc-t) / 2 + 2px));
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bc-hit:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 5px;
  border-radius: 4px;
}

/* ---------- Frecce laterali ---------- */
.bc-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 54px;
  height: 54px;
  margin-top: -27px;
  border-radius: 50%;
  font: inherit;
  font-size: 1.15rem;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.bc-prev { left: clamp(0.4rem, 3vw, 2.6rem); }
.bc-next { right: clamp(0.4rem, 3vw, 2.6rem); }

.bc-arrow:hover { color: var(--text-primary); border-color: rgba(6, 182, 212, 0.38); }
.bc-prev:hover { transform: translateX(-2px); }
.bc-next:hover { transform: translateX(2px); }
.bc-arrow:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 3px; }

/* ---------- Contatore (e suggerimento di gesto su touch) ---------- */
.bc-meta {
  position: absolute;
  left: 50%;
  bottom: 0.2rem;
  z-index: 4;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.4rem 1rem;
  border-radius: 30px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #64748b;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
}

.bc-count { color: var(--text-primary); font-weight: 600; letter-spacing: 1.6px; }
.bc-hint { display: none; }
.bc-hm { display: none; }

/* ---------- Scheda del libro in primo piano ---------- */
.bc-detail {
  --bc-detail-h: 208px;
  position: relative;
  z-index: 5;
  width: min(760px, 100%);
  height: var(--bc-detail-h);
  margin: 0 auto;
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
}

.bc-detail.swap > * { animation: bcDetailIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.bc-detail.swap > *:nth-child(2) { animation-delay: 0.04s; }
.bc-detail.swap > *:nth-child(3) { animation-delay: 0.08s; }
.bc-detail.swap > *:nth-child(4) { animation-delay: 0.12s; }
.bc-detail.swap > *:nth-child(5) { animation-delay: 0.16s; }

@keyframes bcDetailIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.bc-d-head {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  margin-bottom: 0.6rem;
}

.bc-d-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #67e8f9;
  padding: 0.28rem 0.7rem;
  border-radius: 30px;
  border: 1px solid rgba(6, 182, 212, 0.28);
  background: rgba(6, 182, 212, 0.08);
}

.bc-d-top {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #3b2305;
  padding: 0.28rem 0.7rem;
  border-radius: 30px;
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 50%, #d98a0b 100%);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.bc-d-top[hidden] { display: none; }

.bc-d-stars { color: #fbbf24; font-size: 0.82rem; letter-spacing: 2px; }
.bc-d-stars .off { color: rgba(251, 191, 36, 0.22); }

.bc-d-pub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: #64748b;
}

.bc-d-title {
  max-width: 100%;
  font-family: var(--font-title);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.5px;
  text-wrap: balance;
}

.bc-d-author {
  margin: 0.35rem 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.bc-d-desc,
.bc-d-why {
  max-width: 66ch;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bc-d-desc {
  -webkit-line-clamp: 3;
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--text-secondary);
}

.bc-d-why {
  -webkit-line-clamp: 2;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ---------- Touch: niente riflessi (piu' leggero), suggerimento di gesto ---------- */
@media (hover: none) {
  .bc-front { -webkit-box-reflect: none; }
  .bc-hint { display: inline; }
  .bc-hd { display: none; }
  .bc-hm { display: inline; }
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .bc-scene { height: clamp(450px, 124vw, 540px); }

  .bc-arrow {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    font-size: 0.95rem;
    background: rgba(2, 6, 23, 0.55);
  }

  .bc-prev { left: 0.3rem; }
  .bc-next { right: 0.3rem; }

  .bc-filter { font-size: 0.6rem; padding: 0.55rem 0.7rem; letter-spacing: 0.8px; }
  .bc-fl { display: none; }
  .bc-fs { display: inline; }

  .bc-meta { font-size: 0.58rem; gap: 0.7rem; padding: 0.35rem 0.85rem; }
  .bc-hint { display: inline; }
  .bc-hd { display: none; }
  .bc-hm { display: inline; }

  .bc-detail { --bc-detail-h: 224px; padding-top: 0.5rem; }
  .bc-d-why,
  .bc-d-pub { display: none; }
  .bc-d-title { font-size: 1.2rem; }
  .bc-d-author { margin: 0.25rem 0 0.5rem; font-size: 0.64rem; }
  .bc-d-desc { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .js .bc { margin-inline: -1.25rem; padding-inline: 1.25rem; }
}

/* ==========================================================================
   NAVIGAZIONE RAPIDA LATERALE — puntini a sinistra (desktop e mobile)
   Poco invasiva: puntini piccoli e semi-trasparenti, etichette solo al passaggio del
   mouse / alla tastiera o per un attimo quando cambia la sezione (script.js).
   ========================================================================== */
.side-nav {
  position: fixed;
  left: 0.35rem;
  top: 50%;
  z-index: 900;
  transform: translateY(-50%);
  opacity: 0.55;
  transition: opacity 0.35s ease;
}

.side-nav:hover,
.side-nav:focus-within,
.side-nav.is-scrolling,
.side-nav.peek { opacity: 1; }

.side-nav ul {
  position: relative;
  list-style: none;
  display: flex;
  flex-direction: column;
}

/* filo sottile che unisce i puntini */
.side-nav ul::before {
  content: '';
  position: absolute;
  left: calc(0.3rem + 3px);
  top: 15px;
  bottom: 15px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(148, 163, 184, 0.24) 14%, rgba(148, 163, 184, 0.24) 86%, transparent);
  pointer-events: none;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 0.6rem 0 0.3rem;
  color: var(--text-secondary);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.side-nav a:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: -2px;
  border-radius: 12px;
}

.sn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.55);
  /* alone scuro: il puntino resta leggibile anche sopra le immagini chiare */
  box-shadow: 0 0 0 3px rgba(2, 6, 23, 0.55);
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-radius 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
}

.side-nav a.passed .sn-dot { background: rgba(6, 182, 212, 0.55); }

.side-nav a.active .sn-dot {
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--accent-cyan), var(--accent-emerald));
  box-shadow: 0 0 0 3px rgba(2, 6, 23, 0.55), 0 0 12px rgba(6, 182, 212, 0.55);
}

.side-nav a:focus-visible .sn-dot { transform: scale(1.3); }

.sn-label {
  position: absolute;
  left: 100%;
  top: 50%;
  margin-left: 0.15rem;
  transform: translate(-6px, -50%);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 0.32rem 0.75rem;
  border-radius: 30px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-primary);
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.side-nav a:focus-visible .sn-label,
.side-nav.peek a.active .sn-label {
  opacity: 1;
  transform: translate(0, -50%);
}

@media (hover: hover) {
  .side-nav a:hover .sn-dot { transform: scale(1.3); background: var(--accent-cyan); }
  .side-nav a.active:hover .sn-dot { background: linear-gradient(180deg, var(--accent-cyan), var(--accent-emerald)); }

  .side-nav a:hover .sn-label {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

/* ---------- Mobile: puntini ancora piu' piccoli, area di tocco alta, resta nel margine della pagina ---------- */
@media (max-width: 820px) {
  .side-nav { left: 0.05rem; opacity: 0.5; }
  .side-nav a { height: 34px; padding: 0 0.45rem 0 0.25rem; }
  .side-nav ul::before { left: calc(0.25rem + 3px); top: 17px; bottom: 17px; }
  .sn-dot { width: 6px; height: 6px; }
  .side-nav a.active .sn-dot { height: 20px; }

  /* le frecce del cilindro libri non devono finire sotto i puntini */
  .bc-prev { left: 1.4rem; }
  .bc-next { right: 1.4rem; }
}

@media (min-width: 821px) {
  .bc-prev { left: clamp(2rem, 3vw, 2.6rem); }
  .bc-next { right: clamp(2rem, 3vw, 2.6rem); }
}
