* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #222;
  background: #f9f8f5;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
header {
  background: #fff;
  border-bottom: 1px solid #e5e3dd;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 20px;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2d7a4d;
}

.logo-link {
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

nav {
  display: flex;
  gap: 2rem;
}

nav a {
  text-decoration: none;
  color: #222;
  font-size: 1rem;
  transition: color 0.3s;
}

nav a:hover {
  color: #2d7a4d;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #f9f8f5 0%, #ede9e0 100%);
  padding: 4rem 20px;
  text-align: center;
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  color: #222;
}

.subtitle {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 2rem;
}

.cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  transition: opacity 0.3s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #2d7a4d;
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: transparent;
  color: #2d7a4d;
  border: 2px solid #2d7a4d;
}

.btn-secondary:hover {
  background: #2d7a4d;
  color: white;
}

/* Hero section */
.hero h1 {
  white-space: nowrap;
}

/* Page Header */
.page-header {
  background: linear-gradient(135deg, #f9f8f5 0%, #ede9e0 100%);
  padding: 3rem 20px;
  text-align: center;
  border-bottom: 1px solid #e5e3dd;
}

.page-header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  color: #222;
}

.page-header p {
  font-size: 1rem;
  color: #666;
}

/* Page Content Sections */
.page-content {
  background: #fff;
  padding: 3rem 20px;
  border-bottom: 1px solid #e5e3dd;
}

.page-content.alt {
  background: #f9f8f5;
}

.page-content h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: #222;
}

.page-content h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #222;
}

.page-content p {
  font-size: 1rem;
  line-height: 1.8;
  color: #444;
  margin-bottom: 1rem;
}

.page-content a {
  color: #2d7a4d;
  text-decoration: none;
}

.page-content a:hover {
  text-decoration: underline;
}

/* Compact spacing for contact page */
.contact-compact .page-header {
  padding: 2.25rem 20px;
}

.contact-compact .page-content {
  padding: 2.25rem 20px;
}

/* Compact spacing for comitato page */
.comitato-compact .page-header {
  padding: 1.75rem 20px;
}

.comitato-compact .page-content {
  padding: 1.75rem 20px;
}

/* Cards Grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #fff;
  border: 1px solid #e5e3dd;
  padding: 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  color: #222;
  transition: all 0.3s;
}

.card:hover {
  border-color: #2d7a4d;
  box-shadow: 0 2px 8px rgba(45, 122, 77, 0.1);
}

.card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #2d7a4d;
}

.card p {
  font-size: 0.95rem;
  color: #666;
}

/* Docs Grid */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.doc-card {
  background: #fff;
  border: 1px solid #e5e3dd;
  padding: 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  color: #222;
  transition: all 0.3s;
  display: block;
}

.doc-card:hover {
  border-color: #2d7a4d;
  box-shadow: 0 2px 8px rgba(45, 122, 77, 0.1);
}

.doc-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #2d7a4d;
}

.doc-card p {
  font-size: 0.9rem;
  color: #666;
}

/* Lists */
.timeline-list,
.periods-list,
.members-list {
  list-style: none;
}

.timeline-list li,
.periods-list li {
  padding: 1rem 0;
  border-bottom: 1px solid #e5e3dd;
}

.timeline-list li:last-child,
.periods-list li:last-child {
  border-bottom: none;
}

.members-list li {
  padding: 0.8rem 0;
  color: #444;
}

.members-list li:before {
  content: "— ";
  color: #2d7a4d;
  font-weight: bold;
}

/* Contact Block */
.contact-block {
  background: #f9f8f5;
  padding: 1.5rem;
  border-left: 3px solid #2d7a4d;
}

.contact-block h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #2d7a4d;
}

.contact-block p {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.contact-block a {
  color: #2d7a4d;
  text-decoration: none;
}

.contact-block a:hover {
  text-decoration: underline;
}

/* Info Section */
.info-section {
  background: #fff;
  padding: 3rem 20px;
  border-bottom: 1px solid #e5e3dd;
  text-align: center;
}

.info-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: #222;
}

.info-section p {
  font-size: 1rem;
  line-height: 1.8;
  color: #444;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.link {
  display: inline-block;
  color: #2d7a4d;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s;
}

