/* ─── Google Fonts — carica prima di tutto ───────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@300;400;500&display=swap');

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Token design ───────────────────────────────────────────────────────── */
:root {
  --bg:           #f9f7f3;
  --bg-dark:      #1e1812;
  --bg-card:      #ffffff;
  --text:         #1e1812;
  --text-mid:     #4a4038;
  --text-muted:   #6b5e54;   /* ≥ 4.5:1 su --bg */
  --accent:       #7a4f2e;   /* ≥ 4.5:1 su --bg */
  --accent-light: #c4956a;
  --gold:         #b8953a;
  --border:       #ddd5c8;
  --border-light: #ede8e0;
  --focus:        #7a4f2e;

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --max-w:   1120px;
  --max-w-sm: 680px;
  --gap:     2rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:  cubic-bezier(0.7, 0, 0.84, 0);
}

html { scroll-behavior: smooth; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ─── Skip link ──────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  transition: top 0.15s;
}
.skip-link:focus { top: 0.5rem; }

/* ─── Focus ring ─────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ─── Scroll-reveal ──────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(249, 247, 243, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}
.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.9rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  position: relative;
  transition: color 0.2s;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 0.9rem;
  right: 0.9rem;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease-out);
}
.nav-links a:hover,
.nav-links a.active { color: var(--accent); }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  min-height: calc(100svh - 64px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  padding: 5rem 2.5rem 4rem;
  max-width: var(--max-w);
  margin: 0 auto;
  gap: 2rem;
  position: relative;
}

/* Linea decorativa verticale */
.hero::before {
  content: '';
  position: absolute;
  left: 2.5rem;
  top: 3rem;
  width: 1px;
  height: 60px;
  background: var(--gold);
}

.hero-main { align-self: center; }

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding-left: 3rem;
}
.hero-eyebrow::before {
  content: '';
  width: 2rem;
  height: 1px;
  background: var(--gold);
  flex-shrink: 0;
  margin-left: -3rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 9vw, 7rem);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent-light);
  display: block;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.9;
  margin-bottom: 3rem;
  font-weight: 300;
}

.hero-year {
  font-family: var(--font-serif);
  font-size: clamp(5rem, 12vw, 10rem);
  font-weight: 400;
  color: var(--border-light);
  line-height: 1;
  user-select: none;
  align-self: flex-end;
  padding-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

/* ─── Btn ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 2rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  min-height: 44px;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '→';
  font-size: 0.9rem;
  transition: transform 0.25s var(--ease-out);
}
.btn:hover {
  background: var(--accent);
  color: #fff;
}
.btn:hover::after { transform: translateX(4px); }

/* ─── Divisore ornamentale ───────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin: 0 0 3rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

/* ─── Sections ───────────────────────────────────────────────────────────── */
section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 6rem 2.5rem;
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.section-label::before {
  content: '';
  width: 1.5rem;
  height: 1px;
  background: var(--gold);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 2.5rem;
  letter-spacing: -0.01em;
}

/* ─── About ──────────────────────────────────────────────────────────────── */
.about {
  border-top: 1px solid var(--border-light);
}

.about-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 5rem;
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  font-size: 1.02rem;
  line-height: 1.85;
}
.about-text p:last-child { margin-bottom: 0; }

.about-facts {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  margin-top: 3.5rem;
}

.fact {
  padding: 1.6rem 2rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}
.fact:last-child { border-bottom: none; }
.fact::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gold);
  transform: scaleY(0);
  transition: transform 0.3s var(--ease-out);
  transform-origin: bottom;
}
.fact:hover { background: #fff; }
.fact:hover::before { transform: scaleY(1); }

.fact-num {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.fact-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  line-height: 1.4;
}

/* ─── Preview grid (homepage) ────────────────────────────────────────────── */
#opere-preview {
  border-top: 1px solid var(--border-light);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.8rem;
  margin-top: 0;
}

.view-all {
  margin-top: 3.5rem;
  text-align: center;
}

/* ─── Opere page header ──────────────────────────────────────────────────── */
.opere-hero {
  padding: 5rem 2.5rem 3.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
}

.opere-hero-text { flex: 1; }
.opere-hero-text .section-title { margin-bottom: 0.8rem; }

.opere-count {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: right;
  padding-bottom: 0.5rem;
  white-space: nowrap;
}

/* ─── Opere grid ─────────────────────────────────────────────────────────── */
#opere-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 2.5rem 7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

