/* --------------------------------------------------
   FONT & RESET
-------------------------------------------------- */

html {
  box-sizing: border-box;
  overflow-x: hidden;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: #f7f6f3;
  color: #2c2c2c;
  line-height: 1.7;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  margin-top: 0;
}

img {
  max-width: 100%;
  display: block;
  border-radius: 8px;
}

iframe {
  width: 100%;
  max-width: 100%;
  display: block;
  border: none;
}

/* --------------------------------------------------
   NAVBAR
-------------------------------------------------- */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 6%;
  background: #2c2c2c;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar .logo {
  font-size: 1.4rem;
  font-weight: 600;
  flex-shrink: 0;
}

.navbar .logo a {
  display: flex;
  align-items: center;
}

.navbar .logo-img {
  height: 100px;
  width: auto;
  border-radius: 4px;
}

svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* Hamburger Menu Button */
.hamburger {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 6px;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background-color: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Navigation Links */
.navbar .nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.navbar .nav-links a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.navbar .nav-links a:hover {
  opacity: 0.7;
}

/* Submenu Styles */
.nav-submenu {
  position: relative;
}

.nav-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.nav-toggle::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #fff;
  margin-left: 6px;
  transition: transform 0.3s ease;
}

.submenu {
  display: none;
  position: absolute;
  top: calc(100% - 8px);
  left: 0;
  background: #1a1a1a;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  border-radius: 4px;
  min-width: 200px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 1001;
  padding-top: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  visibility: hidden;
}

