/* ═══════════════════════════════════════════ */
/* BASE                                       */
/* ═══════════════════════════════════════════ */
html {
  scroll-behavior: smooth;
}

body {
  background-color: #FAF9F6;
  color: #2D2D2D;
  font-family: 'Inter', system-ui, sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Reading Progress Bar Container */
#progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 9999;
}

#progress-bar {
  height: 100%;
  background: #0F4C5C;
  width: 0%;
  transition: width 0.1s ease-out;
}

body.dark #progress-bar {
  background: #5CB8C4;
}

/* ═══════════════════════════════════════════ */
/* PRELOADER                                  */
/* ═══════════════════════════════════════════ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #FAF9F6;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #C4A882;
  margin: 0 6px;
  animation: preloaderPulse 1.2s ease-in-out infinite;
}

.preloader-dot:nth-child(2) { animation-delay: 0.15s; }
.preloader-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes preloaderPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════ */
/* STICKY NAVBAR                               */
/* ═══════════════════════════════════════════ */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(196, 168, 130, 0.15);
  transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.3s ease;
}

#navbar.scrolled {
  box-shadow: 0 1px 12px rgba(45, 45, 45, 0.06);
}

.nav-link {
  position: relative;
  color: #2D2D2D;
  opacity: 0.6;
  transition: opacity 0.25s ease, color 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
  opacity: 1;
  color: #0F4C5C;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #0F4C5C;
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Dark mode toggle */
#dark-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(196, 168, 130, 0.3);
  background: transparent;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

#dark-toggle:hover {
  border-color: #0F4C5C;
  background-color: rgba(15, 76, 92, 0.06);
}

/* Mobile menu overlay */
#mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 999;
  background-color: rgba(250, 249, 246, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

#mobile-menu a {
  font-size: 1.5rem;
  font-weight: 500;
  color: #2D2D2D;
  opacity: 0.7;
  transition: opacity 0.25s ease, color 0.25s ease;
}

#mobile-menu a:hover {
  opacity: 1;
  color: #0F4C5C;
}

/* Hamburger */
.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #2D2D2D;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ═══════════════════════════════════════════ */
/* SCROLL-TRIGGERED ANIMATIONS                */
/* ═══════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.19s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.33s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.40s; }

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════ */
/* CUSTOM TEAL BULLET                         */
/* ═══════════════════════════════════════════ */
.teal-bullet {
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
}

.teal-bullet::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #0F4C5C;
}

/* ═══════════════════════════════════════════ */
/* OAK DIVIDER                                */
/* ═══════════════════════════════════════════ */
.oak-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, #C4A882, transparent);
}

/* ═══════════════════════════════════════════ */
/* LINKEDIN CARD                              */
/* ═══════════════════════════════════════════ */
.linkedin-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.linkedin-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(15, 76, 92, 0.12);
}

/* ═══════════════════════════════════════════ */
/* SERVICE CARD                               */
/* ═══════════════════════════════════════════ */
.service-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(15, 76, 92, 0.1);
  border-color: rgba(15, 76, 92, 0.25);
}

.service-icon {
  transition: transform 0.3s ease;
}

.service-card:hover .service-icon {
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════ */
/* SUBSTACK TITLE HOVER                       */
/* ═══════════════════════════════════════════ */
.substack-title {
  transition: color 0.25s ease;
}

.substack-title:hover {
  color: #0F4C5C;
}

/* ═══════════════════════════════════════════ */
/* CTA BUTTON                                 */
/* ═══════════════════════════════════════════ */
.cta-btn {
  transition: background-color 0.3s ease, transform 0.1s ease-out, box-shadow 0.3s ease;
  will-change: transform;
}

.cta-btn:hover {
  background-color: #1A6B7D;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 76, 92, 0.25);
}

/* ═══════════════════════════════════════════ */
/* BACK TO TOP                                */
/* ═══════════════════════════════════════════ */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #0F4C5C;
  color: #FAF9F6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
  box-shadow: 0 4px 16px rgba(15, 76, 92, 0.25);
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background-color: #1A6B7D;
  transform: translateY(-2px);
}

/* ═══════════════════════════════════════════ */
/* PROFILE PHOTO PLACEHOLDER                  */
/* ═══════════════════════════════════════════ */
.photo-placeholder {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px solid #C4A882;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: rgba(196, 168, 130, 0.08);
  transition: border-color 0.3s ease;
}

