/* ============================================================
   Massarosa.com — Portale del territorio
   Sistema grafico ripreso da cascatadotro.it (cream/ink, Kaisei Opti + DM Sans,
   bottoni pill, radius 16) esteso con le sezioni di un portale turistico.
   ============================================================ */

:root {
  --cream: #f9f7f2;
  --ink:   #1b1b18;
  --white: #ffffff;
  --olive: #6b7a4f;
  --terracotta: #b5622f;
  --line: rgba(27,27,24,0.12);

  --content: 1770px;
  --gutter:  clamp(1.25rem, 4vw, 75px);
  --radius:  16px;
  --radius-sm: 10px;
  --gap:     20px;

  --font-display: "Kaisei Opti", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }

.container {
  width: min(var(--content), 100% - (var(--gutter) * 2));
  margin-inline: auto;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--ink);
  color: var(--white);
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: clamp(0.78rem, 1.3vw, 13px);
  letter-spacing: 0.02em;
  text-align: center;
  padding: 0.5rem 1rem;
}
.topbar strong { font-weight: 700; }

/* ---------- Navbar ---------- */
.navbar {
  position: relative;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--ink);
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.brand__tag {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27,27,24,0.6);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.9rem);
  flex-wrap: wrap;
  font-size: 15px;
  font-weight: 500;
}
.nav-links a { position: relative; padding-block: 4px; }
.nav-links a:hover { opacity: 0.6; }

/* ---------- Bottoni pill ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(0.9rem, 1.2vw, 14px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  border-radius: 999px;
  padding: 14px 30px;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.3s ease;
}
.btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

/* ---------- Hero ---------- */
.hero__img {
  width: 100%;
  aspect-ratio: 1771 / 782;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ---------- Intro ---------- */
.intro { text-align: center; margin-top: 70px; }

.intro__eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin: 0 0 18px;
}

.intro__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}

.intro__text {
  max-width: 900px;
  margin: 40px auto 0;
  font-size: clamp(1.05rem, 1.6vw, 19px);
  line-height: 1.6;
}
.intro__text p { margin: 0; }
.intro__text p + p { margin-top: 22px; }
.intro__text strong { font-weight: 600; }

.intro__cta { margin-top: 42px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Stats strip ---------- */
.stats {
  margin-top: 80px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
.stats__item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
}
.stats__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
}
.stats__label {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(27,27,24,0.65);
  letter-spacing: 0.02em;
}

/* ---------- Section heading (stile "Gallery" del template) ---------- */
.section { margin-top: 130px; }
.section__head { margin-bottom: 50px; }
.section__eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin: 0 0 12px;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 720px;
}
.section__lead {
  margin: 20px 0 0;
  max-width: 800px;
  font-size: clamp(1rem, 1.3vw, 18px);
  line-height: 1.6;
  color: rgba(27,27,24,0.8);
}

/* ---------- Split (immagine + testo) ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
.split__img { border-radius: var(--radius); overflow: hidden; }
.split__img img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/5; }
.split__text p { margin: 0 0 18px; line-height: 1.7; font-size: 1.02rem; }
.split__text p:last-child { margin-bottom: 0; }
.split--reverse .split__img { order: 2; }

/* ---------- Card grid (Da Vedere) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card__img { aspect-ratio: 4/3; overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 24px; }
.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 10px;
}
.card__text { margin: 0; font-size: 0.95rem; line-height: 1.55; color: rgba(27,27,24,0.78); }
.card--noimg .card__body { padding: 28px 24px; }
.card--noimg { justify-content: center; }

/* ---------- Frazioni ---------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 50px;
  padding: 0;
  list-style: none;
}
.tag-list li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  background: var(--white);
}

/* ---------- Gallery (griglia del template originale) ---------- */
.gallery {
  display: grid;
  grid-template-columns: 856fr 436fr 436fr;
  gap: var(--gap);
}
.gallery__item {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 436 / 310;
}
.gallery__item--big { grid-column: 1; grid-row: 1 / span 2; aspect-ratio: auto; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }
.gallery__item figcaption {
  display: none;
}

/* ---------- Eventi ---------- */
.events {
  display: grid;
  gap: 18px;
}
.event {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 26px;
  align-items: start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
}
.event__date {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--terracotta);
}
.event__title { font-weight: 700; margin: 0 0 6px; font-size: 1.05rem; }
.event__place { font-size: 0.85rem; color: rgba(27,27,24,0.6); margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.event__text { margin: 0; font-size: 0.95rem; line-height: 1.55; color: rgba(27,27,24,0.8); }

/* ---------- Come arrivare ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.info-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.info-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0 0 12px;
}
.info-card__text { margin: 0; font-size: 0.95rem; line-height: 1.6; color: rgba(27,27,24,0.8); }

/* ---------- Footer ---------- */
footer { margin-top: 130px; padding-bottom: 30px; }
.footer {
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius);
  padding: 48px var(--gutter);
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
}
.footer h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 14px;
  font-weight: 700;
}
.footer p, .footer a { font-size: 0.9rem; line-height: 1.7; color: rgba(255,255,255,0.75); }
.footer a:hover { color: var(--white); }
.footer__bottom {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 10px;
  padding-top: 20px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.7;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; gap: 28px; }
  .split--reverse .split__img { order: 0; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
  .footer { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .navbar { min-height: auto; justify-content: center; text-align: center; }
  .nav-links { justify-content: center; font-size: 14px; gap: 0.8rem 1.2rem; }
  .btn { padding: 12px 24px; }

  .intro { margin-top: 40px; }
  .intro__text { margin-top: 24px; }
  .intro__cta { margin-top: 28px; }
  .stats { margin-top: 48px; }
  .section { margin-top: 72px; }
  .section__head { margin-bottom: 32px; }
  footer { margin-top: 72px; }

  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery__item--big { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 16 / 10; }

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

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .gallery__item { aspect-ratio: 3 / 2; }
}
