:root {
  --ivory:    #4c4e4b;
  --gold:     #7e5f18;
  --gold-mid: #9a7322;
  --gold-lt:  #b8922e;
  --gold-glow:#d4ab48;
  --amber:    #6e3a10;
  --text:     #ffffff;
  --text-mid: #ffffff;
  --text-lt:  #ffffff;
  --line:     rgba(126,95,24,0.16);
  --line-md:  rgba(126,95,24,0.26);
  --accent:   #f4e42d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--ivory); overflow-x: hidden; }

#canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5; }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.030'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 88% 88% at 50% 50%, transparent 52%, rgba(195,185,165,0.16) 100%);
}

.corner {
  position: fixed; z-index: 10; width: 56px; height: 56px;
  pointer-events: none; opacity: 0;
  animation: fadeCorner 1.4s ease 2.2s forwards;
}
.corner-tl { top: 26px; left: 26px; }
.corner-tr { top: 26px; right: 26px; transform: scaleX(-1); }
.corner-bl { bottom: 26px; left: 26px; transform: scaleY(-1); }
.corner-br { bottom: 26px; right: 26px; transform: scale(-1,-1); }
@keyframes fadeCorner { to { opacity: 1; } }

.top-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 20;
  background: linear-gradient(90deg, transparent 0%, var(--amber) 12%, var(--gold) 30%, var(--gold-glow) 48%, var(--gold) 66%, #4a7a4a 80%, #6a3a7a 90%, transparent 100%);
  transform-origin: left; opacity: 0;
  animation: barReveal 2s cubic-bezier(0.22,1,0.36,1) 0.2s forwards, barPulse 7s ease-in-out 2.5s infinite alternate;
}
@keyframes barReveal { from { transform: scaleX(0); opacity:0; } to { transform: scaleX(1); opacity:.6; } }
@keyframes barPulse  { from { opacity:.4; } to { opacity:.75; } }

.side {
  position: fixed; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center;
  z-index: 10; opacity: 0;
  animation: sideIn 1.2s ease 2s forwards;
}
.side-l { left: 26px; }
.side-r { right: 26px; }
@keyframes sideIn {
  from { opacity:0; transform: translateY(calc(-50% + 10px)); }
  to   { opacity:1; transform: translateY(-50%); }
}
.side-line {
  width: 1px; background: linear-gradient(to bottom, transparent, var(--gold-lt), transparent);
  opacity: .32; animation: sideBreath 4.5s ease-in-out infinite alternate;
}
@keyframes sideBreath { from { height:58px; opacity:.22; } to { height:80px; opacity:.46; } }
.side-text {
  font-family: 'Jost', sans-serif; font-weight: 100;
  font-size: 9.5px; letter-spacing: .38em; text-transform: uppercase;
  color: var(--gold-mid); writing-mode: vertical-lr;
  padding: 13px 0; opacity: .6;
}

.page {
  position: relative; z-index: 5;
  min-height: 100vh;
  display: grid; grid-template-rows: 1fr auto auto auto;
  padding: 68px 72px 44px;
  font-family: 'Jost', sans-serif; font-weight: 100;
}
.center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.logo-scene {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
}

.logo-img {
  position: relative; z-index: 2;
  width: 100%; height: 100%; object-fit: contain; display: block;
  opacity: 0;
  animation:
    logoReveal 1.8s cubic-bezier(0.16,1,0.3,1) .7s forwards,
    logoPulse 3s ease-in-out infinite;
}

@keyframes logoReveal {
  from { opacity:0; transform:scale(.84); filter:blur(5px); }
  to   { opacity:1; transform:scale(1); filter:blur(0px); }
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(126,95,24,0.2)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 15px rgba(126,95,24,0.4)); }
}

.ornament {
  display: flex; align-items: center; gap: 18px;
  width: clamp(140px, 34vw, 420px);
  margin: 50px 0 42px; opacity: 0;
  animation: riseIn 1s cubic-bezier(0.22,1,0.36,1) 1.3s forwards;
}
.orn-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-md) 50%, transparent); position: relative; overflow: hidden; }
.orn-center { display:flex; gap:7px; align-items:center; }
.orn-dot { width:3px; height:3px; border-radius:50%; background:var(--gold-lt); opacity:.65; }
.orn-diamond { width:8px; height:8px; background:var(--gold); transform:rotate(45deg); }

.title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300; font-size: clamp(28px,4.8vw,54px);
  color: var(--text); letter-spacing: .03em; text-align: center;
  opacity: 0;
  animation: riseIn 1s cubic-bezier(0.22,1,0.36,1) 1.45s forwards;
}
.title em { font-style:italic; color:var(--gold); }