/* ─── Card link wrapper ──────────────────────────────────────────────────── */
.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  group: '';
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: 0 0 0 1px var(--border);
  transition: box-shadow 0.3s var(--ease-out);
  pointer-events: none;
}
.card:hover::after {
  box-shadow: 0 0 0 1px var(--accent-light), 0 20px 48px rgba(30,24,18,0.10);
}

.card-img-wrap {
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--border-light);
  position: relative;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.65s var(--ease-out);
  will-change: transform;
}
.card:hover .card-img-wrap img { transform: scale(1.05); }

/* overlay hover */
.card-img-wrap::after {
  content: '+ Vedi';
  position: absolute;
  inset: 0;
  background: rgba(30, 24, 18, 0.35);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover .card-img-wrap::after { opacity: 1; }

.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.card-info { flex: 1; }

.card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 0.25rem;
  line-height: 1.35;
  color: var(--text);
}

.card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.card-year {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--border);
  line-height: 1;
  flex-shrink: 0;
  align-self: flex-end;
  transition: color 0.2s;
}
.card:hover .card-year { color: var(--accent-light); }

/* ─── Lightbox ───────────────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(18, 14, 10, 0.95);
  justify-content: center;
  align-items: center;
  padding: 2rem;
  animation: lb-in 0.25s var(--ease-out);
}
@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox.open { display: flex; }

.lightbox-inner {
  max-width: 820px;
  width: 100%;
  position: relative;
}

.lightbox img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.lightbox-caption {
  color: rgba(232, 224, 214, 0.75);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  margin-top: 1.2rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.lightbox-close {
  position: absolute;
  top: -3rem;
  right: 0;
  background: none;
  border: none;
  color: rgba(232, 224, 214, 0.7);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.lightbox-close:hover { color: #fff; }

/* ─── Eventi ─────────────────────────────────────────────────────────────── */
#eventi { border-top: 1px solid var(--border-light); }

.eventi-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  max-width: 700px;
}

.evento {
  display: grid;
  grid-template-columns: 80px 1fr 140px;
  gap: 2rem;
  padding: 1.8rem 2rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.2s;
}
.evento:last-child { border-bottom: none; }
.evento:hover { background: #fff; }

.evento-img {
  width: 140px;
  height: 100px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--border-light);
}
.evento-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
}
.evento:hover .evento-img img { transform: scale(1.1); }


.evento-anno {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--border);
  line-height: 1;
  padding-top: 0.15rem;
}

.evento-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.evento-info strong {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}
.evento-info span {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.evento-info time {
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* ─── Contatti ───────────────────────────────────────────────────────────── */
.contatti {
  border-top: 1px solid var(--border-light);
  text-align: center;
  padding-top: 7rem;
  padding-bottom: 7rem;
}
.contatti .section-label { justify-content: center; }
.contatti .section-label::before { display: none; }
.contatti .section-title { margin-bottom: 1rem; }

.contatti-email {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 2.5rem;
}
.contatti-email a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 0.2s;
}
.contatti-email a:hover { color: var(--text); }

.contatti-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  background: var(--bg-dark);
  color: rgba(249, 247, 243, 0.45);
  padding: 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  line-height: 2;
}
footer a {
  color: rgba(249, 247, 243, 0.65);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
footer a:hover { color: #fff; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-year { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 3rem; }
  .preview-grid { grid-template-columns: repeat(2, 1fr); }
  .opere-hero { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .opere-count { text-align: left; }
}

@media (max-width: 640px) {
  nav { padding: 0 1.2rem; height: 56px; }
  .hero { padding: 4rem 1.4rem 3rem; }
  .hero::before { left: 1.4rem; }
  .hero-eyebrow { padding-left: 2.5rem; }
  .hero-eyebrow::before { margin-left: -2.5rem; }
  section { padding: 4rem 1.4rem; }
  .opere-hero { padding: 3.5rem 1.4rem 2.5rem; }
  #opere-grid { padding: 2.5rem 1.4rem 5rem; grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: 1fr; }
  .contatti { padding-top: 4rem; padding-bottom: 4rem; }
  .nav-links a { padding: 0.5rem 0.6rem; font-size: 0.72rem; }
  .evento { grid-template-columns: 1fr; gap: 1rem; padding: 1.5rem; }
  .evento-img { width: 100%; height: 180px; order: -1; }
  .evento-anno { font-size: 1.2rem; }
}

@media (max-width: 380px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: 0.5rem 0.4rem; letter-spacing: 0.06em; }
}

/* ─── High contrast ──────────────────────────────────────────────────────── */
@media (forced-colors: active) {
  .card::after { box-shadow: 0 0 0 1px ButtonText; }
  .btn { border: 2px solid ButtonText; }
  .fact::before { background: ButtonText; }
}
