@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,700&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
  /* Brand Primary (Tavola Logo) */
  --brand-terracotta: #c25337;
  --brand-sand:       #f4e6d7;
  --brand-charcoal:   #2d2a28;

  /* Sfondi Caldi (Pergamena & Crema) */
  --parchment:      #f5f0e8;
  --parchment-deep: #ebe4d6;
  --cream:          #faf8f4;

  /* Testi & Inchiostri */
  --ink:            #2d2a28;
  --ink-soft:       #4a3f30;
  --ink-faded:      #7a7060;

  /* Accenti Storici & Seppia */
  --sepia:          #a0876a;
  --sepia-warm:     #c4a67a;
  --sepia-glow:     rgba(196, 166, 122, 0.12);
  --accent:         #7a3b2e;
  --accent-hover:   #8f4536;
  --accent-soft:    rgba(194, 83, 55, 0.10);
  --shadow-warm:    rgba(45, 42, 40, 0.1);
  --shadow-deep:    rgba(45, 42, 40, 0.2);

  --font-heading: 'Lora', Georgia, serif;
  --font-body:    'Source Sans 3', 'Segoe UI', Arial, sans-serif;

  --text-base: 1.2rem;   /* ~19px — leggibilità per tutti, anche mobile */
  --text-lg:   1.35rem;
  --text-xl:   1.55rem;
  --text-2xl:  2rem;
  --text-3xl:  2.6rem;
  --line-h:    1.85;

  --radius:     8px;
  --radius-lg:  14px;
  --max-w:      860px;
  --ease:       cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--cream);
  color: var(--ink);
  line-height: var(--line-h);
  overflow-x: hidden;
}

/* ══ CTA floating button ══ */
.cta-float {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.3rem;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(122, 59, 46, 0.35);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s var(--ease), background 0.2s ease, box-shadow 0.2s ease;
}

.cta-float.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cta-float:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(122, 59, 46, 0.45);
}

/* ══ Subtle ambient gradients ══ */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, var(--sepia-glow) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, var(--sepia-glow) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}

/* ══════════════════════════════════
   BRAND HEADER (Logo 1B)
   ══════════════════════════════════ */
.site-header {
  position: relative;
  z-index: 20;
  background: var(--parchment);
  border-bottom: 1px solid rgba(160, 135, 106, 0.22);
  padding: 0.9rem 1.5rem;
}

.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-link {
  display: inline-block;
  text-decoration: none;
  transition: transform 0.25s var(--ease), opacity 0.2s ease;
}

.brand-logo-link:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.brand-logo-img {
  display: block;
  width: 260px;
  max-width: 72vw;
  height: auto;
}

/* ══════════════════════════════════
   HERO: title + cover image
   ══════════════════════════════════ */
.hero {
  position: relative; z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2rem;
  text-align: center;
}

.hero-overline {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sepia);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-faded);
  margin-bottom: 2.5rem;
}

/* Cover image — always fully visible, never cropped */
.cover-container {
  display: flex;
  justify-content: center;
  padding: 0 1rem;
}

.cover-frame {
  display: inline-block;
  max-width: 360px;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow:
    0 4px 16px var(--shadow-warm),
    0 16px 48px var(--shadow-deep);
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}

.cover-frame:hover {
  box-shadow:
    0 6px 20px var(--shadow-warm),
    0 24px 60px var(--shadow-deep);
  transform: translateY(-4px);
}

.cover-frame img {
  display: block;
  width: 100%;
  height: auto;   /* NO cropping: shows the full image */
}

/* ══════════════════════════════════
   INTRO TEXT
   ══════════════════════════════════ */
.intro-section {
  position: relative; z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 2rem 2rem;
}

.intro-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--line-h);
  color: var(--ink-soft);
}

.intro-text p + p { margin-top: 1.2rem; }

.intro-text .drop-cap {
  font-family: var(--font-heading);
  font-size: 3.6rem;
  font-weight: 700;
  float: left;
  line-height: 0.78;
  margin-right: 0.12em;
  margin-top: 0.08em;
  color: var(--accent);
}

/* ══ Ringraziamento ══ */
.thanks-block {
  position: relative; z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem 2.5rem;
}

.thanks-inner {
  background: var(--parchment);
  border-left: 3px solid var(--sepia-warm);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
}

