/* ===== Bugliani — stylesheet ===== */

:root {
  --bg: #17130f;
  --bg-soft: #1f1a14;
  --paper: #f6efe2;
  --paper-soft: #eee4d1;
  --ink: #221c15;
  --ink-soft: #574c3d;
  --cream: #f6efe2;
  --cream-dim: #cfc3ab;
  --red: #b8232a;
  --red-deep: #7d1418;
  --gold: #e0a458;
  --wood: #4a3222;
  --line: rgba(246, 239, 226, 0.14);
  --line-dark: rgba(34, 28, 21, 0.12);
  --shadow: 0 20px 60px rgba(0,0,0,.35);
  --ease: cubic-bezier(.16,.84,.44,1);
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
section { position: relative; }
::selection { background: var(--red); color: var(--cream); }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

/* film-grain overlay for warmth */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ===== Loader ===== */
.loader {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity .6s var(--ease), visibility .6s var(--ease);
}
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader-pizza { font-size: 48px; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Nav ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  padding: 22px 0;
  transition: padding .4s var(--ease), background-color .4s var(--ease), box-shadow .4s var(--ease);
}
.nav.is-scrolled {
  padding: 12px 0;
  background: rgba(23, 19, 15, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 1px 0 var(--line);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-logo {
  font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: .01em;
  color: var(--cream);
  display: flex; align-items: center; gap: 10px;
}
.nav-logo-img { height: 40px; width: auto; object-fit: contain; }
.nav-logo span { color: var(--red); }
.nav-links { display: flex; gap: 30px; }
.nav-links a {
  font-size: 14px; letter-spacing: .03em; text-transform: uppercase;
  color: var(--cream-dim); position: relative; padding-bottom: 4px;
  transition: color .3s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--gold); transition: width .35s var(--ease);
}
.nav-links a:hover, .nav-links a.is-active { color: var(--cream); }
.nav-links a:hover::after, .nav-links a.is-active::after { width: 100%; }
.nav-cta {
  border: 1px solid var(--line); padding: 10px 20px; border-radius: 999px;
  font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  transition: background .3s, border-color .3s, transform .3s;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--red); border-color: var(--red); transform: translateY(-2px); }
.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 10px; }
.nav-burger span { width: 22px; height: 2px; background: var(--cream); transition: transform .3s, opacity .3s; }
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
body.nav-locked { overflow: hidden; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 30px; border-radius: 999px; font-size: 14px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; border: 1px solid transparent;
  transition: transform .35s var(--ease), background .3s, border-color .3s, color .3s, box-shadow .3s;
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: var(--cream); box-shadow: 0 10px 30px rgba(184,35,42,.35); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(184,35,42,.45); }
.btn-ghost { border-color: var(--line); color: var(--cream); }
.btn-ghost:hover { border-color: var(--cream); transform: translateY(-3px); }
.btn-link { text-transform: none; letter-spacing: 0; font-weight: 500; padding: 15px 4px; position: relative; }
.btn-link::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 10px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
.btn-link:hover::after { transform: scaleX(1); transform-origin: left; }
.btn-sm { padding: 10px 18px; font-size: 12px; }
.btn-block { width: 100%; }
.contatti .btn-primary, .contatti .btn-ghost { color: var(--cream); }

/* ===== Typography helpers ===== */
.eyebrow {
  font-family: var(--sans); font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--red); font-weight: 600; margin: 0 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before, .eyebrow::after { content: "✺"; font-size: 11px; color: var(--gold); opacity: .8; }
h2 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05; margin: 0 0 26px; letter-spacing: -.01em;
}
h2 em { font-style: italic; color: var(--red); font-weight: 500; }
.storia h2, .menu-section h2, .contatti h2 { color: var(--ink); }
.storia h2 em, .menu-section h2 em, .contatti h2 em { color: var(--red); }
.lead {
  font-size: 18px; line-height: 1.7; max-width: 640px; color: var(--cream-dim);
  font-weight: 400; margin: 0 0 40px;
}
.storia .lead, .menu-section .lead, .contatti .lead { color: var(--ink-soft); }

/* ===== Reveal-on-scroll ===== */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.reveal-load { opacity: 0; transform: translateY(20px); }
.hero-title .line { display: block; overflow: hidden; padding-bottom: .18em; margin-bottom: -.18em; }
.hero-title .line span { display: inline-block; }

