/* ==========================================================================
   MASTERSOFT — service.css
   Template comune alle 5 pagine servizio (il colore arriva da --accent)
   ========================================================================== */

body.svc-ai  { --accent: var(--c-ai); }
body.svc-sw  { --accent: var(--c-sw); }
body.svc-web { --accent: var(--c-web); }
body.svc-ads { --accent: var(--c-ads); }
body.svc-for { --accent: var(--c-for); }

/* ---------- HERO ---------- */
.svc-hero { position: relative; min-height: 100svh; display: flex; align-items: center; padding: calc(var(--header-h) + 60px) 0 90px; overflow: hidden; isolation: isolate; }
.svc-hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.svc-hero h1 { font-size: clamp(2.8rem, 6.6vw, 6.4rem); font-weight: 800; letter-spacing: -.05em; line-height: .95; }
.svc-hero h1 em { font-style: normal; color: var(--accent); }
.svc-hero .lead { margin-top: 30px; max-width: 50ch; }
.svc-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.svc-hero__bg { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 55% 60% at 78% 45%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%); }
.svc-hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 60% 60% at 75% 45%, #000, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 75% 45%, #000, transparent 70%);
}

.svc-hero__scene { position: relative; height: 520px; display: grid; place-items: center; perspective: 1200px; }
.svc-hero__scene .cube { --s: clamp(150px, 17vw, 240px); animation: floatCube 14s linear infinite; }
@keyframes floatCube {
  0% { transform: rotateX(-22deg) rotateY(0deg) translateY(0); }
  50% { transform: rotateX(-30deg) rotateY(180deg) translateY(-18px); }
  100% { transform: rotateX(-22deg) rotateY(360deg) translateY(0); }
}
.svc-hero__scene .cube__face { display: grid; place-items: center; }
.svc-hero__scene .cube__face svg { width: 40%; height: 40%; color: #fff; position: relative; z-index: 1; opacity: .92; }
.orbit-chip {
  position: absolute; padding: 9px 15px; border-radius: 999px; font-size: .82rem; font-weight: 500; white-space: nowrap;
  background: rgba(20,20,26,.75); border: 1px solid var(--line-2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); animation: chipFloat 6s var(--ease-io) infinite alternate; animation-delay: var(--d, 0s);
}
.orbit-chip::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.orbit-chip:nth-of-type(1) { top: 12%; left: 4%; }
.orbit-chip:nth-of-type(2) { top: 22%; right: 0; --d: -2s; }
.orbit-chip:nth-of-type(3) { bottom: 18%; left: 0; --d: -4s; }
.orbit-chip:nth-of-type(4) { bottom: 8%; right: 8%; --d: -1s; }
@keyframes chipFloat { to { transform: translateY(-16px); } }
.svc-hero__shadow { position: absolute; bottom: 14%; width: 46%; height: 30px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 50%, transparent), transparent); filter: blur(14px); animation: shadowPulse 7s var(--ease-io) infinite; }
@keyframes shadowPulse { 50% { transform: scale(.82); opacity: .6; } }