.thanks-inner p {
  font-size: 1.05rem;
  color: var(--ink-faded);
  line-height: 1.75;
}

.thanks-inner strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ══ Descrizione breve ══ */
.description-section {
  position: relative; z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.5rem 2rem 1.5rem;
}

.description-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-h);
  color: var(--ink-soft);
}

.description-text p + p {
  margin-top: 1rem;
}

/* ══ Expand block ══ */
.expand-block {
  margin-top: 1.5rem;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--parchment);
  border: 1px solid rgba(160, 135, 106, 0.3);
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.expand-toggle:hover {
  background: var(--parchment-deep);
  border-color: var(--sepia);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px var(--shadow-warm);
}

.expand-arrow {
  transition: transform 0.3s var(--ease);
}

.expand-arrow.rotated {
  transform: rotate(180deg);
}

.expand-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s var(--ease), opacity 0.4s ease, margin 0.4s ease;
  margin-top: 0;
}

.expand-content.open {
  max-height: 3000px;
  opacity: 1;
  margin-top: 1.5rem;
}

.expand-content p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-h);
  color: var(--ink-soft);
}

.expand-content p + p {
  margin-top: 1.2rem;
}

/* ══ Divider ══ */
.divider {
  display: block;
  width: 60px; height: 1px;
  background: var(--sepia);
  margin: 2rem auto 2.5rem;
  opacity: 0.45;
  border: none;
}

/* ══════════════════════════════════
   VERSION SELECTOR
   ══════════════════════════════════ */
.versions-section {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

.versions-heading {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.versions-sub {
  font-size: 0.95rem;
  text-align: center;
  color: var(--ink-faded);
  margin-bottom: 2rem;
}

.version-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .version-cards { grid-template-columns: 1fr; }
  .hero-title { font-size: 2rem; }
}

.version-card {
  background: var(--parchment);
  border: 1px solid rgba(160, 135, 106, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.5rem 1.25rem;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  display: flex; flex-direction: column; gap: 0.6rem;
}

.version-card:hover {
  border-color: var(--sepia);
  box-shadow: 0 6px 24px var(--shadow-warm);
  transform: translateY(-2px);
}

.version-card.active {
  border-color: var(--accent);
  box-shadow: 0 6px 24px var(--accent-soft), 0 0 0 2px var(--accent-soft);
}

.version-card-icon {
  width: 42px; height: 42px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}

.version-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink);
}

.version-card p {
  font-size: 1.05rem;
  color: var(--ink-faded);
  line-height: 1.55;
}

.version-meta {
  display: flex; gap: 0.75rem; align-items: center;
  margin-top: auto; padding-top: 0.75rem;
  border-top: 1px solid rgba(160, 135, 106, 0.15);
  font-size: 0.9rem; color: var(--ink-faded);
}

.version-meta span {
  display: flex; align-items: center; gap: 0.25rem;
}

/* ══════════════════════════════════
   GALLERY SECTION
   ══════════════════════════════════ */
.gallery-section {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.gallery-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap; gap: 0.5rem;
}

.gallery-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink);
}

.gallery-count {
  font-size: 0.85rem; color: var(--ink-faded);
}

/* ── Sticky download bar ── */
.sticky-download-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(160, 135, 106, 0.15);
  padding: 0.65rem 1rem;
  margin: 0 -1.5rem 1.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.sticky-download-bar .sticky-label {
  font-size: 0.88rem;
  color: var(--ink-faded);
  font-weight: 500;
}

.btn-download {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--accent); color: #fff; border: none;
  padding: 0.55rem 1.15rem; border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.88rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: all 0.25s var(--ease);
}

.btn-download:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(122, 59, 46, 0.25);
}

.btn-download svg { width: 16px; height: 16px; }

/* ── Grid: all thumbs same height ── */
.gallery-grid { display: grid; gap: 0.75rem; }

.gallery-grid.single-mode {
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}

