@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

@font-face {
  font-family: 'Frontage';
  src: url("asset/Frontage W00 Regular (1).ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-page: #f9f9fb;
  --bg-card: #ffffff;
  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --accent-color: #000000;
  --border-color: rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(249, 249, 251, 0.7);
  --glass-scroll: rgba(249, 249, 251, 0.95);
  
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Frontage', sans-serif;
  
  --radius-large: 24px;
  --radius-small: 16px;
  --transition-smooth: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="dark"] {
  --bg-page: #0d0d0e;
  --bg-card: #161618;
  --text-main: #f5f5f7;
  --text-muted: #86868b;
  --accent-color: #ffffff;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(13, 13, 14, 0.75);
  --glass-scroll: rgba(13, 13, 14, 0.95);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 15px; }

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-image: url("asset/LOGO%20G.C..jpg"); 
  background-size: 40%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.30; 
  mix-blend-mode: multiply;
  z-index: -2;
  pointer-events: none;
}

/* Luce Verde Soffusa d'Ambiente in Dark Mode */
[data-theme="dark"] body::after {
  content: '';
  position: fixed;
  top: 25%; left: 50%;
  transform: translate(-50%, -50%);
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(36, 138, 82, 0.07) 0%, rgba(0,0,0,0) 75%);
  z-index: -3;
  pointer-events: none;
  filter: blur(60px);
}

[data-theme="dark"] body::before {
  opacity: 0.03;
  mix-blend-mode: screen;
  filter: invert(1);
}

/* ==========================================
   ANIMAZIONE TRANSIZIONE MATITA
   ========================================== */
.page-transition-wrapper {
  position: fixed; top: -20vh; left: -10vw; width: 120vw; height: 140vh;
  z-index: 99999; pointer-events: none;
  transform: rotate(-4deg); 
  transform-origin: center;
}
.transition-bg {
  position: absolute; top: 50%; left: 0;
  width: 100%; height: 0;
  background: #ffffff; 
  transform: translateY(-50%);
  transition: height 2.0s cubic-bezier(0.9, 0, 0.4, 2);
}
[data-theme="dark"] .transition-bg { background: var(--bg-page); }
.transition-line {
  position: absolute; top: 50%; left: 0;
  width: 0; height: 30px; 
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='30' viewBox='0 0 150 30'%3E%3Cpath d='M0,15 Q15,12 30,16 T60,14 T90,17 T120,13 T150,15' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");  background-repeat: repeat-x;
  background-position: left center;
  background-color: transparent; 
  transform: translateY(-50%);
  transition: width 2.0s cubic-bezier(0.77, 0, 0.4, 2);
  stroke: #000000; 
}
[data-theme="dark"] .transition-line { filter: invert(1); }
.transition-pencil {
  position: absolute; right: -8px; top: 50%; transform: translateY(-100%); width: 38px; height: 38px; stroke: #000000; 
}

.page-transition-wrapper.state-draw .transition-line { width: 100%; }
.page-transition-wrapper.state-expand .transition-line { width: 100%; }
.page-transition-wrapper.state-expand .transition-bg { height: 100%; }

/* ==========================================
   UI COMPONENTS & NAVBAR
   ========================================== */
.glass-nav {
  position: fixed; top: 0; width: 100%; z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0; transition: all 0.3s ease;
}
.nav-content {
  max-width: 1200px; margin: 0 auto; padding: 0 2rem;
  display: flex; justify-content: space-between; align-items: center;
}
.logo-link { display: flex; align-items: center; }
.footer-logo { max-width: 220px; height: auto; mix-blend-mode: multiply; transition: filter 0.3s; }
[data-theme="dark"] .footer-logo { filter: invert(1); mix-blend-mode: screen; }

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text-main); font-size: 0.95rem; font-weight: 400; transition: color 0.3s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-color); font-weight: 500; }

