:root {
  --navy: #12324d;
  --navy-deep: #0b2133;
  --ink: #1c2430;
  --gold: #f0b429;
  --gold-soft: #ffe7a3;
  --teal: #1c9a7a;
  --sky: #2eb5e0;
  --coral: #e45c4a;
  --cream: #f6f0e4;
  --paper: #fffdf8;
  --muted: #5b6773;
  --line: rgba(18, 50, 77, 0.12);
  --shadow: 0 18px 40px rgba(18, 50, 77, 0.12);
  --radius: 22px;
  --max: 1120px;
  --font: "Nunito", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(240, 180, 41, 0.18), transparent 28%),
    linear-gradient(180deg, #efe6d4 0%, var(--cream) 18%, #f7f3ea 100%);
  line-height: 1.55;
  min-height: 100%;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus { left: 12px; background: #fff; padding: 8px 12px; z-index: 20; }

.topbar {
  background: var(--navy-deep);
  color: #f4efe4;
  font-size: 0.92rem;
}
.topbar-inner, .nav-inner, .wrap {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.topbar a { color: var(--gold-soft); text-decoration: none; font-weight: 700; }
.topbar a:hover { text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.brand img.logo {
  width: auto;
  height: 65px;
  max-width: min(440px, 88vw);
  object-fit: contain;
  display: block;
}
.brand-text strong {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--navy);
}
.brand-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}
.nav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--navy);
}
.nav a:hover, .nav a.active {
  background: var(--navy);
  color: #fff;
}
.menu-toggle {
  display: none;
  border: 0;
  background: var(--navy);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 1.3rem;
  cursor: pointer;
}

.hero {
  position: relative;
  min-height: 70vh;
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  z-index: -2;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(11, 33, 51, 0.88) 8%, rgba(11, 33, 51, 0.35) 70%),
    linear-gradient(180deg, transparent 30%, rgba(11, 33, 51, 0.55));
}
.hero-inner { padding: 72px 0 56px; }
.kicker {
  display: inline-block;
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  line-height: 1.08;
  margin: 0 0 14px;
  max-width: 14ch;
}
.hero p {
  max-width: 38ch;
  font-size: 1.12rem;
  color: #f4efe4;
  margin: 0 0 28px;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
}
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-sky { background: var(--sky); color: #083447; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  box-shadow: inset 0 0 0 2px var(--navy);
}
.btn-whatsapp { background: #25d366; color: #073b1d; }
.btn:hover { transform: translateY(-1px); }
.card-body .btn + .btn,
.panel .btn + .btn { margin-left: 8px; }
.link-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}
@media (max-width: 700px) {
  .link-row { grid-template-columns: 1fr; }
}

.section { padding: 64px 0; }
.section h2, .page-head h1 {
  font-family: var(--display);
  color: var(--navy);
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1.15;
  margin: 0 0 12px;
}
.lede { color: var(--muted); max-width: 58ch; font-size: 1.08rem; }
.grid-3, .grid-2, .cards { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.1fr 0.9fr; }
.home-trio {
  display: grid;
  grid-template-columns: 1fr 0.72fr 1fr;
  gap: 20px;
  align-items: stretch;
}
.home-trio--duo {
  grid-template-columns: 1fr 1fr;
}
.home-trio__events { order: 1; }
.home-trio__flyer { order: 2; }
.home-trio__news { order: 3; }
.home-trio > div > h2 {
  font-size: clamp(1.35rem, 2vw, 1.7rem);
}
.home-flyer {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}
.home-flyer-thumb {
  display: block;
  width: min(100%, 220px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.home-flyer-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.home-flyer-thumb:hover { opacity: 0.94; }
.home-stack {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  height: calc(100% - 3rem);
  min-height: 0;
}
.home-stack__action {
  margin: auto 0 0;
  padding-top: 14px;
}
.home-news-excerpt {
  max-height: calc(1.62em * 6);
  overflow: hidden;
}
.home-news-excerpt p {
  margin: 0 0 0.55em;
  line-height: 1.62;
}
.home-news-excerpt p:last-child { margin-bottom: 0; }
.home-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.panel .home-feed {
  margin: -6px 0 0;
}
.home-feed li + li {
  border-top: 1px solid rgba(15, 40, 70, 0.1);
}
.home-feed__link {
  display: block;
  padding: 12px 0;
  text-decoration: none;
  color: inherit;
}
.home-feed__link:hover .home-feed__title {
  color: var(--teal);
  text-decoration: underline;
}
.home-feed__date {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.home-feed__title {
  display: block;
  color: var(--navy);
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
}
.home-news-title {
  color: inherit;
  text-decoration: none;
}
.home-news-title:hover {
  color: var(--teal);
  text-decoration: underline;
}
.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card, .panel {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card img, .media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  object-fit: cover;
  object-position: center;
}
.card-body, .panel { padding: 22px; }

/* Calendario: griglia compatta per news ed eventi */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
  align-items: stretch;
}
.cal-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  scroll-margin-top: 96px;
}
.cal-card__thumb {
  width: 100%;
  height: 88px;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #e8e2d6;
  flex-shrink: 0;
}
.cal-card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.cal-card__when {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.cal-card__date {
  color: var(--navy);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.cal-card__place {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}
.cal-card__body h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  color: var(--navy);
  font-size: 1.28rem;
  line-height: 1.25;
}
.cal-card__body p {
  margin: 0 0 0.55em;
  line-height: 1.62;
  font-size: 0.98rem;
  color: #2a3340;
}
.cal-card__body p:last-of-type { margin-bottom: 0; }
.cal-card__body .badge { margin-bottom: 8px; }
.cal-card__body .meta { margin-bottom: 6px; }
.cal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  min-height: 40px;
}
.cal-actions .btn,
.cal-actions .btn + .btn {
  margin-left: 0;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.95rem;
}

/* News: griglia a card espandibili */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
  align-items: start;
}
.news-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: auto;
  scroll-margin-top: 96px;
}
.news-card__media {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #e8e2d6;
  flex-shrink: 0;
  overflow: hidden;
}
.news-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.news-card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.news-card__body .meta {
  margin-bottom: 6px;
}
.news-card__body h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  color: var(--navy);
  font-size: 1.2rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  min-height: calc(1.25em * 2);
}
.news-card.is-open .news-card__body h3 {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  min-height: 0;
}
.news-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  flex: 0 0 auto;
  max-height: calc(1.62em * 5);
}
.news-card.is-open .news-card__excerpt {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  max-height: none;
}
.news-card__excerpt p {
  display: inline;
  margin: 0;
  line-height: 1.62;
  font-size: 0.98rem;
  color: #2a3340;
}
.news-card__excerpt p + p::before {
  content: "\A\A";
  white-space: pre;
}
.news-card.is-open .news-card__excerpt p {
  display: block;
  margin: 0 0 0.55em;
}
.news-card.is-open .news-card__excerpt p + p::before {
  content: none;
}
.news-card.is-open .news-card__excerpt p:last-child { margin-bottom: 0; }
.news-card__toggle {
  align-self: flex-start;
  margin-top: 12px;
  min-height: 40px;
  padding: 0 14px;
}
.news-card__toggle.is-hidden {
  visibility: hidden;
  pointer-events: none;
}
.news-card .cal-actions {
  margin-top: 12px;
}

