/* Scuola Presepi – blocco homepage, galleria, scheda, modulo. Mobile first. */
.sp-home, .sp-intro, .sp-grid, .sp-entry, .sp-form, .sp-notice, .sp-pager, .sp-h {
	--sp-red: #8b1e2b;
	--sp-red-dark: #6e1622;
	--sp-green: #4e6e1a;
	--sp-green-dark: #3c5513;
	--sp-gold: #e0a526;
	--sp-cream: #fbf6ec;
	--sp-ink: #2b2b2b;
	--sp-muted: #5f5f5f;
	--sp-line: #e7dcc6;
	box-sizing: border-box;
}
.sp-home *, .sp-entry *, .sp-form *, .sp-grid * { box-sizing: border-box; }

/* Pulsanti */
.sp-btn {
	display: inline-block; padding: .65em 1.2em; border-radius: 999px; border: 2px solid transparent;
	font-weight: 700; line-height: 1.2; text-decoration: none !important; cursor: pointer; font-size: 1rem;
	transition: background-color .15s, color .15s, border-color .15s;
}
.sp-btn--red { background: var(--sp-red); color: #fff !important; }
.sp-btn--red:hover, .sp-btn--red:focus-visible { background: var(--sp-red-dark); }
.sp-btn--green { background: var(--sp-green); color: #fff !important; }
.sp-btn--green:hover, .sp-btn--green:focus-visible { background: var(--sp-green-dark); }
.sp-btn--ghost { background: #fff; color: var(--sp-red) !important; border-color: var(--sp-red); }
.sp-btn--ghost:hover, .sp-btn--ghost:focus-visible { background: var(--sp-cream); }
.sp-btn:focus-visible, .sp-card a:focus-visible, .sp-thumb:focus-visible, .sp-nav:focus-visible { outline: 3px solid var(--sp-gold); outline-offset: 2px; }
.sp-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }

/* Blocco homepage */
.sp-home { max-width: 1170px; margin: 1.25rem auto; padding: 0 16px; color: var(--sp-ink); }
.sp-bar {
	background: var(--sp-red); color: #fff; border-radius: 12px; padding: .6rem 1rem; margin-bottom: 1rem;
	font-weight: 600; text-align: center; font-size: .98rem;
}
.sp-bar a { color: #fff; text-decoration: underline; white-space: nowrap; }
.sp-bar--ultimi_giorni { background: var(--sp-gold); color: #2b2b2b; }
.sp-bar--ultimi_giorni a { color: #2b2b2b; }
.sp-bar--prima, .sp-bar--chiuso { background: var(--sp-green); }
.sp-home__grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.sp-box {
	display: flex; flex-direction: column; background: #fff; border: 1px solid var(--sp-line);
	border-radius: 16px; overflow: hidden; box-shadow: 0 6px 18px rgba(80, 50, 20, .08);
}
.sp-box--presepi { background: var(--sp-cream); }
.sp-box__media { display: block; background: var(--sp-cream); }
.sp-box__media img { display: block; width: 100%; height: auto; }
.sp-box--openday .sp-box__media { max-height: 220px; overflow: hidden; }
.sp-box--openday .sp-box__media img { object-fit: cover; object-position: center 35%; height: 220px; }
.sp-box__media--art { padding: 1rem 1rem 0; }
.sp-box__media--art img { max-width: 360px; margin: 0 auto; }
.sp-box__body { padding: 1rem 1.25rem 1.25rem; }
.sp-box__body h2 { margin: .1rem 0 .5rem; font-size: 1.6rem; line-height: 1.15; color: var(--sp-red); }
.sp-box--openday h2 { color: #5b2bd9; }
.sp-box__body p { margin: .4rem 0; }
.sp-kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; color: var(--sp-green); margin: 0 !important; }
.sp-dates { list-style: none; margin: .5rem 0; padding: 0; }
.sp-dates li { display: flex; flex-wrap: wrap; gap: .25rem .6rem; padding: .35rem 0; border-bottom: 1px dashed var(--sp-line); }
.sp-dates li:last-child { border-bottom: 0; }
.sp-dates span { color: var(--sp-muted); }
.sp-when { font-weight: 600; color: var(--sp-green-dark); }
.sp-invite { font-size: .95rem; margin: .75rem 0 0; }
.sp-invite a { font-weight: 600; color: var(--sp-green-dark); }

@media (min-width: 768px) {
	.sp-home__grid { grid-template-columns: 1fr 1fr; }
	.sp-home--single .sp-home__grid { grid-template-columns: 1fr; }
	.sp-box--openday { flex-direction: row; }
	.sp-box--openday .sp-box__media { flex: 0 0 40%; max-height: none; }
	.sp-box--openday .sp-box__media img { height: 100%; object-fit: contain; object-position: center top; }
	.sp-home--single .sp-box--presepi { flex-direction: row; align-items: center; }
	.sp-home--single .sp-box__media--art { flex: 0 0 40%; padding: 1rem; }
}

/* Galleria */
.sp-intro { display: grid; gap: 1rem; align-items: center; background: var(--sp-cream); border-radius: 16px; padding: 1rem; margin-bottom: 1.5rem; }
.sp-intro__art { width: 100%; max-width: 280px; height: auto; margin: 0 auto; }
@media (min-width: 768px) { .sp-intro { grid-template-columns: 260px 1fr; } }
.sp-h { font-size: 1.35rem; margin: 1.5rem 0 .75rem; color: var(--sp-red); }
.sp-h span { color: var(--sp-muted); font-weight: 400; font-size: .9em; }
.sp-grid { list-style: none !important; margin: 0 !important; padding: 0 !important; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 600px) { .sp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 960px) { .sp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sp-card { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.sp-card::before { display: none !important; }
.sp-card a { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--sp-line); border-radius: 12px; overflow: hidden; text-decoration: none !important; color: var(--sp-ink); transition: transform .15s, box-shadow .15s; }
.sp-card a:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(80, 50, 20, .12); }
/* Copertine uniformi senza ritagli: la foto intera su fondo crema. */
.sp-card__img { display: block; position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--sp-cream); }
.sp-card__img img { position: absolute; inset: 0; display: block; width: 100% !important; height: 100% !important; max-width: none; object-fit: contain; }
.sp-card__num { display: inline-block; margin: .6rem .7rem 0; background: var(--sp-red); color: #fff; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 700; align-self: flex-start; }
.sp-card__title { display: block; margin: .35rem .7rem 0; font-weight: 700; line-height: 1.25; }
.sp-card__who { display: block; margin: .15rem .7rem .7rem; color: var(--sp-muted); font-size: .9rem; }
.sp-pager { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1.5rem 0; }
.sp-pager a, .sp-pager span { min-width: 2.6rem; padding: .5rem .8rem; border-radius: 999px; text-align: center; border: 2px solid var(--sp-red); text-decoration: none; color: var(--sp-red); font-weight: 700; }
.sp-pager span { background: var(--sp-red); color: #fff; }

/* Scheda */
.sp-entry { max-width: 900px; margin: 0 auto; }
.sp-back a { color: var(--sp-red); font-weight: 600; }
.sp-entry__head h2 { margin: .4rem 0 .2rem; color: var(--sp-red); }
.sp-entry__head .sp-card__num { margin: 0; }
.sp-entry__who { color: var(--sp-muted); margin: 0 0 1rem; }
.sp-carousel { position: relative; }
.sp-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; border-radius: 14px; background: var(--sp-cream); scrollbar-width: none; }
.sp-track::-webkit-scrollbar { display: none; }
.sp-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; }
.sp-slide img { display: block; max-width: 100%; max-height: 75vh; width: auto; height: auto; }
.sp-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--sp-red); font-size: 2rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.sp-nav--prev { left: 8px; }
.sp-nav--next { right: 8px; }
.sp-thumbs { display: flex; gap: .5rem; margin-top: .6rem; }
.sp-thumb { padding: 0; border: 3px solid transparent; border-radius: 8px; background: none; cursor: pointer; }
.sp-thumb[aria-current="true"] { border-color: var(--sp-red); }
.sp-thumb img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 5px; }
.sp-share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1.25rem 0; }

/* Avvisi */
.sp-notice { background: var(--sp-cream); border-left: 5px solid var(--sp-gold); border-radius: 8px; padding: 1rem 1.25rem; margin: 1rem 0; }
.sp-notice--ok { border-left-color: var(--sp-green); }
.sp-notice--err { border-left-color: var(--sp-red); background: #fff1f1; }
.sp-notice h2 { margin-top: 0; color: var(--sp-green-dark); }

/* Modulo */
.sp-form { max-width: 680px; }
.sp-form fieldset { border: 1px solid var(--sp-line); border-radius: 12px; padding: 1rem 1.25rem; margin: 0 0 1.25rem; background: #fff; }
.sp-form legend { font-weight: 700; color: var(--sp-red); padding: 0 .4rem; }
.sp-form label { display: block; font-weight: 600; margin-bottom: .3rem; }
.sp-form input[type=text], .sp-form input[type=email] { width: 100%; padding: .65rem .75rem; border: 1px solid #bfb3a0; border-radius: 8px; font-size: 1rem; }
.sp-form input[type=file] { width: 100%; padding: .5rem 0; }
.sp-form input[aria-invalid=true] { border-color: var(--sp-red); }
.sp-check label { font-weight: 400; display: flex; gap: .5rem; align-items: flex-start; }
.sp-check input { margin-top: .25rem; flex: 0 0 auto; width: 1.15rem; height: 1.15rem; }
.sp-help, .sp-small { display: block; color: var(--sp-muted); font-size: .9rem; margin-top: .3rem; }
.sp-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.sp-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: .6rem; }
.sp-preview { border: 2px solid var(--sp-line); border-radius: 10px; padding: .35rem; background: var(--sp-cream); text-align: center; font-size: .85rem; }
.sp-preview img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border-radius: 6px; }
.sp-preview label { font-weight: 600; display: flex; justify-content: center; gap: .3rem; margin: .35rem 0 0; }
.sp-preview.is-cover { border-color: var(--sp-red); }
.sp-form-error { color: var(--sp-red); font-weight: 600; margin: .5rem 0; }
.sp-submit .sp-btn[disabled] { opacity: .6; cursor: wait; }

/* Voto */
.sp-vote { max-width: none; }
.sp-vote__find { max-width: 360px; }
.sp-vote__find input { width: 100%; padding: .6rem .75rem; border: 1px solid #bfb3a0; border-radius: 8px; font-size: 1rem; }
.sp-vcard { position: relative; display: flex; flex-direction: column; margin: 0 !important; padding: 0 !important; list-style: none !important; }
.sp-vcard::before { display: none !important; }
.sp-vcard label { display: flex; flex-direction: column; flex: 1 1 auto; margin: 0; font-weight: 400; background: #fff; border: 2px solid var(--sp-line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sp-vcard input[type=checkbox] { position: absolute; top: .6rem; left: .6rem; width: 1.4rem; height: 1.4rem; z-index: 2; accent-color: var(--sp-red); }
.sp-vcard.is-chosen label { border-color: var(--sp-red); box-shadow: 0 0 0 3px rgba(139, 30, 43, .18); }
.sp-vcard.is-off label { opacity: .55; cursor: not-allowed; }
.sp-vcard label:focus-within { outline: 3px solid var(--sp-gold); outline-offset: 2px; }
.sp-vcard__tick { display: none; margin: 0 .7rem .7rem; color: var(--sp-red); font-weight: 700; }
.sp-vcard.is-chosen .sp-vcard__tick { display: block; }
.sp-vcard__see { display: block; text-align: center; font-size: .85rem; margin-top: .3rem; color: var(--sp-red); }
.sp-vcard[hidden] { display: none; }
.sp-vote__float { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 9990; white-space: nowrap; background: var(--sp-red); color: #fff !important; font-weight: 700; padding: .6rem 1.1rem; border-radius: 999px; text-decoration: none !important; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.sp-vote__bar { background: #fff; border: 1px solid var(--sp-line); border-radius: 14px; padding: .75rem 1rem; margin-top: 1rem; scroll-margin-top: 80px; }
.sp-vote__bar p { margin: .35rem 0; }
.sp-vote__bar input[type=email] { max-width: 420px; }
.sp-vote__count { font-weight: 700; color: var(--sp-red); }
.sp-vote__float[hidden] { display: none; }

/* Podio (risultati) */
.sp-podium { --sp-red: #8b1e2b; --sp-gold: #e0a526; --sp-cream: #fbf6ec; --sp-line: #e7dcc6; --sp-muted: #5f5f5f; --sp-ink: #2b2b2b; margin-bottom: 2rem; scroll-margin-top: 90px; }
.sp-podium__step { background: var(--sp-cream); border-radius: 16px; padding: .75rem 1rem 1rem; margin-bottom: 1rem; border-left: 6px solid var(--sp-line); }
.sp-podium__step--1 { border-left-color: var(--sp-gold); }
.sp-podium__step--2 { border-left-color: #a9a9a9; }
.sp-podium__step--3 { border-left-color: #b4763a; }
.sp-podium__step h3 { margin: .2rem 0 .6rem; color: var(--sp-red); font-size: 1.3rem; }
.sp-podium__step h3 span { color: var(--sp-muted); font-weight: 400; font-size: .85em; }
.sp-podium__thanks { font-weight: 600; color: var(--sp-red); }
.sp-podium__badge { display: inline-block; background: #e0a526; color: #2b2b2b; font-weight: 700; border-radius: 999px; padding: .4rem 1rem; }