/* RISOLUZIONE TEXT CONTRAST (NERO SU NERO CORRETTO) */
.nav-links .btn-primary-small, .btn-primary-small {
  background: var(--text-main) !important;
  color: var(--bg-page) !important;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 980px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.nav-links .btn-primary-small:hover, .btn-primary-small:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.nav-controls { display: flex; gap: 0.8rem; align-items: center; }
.icon-btn {
  background: transparent; border: none; color: var(--text-main); font-size: 1.4rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s; padding: 6px;
}
.icon-btn:hover { transform: scale(1.08); }
.mobile-only { display: none; }

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 980px; text-decoration: none; transition: var(--transition-smooth);
}
.btn-primary { background: var(--text-main); color: var(--bg-page); padding: 0.9rem 2rem; font-size: 0.95rem; font-weight: 400; }
.btn-primary:hover { transform: scale(1.02); opacity: 0.9; }
.btn-secondary { background: transparent; color: var(--text-main); font-size: 1rem; gap: 0.5rem; border: none; cursor: pointer; }
.btn-secondary:hover { gap: 0.8rem; }

h1, h2, h3, .hero-title, .hero-title-small {
  font-family: var(--font-heading);
  font-weight: normal; font-style: normal;
  color: var(--text-main); letter-spacing: 1.5px; 
}

/* GRIGLIE BENTO */
.hero-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 8rem 2rem 4rem; text-align: center; }
.hero-text-container { max-width: 800px; }
.hero-title { font-size: clamp(2.4rem, 4vw, 3.8rem); line-height: 1.15; margin-bottom: 1.5rem; }
.hero-subtitle { font-size: clamp(1rem, 1.8vw, 1.15rem); color: var(--text-muted); max-width: 600px; margin: 0 auto 3rem auto; font-weight: 300; line-height: 1.7; }
.hero-cta { display: flex; justify-content: center; align-items: center; gap: 2rem; }

.bento-section { max-width: 1200px; margin: 0 auto; padding: 6rem 2rem; }
.section-header { text-align: center; margin-bottom: 4rem; }
.section-header h2 { font-size: clamp(2rem, 3.5vw, 2.5rem); line-height: 1.1; }

.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; auto-rows: minmax(280px, auto); }
.bento-card { 
  background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-large); padding: 2.5rem; display: flex; flex-direction: column; 
  justify-content: flex-start; box-shadow: 0 4px 30px rgba(0,0,0,0.01); 
  transition: var(--transition-smooth); border: 1px solid var(--border-color);
  position: relative;
}
[data-theme="dark"] .bento-card { 
  background: rgba(22, 22, 24, 0.7); 
  border: 1px solid rgba(36, 138, 82, 0.15); /* Leggero bordo verde per armonizzare */
}
.bento-card:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(0,0,0,0.04); }
[data-theme="dark"] .bento-card:hover { box-shadow: 0 15px 40px rgba(36, 138, 82, 0.04); }

.bento-card.large { grid-column: span 12; }
.bento-card.medium { grid-column: span 6; }
.bento-card.small { grid-column: span 6; padding: 2rem; }

/* UX PRECISIONE: Intera Bento Card Cliccabile */
.bento-card h3 a::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
}

.card-icon { font-size: 2.5rem; color: var(--text-main); margin-bottom: 1rem; font-weight: 100; }
.bento-card h3 a { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 0.5rem; transition: color 0.3s; }
.bento-card h3 { font-size: 1.5rem; margin-bottom: 0.8rem; position: relative; z-index: 2; }
.bento-card p { font-size: 1rem; color: var(--text-muted); font-weight: 300; line-height: 1.6; position: relative; z-index: 2; }

