/* Il presepio di Gonars — foglio di stile */

:root {
	--night: #120d0a;
	--night-2: #1b1410;
	--night-3: #261c16;
	--parchment: #f4ead8;
	--parchment-2: #e9dcc3;
	--ink: #2a1f17;
	--ink-soft: #5c4a3b;
	--gold: #d9a54a;
	--gold-bright: #f0c46e;
	--gold-deep: #9c6b1c;
	--text-on-dark: #f3e9d9;
	--muted-on-dark: #bfae96;
	--error: #b3261e;
	--ok: #2f6b3a;

	--font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
	--font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--radius: 14px;
	--maxw: 1160px;
	--gutter: clamp(16px, 4vw, 40px);
	--header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
	scroll-behavior: smooth;
	scroll-padding-top: var(--header-h);
	-webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
	margin: 0;
	background: var(--night);
	color: var(--text-on-dark);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	line-height: 1.65;
	overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 {
	font-family: var(--font-display);
	font-weight: 600;
	line-height: 1.1;
	margin: 0 0 .5em;
	text-wrap: balance;
}

p { margin: 0 0 1em; }

a { color: inherit; }

:focus-visible {
	outline: 2px solid var(--gold-bright);
	outline-offset: 3px;
	border-radius: 4px;
}

.skip-link {
	position: absolute;
	left: 16px;
	top: -60px;
	z-index: 100;
	padding: 8px 14px;
	background: var(--gold);
	color: var(--night);
	border-radius: 8px;
	text-decoration: none;
	font-weight: 600;
}
.skip-link:focus { top: 12px; }

.eyebrow {
	font-size: .8rem;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--gold);
	font-weight: 600;
	margin-bottom: .9em;
}

/* ---------- Header ---------- */

.site-header {
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 50;
	height: var(--header-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 var(--gutter);
	transition: background-color .3s, box-shadow .3s;
}
.site-header.is-scrolled {
	background: rgba(18, 13, 10, .88);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 1px 0 rgba(217, 165, 74, .18);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	font-family: var(--font-display);
	font-size: 1.35rem;
	font-weight: 600;
	white-space: nowrap;
}
.brand-star { width: 20px; height: 20px; fill: var(--gold); flex: none; }

.site-header ul {
	display: flex;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.site-header nav a {
	display: block;
	padding: 8px 12px;
	text-decoration: none;
	font-size: .95rem;
	color: var(--text-on-dark);
	border-radius: 999px;
	transition: color .2s, background-color .2s;
}
.site-header nav a:hover { color: var(--gold-bright); }
.site-header nav a.nav-cta {
	border: 1px solid rgba(217, 165, 74, .6);
	color: var(--gold-bright);
}
.site-header nav a.nav-cta:hover { background: rgba(217, 165, 74, .14); }

@media (max-width: 900px) {
	.site-header nav li:not(:last-child) { display: none; }
	.brand { font-size: 1.15rem; }
}

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 12px 26px;
	border-radius: 999px;
	font: 600 1rem/1 var(--font-body);
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	transition: transform .15s, background-color .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-gold { background: var(--gold); color: var(--night); }
.btn-gold:hover { background: var(--gold-bright); }
.btn-ghost { border-color: rgba(243, 233, 217, .45); color: var(--text-on-dark); }
.btn-ghost:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* ---------- Hero ---------- */

.hero {
	position: relative;
	min-height: 100vh;
	min-height: 100svh;
	display: grid;
	place-items: center;
	text-align: center;
	padding: calc(var(--header-h) + 32px) var(--gutter) 64px;
	isolation: isolate;
	overflow: hidden;
}
.hero-bg {
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient(ellipse at 50% 40%, rgba(18, 13, 10, .35) 0%, rgba(18, 13, 10, .82) 70%),
		linear-gradient(180deg, rgba(18, 13, 10, .55) 0%, rgba(18, 13, 10, .25) 40%, var(--night) 100%),
		url("../images/web/hero.jpg") center 45% / cover no-repeat;
	animation: hero-zoom 24s ease-out both;
}
@keyframes hero-zoom {
	from { transform: scale(1.08); }
	to { transform: scale(1); }
}

.hero-inner { max-width: 820px; }

.hero h1 {
	font-size: clamp(2.8rem, 9vw, 5.6rem);
	font-weight: 700;
	letter-spacing: -.01em;
	text-shadow: 0 2px 24px rgba(0, 0, 0, .5);
}
.hero .lead {
	font-size: clamp(1.1rem, 2.4vw, 1.35rem);
	color: var(--parchment-2);
	max-width: 620px;
	margin: 0 auto 2.2em;
}
.hero .lead strong { color: var(--gold-bright); font-weight: 600; }

.countdown {
	margin: 0 auto 2.4em;
	padding: 22px clamp(14px, 4vw, 32px) 26px;
	max-width: 560px;
	background: rgba(18, 13, 10, .55);
	border: 1px solid rgba(217, 165, 74, .35);
	border-radius: var(--radius);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}
.countdown-label {
	font-family: var(--font-display);
	font-style: italic;
	font-size: 1.2rem;
	color: var(--parchment);
	margin-bottom: 14px;
}
.countdown-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: clamp(6px, 2vw, 14px);
}
.cd-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 10px 4px 8px;
	border-radius: 10px;
	background: rgba(243, 233, 217, .06);
}
.cd-num {
	font-family: var(--font-display);
	font-size: clamp(2rem, 8vw, 3.2rem);
	font-weight: 700;
	line-height: 1;
	color: var(--gold-bright);
	font-variant-numeric: lining-nums tabular-nums;
}
.cd-unit {
	margin-top: 6px;
	font-size: .72rem;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--muted-on-dark);
}
.countdown-open {
	font-size: 1.15rem;
	margin: 0;
}
.countdown-open strong { color: var(--gold-bright); }