.card h3, .panel h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  color: var(--navy);
  font-size: 1.35rem;
}
.meta {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.badge {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--navy);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 4px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stat {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.stat b {
  display: block;
  font-family: var(--display);
  font-size: 2rem;
  color: var(--gold);
}
.paths {
  align-items: stretch;
}
.paths .card {
  text-align: left;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.paths .card-body {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.paths .btn {
  margin-top: auto;
  align-self: flex-start;
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
  align-items: stretch;
}

.lede a {
  color: var(--teal);
  font-weight: 800;
}

.volantino {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
  margin-bottom: 12px;
}
.volantino-box {
  margin-bottom: 0;
}
.corsi-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: start;
}
.corsi-testi {
  display: grid;
  gap: 20px;
}
.corsi-testi .panel .btn {
  margin-top: 18px;
}

.page-head {
  padding: 42px 0 10px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
}
.split img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.list li {
  padding: 10px 0 10px 28px;
  position: relative;
}
.list li::before {
  content: "♟";
  position: absolute;
  left: 0;
  color: var(--gold);
}

.form, .admin-box {
  background: var(--paper);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
label { display: block; font-weight: 800; margin: 12px 0 6px; color: var(--navy); }
input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font: inherit;
  background: #fff;
}
textarea { min-height: 140px; resize: vertical; }
.hp { position: absolute; left: -9999px; }
.notice {
  padding: 14px 16px;
  border-radius: 14px;
  background: #e4f7ee;
  color: #135c3a;
  font-weight: 700;
  margin-bottom: 16px;
}
.notice.error { background: #fde8e4; color: #8a2418; }

.site-footer {
  background: var(--navy-deep);
  color: #f4efe4;
  padding: 42px 0 24px;
  margin-top: 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
.site-footer a { color: var(--gold-soft); text-decoration: none; }
.site-footer h3 { font-family: var(--display); margin: 0 0 10px; }
.legal { opacity: 0.75; font-size: 0.9rem; margin-top: 28px; }

.admin-bar {
  background: #111;
  color: #fff;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}
input[type="checkbox"] { width: auto; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 16px; overflow: hidden; }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { background: var(--navy); color: #fff; }
.empty {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

button.linkish,
.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}
button.linkish:hover,
.linkish:hover { color: var(--teal); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox[hidden] { display: none !important; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 28, 0.88);
}
.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  background: transparent;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.lightbox-close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--navy);
  font-size: 1.85rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.lightbox-close:hover {
  background: #fff;
  color: var(--teal);
}
.lightbox-body {
  padding: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
}
.lightbox-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 40px);
  display: block;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}
.lightbox-frame {
  width: 100%;
  height: 100%;
  min-height: 70vh;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}
body.lightbox-open { overflow: hidden; }

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 76px;
    background: #fffdf8;
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 16px; }
  .grid-3, .grid-2, .split, .stats, .footer-grid, .corsi-layout, .cal-grid, .archive-list, .home-trio, .news-grid { grid-template-columns: 1fr; }
  .home-trio__news { order: 2; }
  .home-trio__flyer { order: 3; }
  .home-stack { height: auto; }
  .hero { min-height: 78vh; }
  .split img { height: 240px; }
  .topbar-inner { justify-content: center; text-align: center; }
}
