/* =========================================================
   Terra di APSfera - Foglio di stile principale
   ========================================================= */

:root {
  --color-primary: #2d6a4f;
  --color-primary-dark: #1b4332;
  --color-secondary: #95d5b2;
  --color-accent: #f4a261;
  --color-warm: #e9c46a;
  --color-bg: #fdf6ec;
  --color-bg-soft: #fffaf2;
  --color-text: #2c3e2d;
  --color-text-light: #5a6c5d;
  --color-border: #d8e2d2;
  --color-error: #c44536;
  --color-success: #4a7c59;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.15);
  --radius: 14px;
  --radius-lg: 24px;
  --transition: 0.3s ease;
  --font-headline: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Open Sans', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4 {
  font-family: var(--font-headline);
  color: var(--color-primary-dark);
  line-height: 1.3;
  margin-bottom: 0.6em;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2.4vw, 1.6rem); }

p { margin-bottom: 1em; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 246, 236, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--color-border);
}

.header-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

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

.logo-link img {
  height: 70px;
  width: auto;
  transition: transform var(--transition);
}

.logo-link:hover img {
  transform: scale(1.05);
}

.brand-title {
  text-align: center;
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  color: var(--color-primary-dark);
  letter-spacing: 0.5px;
  margin: 0;
}

.brand-title a {
  color: inherit;
}

.brand-title small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.55em;
  color: var(--color-text-light);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Hamburger menu */
.hamburger {
  background: none;
  border: 2px solid var(--color-primary);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all var(--transition);
}

.hamburger:hover {
  background: var(--color-primary);
}

.hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

.hamburger:hover span {
  background: white;
}

/* Top nav (sotto al titolo) */
.top-nav {
  background: var(--color-primary-dark);
  color: white;
}

.top-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.top-nav a {
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--transition);
}

.top-nav a:hover,
.top-nav a.active {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

.lang-switcher {
  position: relative;
  margin-left: auto;
}

.lang-switcher button {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition);
}

.lang-switcher button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  color: var(--color-text);
  list-style: none;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 0.4rem 0;
  min-width: 160px;
  display: none;
  overflow: hidden;
}

.lang-switcher.open .lang-dropdown {
  display: block;
}

.lang-dropdown li button {
  width: 100%;
  text-align: left;
  background: none;
  color: var(--color-text);
  border: none;
  border-radius: 0;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-weight: 500;
}

.lang-dropdown li button:hover,
.lang-dropdown li button.active {
  background: var(--color-bg);
  color: var(--color-primary);
}

/* Side drawer for hamburger */
.drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 320px;
  max-width: 90vw;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right var(--transition);
  z-index: 200;
  padding: 5rem 1.5rem 2rem;
  overflow-y: auto;
}

.drawer.open { right: 0; }

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 150;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--color-primary-dark);
}

.drawer ul {
  list-style: none;
}

.drawer li {
  border-bottom: 1px solid var(--color-border);
}

.drawer a {
  display: block;
  padding: 0.9rem 0.4rem;
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: 1.05rem;
}

.drawer a:hover {
  color: var(--color-accent);
  padding-left: 1rem;
}

/* =========================================================
   HERO + FLOATING BUBBLES
   ========================================================= */
.hero {
  position: relative;
  min-height: calc(100vh - 200px);
  padding: 3rem 1.5rem 5rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(149, 213, 178, 0.4), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(244, 162, 97, 0.3), transparent 50%),
    linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-soft) 100%);
  overflow: hidden;
}

.hero-intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 3rem;
  position: relative;
  z-index: 2;
}

.hero-intro h1 {
  margin-bottom: 1rem;
}

.hero-intro p {
  color: var(--color-text-light);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.bubbles-area {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem 1.5rem;
  padding: 1rem;
  z-index: 2;
}

.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--color-primary-dark);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  animation: float 6s ease-in-out infinite;
}

.bubble:nth-child(2n) { animation-delay: -1.5s; animation-duration: 7s; }
.bubble:nth-child(3n) { animation-delay: -3s;   animation-duration: 8s; }
.bubble:nth-child(4n) { animation-delay: -2s;   animation-duration: 6.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

.bubble-img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(45, 106, 79, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all var(--transition);
}

.bubble-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble:hover .bubble-img {
  transform: scale(1.08);
  box-shadow: var(--shadow-lg), 0 0 0 6px rgba(244, 162, 97, 0.25);
}

.bubble-label {
  margin-top: 0.9rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary-dark);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

/* Decorative bubbles in background */
.bg-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(149, 213, 178, 0.45), rgba(149, 213, 178, 0.05));
  pointer-events: none;
  z-index: 1;
  animation: floatBg 12s ease-in-out infinite;
}

.bg-bubble.b1 { width: 220px; height: 220px; top: 10%;  left: 4%;  }
.bg-bubble.b2 { width: 150px; height: 150px; top: 65%;  right: 6%; background: radial-gradient(circle at 30% 30%, rgba(244, 162, 97, 0.35), rgba(244, 162, 97, 0.05)); animation-delay: -4s; }
.bg-bubble.b3 { width: 100px; height: 100px; top: 30%;  right: 12%; animation-delay: -8s; }
.bg-bubble.b4 { width: 180px; height: 180px; bottom: 5%; left: 8%;  background: radial-gradient(circle at 30% 30%, rgba(233, 196, 106, 0.4), rgba(233, 196, 106, 0.05)); animation-delay: -2s; }