.subtitle {
  margin-top:14px; font-weight:100;
  font-size:clamp(16px,1.8vw,22px); letter-spacing:.12em; text-transform:uppercase;
  color:var(--text-lt); text-align:center; opacity:0;
  animation: riseIn 1s cubic-bezier(0.22,1,0.36,1) 1.6s forwards;
}

.body-copy {
  margin-top:28px; max-width:460px; text-align:center;
  font-size:clamp(16px,1.8vw,22px); font-weight:200;
  line-height:2.0; letter-spacing:.03em; color:var(--text-mid);
  opacity:0;
  animation: riseIn 1s cubic-bezier(0.22,1,0.36,1) 1.75s forwards;
}

.hr { width:50px; height:1px; background:var(--line-md); margin:40px auto 0; opacity:0; animation:fadeOnly 1s ease 1.9s forwards; }

.contact {
  display:flex; flex-direction:column; align-items:center; gap:7px;
  margin-top:30px; opacity:0;
  animation: riseIn 1s cubic-bezier(0.22,1,0.36,1) 2.0s forwards;
}
.contact-label { font-size:16px; font-weight:200; letter-spacing:.5em; text-transform:uppercase; color:var(--gold-mid); opacity:.8; }
.contact-email { font-family:'Cormorant Garamond',serif; font-weight:300; font-size:clamp(20px,2.2vw,28px); color:var(--text); text-decoration:none; }

/* ═══════════════════════════════════════════════════
   SEZIONE MOSTRE
   ═══════════════════════════════════════════════════ */

.mostre-section {
  position: relative;
  padding: 80px 0 64px;
  opacity: 0;
  animation: riseIn 1.2s cubic-bezier(0.22,1,0.36,1) 2.4s forwards;
}

/* Separatore superiore con sfumatura */
.mostre-section::before {
  content: '';
  display: block;
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: clamp(200px, 60vw, 700px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-lt) 30%, var(--gold-glow) 50%, var(--gold-lt) 70%, transparent);
  opacity: 0.28;
}

.mostre-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 56px;
}

.mostre-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  width: clamp(120px, 28vw, 360px);
  margin-bottom: 6px;
}
.mostre-rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-md) 60%, transparent);
}
.mostre-rule-emblem svg { width: 32px; height: 12px; display: block; }

.mostre-eyebrow {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 9px;
  letter-spacing: .52em;
  text-transform: uppercase;
  color: var(--gold-mid);
  opacity: .7;
}

.mostre-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(22px, 3.6vw, 42px);
  color: var(--text);
  letter-spacing: .04em;
  text-align: center;
}

.mostre-intro {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: clamp(13px, 1.3vw, 15px);
  letter-spacing: .06em;
  color: var(--text-lt);
  opacity: .6;
  text-align: center;
  max-width: 400px;
  line-height: 1.9;
}

/* ── Griglia Flyer ── */

.flyer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
  max-width: 1000px;
  margin: 0 auto;
}

.flyer-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: default;
  transition: transform .5s cubic-bezier(0.22,1,0.36,1);
}
.flyer-card:hover { transform: translateY(-6px); }

/* Cornice con angoli decorativi */
.flyer-frame {
  position: relative;
}
.flyer-frame::before,
.flyer-frame::after,
.flyer-frame > .flyer-img-wrap::before,
.flyer-frame > .flyer-img-wrap::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: rgba(184,146,46,0.45);
  border-style: solid;
  z-index: 3;
  pointer-events: none;
}
.flyer-frame::before       { top: -4px; left: -4px;  border-width: 1px 0 0 1px; }
.flyer-frame::after        { top: -4px; right: -4px; border-width: 1px 1px 0 0; }
.flyer-frame > .flyer-img-wrap::before { bottom: -4px; left: -4px;  border-width: 0 0 1px 1px; }
.flyer-frame > .flyer-img-wrap::after  { bottom: -4px; right: -4px; border-width: 0 1px 1px 0; }

.flyer-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: rgba(0,0,0,0.30);
}

/* Stato placeholder quando l'immagine non c'è */
.flyer-img-wrap.flyer-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flyer-img-wrap.flyer-placeholder::after {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(126,95,24,0.05) 0px, rgba(126,95,24,0.05) 1px,
      transparent 1px, transparent 24px
    );
  border: 1px solid rgba(126,95,24,0.18);
}
.flyer-img-wrap.flyer-placeholder .flyer-overlay {
  display: none;
}

