/* =========================================================
   Costruzioni SRLS — redesign layer (loaded after style.css)
   3D hero, construction scroll section, motion & polish
   ========================================================= */

:root { --glow: rgba(201,162,75,.16); }

/* ---- scroll progress + cursor glow ---- */
.scroll-bar {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 200;
  background: linear-gradient(90deg, #c9a24b, #f0d58a);
  transform-origin: 0 50%; transform: scaleX(0); pointer-events: none;
}
.cursor-glow {
  position: fixed; left: -260px; top: -260px; width: 520px; height: 520px; z-index: 0;
  border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(closest-side, var(--glow), transparent);
  mix-blend-mode: screen;
}
.cursor-glow.on { opacity: 1; }
main, .site-footer { position: relative; z-index: 1; }

/* ---- header: glass + hide on scroll down ---- */
.site-header { transition: transform .45s var(--ease), background .3s, border-color .3s; backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
.site-header.scrolled { background: rgba(12,13,16,.72); }
.site-header.hide { transform: translateY(-100%); }
.nav-links a { position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform .35s var(--ease); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

/* ---- hero ---- */
.hero { min-height: min(100vh, 880px); display: flex; align-items: center; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 55% at 78% 42%, rgba(201,162,75,.13), transparent 70%),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 64px 64px;
  -webkit-mask-image: radial-gradient(75% 85% at 70% 45%, #000, transparent);
  mask-image: radial-gradient(75% 85% at 70% 45%, #000, transparent);
}
.hero-grid { width: 100%; z-index: 1; padding: 120px 0 90px; }
.hero h1 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.hero h1 .w > span { display: inline-block; transform: translateY(110%); transition: transform .9s var(--ease); }
.hero h1.in .w > span { transform: none; }
.hero h1 { text-wrap: balance; }

.hero-visual { aspect-ratio: 1 / 1.02; max-height: 620px; }
.hero-3d { position: absolute; inset: -6% -14% -6% -14%; z-index: 2; opacity: 0; transition: opacity 1.2s .2s; }
.hero.has3d .hero-3d { opacity: 1; }
.hero.has3d .hero-visual .frame, .hero.has3d .hero-visual::before { opacity: 0; visibility: hidden; transition: opacity .6s; }
.hero-3d canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.hero-3d canvas.grabbing, .process-stage canvas.grabbing { cursor: grabbing; }
.hero-3d .hint { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); pointer-events: none; white-space: nowrap; }
.hero-3d .hint span { width: 28px; height: 1px; background: var(--accent); animation: hint 2.2s var(--ease) infinite; transform-origin: 0 50%; }
.hero-3d .hint em { font-style: normal; }
@keyframes hint { 0%,100% { transform: scaleX(.3); opacity: .4; } 50% { transform: scaleX(1); opacity: 1; } }
.hero.has3d .hero-badge { z-index: 3; left: 2%; bottom: auto; top: 10%; }

/* scroll cue */
.hero-grid::after { content: ""; position: absolute; left: 24px; bottom: 28px; width: 1px; height: 54px; background: linear-gradient(var(--accent), transparent); animation: cue 2s var(--ease) infinite; transform-origin: 0 0; }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---- buttons ---- */
.btn { transition: transform .25s var(--ease), background .25s, color .25s, border-color .25s, box-shadow .25s; will-change: transform; }
.btn--primary { position: relative; overflow: hidden; }
.btn--primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s var(--ease); }
.btn--primary:hover::after { transform: translateX(120%); }

/* ---- cards: 3D tilt + spotlight ---- */
.card, .proj-card, .contact-card, .step-card { transform-style: preserve-3d; will-change: transform; }
.card.tilting, .proj-card.tilting, .contact-card.tilting, .step-card.tilting { transition: transform .08s linear, border-color .3s; }
.card::after, .contact-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(224,189,106,.14), transparent 70%);
}
.card.tilting::after, .contact-card.tilting::after { opacity: 1; }
.contact-card { position: relative; }
.proj-card .thumb { overflow: hidden; }
.proj-card .thumb img { transition: transform 1s var(--ease); }
.proj-card:hover .thumb img { transform: scale(1.08); }
.proj-card.gone { display: none; }

/* ---- reveal: stronger, staggered ---- */
.reveal { transition-duration: .9s; }
.cards .reveal:nth-child(2), .proj-grid .reveal:nth-child(2), .stats .reveal:nth-child(2) { transition-delay: .12s; }
.cards .reveal:nth-child(3), .proj-grid .reveal:nth-child(3), .stats .reveal:nth-child(3) { transition-delay: .24s; }

