/* ============================================================
   MG Impianti — experience.css
   Stile 3D-first, editoriale, asimmetrico.
   Il campo di particelle WebGL è il protagonista; l'UI è minimale.
   ============================================================ */

:root {
  --bg: #04050a;
  --text: #eef0f7;
  --muted: #8a90a6;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #5b8cff;
  --accent-2: #25e8d8;
  --grad: linear-gradient(110deg, #5b8cff, #25e8d8);
  --maxw: 1280px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }

body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 35%, rgba(4,5,10,0.55) 100%),
    linear-gradient(180deg, rgba(4,5,10,0.35), rgba(4,5,10,0.15));
}

#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; display: block; }

.eyebrow, .hud, .scroll-cue, .nav-links a, .cta-link, .list span,
.hours span, .metrics span, .contact-links span, .foot { font-family: "JetBrains Mono", monospace; }

::selection { background: var(--accent); color: #04050a; }

/* ---------- custom cursor ---------- */
.cursor, .cursor-dot { position: fixed; top: 0; left: 0; z-index: 999; pointer-events: none; border-radius: 50%; mix-blend-mode: difference; }
.cursor { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,0.6); transform: translate(-50%,-50%); transition: width .25s var(--ease), height .25s var(--ease), background .25s; }
.cursor.hover { width: 56px; height: 56px; background: rgba(255,255,255,0.12); }
.cursor-dot { width: 5px; height: 5px; background: #fff; transform: translate(-50%,-50%); }
@media (pointer: coarse) { .cursor, .cursor-dot { display: none; } }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: flex; align-items: center; justify-content: space-between; padding: 0 6vw; transition: opacity .7s var(--ease), visibility .7s; }
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-mark { font-size: clamp(1.6rem, 7vw, 5rem); font-weight: 700; letter-spacing: -0.04em; }
.loader-mark span { color: var(--accent); margin: 0 .1em; }
.loader-pct { font-family: "JetBrains Mono", monospace; font-size: clamp(1.6rem, 7vw, 5rem); color: var(--muted); }

/* ---------- HUD ---------- */
.hud { position: fixed; right: 28px; top: 50%; transform: translateY(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 0.7rem; letter-spacing: 0.1em; color: var(--muted); }
.hud-idx { color: var(--text); }
.hud-line { width: 1px; height: 120px; background: var(--line); position: relative; overflow: hidden; }
.hud-line i { position: absolute; top: 0; left: 0; width: 100%; height: 0%; background: var(--grad); transition: height .2s linear; }
@media (max-width: 760px) { .hud { display: none; } }

/* ---------- nav ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; padding: 20px 6vw; transition: padding .4s var(--ease), background .4s; }
.nav.shrink { padding: 12px 6vw; background: rgba(4,5,10,0.55); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.nav.shrink .brand-logo { height: 28px; }
.nav-menu { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { color: var(--muted); font-size: 0.78rem; text-decoration: none; letter-spacing: 0.04em; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.cta-link { color: var(--text); font-size: 0.78rem; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 3px; transition: opacity .2s; }
.cta-link:hover { opacity: 0.7; }

/* hamburger */
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 6px; width: 42px; height: 42px; padding: 0; background: none; border: 0; cursor: pointer; z-index: 70; }
.nav-toggle span { display: block; width: 26px; height: 2px; margin: 0 auto; background: var(--text); border-radius: 2px; transition: transform .35s var(--ease), opacity .25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed; inset: 0; flex-direction: column; justify-content: center; gap: 34px;
    background: rgba(4, 5, 10, 0.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    opacity: 0; pointer-events: none; transform: translateY(-12px);
    transition: opacity .4s var(--ease), transform .4s var(--ease);
  }
  .nav.menu-open .nav-menu { opacity: 1; pointer-events: auto; transform: none; }
  .nav-links { flex-direction: column; align-items: center; gap: 30px; }
  .nav-links a { font-size: 1.5rem; color: var(--text); }
  .cta-link { font-size: 1.1rem; }
}

/* ---------- panels ---------- */
.panel { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 120px 6vw; }
.panel.center { justify-content: center; text-align: center; }
.panel.right { justify-content: flex-end; }
.panel.left { justify-content: flex-start; }
.panel-in { max-width: 560px; }
.panel.center .panel-in { max-width: 760px; }
.panel.wide .panel-in.wide { max-width: 1120px; }

.eyebrow { display: inline-block; font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 22px; }

h1 { font-size: clamp(2.4rem, 7.5vw, 5.6rem); font-weight: 600; line-height: 0.98; letter-spacing: -0.04em; }
h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: clamp(1.9rem, 5vw, 3.4rem); font-weight: 600; line-height: 1.02; letter-spacing: -0.03em; }
.lead { color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.15rem); margin-top: 22px; max-width: 52ch; }
.panel.center .lead { margin-inline: auto; }