/* CERTIFICATI */
.cert-section { max-width: 1200px; margin: 0 auto; padding: 6rem 2rem; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.cert-card { 
  background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-large); padding: 2.2rem; border: 1px solid var(--border-color); 
  box-shadow: 0 4px 30px rgba(0,0,0,0.01); transition: var(--transition-smooth); 
  display: flex; flex-direction: column; gap: 1rem; 
}
[data-theme="dark"] .cert-card { background: rgba(22, 22, 24, 0.7); border: 1px solid rgba(36, 138, 82, 0.12); }
.cert-card:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(0,0,0,0.04); }
.cert-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.cert-card-header h4 { font-size: 1.15rem; font-family: var(--font-body); font-weight: 600; color: var(--text-main); line-height: 1.4; }
.cert-icon-green { font-size: 2.2rem; color: #248a52 !important; }

.text-green { color: #248a52 !important; }
.font-weight-600 { font-weight: 600; }
.cert-card p { font-size: 0.95rem; color: var(--text-muted); font-weight: 300; line-height: 1.6; }

/* CHI SONO */
.about-section { max-width: 1200px; margin: 0 auto; padding: 6rem 2rem; }
.about-content-linear { max-width: 1000px; margin: 0 auto; }
.spaced-title { font-family: var(--font-heading); font-size: 1.8rem; letter-spacing: 6px; text-transform: uppercase; margin-bottom: 1.5rem; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }
.about-content-linear p { font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 1rem; font-weight: 300; }
.about-content-linear strong { color: var(--text-main); font-weight: 500; font-family: var(--font-body); }
.mt-4 { margin-top: 4rem; }
.map-wrapper-large { width: 100%; height: 400px; border-radius: var(--radius-large); overflow: hidden; border: 1px solid var(--border-color); margin-top: 2rem; box-shadow: 0 4px 30px rgba(0,0,0,0.01); }
.map-wrapper-large iframe { width: 100%; height: 100%; filter: grayscale(100%) opacity(0.8); transition: all 0.5s ease; border: none; }
.map-wrapper-large iframe:hover { filter: grayscale(0%) opacity(1); }
[data-theme="dark"] .map-wrapper-large iframe { filter: grayscale(100%) invert(90%) opacity(0.6); }
[data-theme="dark"] .map-wrapper-large iframe:hover { filter: grayscale(0%) invert(0%) opacity(1); }

/* FOOTER */
.modern-footer { max-width: 1200px; margin: 0 auto; padding: 6rem 2rem; }
.footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3rem; }
.footer-info p { color: var(--text-muted); max-width: 400px; font-size: 1rem; margin-bottom: 2rem; font-weight: 300; }
.contact-links { display: flex; flex-direction: column; gap: 1rem; }
.contact-links a { color: var(--text-main); text-decoration: none; font-size: 1.05rem; font-weight: 400; display: inline-flex; align-items: center; gap: 0.6rem; transition: color 0.3s;}
.contact-links a:hover { color: var(--text-muted); }
.contact-links a i { font-size: 1.3rem; }
.footer-legal { text-align: right; display: flex; flex-direction: column; justify-content: flex-end; }
.footer-legal p { font-size: 0.9rem; color: var(--text-main); }
.footer-legal .copyright { color: var(--text-muted); margin-top: 0.5rem; }

.reveal { opacity: 0; transform: translateY(20px); transition: all 1s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

/* LAYOUT DOCUMENTAZIONE SERVIZI */
.services-hero { padding: 9rem 2rem 3rem; text-align: center; }
.hero-title-small { font-size: clamp(2.2rem, 3vw, 3.2rem); margin-bottom: 1rem; }
.docs-container { display: flex; max-width: 1200px; margin: 0 auto; padding: 2rem 2rem 6rem; gap: 4rem; align-items: flex-start; }

.docs-sidebar { flex: 0 0 260px; position: sticky; top: 100px; background: transparent; padding: 0; }
.docs-sidebar h3 { font-family: var(--font-body); font-style: normal; font-size: 0.85rem; margin-bottom: 1.5rem; color: var(--text-muted); text-transform: uppercase !important; letter-spacing: 1px; font-weight: 500; }
.sidebar-menu { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.menu-group { position: relative; }
.menu-link { text-decoration: none; color: var(--text-main); font-weight: 400; transition: color 0.2s; font-size: 1rem; display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; cursor: pointer; }
.menu-label { display: flex; align-items: center; gap: 0.6rem; }
.menu-label i { font-size: 1.3rem; color: var(--text-muted); }
.caret-icon { font-size: 1rem; color: var(--text-muted); transition: transform 0.3s ease; }
.menu-link:hover { color: var(--text-muted); }
.menu-group:hover .caret-icon { transform: rotate(180deg); color: var(--text-muted); }

.sub-menu { max-height: 0; opacity: 0; overflow: hidden; padding-left: 2rem; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; gap: 0.6rem; list-style: none; }
.menu-group:hover .sub-menu { max-height: 400px; opacity: 1; padding-top: 0.3rem; padding-bottom: 0.8rem; }
.sub-menu a { font-size: 0.9rem; color: var(--text-muted); text-decoration: none; font-weight: 300; transition: color 0.2s; display: block; }
.sub-menu a:hover { color: var(--text-main); font-weight: 500; }

.docs-content { flex: 1; min-width: 0; }
.service-article { margin-bottom: 4rem; scroll-margin-top: 100px; }
.article-icon { font-size: 2.8rem; margin-bottom: 1rem; color: var(--text-main); font-weight: 100; }
.service-article h2 { font-size: 2rem; margin-bottom: 1rem; }
.intro-text { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 2.5rem; font-weight: 300; }
.service-article h3 { font-size: 1.4rem; margin: 2.5rem 0 1rem 0; }
.service-article p { font-size: 1rem; font-weight: 300; margin-bottom: 1.5rem; }

.styled-list { list-style: none; margin-bottom: 2rem; padding-left: 0; }
.styled-list li { margin-bottom: 1rem; font-size: 1rem; font-weight: 300; }
.styled-list strong { font-weight: 500; font-family: var(--font-body); font-style: normal; }

.highlight-box { background-color: rgba(255, 255, 255, 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-left: 3px solid var(--text-main); padding: 1.5rem; border-radius: 0 var(--radius-small) var(--radius-small) 0; margin: 2rem 0; font-size: 1rem; font-weight: 300; line-height: 1.6; }
[data-theme="dark"] .highlight-box { background: rgba(22, 22, 24, 0.4); border-left-color: rgba(36, 138, 82, 0.6); }
.highlight-box strong { font-weight: 600; font-family: var(--font-body); }

.article-divider { border: none; border-top: 1px solid var(--border-color); margin: 4rem 0; }

/* ==========================================
   CANVAS INTERFACCIA CURSORE PERSONALIZZATO
   ========================================== */
@media (hover: hover) and (pointer: fine) {
  body, a, button, .menu-link, .bento-card, .sub-menu a {
    cursor: none !important;
  }
}
#cursor-trail {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none; z-index: 999999;
}

/* ==========================================
   RESPONSIVE & MOBILE DESIGN OPTIMIZATION
   ========================================== */
@media (max-width: 900px) {
  .mobile-only { display: flex; }

  .nav-links {
    position: fixed; top: 73px; left: 0; width: 100%;
    background: var(--glass-scroll); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    flex-direction: column; align-items: center; padding: 2.5rem 0; gap: 2rem;
    border-bottom: 1px solid var(--border-color); box-shadow: 0 20px 40px rgba(0,0,0,0.04);
    transform: translateY(-150%); opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s linear;
    z-index: -1;
  }
  .nav-links.menu-open { transform: translateY(0); opacity: 1; }

  .bento-card.medium, .bento-card.small { grid-column: span 12; }
  .footer-grid { flex-direction: column; gap: 2rem; }
  .footer-legal { text-align: left; margin-top: 1rem; }
  .docs-container { flex-direction: column; gap: 2rem; }
  .docs-sidebar { position: relative; top: 0; width: 100%; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1.5rem; }
}

@media (max-width: 600px) {
  .hero-title { font-size: 2.1rem; }
  .hero-cta { flex-direction: column; gap: 1rem; width: 100%; }
  .btn-primary, .btn-secondary { width: 100%; padding: 1rem; }
}