/* Foglio di stile condiviso v5 - Sito statico Arti & Mestieri */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-soft: #faf9f5;
  --ink: #1b1917;
  --muted: #59554e;
  --accent: #8c2d19;
  --accent-hover: #6b2011;
  --accent-soft: #f7ece8;
  --border: #ddd7cb;
  --shadow: 0 2px 10px rgba(27, 25, 23, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header e navigazione */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.15rem 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.brand {
  margin: 0 0 0.75rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand a {
  color: var(--ink);
  text-decoration: none;
}

.brand a:hover {
  color: var(--accent);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  align-items: center;
}

.main-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.3rem 0.2rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Card principale */
.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.25rem 2.25rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow);
}

.page-title {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  line-height: 1.25;
  color: var(--ink);
}

.page-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.content-body h2 {
  margin: 2.25rem 0 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.35rem;
  color: var(--accent);
}

.content-body p {
  margin: 0 0 1rem;
}

/* Indice rapido */
.quick-index {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 1.1rem 1.35rem;
  margin-bottom: 2rem;
}

.quick-index strong {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.quick-index ul {
  margin: 0;
  padding-left: 1.2rem;
  columns: 2;
  column-gap: 2rem;
}

.quick-index li {
  margin-bottom: 0.25rem;
  break-inside: avoid;
}

.quick-index a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.quick-index a:hover {
  text-decoration: underline;
}

/* Immagini e layout centrato */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

img.center,
.img-center {
  display: block;
  margin: 1.35rem auto;
  text-align: center;
}

.img-center img {
  display: inline-block;
  margin: 0 auto;
  box-shadow: 0 4px 14px rgba(27, 25, 23, 0.08);
}

/* Layout opzionale immagine al centro affiancata a testo */
.media-center {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.media-center .media-side {
  flex: 1 1 220px;
  min-width: 0;
}

.media-center .media-figure {
  flex: 0 1 320px;
  text-align: center;
}

.media-center .media-figure img {
  display: block;
  margin: 0 auto;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  background: var(--surface-soft);
  border-radius: 6px;
  overflow: hidden;
}

td, th {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
  vertical-align: top;
}

/* Pulsante "Riporta in alto" fisso in basso a destra */
.back-to-top-fixed {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.05rem;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(27, 25, 23, 0.18);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.back-to-top-fixed:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(27, 25, 23, 0.24);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 0 4.5rem;
  margin-top: 3rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 640px) {
  .page-card {
    padding: 1.25rem;
  }
  .page-title {
    font-size: 1.6rem;
  }
  .quick-index ul {
    columns: 1;
  }
  .back-to-top-fixed {
    right: 0.9rem;
    bottom: 0.9rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.85rem;
  }
}