.nav-submenu:hover > .submenu {
  display: block;
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.submenu.active {
  display: block;
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.submenu li {
  padding: 0;
}

.submenu a {
  display: block;
  padding: 0.8rem 1.5rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background-color 0.2s ease;
}

.submenu a:hover {
  background-color: #3c3c3c;
  opacity: 1;
}

/* --------------------------------------------------
   HERO SECTIONS
-------------------------------------------------- */

.hero {
  height: 90vh;
  background: linear-gradient(rgba(0,0,0,0.45), rgba(0,0,0,0.45)),
              url('img/rendering-ricostruzione-interno-basilica-zuglio.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 0 6%;
}

.hero h1 {
  font-size: 3rem;
  max-width: 800px;
}

.hero p {
  font-size: 1.2rem;
  margin-top: 1rem;
}

.hero-small {
  height: 50vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-blend-mode: multiply;
  background-color: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  padding: 0 6%;
}

.hero-small h1 {
  font-size: 2.6rem;
}

/* --------------------------------------------------
   SECTIONS
-------------------------------------------------- */

section {
  padding: 4rem 6%;
  max-width: 1200px;
  margin: auto;
}

section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.highlight {
  background-color: #e9e6df;
  padding: 4rem 6%;
}

.image-full {
  width: 100%;
  margin: 2rem 0;
}

/* --------------------------------------------------
   TIMELINE
-------------------------------------------------- */

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.timeline-item {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.timeline-item h3 {
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------
   GALLERY + LIGHTBOX
-------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.gallery img {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery img:hover {
  transform: scale(1.03);
}

/* --------------------------------------------------
   DETAILS GALLERY
-------------------------------------------------- */

.details-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin: 2rem 0;
}

.gallery-section {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.gallery-section h3 {
  margin-top: 0;
  border-bottom: 2px solid #8b6f47;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  text-align: center;
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.gallery-item img:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.gallery-item p {
  font-size: 0.9rem;
  color: #666;
  margin-top: 1rem;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .details-gallery {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* --------------------------------------------------
   LIGHTBOX - ENHANCED
-------------------------------------------------- */

.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox-content {
  max-width: 90%;
  max-height: 80%;
  border-radius: 8px;
  object-fit: contain;
  animation: zoomIn 0.3s ease;
}

.lightbox-caption {
  color: #fff;
  margin-top: 1.5rem;
  font-size: 1.1rem;
  text-align: center;
  max-width: 90%;
  font-style: italic;
}

.lightbox .close {
  position: absolute;
  top: 30px;
  right: 40px;
  font-size: 3rem;
  color: white;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.lightbox .close:hover {
  opacity: 0.7;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* --------------------------------------------------
   LIGHTBOX ITEMS
-------------------------------------------------- */

.lightbox-item {
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lightbox-item:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

/* --------------------------------------------------
   FOOTER
-------------------------------------------------- */

footer {
  background: #2c2c2c;
  color: #fff;
  padding: 3rem 10%;
  text-align: center;
}

/* --------------------------------------------------
   ARCHITETTURA - DETTAGLI
-------------------------------------------------- */

.architecture-intro {
  background-color: #f0ebe2;
  padding: 2.5rem;
  border-left: 5px solid #8b7355;
  border-radius: 4px;
  margin-bottom: 3rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.architecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  margin-bottom: 4rem;
}

.architecture-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.architecture-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.architecture-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.architecture-card h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: #2c2c2c;
  border-bottom: 2px solid #d4a574;
  padding-bottom: 0.8rem;
}

.architecture-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #555;
}

.architecture-highlight {
  background: linear-gradient(135deg, #f0ebe2 0%, #f5f1e8 100%);
  padding: 3rem;
  border-radius: 8px;
  margin-top: 3rem;
  border-left: 5px solid #d4a574;
}

.architecture-highlight h3 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  color: #2c2c2c;
}

.architecture-highlight p {
  font-size: 1rem;
  line-height: 1.8;
  color: #333;
}

/* --------------------------------------------------
   CONTEXT - SEZIONI STORICHE
-------------------------------------------------- */

.hero-subtitle {
  font-size: 1.2rem;
  font-weight: 300;
  margin-top: 0.5rem;
  margin-left: 0.5rem;
  opacity: 0.95;
}

.context-section {
  padding: 4rem 6%;
  max-width: 1200px;
  margin: auto;
}

.context-intro {
  background-color: #f0ebe2;
  padding: 2.5rem;
  border-left: 5px solid #8b7355;
  border-radius: 4px;
  margin-bottom: 3rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.context-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.context-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.context-card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: #2c2c2c;
  border-bottom: 2px solid #d4a574;
  padding-bottom: 0.8rem;
}

.context-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #555;
}

/* --------------------------------------------------
   TOPOGRAPHY SECTION
-------------------------------------------------- */

.topography-showcase {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.topography-main {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.topography-secondary {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.topography-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  width: 100%;
  max-width: 100%;
}

.topography-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 8px;
  border-top: 4px solid #d4a574;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transition: transform 0.3s ease;
}

.topography-card:hover {
  transform: translateY(-3px);
}

.topography-card h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: #2c2c2c;
}

.topography-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #555;
}

/* --------------------------------------------------
   HISTORICAL TIMELINE
-------------------------------------------------- */

.historical-timeline {
  background: linear-gradient(180deg, rgba(240,235,226,0.5) 0%, rgba(245,241,232,0.5) 100%);
  padding: 3rem 2.5rem;
  border-radius: 8px;
  margin-bottom: 4rem;
  border-left: 5px solid #d4a574;
}

.timeline-node {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #d4a574;
}

.timeline-node:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.timeline-date {
  display: inline-block;
  background: #d4a574;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.timeline-node h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: #2c2c2c;
}

.timeline-node p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #555;
}

/* --------------------------------------------------
   HISTORICAL PHOTOS GALLERY
-------------------------------------------------- */

.historical-photos {
  margin-top: 4rem;
}

.historical-photos h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-align: center;
  color: #2c2c2c;
}

.historical-photos > p {
  text-align: center;
  font-size: 1rem;
  color: #666;
  margin-bottom: 2.5rem;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  width: 100%;
  max-width: 100%;
}

.photo-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.photo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.photo-card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.photo-card h4 {
  font-size: 1.1rem;
  font-family: 'Playfair Display', serif;
  padding: 1.5rem 1.5rem 0.5rem;
  margin: 0;
  color: #2c2c2c;
}

.photo-card p {
  font-size: 0.9rem;
  padding: 0 1.5rem 1.5rem;
  color: #666;
  line-height: 1.6;
}

/* --------------------------------------------------
   CLICKABLE IMAGES IN CARDS
-------------------------------------------------- */

.photo-card img,
.architecture-card img,
.context-card img {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.photo-card img:hover,
.architecture-card img:hover,
.context-card img:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

/* --------------------------------------------------
   ERROR LINKS
-------------------------------------------------- */

.error-links a {
    display: inline-block;
    color: #d4a574;
    text-decoration: none;
    padding: 0.8rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    word-break: break-word;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

.error-container {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 10%;
  background: linear-gradient(135deg, #f7f6f3 0%, #f0ebe2 100%);
}

.error-content {
  max-width: 600px;
  width: 100%;
}

/* --------------------------------------------------
   FAMILY TREE - D3.JS
-------------------------------------------------- */

.tree-link {
  fill: none;
  stroke: #ccc;
  stroke-width: 1.5px;
  transition: all 0.2s ease;
}

.tree-node {
  cursor: pointer;
}

.node-circle {
  fill: #d4a574;
  stroke: #fff;
  stroke-width: 2px;
  transition: all 0.2s ease;
}

.node-circle.active {
  fill: #8b6f47;
  stroke: #fff;
  stroke-width: 3px;
  filter: drop-shadow(0 0 4px rgba(212, 165, 116, 0.6));
}

.node-circle.ancestor {
  fill: #d4a574;
  stroke: #8b6f47;
  stroke-width: 2px;
  filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.4));
}

.node-circle.descendant {
  fill: #f0ebe2;
  stroke: #d4a574;
  stroke-width: 2px;
  filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.4));
}

.node-text {
  font-size: 11px;
  font-weight: normal;
  fill: #2c2c2c;
  transition: all 0.2s ease;
  pointer-events: none;
}

svg {
  display: block;
  margin: 0 auto;
}

#family-tree-d3 svg {
  width: 100%;
  height: auto;
}

#family-tree-d3 {
  display: block;
}

/* --------------------------------------------------
   FAMILY TREE - TEXT LIST (MOBILE FALLBACK)
-------------------------------------------------- */

.family-tree-list {
  display: none;
}

.family-list {
  list-style: none;
  padding: 1.5rem;
  margin: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.family-list ul {
  list-style: none;
  padding-left: 2rem;
  margin: 0.5rem 0 0 0;
}

.family-list li {
  padding: 0.5rem 0;
  line-height: 1.5;
  color: #2c2c2c;
}

.family-name {
  font-weight: 600;
  color: #5d4e37;
}

.family-years {
  font-size: 0.85rem;
  color: #999;
  margin-left: 0.5rem;
}

.family-list-empty {
  color: #d4a574;
  padding: 2rem;
  text-align: center;
}

/* Mobile: show text list, hide D3 tree */
@media (max-width: 768px) {
  #family-tree-d3 {
    display: none;
  }
  
  .family-tree-list {
    display: block;
  }
}

/* Desktop: show D3 tree, hide text list */
@media (min-width: 769px) {
  .family-tree-list {
    display: none;
  }
  
  #family-tree-d3 {
    display: block;
  }
}

/* --------------------------------------------------
   RESPONSIVE
-------------------------------------------------- */

@media (max-width: 768px) {

  .navbar {
    padding: 1rem 6%;
    flex-wrap: wrap;
  }

  .navbar .logo-img {
    height: 60px;
  }

  /* Show hamburger on mobile */
  .hamburger {
    display: flex;
  }

  /* Stack nav vertically on mobile */
  .nav-links {
    position: fixed !important;
    top: 80px;
    left: 0;
    width: 100%;
    flex-direction: column !important;
    background: #2c2c2c;
    gap: 0 !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
  }

  .nav-links.active {
    max-height: 100vh;
  }

  .nav-links li {
    border-bottom: 1px solid #3c3c3c;
  }

  .nav-links a,
  .nav-toggle {
    display: block;
    padding: 1rem 10%;
    width: 100%;
  }

  /* Submenu on mobile */
  .submenu {
    position: static !important;
    display: none !important;
    background: #1a1a1a;
    box-shadow: none;
    border-radius: 0;
    min-width: auto;
    margin: 0 !important;
    padding: 0 !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .submenu li a {
    padding: 0.8rem 10% 0.8rem calc(10% + 1rem) !important;
  }

  .submenu.active {
    display: block !important;
    max-height: 100vh;
  }

  .nav-toggle.active::after {
    transform: rotate(180deg);
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .two-columns {
    grid-template-columns: 1fr;
  }

  .navbar .nav-links {
    gap: 1rem;
  }

  .architecture-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .architecture-card {
    padding: 2rem;
  }

  .architecture-intro {
    padding: 2rem;
  }

  .architecture-highlight {
    padding: 2rem;
  }

  .context-section {
    padding: 2.5rem 5%;
  }

  .context-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .topography-showcase {
    gap: 2rem;
  }

  .topography-info {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .historical-timeline {
    padding: 2rem;
  }

  .timeline-date {
    font-size: 0.9rem;
  }

  .photo-gallery {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .photo-card img {
    height: 200px;
  }
}

/* --------------------------------------------------
   CONTACT PAGE
-------------------------------------------------- */

.contact-section {
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.contact-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
}

.contact-info h2,
.contact-form h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: #2c2c2c;
}

.info-item {
  margin-bottom: 2.5rem;
}

.info-item h3 {
  font-size: 1.1rem;
  color: #5d4e37;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.info-item p {
  color: #555;
  line-height: 1.8;
  margin: 0;
}

.info-item a {
  color: #5d4e37;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.info-item a:hover {
  color: #8b7355;
  text-decoration: underline;
}

/* FORM STYLES */

.form-contatti {
  background: linear-gradient(135deg, #fff 0%, #fffbf7 100%);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.08),
    0 0 1px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(93, 78, 55, 0.08);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  margin-bottom: 2rem;
  position: relative;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #2c2c2c;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.required::before {
  content: '✱';
  color: #c41e3a;
  font-size: 1.2em;
  line-height: 1;
}

.required {
  color: #c41e3a;
  margin-left: 0;
}

.optional {
  color: #999;
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 1rem;
  background-color: #fff;
  border: 2px solid #e8ddd2;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.96rem;
  color: #2c2c2c;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #b8a89a;
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
  border-color: #d4c4b0;
  background-color: #fffef9;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #5d4e37;
  background-color: #fffbf7;
  box-shadow: 
    0 0 0 4px rgba(93, 78, 55, 0.12),
    0 4px 12px rgba(93, 78, 55, 0.15);
}

.form-group textarea {
  resize: vertical;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
}

.form-group small {
  display: block;
  margin-top: 0.5rem;
  color: #998876;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.btn-submit {
  background: linear-gradient(135deg, #5d4e37 0%, #8b7355 100%);
  color: #fff;
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(93, 78, 55, 0.2);
}

.btn-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(93, 78, 55, 0.35);
  background: linear-gradient(135deg, #8b7355 0%, #a68b76 100%);
}

.btn-submit:hover:not(:disabled)::before {
  left: 100%;
}

.btn-submit:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(135deg, #b8a89a 0%, #c9b8aa 100%);
}

.form-note {
  margin-top: 2rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f0ebe4 0%, #fffbf7 100%);
  border-left: 4px solid #5d4e37;
  border-radius: 8px;
  color: #555;
  border-top: 1px solid rgba(93, 78, 55, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-note small {
  color: #666;
  font-weight: 400;
  letter-spacing: 0.3px;
  line-height: 1.6;
}

/* ALERT MESSAGES */

.alert {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid;
  animation: slideDown 0.4s ease-out;
  display: flex;
  align-items: center;
  gap: 1rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: linear-gradient(135deg, #d4edda 0%, #e8f5e9 100%);
  border-color: #28a745;
  color: #155724;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.alert-error {
  background: linear-gradient(135deg, #f8d7da 0%, #ffebee 100%);
  border-color: #c41e3a;
  color: #721c24;
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.15);
}

/* RESPONSIVE */

@media (max-width: 768px) {
  .contact-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .contact-info h2,
  .contact-form h2 {
    font-size: 1.5rem;
  }

  .form-contatti {
    padding: 1.5rem;
  }

  .btn-submit {
    padding: 0.9rem 1.5rem;
    font-size: 0.9rem;
  }

  .contact-info {
    order: 2;
  }

  .contact-form {
    order: 1;
  }
}

/* Additional animations and effects */

.form-group.focused label {
  color: #5d4e37;
}

.form-group input:not(:placeholder-shown),
.form-group textarea:not(:placeholder-shown) {
  background-color: #fffbf7;
}

/* Stato di successo per i campi */
.form-group input:valid:not(:placeholder-shown),
.form-group textarea:valid:not(:placeholder-shown) {
  border-color: #28a745;
}

/* Spinner per il submit */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------
   DESIGN TOKENS
-------------------------------------------------- */

:root {
  /* Primary palette */
  --primary: #5d4e37;          /* Terra di Siena */
  --primary-light: #8b7355;
  --primary-lighter: #a68b76;

  /* Neutral palette */
  --bg: #ffffff;
  --bg-soft: #fffbf7;
  --bg-muted: #f0ebe4;

  --border: #e8ddd2;
  --text: #2c2c2c;
  --text-muted: #666;
  --text-light: #998876;

  /* States */
  --success: #28a745;
  --danger: #c41e3a;
  --warning: #ff9800;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 1rem;
  --sp-4: 1.5rem;
  --sp-5: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 25px rgba(0,0,0,0.12);
  --shadow-focus: 0 0 0 0.25rem rgba(93,78,55,0.25);

  /* Transition */
  --transition: all 0.25s ease;
}

/* --------------------------------------------------
   BUTTONS (Bootstrap-like)
-------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.9rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

/* Primary button */

.btn-primary {
  color: #ffffff;
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-light)
  );
  box-shadow: 0 4px 15px rgba(93,78,55,0.3);
}

/* Hover */

.btn-primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(
    135deg,
    var(--primary-light),
    var(--primary-lighter)
  );
}

/* Focus (accessibilità) */

.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 0.25rem rgba(93,78,55,0.35),
    0 6px 20px rgba(93,78,55,0.35);
}

/* Active */

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(93,78,55,0.25);
}

/* Disabled */

.btn:disabled,
.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  background: linear-gradient(
    135deg,
    #b8a89a,
    #c9b8aa
  );
  box-shadow: none;
}

/* --------------------------------------------------
   MODAL - DETTAGLI PERSONA ALBERO GENEALOGICO
-------------------------------------------------- */

.person-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.person-detail-modal.person-detail-modal-active {
  display: flex;
}

.person-detail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: -1;
  animation: fadeIn 0.3s ease-out;
}

.person-detail-content {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  z-index: 10000;
  animation: slideUp 0.3s ease-out;
}

.person-detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.person-detail-close:hover {
  background-color: #f0f0f0;
  color: #2c2c2c;
}

#person-detail-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: #2c2c2c;
  margin: 0 2rem 1.5rem 0;
  padding-right: 2rem;
  line-height: 1.4;
}

.person-detail-body {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.person-detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.person-detail-field label {
  font-weight: 600;
  color: #5d4e37;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.person-detail-field span {
  color: #2c2c2c;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Animation */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Media Query - Modal responsivo */

@media (max-width: 480px) {
  .person-detail-content {
    padding: 1.5rem;
    max-width: 100%;
  }
  
  #person-detail-name {
    font-size: 1.3rem;
    margin-right: 2rem;
  }
  
  .person-detail-field label {
    font-size: 0.85rem;
  }
  
  .person-detail-field span {
    font-size: 0.9rem;
  }
}