.link:hover {
  transform: translateX(4px);
}

/* Footer */
footer {
  background: #222;
  color: #fff;
  padding: 1rem 20px;
  font-size: 0.8rem;
}

footer .container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer p {
  margin: 0;
  font-size: 0.85rem;
}

footer a {
  color: #2d7a4d;
  text-decoration: none;
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
}

footer a.btn {
  font-size: 0.7rem;
  padding: 0.35rem 0.8rem;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.gallery-card {
  background: #fff;
  border: 1px solid #e5e3dd;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
}

.gallery-card:hover {
  border-color: #2d7a4d;
  box-shadow: 0 2px 8px rgba(45, 122, 77, 0.1);
}

.gallery-thumb {
  background: #ede9e0;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.gallery-card h3 {
  padding: 1rem 1rem 0.5rem;
  font-size: 1rem;
  color: #2d7a4d;
}

.gallery-card p {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  color: #555;
}

.gallery-card.clickable {
  cursor: pointer;
}

.thumb-row {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f5f2eb;
}

.thumb-row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  border: none;
  display: block;
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.lightbox-backdrop.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lightbox-content img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  background: #000;
  border-radius: 4px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.lightbox-close {
  top: -20px;
  right: -20px;
  transform: none;
}

.lightbox-prev {
  left: -50px;
}

.lightbox-next {
  right: -50px;
}

@media (max-width: 768px) {
  .lightbox-content img {
    max-width: 90vw;
    max-height: 60vh;
  }

  .lightbox-prev {
    left: -30px;
  }

  .lightbox-next {
    right: -30px;
  }
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 0;
}

.newsletter-box {
  background: #fff;
  border: 1px solid #e5e3dd;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  max-width: 520px;
}

.newsletter-form button {
  margin-top: 0.5rem;
  width: auto;
}

.newsletter-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #444;
}

.newsletter-status.success {
  color: #2d7a4d;
}

.newsletter-status.error {
  color: #b00020;
}

.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #222;
}

.form-group input,
.form-group textarea {
  padding: 0.8rem;
  border: 1px solid #e5e3dd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  color: #222;
  background: #fff;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2d7a4d;
  box-shadow: 0 0 0 2px rgba(45, 122, 77, 0.1);
}

.contact-form button {
  margin-top: 1rem;
  width: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  nav {
    gap: 1rem;
  }

  nav a {
    font-size: 0.9rem;
  }

  header .container {
    padding: 1rem 15px;
    gap: 1.5rem;
  }

  .hero h1 {
    font-size: 1.4rem !important;
    white-space: normal !important;
    padding: 0 1rem;
    line-height: 1.2;
  }

  .hero p.subtitle {
    font-size: 0.95rem !important;
    padding: 0 1rem;
  }

  .page-header h1 {
    font-size: 1.6rem;
  }

  .page-content h2 {
    font-size: 1.4rem;
  }

  .cta {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .cards,
  .docs-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .form-group {
    flex: 1;
  }
}

/* Modal / Popup */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 2.5rem;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

.modal-content h2 {
  color: #2d7a4d;
  margin-bottom: 1rem;
}

.modal-content p {
  margin-bottom: 1rem;
}

.modal-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #333;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { 
    opacity: 0;
    transform: translateY(-50px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Mobile */
@media (max-width: 768px) {
  .modal-content {
    padding: 1.5rem;
    max-width: 95%;
    max-height: 80vh;
    overflow-y: auto;
  }

  .modal-content h2 {
    font-size: 1.2rem;
  }

  .modal-content h3 {
    font-size: 0.95rem;
  }

  .modal-content p,
  .modal-content li {
    font-size: 0.9rem;
  }

  .modal-close {
    font-size: 1.5rem;
    top: 0.5rem;
    right: 0.8rem;
  }

  .modal-content .btn {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

/* Extra small devices (iPhone) */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.2rem !important;
    padding: 0 0.5rem;
    line-height: 1.3;
  }

  .hero p.subtitle {
    font-size: 0.85rem !important;
    padding: 0 0.5rem;
  }

  .hero {
    min-height: 350px !important;
  }
}