/* ===== Hero ===== */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 140px 24px 80px; text-align: center;
  background: radial-gradient(120% 100% at 50% 0%, #241c15 0%, #17130f 55%, #100d0a 100%);
  overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.hero-glow {
  position: absolute; left: 50%; bottom: -10%; width: 900px; height: 500px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(224,164,88,.28), transparent 70%);
  filter: blur(10px); z-index: 1; pointer-events: none;
}
.hero-content { position: relative; z-index: 2; max-width: 820px; }
.hero-logo {
  width: min(260px, 60vw); height: auto; object-fit: contain;
  margin: 0 auto 28px; filter: drop-shadow(0 10px 30px rgba(0,0,0,.45));
}
.hero-kicker {
  text-transform: uppercase; letter-spacing: .22em; font-size: 12.5px; color: var(--gold);
  margin: 0 0 22px; font-weight: 600;
}
.hero-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(44px, 8vw, 92px);
  line-height: 1.02; margin: 0 0 28px; letter-spacing: -.015em;
}
.hero-title em { font-style: italic; color: var(--gold); font-weight: 500; }
.hero-sub { font-size: 19px; line-height: 1.7; color: var(--cream-dim); max-width: 560px; margin: 0 auto 40px; }
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }

.scroll-cue { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 2; }
.scroll-cue span { display: block; width: 1px; height: 46px; background: linear-gradient(var(--gold), transparent); animation: cue 2s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; opacity: 0; } 40% { transform: scaleY(1); transform-origin: top; opacity: 1; } 60% { transform: scaleY(1); transform-origin: bottom; opacity: 1; } 100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; } }

/* ===== Section spacing / theming ===== */
.section { padding: 140px 0; }
.storia, .menu-section, .contatti { background: var(--paper); color: var(--ink); }
.sedi, .forno { background: var(--bg); }
.sedi::before, .forno::before {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(74,50,34,.35) 0 2px, transparent 2px 60px);
  opacity: .5; pointer-events: none;
}

/* ===== Stats ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 0 0 100px; padding: 40px 0; border-top: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark); }
.stat { text-align: center; }
.stat-num { display: block; font-family: var(--serif); font-size: clamp(32px, 4vw, 48px); font-weight: 700; color: var(--red); }
.stat-label { font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }

/* ===== Timeline ===== */
.timeline { position: relative; max-width: 780px; margin: 0 auto; padding-left: 46px; }
.timeline-line { position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line-dark); }
.timeline-line-fill { position: absolute; top: 0; left: 0; width: 100%; height: 0%; background: var(--red); transition: height .2s linear; }
.tl-item { position: relative; padding-bottom: 64px; }
.tl-body { overflow: hidden; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -46px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 2px solid var(--red); }
.tl-year { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); font-weight: 700; margin-bottom: 8px; }
.tl-body h3 { font-family: var(--serif); font-size: 26px; margin: 0 0 10px; font-weight: 600; }
.tl-body p { margin: 0; color: var(--ink-soft); line-height: 1.7; max-width: 560px; }
.tl-photo {
  width: 108px; height: 108px; border-radius: 14px; object-fit: cover;
  float: left; margin: 2px 20px 12px 0; border: 2px solid var(--line-dark); box-shadow: var(--shadow);
}
.tl-photo-pair { display: flex; gap: 10px; float: left; margin: 2px 20px 12px 0; }
.tl-photo-pair .tl-photo-sm { float: none; margin: 0; width: 96px; height: 108px; }
@media (max-width: 560px) {
  .tl-photo, .tl-photo-pair { float: none; margin: 0 0 16px; }
}

/* ===== Locations ===== */
.locations { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.loc-card {
  border-radius: 22px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--line);
  transition: transform .1s linear; will-change: transform;
}
.loc-card-inner { padding: 40px 36px 32px; }
.loc-tag { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.loc-card h3 { font-family: var(--serif); font-size: 32px; margin: 10px 0 24px; font-weight: 600; }
.loc-info { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.loc-info li { display: flex; flex-direction: column; gap: 4px; font-size: 15px; color: var(--cream-dim); line-height: 1.5; }
.loc-info strong { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.loc-info a { color: var(--cream); transition: color .3s; }
.loc-info a:hover { color: var(--gold); }
.loc-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.loc-map { height: 220px; filter: grayscale(.5) sepia(.15) contrast(1.05); }
.loc-map iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ===== Menu ===== */
.menu-tabs { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 50px; border-bottom: 1px solid var(--line-dark); padding-bottom: 0; }
.menu-tab {
  background: none; border: none; padding: 12px 18px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); letter-spacing: .01em; position: relative; transition: color .3s;
}
.menu-tab:hover { color: var(--ink); }
.menu-tab.is-active { color: var(--red); }
.menu-tab-indicator { position: absolute; bottom: -1px; height: 2px; background: var(--red); transition: left .4s var(--ease), width .4s var(--ease); }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 48px; }
.menu-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 18px 0; border-bottom: 1px dashed var(--line-dark);
  opacity: 0; transform: translateY(14px); animation: itemIn .5s var(--ease) forwards;
}
@keyframes itemIn { to { opacity: 1; transform: translateY(0); } }
.menu-item-name { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.menu-item-desc { display: block; font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--ink-soft); margin-top: 4px; }
.menu-item-price { font-weight: 600; color: var(--red); white-space: nowrap; }