.photo-placeholder:hover {
  border-color: #0F4C5C;
}

.photo-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ═══════════════════════════════════════════ */
/* CONTACT SECTION                            */
/* ═══════════════════════════════════════════ */
.contact-link {
  transition: transform 0.25s ease, color 0.25s ease;
}

.contact-link:hover {
  transform: translateY(-2px);
  color: #0F4C5C;
}

/* ═══════════════════════════════════════════ */
/* DARK MODE                                  */
/* ═══════════════════════════════════════════ */
body.dark {
  background-color: #1A1A1A;
  color: #E8E4DF;
}

body.dark #navbar {
  background-color: rgba(26, 26, 26, 0.92);
  border-bottom-color: rgba(196, 168, 130, 0.1);
}

body.dark #navbar.scrolled {
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.2);
}

body.dark .nav-link {
  color: #E8E4DF;
}

body.dark .nav-link:hover,
body.dark .nav-link.active {
  color: #5CB8C4;
}

body.dark .nav-link::after {
  background-color: #5CB8C4;
}

body.dark #dark-toggle {
  border-color: rgba(196, 168, 130, 0.2);
}

body.dark #dark-toggle:hover {
  border-color: #5CB8C4;
  background-color: rgba(92, 184, 196, 0.1);
}

body.dark .hamburger-line {
  background-color: #E8E4DF;
}

body.dark #mobile-menu {
  background-color: rgba(26, 26, 26, 0.98);
}

body.dark #mobile-menu a {
  color: #E8E4DF;
}

body.dark #mobile-menu a:hover {
  color: #5CB8C4;
}

body.dark #preloader {
  background-color: #1A1A1A;
}

body.dark .preloader-dot {
  background-color: #C4A882;
}

body.dark h1, body.dark h2, body.dark h3 {
  color: #F0EDE8;
}

body.dark p {
  color: rgba(232, 228, 223, 0.7);
}

body.dark .linkedin-card {
  background-color: #242424;
  border-color: rgba(92, 184, 196, 0.15);
}

body.dark .linkedin-card:hover {
  box-shadow: 0 12px 32px rgba(92, 184, 196, 0.1);
}

body.dark .service-card {
  background-color: #242424;
  border-color: rgba(92, 184, 196, 0.12);
}

body.dark .service-card:hover {
  border-color: rgba(92, 184, 196, 0.3);
  box-shadow: 0 12px 32px rgba(92, 184, 196, 0.08);
}

body.dark .photo-placeholder {
  border-color: rgba(196, 168, 130, 0.4);
  background-color: rgba(196, 168, 130, 0.05);
}

body.dark .photo-placeholder:hover {
  border-color: #5CB8C4;
}

body.dark .cta-btn {
  background-color: #0F4C5C;
  color: #E8E4DF;
}

body.dark .cta-btn:hover {
  background-color: #1A6B7D;
}

body.dark #back-to-top {
  background-color: #0F4C5C;
}

body.dark #back-to-top:hover {
  background-color: #1A6B7D;
}

body.dark .oak-divider {
  background: linear-gradient(90deg, transparent, rgba(196, 168, 130, 0.4), transparent);
}

body.dark .teal-bullet::before {
  background-color: #5CB8C4;
}

body.dark footer {
  border-top-color: rgba(196, 168, 130, 0.1);
}