.hero-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

/* ---------- Sezioni ---------- */

section { padding: clamp(72px, 10vw, 128px) var(--gutter); }

.section-head {
	max-width: 760px;
	margin: 0 auto clamp(40px, 6vw, 72px);
	text-align: center;
}
.section-head h2 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.section-intro { font-size: 1.12rem; color: var(--muted-on-dark); margin: 0; }

/* ---------- Storia ---------- */

.story { background: var(--night); }

.chapter {
	max-width: var(--maxw);
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1.1fr 1fr;
	gap: clamp(28px, 5vw, 72px);
	align-items: center;
}
.chapter + .chapter { margin-top: clamp(64px, 9vw, 120px); }
.chapter-reverse .chapter-img { order: 2; }

.chapter-img { margin: 0; position: relative; }
.chapter-img img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--radius);
	box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8);
}
.chapter-img::after {
	content: "";
	position: absolute;
	inset: 12px -12px -12px 12px;
	border: 1px solid rgba(217, 165, 74, .35);
	border-radius: var(--radius);
	z-index: -1;
}
.chapter-reverse .chapter-img::after { inset: 12px 12px -12px -12px; }
.chapter-img figcaption {
	margin-top: 10px;
	font-size: .85rem;
	font-style: italic;
	color: var(--muted-on-dark);
}

.chapter-year {
	display: inline-block;
	font-family: var(--font-display);
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--gold);
	padding-bottom: 6px;
	margin-bottom: 14px;
	border-bottom: 1px solid rgba(217, 165, 74, .5);
}
.chapter h3 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.chapter-text p { color: var(--parchment-2); }
.chapter-text p:last-child { margin-bottom: 0; }

@media (max-width: 820px) {
	.chapter { grid-template-columns: 1fr; }
	.chapter-reverse .chapter-img { order: 0; }
	.chapter-img::after { display: none; }
}

/* ---------- Galleria ---------- */

.gallery-section {
	background:
		radial-gradient(ellipse at 50% 0%, rgba(217, 165, 74, .1), transparent 60%),
		var(--night-2);
}
.gallery {
	list-style: none;
	margin: 0 auto;
	padding: 0;
	max-width: var(--maxw);
	display: grid;
	gap: clamp(16px, 3vw, 28px);
}
.gallery-item {
	display: block;
	position: relative;
	border-radius: var(--radius);
	overflow: hidden;
	text-decoration: none;
	background: var(--night-3);
}
.gallery-item img {
	width: 100%;
	aspect-ratio: 3.2 / 1;
	object-fit: cover;
	transition: transform .6s ease;
}
.gallery-item:hover img { transform: scale(1.03); }
.gallery-caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: 40px 20px 14px;
	background: linear-gradient(transparent, rgba(18, 13, 10, .88));
	font-size: .98rem;
	display: flex;
	align-items: baseline;
	gap: 12px;
}
.gallery-year {
	font-family: var(--font-display);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--gold-bright);
}

@media (max-width: 640px) {
	.gallery-item img { aspect-ratio: 2 / 1; }
	.gallery-caption { position: static; background: var(--night-3); padding: 10px 14px; }
}

/* ---------- Visita ---------- */