/* ===== Forno live ===== */
.forno-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.forno-text .lead { color: var(--cream-dim); }
.forno-text h2 { color: var(--cream); }
.forno-cam-frame {
  position: relative; border-radius: 22px; overflow: hidden; aspect-ratio: 4/3;
  background: #0b0906; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.forno-cam-frame canvas { width: 100%; height: 100%; display: block; }
.forno-cam-caption {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 16px 20px;
  font-size: 12.5px; color: var(--cream-dim); background: linear-gradient(transparent, rgba(0,0,0,.65));
}
.live-badge {
  position: absolute; top: 16px; left: 16px; z-index: 3; display: flex; align-items: center; gap: 7px;
  background: rgba(0,0,0,.55); padding: 7px 12px; border-radius: 999px; font-size: 11.5px;
  letter-spacing: .08em; font-weight: 700; color: var(--cream); backdrop-filter: blur(6px);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(184,35,42,.6); } 70% { box-shadow: 0 0 0 8px rgba(184,35,42,0); } }

/* ===== Contatti ===== */
.contatti-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 70px; align-items: start; }
.contact-info { display: flex; flex-direction: column; gap: 18px; margin: 30px 0; }
.contact-info li { display: flex; flex-direction: column; gap: 2px; }
.contact-info strong { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.contact-info a { font-size: 16px; color: var(--ink); transition: color .3s; }
.contact-info a:hover { color: var(--red); }
.social-links { display: flex; gap: 20px; }
.social-links a { font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.social-links a:hover { color: var(--red); border-color: var(--red); }

.contact-form { display: flex; flex-direction: column; gap: 18px; background: var(--cream); padding: 36px; border-radius: 22px; border: 1px solid var(--line-dark); box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.contact-form label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); letter-spacing: .02em; }
.contact-form input, .contact-form textarea {
  font-family: var(--sans); font-size: 15px; padding: 13px 14px; border-radius: 10px;
  border: 1px solid var(--line-dark); background: var(--paper); color: var(--ink);
  transition: border-color .3s, box-shadow .3s;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(184,35,42,.12); }
.checkbox { flex-direction: row !important; align-items: flex-start; gap: 10px !important; font-weight: 400 !important; font-size: 13px !important; }
.checkbox input { width: 16px; height: 16px; margin-top: 2px; }
.form-note { font-size: 13px; color: var(--red); min-height: 18px; margin: 0; }

/* ===== Footer ===== */
.footer { background: var(--bg); padding: 70px 0 30px; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 30px; margin-bottom: 50px; }
.footer-inner p { color: var(--cream-dim); margin: 10px 0 0; font-size: 14px; }
.footer-links { display: flex; gap: 26px; flex-wrap: wrap; }
.footer-links a { font-size: 14px; color: var(--cream-dim); transition: color .3s; }
.footer-links a:hover { color: var(--cream); }
.footer-copy { text-align: center; font-size: 12.5px; color: var(--cream-dim); opacity: .6; }

/* ===== Back to top ===== */
.to-top {
  position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 400; width: 46px; height: 46px; border-radius: 50%;
  background: var(--red); color: var(--cream); border: none; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s, transform .3s; box-shadow: 0 10px 26px rgba(184,35,42,.4);
}
.to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .nav-links, .nav-cta { display: none; }
  .nav-burger { display: flex; }
  .nav-links.is-open {
    display: flex; flex-direction: column; position: fixed; top: 68px; left: 16px; right: 16px;
    background: rgba(23,19,15,.97); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
    gap: 18px; backdrop-filter: blur(14px);
  }
  .locations, .forno-inner, .contatti-inner, .menu-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 30px; }
  .form-row { grid-template-columns: 1fr; }
  .section { padding: 90px 0; }
  .loc-card[data-tilt] { transform: none !important; }
  .container { padding: 0 22px; }

  .menu-tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 14px; margin-bottom: 36px;
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  }
  .menu-tabs::-webkit-scrollbar { display: none; }
  .menu-tab { flex: 0 0 auto; padding: 10px 16px; }

  .hero { padding-top: 120px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .btn, .nav-cta { min-height: 44px; }
  .nav-inner { padding: 0 22px; }

  .timeline { padding-left: 34px; }
  .tl-dot { left: -34px; }
}

@supports (padding: max(0px)) {
  .nav-inner { padding-left: max(32px, env(safe-area-inset-left)); padding-right: max(32px, env(safe-area-inset-right)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