.gallery-grid.double-mode {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (max-width: 480px) {
  .gallery-grid.single-mode {
    grid-template-columns: repeat(3, 1fr);
  }
  .gallery-grid.double-mode { grid-template-columns: 1fr; }
}

.gallery-thumb {
  position: relative;
  background: var(--parchment);
  border: 1px solid rgba(160, 135, 106, 0.18);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

/* Fixed aspect ratio so all thumbs are the same height */
.gallery-grid.single-mode .gallery-thumb { aspect-ratio: 3 / 4.5; }
.gallery-grid.double-mode .gallery-thumb { aspect-ratio: 4 / 3; }

.gallery-thumb:hover {
  border-color: var(--sepia);
  box-shadow: 0 4px 14px var(--shadow-warm);
  transform: translateY(-2px);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 130%;          /* taller than container for parallax room */
  object-fit: cover;
  object-position: center;
  transform: translateY(0%);
  transition: transform 0.1s linear;
  will-change: transform;
}

.gallery-thumb-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.35rem 0.5rem;
  background: linear-gradient(to top, rgba(44, 36, 24, 0.65), transparent);
  font-size: 0.75rem; color: #f5f0e8; font-weight: 500; text-align: center;
  opacity: 0; transition: opacity 0.2s ease;
}

.gallery-thumb:hover .gallery-thumb-label { opacity: 1; }

/* ══════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20, 16, 10, 0.93);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

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

.lightbox-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(245, 240, 232, 0.2);
  background: rgba(245, 240, 232, 0.08);
  color: var(--parchment);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s ease; z-index: 10;
}
.lightbox-close:hover { background: rgba(245, 240, 232, 0.18); }

.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 50px; height: 50px; border-radius: 50%;
  border: 1px solid rgba(245, 240, 232, 0.2);
  background: rgba(245, 240, 232, 0.08);
  color: var(--parchment);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s ease; z-index: 10;
}
.lightbox-nav:hover { background: rgba(245, 240, 232, 0.2); }
.lightbox-nav.prev { left: 1rem; }
.lightbox-nav.next { right: 1rem; }

.lightbox-img-wrap {
  max-width: 90vw; max-height: 85vh;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-in;
}

.lightbox-img-wrap.zoomed { cursor: zoom-out; overflow: auto; }

.lightbox-img-wrap img {
  max-width: 100%; max-height: 85vh;
  object-fit: contain; border-radius: 3px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  user-select: none; -webkit-user-drag: none;
}

.lightbox-img-wrap.zoomed img {
  max-width: none; max-height: none;
}

.lightbox-counter {
  position: absolute; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  font-size: 0.88rem; color: rgba(245, 240, 232, 0.6); font-weight: 500;
}

.lightbox-zoom-hint {
  position: absolute; bottom: 3.2rem; left: 50%; transform: translateX(-50%);
  font-size: 0.8rem; color: rgba(245, 240, 232, 0.35); pointer-events: none;
}

/* ══════════════════════════════════
   FOOTER COMPATTO
   ══════════════════════════════════ */
.site-footer {
  position: relative; z-index: 1;
  margin-top: 1.5rem;
  background: var(--parchment-deep);
  border-top: 1px solid rgba(160, 135, 106, 0.22);
  padding: 1.25rem 1.25rem 1.15rem;
  text-align: center;
}

.footer-top-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.65rem;
}

.footer-fb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid rgba(194, 83, 55, 0.32);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(42, 33, 24, 0.06);
  transition: all 0.2s var(--ease);
}

.footer-fb-btn svg {
  color: #1877F2;
  flex-shrink: 0;
}

.footer-fb-btn:hover {
  border-color: var(--brand-terracotta);
  background: #fff;
  color: var(--brand-terracotta);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194, 83, 55, 0.14);
}

.footer-by {
  font-size: 0.86rem;
  color: var(--ink-faded);
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.footer-by a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer-by a:hover { color: var(--accent); }

.footer-sep {
  margin: 0 0.35rem;
  color: var(--sepia);
  opacity: 0.7;
}

.footer-tagline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.86rem;
  color: var(--sepia);
}

.footer-fiscal {
  font-size: 0.76rem;
  color: var(--ink-faded);
  line-height: 1.5;
  margin-bottom: 0.3rem;
}

.footer-fiscal strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.footer-fiscal a {
  color: var(--ink-faded);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-fiscal a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-legal {
  font-size: 0.76rem;
  color: var(--ink-faded);
  line-height: 1.5;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.1rem;
}

.footer-legal a {
  color: var(--ink-faded);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-legal a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ══ Animations ══ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { opacity: 0; animation: fadeUp 0.55s var(--ease) forwards; }
.fade-up-d1 { animation-delay: 0.12s; }
.fade-up-d2 { animation-delay: 0.24s; }
.fade-up-d3 { animation-delay: 0.36s; }