.visit { background: var(--night); }
.visit-grid {
	max-width: var(--maxw);
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.visit-card {
	padding: 28px;
	border: 1px solid rgba(217, 165, 74, .3);
	border-radius: var(--radius);
	background: linear-gradient(180deg, rgba(243, 233, 217, .05), transparent);
}
.visit-card h3 { font-size: 1.8rem; color: var(--gold-bright); }
.visit-card p { color: var(--parchment-2); margin-bottom: .6em; }
.visit-hours {
	font-family: var(--font-display);
	font-size: 1.6rem;
	font-weight: 600;
	line-height: 1.35;
	font-variant-numeric: lining-nums tabular-nums;
	color: var(--text-on-dark) !important;
}
.text-link { color: var(--gold-bright); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

@media (max-width: 820px) {
	.visit-grid { grid-template-columns: 1fr; }
}

/* ---------- Contatti ---------- */

.contact {
	background: var(--parchment);
	color: var(--ink);
}
.contact .eyebrow { color: var(--gold-deep); }
.contact .section-intro { color: var(--ink-soft); }

.contact-form {
	max-width: 760px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .95rem; }

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
	width: 100%;
	padding: 13px 15px;
	font: inherit;
	color: var(--ink);
	background: #fffaf1;
	border: 1px solid #cdbb9c;
	border-radius: 10px;
	transition: border-color .2s, box-shadow .2s;
}
.contact-form textarea { resize: vertical; min-height: 150px; }
.contact-form input:focus,
.contact-form textarea:focus {
	outline: none;
	border-color: var(--gold-deep);
	box-shadow: 0 0 0 3px rgba(217, 165, 74, .35);
}
.contact-form [aria-invalid="true"] { border-color: var(--error); }

.field-check {
	flex-direction: row;
	align-items: flex-start;
	gap: 10px;
}
.field-check input {
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	flex: none;
	accent-color: var(--gold-deep);
}
.field-check label { font-weight: 400; font-size: .92rem; color: var(--ink-soft); }

.hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.form-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
}
.contact .btn-gold { background: var(--ink); color: var(--parchment); }
.contact .btn-gold:hover { background: #000; }
.form-status { margin: 0; font-weight: 600; }
.form-status.is-ok { color: var(--ok); }
.form-status.is-error { color: var(--error); }

@media (max-width: 640px) {
	.contact-form { grid-template-columns: 1fr; }
	.form-actions .btn { width: 100%; }
}

/* ---------- Footer ---------- */

.site-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 12px;
	padding: 28px var(--gutter);
	background: var(--night);
	color: var(--muted-on-dark);
	font-size: .92rem;
	border-top: 1px solid rgba(217, 165, 74, .18);
}
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--gold-bright); }

/* ---------- Lightbox ---------- */

.lightbox {
	width: 100vw;
	height: 100vh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(10, 7, 5, .95);
	color: var(--text-on-dark);
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(0, 0, 0, .6); }
.lightbox figure { margin: 0; padding: 56px 16px; max-width: 100%; }
.lightbox img {
	max-width: min(96vw, 1800px);
	max-height: calc(100vh - 160px);
	margin: 0 auto;
	border-radius: 8px;
}
.lightbox figcaption {
	text-align: center;
	margin-top: 14px;
	font-family: var(--font-display);
	font-size: 1.3rem;
}
.lb-close, .lb-nav {
	position: absolute;
	background: rgba(243, 233, 217, .1);
	color: var(--text-on-dark);
	border: 0;
	border-radius: 999px;
	width: 48px;
	height: 48px;
	font-size: 1.8rem;
	line-height: 1;
	cursor: pointer;
}
.lb-close:hover, .lb-nav:hover { background: rgba(217, 165, 74, .35); }
.lb-close { top: 12px; right: 12px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

/* ---------- Animazioni d'ingresso ---------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Archivio (linea del tempo) ---------- */

.archive { background: var(--night); }

.timeline-wrap {
	position: relative;
	max-width: var(--maxw);
	margin: 0 auto;
}
.timeline {
	list-style: none;
	margin: 0;
	padding: 34px 4px 18px;
	display: flex;
	gap: 18px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: var(--gold-deep) transparent;
	/* linea del tempo */
	background: linear-gradient(rgba(217, 165, 74, .45), rgba(217, 165, 74, .45)) 0 14px / 100% 1px no-repeat;
	background-attachment: local;
}
.timeline:focus-visible { outline-offset: 6px; }
.timeline li {
	flex: 0 0 clamp(200px, 26vw, 260px);
	scroll-snap-align: start;
}
.timeline-item {
	position: relative;
	display: block;
	text-decoration: none;
}
.timeline-item::before {
	content: "";
	position: absolute;
	top: -25px;
	left: 16px;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--gold);
	box-shadow: 0 0 0 4px var(--night), 0 0 12px rgba(240, 196, 110, .6);
}
.timeline-item img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 10px;
	background: var(--night-3);
	transition: transform .3s ease, box-shadow .3s ease;
}
.timeline-item:hover img {
	transform: translateY(-4px);
	box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .9);
}
.timeline-year {
	display: block;
	margin-top: 10px;
	font-family: var(--font-display);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--gold-bright);
	font-variant-numeric: lining-nums;
}
.timeline-btn {
	position: absolute;
	top: calc(50% - 6px);
	transform: translateY(-50%);
	z-index: 2;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1px solid rgba(217, 165, 74, .5);
	background: rgba(18, 13, 10, .85);
	color: var(--gold-bright);
	font-size: 1.7rem;
	line-height: 1;
	cursor: pointer;
}
.timeline-btn:hover { background: var(--night-3); }
.timeline-btn[disabled] { opacity: 0; pointer-events: none; }
.timeline-prev { left: -22px; }
.timeline-next { right: -22px; }

@media (max-width: 820px) {
	.timeline-btn { display: none; }
}