/* ---------- SHOWCASE con zoom a scorrimento (stile pagina prodotto Apple) ---------- */
.showcase { position: relative; height: 240vh; }
.showcase__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; perspective: 1600px; }
.showcase__title { text-align: center; margin-bottom: 40px; transition: none; will-change: opacity, transform; }
.showcase__title h2 { font-size: var(--fs-h2); }
.showcase__title p { margin-top: 14px; color: var(--muted); }
.device {
  --p: 0;
  width: min(1040px, 92vw); border-radius: 26px; overflow: hidden; position: relative;
  background: #0d0d12; border: 1px solid var(--line-2);
  box-shadow: 0 60px 120px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.04), 0 0 120px -40px var(--accent);
  transform: translateY(calc((1 - var(--p)) * 80px)) rotateX(calc((1 - var(--p)) * 28deg)) scale(calc(.78 + var(--p) * .22));
  transform-origin: 50% 0; will-change: transform;
}
.device__bar { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-bottom: 1px solid var(--line); background: #121218; }
.device__bar i { width: 11px; height: 11px; border-radius: 50%; background: #2a2a33; }
.device__bar i:nth-child(1) { background: #ff5f57; } .device__bar i:nth-child(2) { background: #febc2e; } .device__bar i:nth-child(3) { background: #28c840; }
.device__url { margin-left: 16px; flex: 1; max-width: 420px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.05); font-size: .78rem; color: var(--dim); display: flex; align-items: center; padding: 0 12px; font-family: var(--font-mono); }
.device__screen { position: relative; height: clamp(360px, 52vh, 560px); overflow: hidden; }

/* — Demo: chat con agente AI — */
.demo-chat { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
.demo-chat aside { border-right: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 10px; font-size: .82rem; color: var(--muted); }
.demo-chat aside b { color: var(--text); font-size: .9rem; margin-bottom: 6px; }
.demo-chat aside span { padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.03); }
.demo-chat aside span.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
.demo-chat__log { padding: 28px clamp(18px, 3vw, 40px); display: flex; flex-direction: column; gap: 14px; overflow: hidden; justify-content: flex-end; }
.msg { max-width: 76%; padding: 13px 17px; border-radius: 18px; font-size: .93rem; line-height: 1.5; opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .5s var(--ease-out), transform .6s var(--ease-out); }
.msg.is-in { opacity: 1; transform: none; }
.msg--user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg--bot { align-self: flex-start; background: #1c1c24; border-bottom-left-radius: 6px; }
.msg--tool { align-self: flex-start; font-family: var(--font-mono); font-size: .78rem; background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
.msg--tool::before { content: "⚙ "; color: var(--accent); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* — Demo: editor di codice — */
.demo-code { display: grid; grid-template-columns: 200px 1fr; height: 100%; font-family: var(--font-mono); font-size: clamp(.72rem, 1.05vw, .88rem); }
.demo-code aside { border-right: 1px solid var(--line); padding: 18px 14px; color: var(--dim); line-height: 2; font-size: .8em; }
.demo-code aside .on { color: var(--text); background: rgba(255,255,255,.05); border-radius: 6px; padding: 0 8px; margin: 0 -8px; display: block; }
.demo-code pre { margin: 0; padding: 22px 26px; line-height: 1.75; color: #d4d4dc; white-space: pre-wrap; overflow: hidden; counter-reset: ln; }
.demo-code .caret { display: inline-block; width: .6em; height: 1.15em; background: var(--accent); vertical-align: -.2em; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.tok-k { color: #c792ea; } .tok-s { color: #a5e3a0; } .tok-f { color: #82aaff; } .tok-c { color: #6b6b78; font-style: italic; } .tok-n { color: #f78c6c; }

/* — Demo: e-commerce — */
.demo-shop { padding: clamp(18px, 3vw, 34px); height: 100%; display: flex; flex-direction: column; gap: 22px; }
.demo-shop__top { display: flex; justify-content: space-between; align-items: center; }
.demo-shop__logo { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.04em; }
.demo-shop__nav { display: flex; gap: 22px; font-size: .85rem; color: var(--muted); }
.demo-shop__cart { position: relative; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.06); display: grid; place-items: center; }
.demo-shop__cart svg { width: 18px; }
.demo-shop__cart b { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #04140b; font-size: .72rem; display: grid; place-items: center; transition: transform .4s var(--ease-out); }
.demo-shop__cart b.bump { transform: scale(1.4); }
.demo-shop__grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.product { border-radius: 18px; background: #16161d; border: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; opacity: 0; transform: translateY(30px); transition: opacity .7s var(--ease-out), transform .8s var(--ease-out); transition-delay: var(--d, 0s); }
.is-live .product { opacity: 1; transform: none; }
.product__img { flex: 1; min-height: 80px; border-radius: 12px; background: linear-gradient(140deg, var(--g1), var(--g2)); position: relative; overflow: hidden; }
.product__img::after { content: ""; position: absolute; width: 46%; aspect-ratio: 1; left: 27%; top: 22%; border-radius: 30%; background: rgba(255,255,255,.28); box-shadow: 0 20px 30px -10px rgba(0,0,0,.4); }
.product strong { font-size: .85rem; } .product span { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.product button { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #04140b; font-weight: 700; }
.demo-shop__pay { display: flex; gap: 10px; flex-wrap: wrap; font-size: .75rem; color: var(--dim); }
.demo-shop__pay span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* — Demo: dashboard campagne — */
.demo-ads { padding: clamp(18px, 3vw, 34px); height: 100%; display: grid; grid-template-rows: auto 1fr; gap: 20px; }
.demo-ads__kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 16px; border-radius: 16px; background: #15151c; border: 1px solid var(--line); }
.kpi small { display: block; font-size: .72rem; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.kpi b { display: block; font-family: var(--font-display); font-size: clamp(1.2rem, 2.2vw, 1.9rem); letter-spacing: -.04em; margin-top: 6px; }
.kpi em { font-style: normal; font-size: .78rem; color: var(--c-web); }
.demo-ads__chart { position: relative; border-radius: 18px; background: #121218; border: 1px solid var(--line); padding: 20px; display: flex; align-items: flex-end; gap: 2.2%; overflow: hidden; }
.demo-ads__chart .bar { flex: 1; height: var(--h); border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 25%, transparent)); transform: scaleY(0); transform-origin: bottom; transition: transform 1.2s var(--ease-out); transition-delay: var(--d, 0s); }
.is-live .bar { transform: scaleY(1); }
.demo-ads__chart svg { position: absolute; inset: 20px; width: calc(100% - 40px); height: calc(100% - 40px); overflow: visible; }
.demo-ads__chart path { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1400; stroke-dashoffset: 1400; transition: stroke-dashoffset 2.4s var(--ease-out) .4s; }
.is-live .demo-ads__chart path { stroke-dashoffset: 0; }

/* — Demo: terminale forense — */
.demo-term { height: 100%; padding: 24px 28px; font-family: var(--font-mono); font-size: clamp(.72rem, 1.05vw, .9rem); line-height: 1.85; color: #c8c8d0; background: radial-gradient(ellipse at 50% 120%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%); overflow: hidden; position: relative; }
.demo-term .ln { opacity: 0; transition: opacity .2s; white-space: pre-wrap; word-break: break-all; }
.demo-term .ln.is-in { opacity: 1; }
.demo-term .p { color: var(--accent); } .demo-term .ok { color: var(--c-web); } .demo-term .dim { color: var(--dim); } .demo-term .hash { color: #ffd479; }
.demo-term .progress { display: inline-block; width: 220px; max-width: 50%; height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); vertical-align: middle; overflow: hidden; margin-left: 8px; }
.demo-term .progress i { display: block; height: 100%; width: var(--w, 0%); background: var(--accent); transition: width .1s linear; }
.demo-term::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); }

/* ---------- INTRO scrub ---------- */
.svc-intro .scrub-text { max-width: 26ch; }

/* ---------- FEATURES ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  position: relative; padding: 34px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); overflow: hidden; isolation: isolate;
  transition: border-color .4s, transform .6s var(--ease-out);
}
.feature::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .5s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%); }
.feature:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.feature:hover::before { opacity: 1; }
.feature__icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); margin-bottom: 60px; }
.feature__icon svg { width: 25px; height: 25px; }
.feature h3 { font-size: 1.35rem; letter-spacing: -.025em; }
.feature p { margin-top: 10px; color: var(--muted); font-size: .97rem; }
.feature--wide { grid-column: span 2; }
.feature--accent { background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 30%, var(--surface)), var(--surface) 70%); }

/* ---------- SPLIT: per chi / cosa ricevi ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 6vw, 90px); align-items: start; }
.split h2 { font-size: var(--fs-h2); }
.checklist li { display: flex; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.checklist li:first-child { border-top: 1px solid var(--line); }
.checklist svg { flex: none; width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.checklist strong { display: block; font-weight: 600; }
.checklist span { color: var(--muted); font-size: .95rem; }
.tech { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.tech li { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-2); font-size: .88rem; color: var(--muted); transition: color .2s, border-color .2s; }
.tech li:hover { color: var(--text); border-color: var(--accent); }

/* ---------- PROCESS timeline ---------- */
.timeline { position: relative; max-width: 880px; margin-inline: auto; }
.timeline::before, .timeline__fill { content: ""; position: absolute; left: 27px; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.timeline__fill { background: var(--accent); transform-origin: top; transform: scaleY(var(--p, 0)); box-shadow: 0 0 16px var(--accent); }
.timeline li { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 28px; padding-bottom: 60px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline__dot { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); border: 2px solid var(--line-2); font-family: var(--font-mono); font-size: .9rem; position: relative; z-index: 1; transition: border-color .5s, background .5s, color .5s; }
.timeline li.is-visible .timeline__dot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg)); color: #fff; }
.timeline h3 { font-size: clamp(1.4rem, 2.4vw, 2rem); padding-top: 10px; }
.timeline p { margin-top: 10px; color: var(--muted); max-width: 56ch; }

/* ---------- FAQ ---------- */
.faq { max-width: 900px; margin-inline: auto; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 26px 0; cursor: pointer; font-family: var(--font-display); font-size: clamp(1.1rem, 1.8vw, 1.4rem); font-weight: 600; letter-spacing: -.02em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary i { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); position: relative; transition: transform .5s var(--ease-out), background .3s, border-color .3s; }
.faq summary i::before, .faq summary i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px; background: currentColor; border-radius: 2px; }
.faq summary i::after { transform: rotate(90deg); transition: transform .4s var(--ease-out); }
.faq details[open] summary i { background: var(--accent); border-color: var(--accent); }
.faq details[open] summary i::after { transform: rotate(0); }
.faq__a { overflow: hidden; }
.faq__a p { padding: 0 60px 28px 0; color: var(--muted); }

/* ---------- RELATED ---------- */
.related { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.related a { --c: var(--accent); position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; min-height: 200px; padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: border-color .3s, transform .6s var(--ease-out); }
.related a:hover { border-color: var(--c); transform: translateY(-6px); }
.related a::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 120px; height: 120px; border-radius: 26px; background: var(--c); opacity: .18; transform: rotate(20deg); transition: transform .8s var(--ease-out), opacity .3s; }
.related a:hover::after { transform: rotate(65deg) scale(1.15); opacity: .35; }
.related strong { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: -.02em; line-height: 1.2; }
.related span { font-size: .85rem; color: var(--c); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .svc-hero__grid { grid-template-columns: 1fr; }
  .svc-hero__scene { height: 340px; order: -1; }
  .svc-hero { min-height: 0; padding-top: calc(var(--header-h) + 20px); }
  .showcase { height: auto; padding-block: 60px; }
  .showcase__sticky { position: relative; height: auto; }
  .device { transform: none !important; }
  .features { grid-template-columns: 1fr 1fr; }
  .feature--wide { grid-column: 1 / -1; }
  .split { grid-template-columns: 1fr; }
  .related { grid-template-columns: 1fr 1fr; }
  .demo-chat, .demo-code { grid-template-columns: 1fr; }
  .demo-chat aside, .demo-code aside { display: none; }
  .demo-shop__grid { grid-template-columns: repeat(2, 1fr); }
  .demo-shop__grid .product:nth-child(n+3) { display: none; }
  .demo-shop__nav { display: none; }
}
@media (max-width: 680px) {
  .svc-hero__scene { height: 280px; }
  .orbit-chip { font-size: .72rem; padding: 7px 11px; }
  .orbit-chip:nth-of-type(n+3) { display: none; }
  .orbit-chip:nth-of-type(1) { top: 2%; left: 0; }
  .orbit-chip:nth-of-type(2) { top: auto; bottom: 4%; right: 0; }
  .features, .related { grid-template-columns: 1fr; }
  .feature__icon { margin-bottom: 36px; }
  .device__screen { height: 400px; }
  .demo-ads__kpis { grid-template-columns: 1fr 1fr; }
  .msg { max-width: 90%; font-size: .86rem; }
  .faq__a p { padding-right: 0; }
  .timeline li { grid-template-columns: 44px 1fr; gap: 18px; }
  .timeline__dot { width: 44px; height: 44px; font-size: .8rem; }
  .timeline::before, .timeline__fill { left: 21px; }
}
