body {
  font-family: Arial, Verdana, sans-serif;
  background: #f5f7fa;
  margin: 0;
  padding: 20px;
  letter-spacing: 0.04em;
}

.container {
  max-width: 75ch;
  margin: auto;
  background: white;
  padding: 30px;
  border-radius: 12px;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.subtitle {
  font-size: 1.1em;
}

.switch {
  display: inline-block;
  margin-top: 10px;
}

h1, h2, h3 {
  color: #2e7d32;
}

p, li {
  line-height: 1.9;
  font-size: 1.05em;
}

.section-button {
  width: 100%;
  padding: 15px;
  font-size: 1.2em;
  background: #e8f5e9;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left; /* Assicura che il testo del bottone sia a sinistra */
}

.section-button:focus {
  outline: 3px solid #ff9800;
}

.section-content {
  display: none;
  padding: 20px;
  border: 1px solid #e8f5e9;
  border-top: none;
}

.section-content.active {
  display: block;
}

.arrow {
  display: inline-block;
  float: right;
  transition: transform 0.3s ease;
  font-size: 0.8em;
  margin-top: 5px;
}

.arrow.rotated {
  transform: rotate(180deg);
}

.example {
  background: #f1f8e9;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 8px;
}

.formula {
  background: white;
  padding: 12px;
  margin: 10px 0;
  border-left: 4px solid #4caf50;
}

.highlight {
  background: #fff59d;
  padding: 2px 6px;
}

.result {
  font-weight: bold;
}

/* --- REGOLE PER LA STAMPA --- */
@media print {
  /* Nasconde i bottoni di navigazione in alto e in fondo */
  nav, 
  .switch,
  p[style*="justify-content: center"],
  button:not(.section-button) {
    display: none !important;
  }

  /* Nasconde le freccette dentro i bottoni delle sezioni */
  .arrow {
    display: none !important;
  }

  /* Assicura che tutto il contenuto sia visibile su carta */
  .section-content {
    display: block !important;
    border: none !important;
    padding: 10px 0 !important;
  }

  .container {
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    box-shadow: none;
  }

  /* Evita di spezzare gli esempi tra due pagine diverse */
  .example, .formula, .section {
    page-break-inside: avoid;
  }

  body {
    background: white;
    padding: 0;
  }
}

/* Accessibilità per chi preferisce meno animazioni */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}