/* ---- filter chips ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 44px; }
.chip { font: 500 .82rem/1 Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); background: transparent; border: 1px solid var(--line); padding: 13px 22px; border-radius: 999px; cursor: pointer; transition: all .25s var(--ease); }
.chip:hover { border-color: var(--accent); color: var(--accent-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #14120b; }

/* ---- construction process (scroll-driven 3D) ---- */
.process { position: relative; height: 420vh; background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.process-sticky { position: sticky; top: 0; height: 100vh; display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: 40px; max-width: var(--maxw); margin: 0 auto; padding: 90px 24px 40px; }
.process-copy .section-head { margin-bottom: 36px; }
.process-copy h2 { font-size: clamp(2.1rem, 4vw, 3.1rem); }
.steps { position: relative; display: grid; gap: 6px; padding-left: 28px; }
.steps-rail { position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.steps-rail b { position: absolute; inset: 0; background: linear-gradient(var(--accent-2), var(--accent)); transform: scaleY(0); transform-origin: 0 0; }
.step-card { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 14px 18px; border: 1px solid transparent; border-radius: var(--radius); opacity: .38; transition: opacity .5s var(--ease), background .5s, border-color .5s; }
.step-card::before { content: ""; position: absolute; left: -26px; top: 22px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg-alt); border: 1px solid var(--muted); transition: all .4s; }
.step-card .n { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.6rem; color: var(--accent); line-height: 1.2; }
.step-card h3 { font-size: 1.4rem; margin: 0 0 2px; }
.step-card p { margin: 0; font-size: .92rem; color: var(--muted); max-height: 0; overflow: hidden; opacity: 0; transition: max-height .5s var(--ease), opacity .5s; }
.step-card.on { opacity: 1; background: var(--panel); border-color: rgba(201,162,75,.28); }
.step-card.on::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px rgba(201,162,75,.18); }
.step-card.on p { max-height: 8em; opacity: 1; }
.process-stage { position: relative; height: min(72vh, 640px); }
.process-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.process-stage.no3d::after { content: ""; position: absolute; inset: 0; background: url(../images/general/casa-nuova.jpg) center/cover; border-radius: var(--radius); opacity: .8; }
.process-dots { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; gap: 10px; }
.process-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: all .3s; }
.process-dots i.on { background: var(--accent); transform: scale(1.4); }

/* ---- marquee of locations ---- */
.marquee { overflow: hidden; border-block: 1px solid var(--line); background: var(--bg); padding: 26px 0; position: relative; z-index: 1; }
.marquee-track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee span { font-family: "Cormorant Garamond", Georgia, serif; font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 600; color: transparent; -webkit-text-stroke: 1px rgba(201,162,75,.55); padding: 0 34px; white-space: nowrap; transition: color .3s; }
.marquee span::after { content: "◆"; font-size: .5em; margin-left: 68px; color: var(--accent); -webkit-text-stroke: 0; vertical-align: middle; }
.marquee span:hover { color: var(--accent-2); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---- CTA band glow ---- */
.cta-band { position: relative; overflow: hidden; }
.cta-band::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(201,162,75,.18), transparent 40%); animation: spin 14s linear infinite; pointer-events: none; }
.cta-band > * { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .hero { min-height: 0; }
  .hero-grid { padding: 96px 0 60px; }
  .hero-visual { aspect-ratio: 1 / .95; max-width: 520px; margin: 0 auto; width: 100%; }
  .hero-3d { inset: -4% -8%; }
  .process { height: 380vh; }
  .process-sticky { grid-template-columns: 1fr; grid-template-rows: 42vh auto; gap: 14px; padding-top: 76px; align-content: start; }
  .process-stage { order: -1; height: 42vh; }
  .process-copy .section-head { display: none; }
  .step-card { padding: 10px 14px; }
  .process-dots { display: none; }
}
@media (max-width: 560px) { .hero-3d .hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .hero h1 .w > span { transform: none; transition: none; }
  .marquee-track, .cta-band::before, .hero-grid::after { animation: none; }
  .process { height: auto; }
  .process-sticky { position: static; height: auto; padding-block: 80px; }
}

@media (max-width: 560px) {
  .hero-visual { aspect-ratio: 1 / .72; max-height: 320px; }
  .hero-3d { inset: -10% -14%; }
  .hero-grid { padding-top: 84px; gap: 24px; }
}