@keyframes floatBg {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(20px, -30px); }
}

/* =========================================================
   SUBPAGE CONTENT
   ========================================================= */
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.page-hero {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-bg-soft) 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.page-hero h1 {
  margin-bottom: 0.5rem;
}

.page-hero .subtitle {
  color: var(--color-text-light);
  font-size: 1.1rem;
  font-style: italic;
}

.content-block {
  background: white;
  padding: 2rem clamp(1.2rem, 3vw, 2.5rem);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.content-block p {
  margin-bottom: 1.1em;
  font-size: 1.05rem;
  color: var(--color-text);
}

.content-block strong {
  color: var(--color-primary-dark);
}

/* Image gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.gallery img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}

.gallery img:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

/* CTA buttons embedded in text */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 2rem 0 1rem;
}

.cta-btn {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 0.85rem 1.8rem;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.cta-btn:hover {
  background: var(--color-primary-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cta-btn.secondary {
  background: var(--color-accent);
}

.cta-btn.secondary:hover {
  background: #e08545;
}

.cta-btn.outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.cta-btn.outline:hover {
  background: var(--color-primary);
  color: white;
}

/* =========================================================
   FORMS
   ========================================================= */
.form-card {
  max-width: 640px;
  margin: 0 auto;
  background: white;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 1.3rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-primary-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
  background: var(--color-bg-soft);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1.2rem 0;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.checkbox-row label {
  font-size: 0.95rem;
  color: var(--color-text-light);
  margin: 0;
  line-height: 1.5;
}

.form-message {
  padding: 1rem;
  border-radius: 10px;
  margin-top: 1rem;
  text-align: center;
  font-weight: 600;
  display: none;
}

.form-message.success {
  background: #d4edda;
  color: var(--color-success);
  display: block;
}

.form-message.error {
  background: #f8d7da;
  color: var(--color-error);
  display: block;
}

/* =========================================================
   DONATIONS PAGE
   ========================================================= */
.donation-toggle {
  display: flex;
  background: var(--color-bg-soft);
  border-radius: 999px;
  padding: 5px;
  max-width: 460px;
  margin: 0 auto 2rem;
  box-shadow: var(--shadow-sm);
}

.donation-toggle button {
  flex: 1;
  padding: 0.75rem 1.2rem;
  border: none;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  color: var(--color-text-light);
  transition: all var(--transition);
  font-family: inherit;
  font-size: 0.95rem;
}

.donation-toggle button.active {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.8rem;
  margin: 1.5rem 0;
}

.amount-btn {
  padding: 1rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary-dark);
  transition: all var(--transition);
  font-family: inherit;
}

.amount-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-soft);
}

.amount-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.payments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.payment-method {
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.2rem 0.8rem;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  color: var(--color-primary-dark);
  transition: all var(--transition);
  font-family: inherit;
  font-size: 0.95rem;
}

.payment-method:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-soft);
  transform: translateY(-2px);
}

.payment-method .icon {
  font-size: 2rem;
  margin-bottom: 0.4rem;
  display: block;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
}

.modal h3 {
  margin-bottom: 1rem;
  color: var(--color-error);
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--color-text-light);
}

/* =========================================================
   FAQ
   ========================================================= */
.faq-section h2 {
  border-bottom: 2px solid var(--color-secondary);
  padding-bottom: 0.5rem;
  margin: 2rem 0 1rem;
}

.faq-item {
  background: white;
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.faq-item summary {
  padding: 1rem 1.4rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-primary-dark);
  transition: background var(--transition);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.6rem;
  color: var(--color-accent);
  transition: transform var(--transition);
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item summary:hover {
  background: var(--color-bg-soft);
}

.faq-answer {
  padding: 0 1.4rem 1.2rem;
  color: var(--color-text-light);
  line-height: 1.65;
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 2.5rem 1.5rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  color: white;
  margin-bottom: 0.8rem;
  font-family: var(--font-headline);
}

.footer-col a {
  color: rgba(255, 255, 255, 0.85);
  display: block;
  padding: 0.25rem 0;
}

.footer-col a:hover {
  color: var(--color-warm);
}

.social-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.social-row a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  transition: all var(--transition);
}

.social-row a:hover {
  background: var(--color-accent);
  transform: translateY(-2px);
}

.social-row svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
  .header-bar {
    grid-template-columns: auto 1fr auto;
    padding: 0.5rem 1rem;
  }

  .logo-link img { height: 50px; }

  .top-nav-inner {
    gap: 0.4rem;
    padding: 0.4rem 1rem;
  }

  .top-nav a {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
  }

  .lang-switcher {
    margin-left: 0;
  }

  .bubble-img {
    width: 130px;
    height: 130px;
  }

  .bubble-label { font-size: 0.9rem; }

  .bubbles-area {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem 1rem;
  }

  .page { padding: 2rem 1rem 3rem; }

  .gallery img { height: 200px; }
}

@media (max-width: 480px) {
  .top-nav-inner { justify-content: flex-start; }
  .bubbles-area { grid-template-columns: repeat(2, 1fr); }
  .bubble-img { width: 110px; height: 110px; }
  .bubble-label { font-size: 0.8rem; padding: 0.25rem 0.6rem; }
  .footer-inner { grid-template-columns: 1fr; }
}