.flyer-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .8s cubic-bezier(0.22,1,0.36,1), opacity .4s ease;
}
.flyer-card:hover .flyer-img { transform: scale(1.04); }

/* Overlay gradiente basso */
.flyer-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(30,28,24,0.55) 0%,
    transparent 55%
  );
  pointer-events: none;
}

/* Badge stato */
.flyer-badge {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 4;
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 7.5px;
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--ivory);
  background: var(--gold-glow);
  padding: 4px 10px;
}

/* Info testuale sotto il flyer */
.flyer-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}

.flyer-date {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 9px;
  letter-spacing: .44em;
  text-transform: uppercase;
  color: var(--gold-mid);
  opacity: .8;
}

.flyer-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(17px, 1.9vw, 22px);
  color: var(--text);
  letter-spacing: .02em;
  line-height: 1.2;
}

.flyer-place {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--text-lt);
  opacity: .5;
}

/* ── Fine Sezione Mostre ── */

.footer { display:flex; flex-direction:column; align-items:center; gap:10px; opacity:0; animation: fadeOnly 1.2s ease 2.3s forwards; }
.social-row { display:flex; gap:0; }
.social-link { font-size:8.5px; font-weight:200; letter-spacing:.42em; text-transform:uppercase; color:var(--text-lt); text-decoration:none; padding:9px 22px; }
.footer-rule { display:flex; align-items:center; gap:10px; width:clamp(80px,18vw,160px); margin:2px 0; }
.footer-rule-line { flex:1; height:1px; background:var(--line); }
.footer-rule-dot { width:3px; height:3px; border-radius:50%; background:var(--gold-lt); opacity:.5; }
.copyright { font-size:8px; font-weight:200; letter-spacing:.28em; text-transform:uppercase; color:var(--text-lt); text-align:center; opacity:.6; }

@keyframes riseIn  { from{opacity:0;transform:translateY(15px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeOnly{ from{opacity:0} to{opacity:1} }

@media(max-width:600px) {
  .side,.corner { display:none; }
  .page { padding:72px 20px 36px; }
  .flyer-grid { grid-template-columns: 1fr; max-width: 340px; }
  .mostre-section { padding: 56px 0 40px; }
}
/* --- Featured Exhibition Area --- */
.featured-exhibition {
  margin: 20px auto 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  animation: riseIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) 1s forwards;
  max-width: 500px;
  width: 100%;
}

.exhibition-frame {
  position: relative;
  padding: 15px; /* Spazio per gli angoli */
  background: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  transition: transform 0.6s ease;
}

.exhibition-frame:hover {
  transform: scale(1.02);
}

.exhibition-content {
  position: relative;
  overflow: hidden;
  line-height: 0;
}

.exhibition-poster {
  width: 100%;
  max-width: 320px; /* Dimensione elegante, non troppo ingombrante */
  height: auto;
  display: block;
  filter: sepia(0.2) contrast(1.05); /* Tocco artistico */
}

.exhibition-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.2) 100%);
  pointer-events: none;
}

/* Angoli personalizzati per la locandina */
.frame-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 1px solid var(--gold-lt);
  pointer-events: none;
  opacity: 0.6;
}
.f-tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.f-tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.f-bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.f-br { bottom: 0; right: 0; border-left: none; border-top: none; }

.exhibition-info {
  margin-top: 20px;
  text-align: center;
}

.exhibition-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold-glow);
  margin-bottom: 8px;
}

.exhibition-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  font-weight: 300;
  color: var(--text);
  margin-bottom: 4px;
}

.exhibition-details {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-lt);
  opacity: 0.7;
}

/* Responsive */
@media(max-width:600px) {
  .exhibition-poster { max-width: 260px; }
}

/* --- Lightbox / Popup --- */
.lightbox {
  display: none; /* Nascosto di default */
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
  align-items: center;
  justify-content: center;
  padding: 40px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-img {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(184, 146, 46, 0.3);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 30px;
  right: 40px;
  color: var(--gold-lt);
  font-size: 40px;
  font-family: 'Jost', sans-serif;
  font-weight: 100;
  cursor: pointer;
}

.lightbox-caption {
  position: absolute;
  bottom: 30px;
  color: var(--gold-mid);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* Cursor pointer sulla locandina per far capire che è cliccabile */
.exhibition-frame {
  cursor: zoom-in;
}

/* Stile per nascondere gli angoli della locandina allo scroll */
.exhibition-frame .frame-corner {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

body.scrolled .exhibition-frame .frame-corner {
  opacity: 0;
  transform: scale(0.8); /* Opzionale: aggiunge un leggero restringimento mentre spariscono */
  pointer-events: none;
}