.actions { display: flex; gap: 14px; margin-top: 38px; flex-wrap: wrap; }
.panel.center .actions { justify-content: center; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 26px; border-radius: 999px; background: var(--grad); color: #04050a; font-weight: 600; font-size: 0.92rem; text-decoration: none; border: 1px solid transparent; transition: transform .3s var(--ease), box-shadow .3s; }
.btn:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(91,140,255,0.35); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--text); box-shadow: none; }

/* ---------- hero stats ---------- */
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 56px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.hero-stats span { font-family: "JetBrains Mono", monospace; color: var(--muted); font-size: 0.72rem; }

/* ---------- service list ---------- */
.list { list-style: none; margin-top: 34px; }
.list li { display: flex; align-items: baseline; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); font-size: clamp(1.1rem, 2.4vw, 1.7rem); font-weight: 500; transition: padding-left .3s var(--ease), color .3s; }
.list li:last-child { border-bottom: 1px solid var(--line); }
.list li span { font-size: 0.72rem; color: var(--accent); }
.list li:hover { padding-left: 14px; color: #fff; }

/* ---------- storia: metrics + quote ---------- */
.metrics { display: flex; gap: 48px; margin-top: 34px; flex-wrap: wrap; }
.metrics b { display: block; font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }
.metrics span { color: var(--muted); font-size: 0.78rem; max-width: 22ch; display: block; }
.quote { margin-top: 34px; padding-left: 20px; border-left: 2px solid var(--accent); color: var(--text); font-size: 1.1rem; font-style: italic; }
.quote cite { display: block; margin-top: 10px; font-style: normal; color: var(--muted); font-size: 0.85rem; }

/* ---------- orari ---------- */
.hours { list-style: none; margin-top: 30px; }
.hours li { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.hours li:last-child { border-bottom: 1px solid var(--line); }
.hours span { color: var(--muted); font-size: 0.85rem; }
.hours b { font-weight: 600; }

/* ---------- lavori ---------- */
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 36px; text-align: left; }
.work-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(255,255,255,0.03); transition: transform .35s var(--ease), border-color .35s; }
.work-card:hover { transform: translateY(-6px); border-color: rgba(91,140,255,0.5); }
.work-card figure { margin: 0; aspect-ratio: 4 / 3; overflow: hidden; background: #0a0c14; }
.work-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.work-card:hover img { transform: scale(1.06); }
.work-card p { padding: 16px 18px; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }

/* ---------- marchi ---------- */
.marquee { margin-top: 40px; display: flex; gap: 16px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-lane { display: flex; gap: 16px; flex-shrink: 0; animation: marquee 40s linear infinite; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.brand-pill { flex: 0 0 auto; width: 150px; height: 76px; display: grid; place-items: center; padding: 16px 22px; border-radius: 14px; background: rgba(255,255,255,0.92); }
.brand-pill img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-pill span { color: #04050a; font-size: 0.8rem; font-weight: 600; }
.marquee:hover .marquee-lane { animation-play-state: paused; }

/* ---------- contatti ---------- */
.contact-links { display: flex; flex-direction: column; gap: 4px; margin: 34px auto 30px; max-width: 460px; }
.contact-links a { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); transition: padding .3s var(--ease); }
.contact-links a:last-child { border-bottom: 1px solid var(--line); }
.contact-links a:hover { padding-inline: 10px; }
.contact-links span { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; }
.contact-links b { font-weight: 600; font-size: 1.05rem; }
.foot { display: flex; flex-direction: column; gap: 6px; margin-top: 40px; color: var(--muted); font-size: 0.72rem; }
.foot-policy { display: flex; gap: 16px; margin-top: 4px; }
.foot-policy a { color: var(--muted); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; transition: color .2s ease; }
.foot-policy a:hover { color: var(--ink, #fff); }

/* ---------- cookie banner ---------- */
.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(720px, calc(100% - 24px));
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(10, 12, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__text { margin: 0; font-size: 0.78rem; line-height: 1.5; color: #cdd3e3; }
.cookie-banner__text a { color: #7aa2ff; text-decoration: underline; }
.cookie-banner__btn {
  flex: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #04050a;
  background: #7aa2ff;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background .2s ease;
}
.cookie-banner__btn:hover { background: #9bb8ff; }
@media (max-width: 560px) {
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ---------- scroll cue ---------- */
.scroll-cue { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.scroll-cue i { width: 1px; height: 40px; background: linear-gradient(var(--accent), transparent); animation: cue 1.8s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .panel { padding: 110px 7vw; min-height: 100svh; }
  .panel.right, .panel.left { justify-content: center; }
  .works-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) { .works-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  body { cursor: auto; }
  .cursor, .cursor-dot { display: none; }
  .marquee-lane { animation: none; }
}