/* Dark mode text overrides */
body.dark .text-charcoal { color: #F0EDE8; }
body.dark .text-charcoal\/70 { color: rgba(232, 228, 223, 0.7); }
body.dark .text-charcoal\/80 { color: rgba(232, 228, 223, 0.8); }
body.dark .text-charcoal\/60 { color: rgba(232, 228, 223, 0.6); }
body.dark .text-charcoal\/50 { color: rgba(232, 228, 223, 0.5); }
body.dark .text-charcoal\/40 { color: rgba(232, 228, 223, 0.4); }
body.dark .text-charcoal\/30 { color: rgba(232, 228, 223, 0.3); }

body.dark .bg-white { background-color: #242424; }
body.dark .bg-cream { background-color: #1A1A1A; }
body.dark .bg-teal\/10 { background-color: rgba(92, 184, 196, 0.1); }

body.dark .border-teal\/15 { border-color: rgba(92, 184, 196, 0.15); }
body.dark .border-oak\/20 { border-color: rgba(196, 168, 130, 0.15); }

body.dark .substack-title:hover { color: #5CB8C4; }
body.dark .text-teal { color: #5CB8C4; }
body.dark .text-teal:hover { color: #7ECBD5; }

/* ═══════════════════════════════════════════ */
/* TYPING CURSOR BLINK                        */
/* ═══════════════════════════════════════════ */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Hide cursor after typing completes */
#typed-cursor.hidden {
  animation: blink 1s step-end infinite 2s;
  opacity: 0;
  transition: opacity 0.5s ease 2s;
}

/* ═══════════════════════════════════════════ */
/* HERO PARALLAX                              */
/* ═══════════════════════════════════════════ */
#hero .reveal {
  will-change: transform, opacity;
}

/* ═══════════════════════════════════════════ */
/* SCROLLBAR                                  */
/* ═══════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #FAF9F6;
}

::-webkit-scrollbar-thumb {
  background: #C4A882;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #A68B5E;
}

body.dark ::-webkit-scrollbar-track {
  background: #1A1A1A;
}

body.dark ::-webkit-scrollbar-thumb {
  background: rgba(196, 168, 130, 0.5);
}

body.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 168, 130, 0.7);
}

/* ═══════════════════════════════════════════ */
/* SECTION SPACING OVERRIDES                  */
/* (Tailwind compiled CSS doesn't include     */
/*  non-pre-existing utility classes)         */
/* ═══════════════════════════════════════════ */
#about {
  padding-bottom: 8rem; /* ~128px */
}

#expertise {
  padding-top: 10rem;   /* ~160px */
  padding-bottom: 8rem; /* ~128px */
}

#credentials {
  padding-top: 10rem;   /* ~160px */
}

@media (min-width: 768px) {
  #about {
    padding-bottom: 10rem; /* ~160px */
  }

  /* Seamless transition between Expertise and Path */
  #path {
    padding-top: 4rem;    /* Reduced to blend with Expertise bottom padding */
    padding-bottom: 10rem;
  }

  #expertise {
    padding-bottom: 10rem; /* ~160px */
  }

  #credentials {
    padding-top: 12rem;    /* ~192px */
  }
}

#see-all-articles-wrap {
  margin-top: 5rem;   /* ~80px */
  padding-top: 3rem;  /* ~48px */
}

/* LinkedIn Read button: extra breathing room on mobile */
@media (max-width: 767px) {
  .linkedin-btn-wrap {
    margin-top: 1.75rem; /* ~28px, more generous on single-column layout */
  }
}

/* ═══════════════════════════════════════════ */
/* SMOOTH SCROLL OFFSET (navbar height ~64px) */
/* ═══════════════════════════════════════════ */
section[id] {
  scroll-margin-top: 5rem; /* ~80px, clears fixed navbar */
}

/* ═══════════════════════════════════════════ */
/* SUBSTACK ARTICLE HOVER                     */
/* ═══════════════════════════════════════════ */
#substack-posts article {
  padding: 1rem 0;
  transition: transform 0.3s ease;
}

#substack-posts article:hover {
  transform: translateX(6px);
}

/* ═══════════════════════════════════════════ */
/* FOOTER SOCIAL ICONS                        */
/* ═══════════════════════════════════════════ */
.footer-social {
  transition: color 0.25s ease, transform 0.25s ease;
}

.footer-social:hover {
  transform: translateY(-2px);
}

body.dark .footer-social {
  color: rgba(232, 228, 223, 0.3);
}

body.dark .footer-social:hover {
  color: #5CB8C4;
}

body.dark .footer-social:hover {
  color: #5CB8C4;
}

#about-languages {
  margin-top: 3rem !important;
  padding-top: 1.75rem !important;
}

#path-title {
  margin-bottom: 3rem !important;
}

#path-experience p, #path-toolkit p {
  margin-bottom: 1.75rem !important;
}

#path-experience {
  margin-bottom: 5rem !important; /* Spazio tra i due blocchi principali */
}

/* ═══════════════════════════════════════════ */
/* THE PATH REDESIGN                          */
/* ═══════════════════════════════════════════ */
#path .group {
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

#path .group:hover {
  border-color: rgba(196, 168, 130, 0.4);
}

#path .group a {
  transition: all 0.3s ease;
}

body.dark #path .group:hover {
  background-color: rgba(196, 168, 130, 0.05);
}
