/* ═══════════════════════════════════════════════════════
   SolarPlatform Widget v7 — layout pulito, zero overlap
   ═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&display=swap');

/* ── KEYFRAMES ── */
@keyframes spw-sky{0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}}
@keyframes spw-slideUp{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}
@keyframes spw-slideIn{from{opacity:0;transform:translateX(-14px)}to{opacity:1;transform:translateX(0)}}
@keyframes spw-kpiPop{from{opacity:0;transform:translateY(10px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes spw-shimmer{0%{left:-150%}100%{left:200%}}
@keyframes spw-ctaGlow{
  0%,100%{box-shadow:0 4px 22px rgba(245,158,11,.38)}
  50%{box-shadow:0 8px 38px rgba(245,158,11,.62),0 0 0 5px rgba(245,158,11,.09)}
}
@keyframes spw-dotPulse{0%,100%{opacity:.3;transform:scale(.7)}50%{opacity:1;transform:scale(1.2)}}
@keyframes spw-accentFlow{0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}}
@keyframes spw-livePulse{0%{transform:scale(1);opacity:.7}100%{transform:scale(2.8);opacity:0}}
@keyframes spw-panelFloat{
  0%,100%{transform:perspective(900px) rotateX(46deg) rotateZ(-6deg) translateY(0)}
  50%{transform:perspective(900px) rotateX(46deg) rotateZ(-6deg) translateY(-10px)}
}
@keyframes spw-shineSlide{0%{transform:translateX(-200%) rotate(18deg)}100%{transform:translateX(300%) rotate(18deg)}}
@keyframes spw-cellGlow{0%,100%{box-shadow:inset 0 0 0 transparent}50%{box-shadow:inset 0 0 16px rgba(245,158,11,.26)}}
@keyframes spw-gridScroll{0%{background-position:0 0}100%{background-position:0 50px}}

/* ══════════════════════════════════════════════
   WRAPPER — sfugge al max-width del tema PS
   Tecnica: negative margin + 100vw
   ══════════════════════════════════════════════ */
.spw-outer {
  position: relative;
  width: 100vw;
  left: 50%;
  margin-left: -50vw;
  overflow: hidden;   /* taglia i pannelli che sforano */
}

/* ── CONTENITORE PRINCIPALE: griglia 2 colonne ── */
.spw {
  position: relative;
  width: 100%;
  /* altezza: copre viewport - navbar (≈72px) */
  height: calc(100vh - 72px);
  max-height: 680px;
  min-height: 460px;
  display: grid;
  grid-template-columns: 52% 48%;
  grid-template-rows: 1fr;
  align-items: center;
  font-family: 'Outfit', system-ui, sans-serif;
  isolation: isolate;
  /* NON overflow:hidden qui — è sul wrapper */
}

/* ── SFONDO ── */
.spw__sky {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(-45deg, #010410 0%, #030d22 25%, #071840 55%, #04102e 80%, #010308 100%);
  background-size: 400% 400%;
  animation: spw-sky 20s ease infinite;
}

/* Griglia prospettica sul pavimento */
.spw__grid-floor {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 38%; z-index: 1; overflow: hidden; pointer-events: none;
}
.spw__grid-floor::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(245,158,11,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,158,11,.05) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(600px) rotateX(65deg);
  transform-origin: center top;
  animation: spw-gridScroll 3.5s linear infinite;
  mask-image: linear-gradient(to top, rgba(0,0,0,.5), transparent 88%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.5), transparent 88%);
}

/* ── CANVAS ── */
.spw__canvas {
  position: absolute; inset: 0;
  z-index: 5; pointer-events: none;
  width: 100%; height: 100%;
}

/* ═══════════════════════════════════════
   COLONNA SINISTRA — contenuto
   Tutto allineato su un unico asse left
   ═══════════════════════════════════════ */
.spw__content {
  position: relative; z-index: 10;
  grid-column: 1;
  /* padding uniforme: tutto parte dallo stesso left */
  padding: 0 32px 0 6%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;  /* allinea tutto a sinistra */
  gap: 0;
}

/* Logo: più piccolo, stesso left degli altri elementi */
.spw__logo {
  margin-bottom: 14px;
  animation: spw-slideIn .6s ease .1s both;
}
.spw__logo-img {
  /* 150px: leggibile ma non invade */
  width: 150px; height: auto;
  filter: drop-shadow(0 2px 8px rgba(245,158,11,.22));
  opacity: .92;
  display: block;
}

/* Badge */
.spw__badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 100px; padding: 6px 14px;
  font-size: 10px; font-weight: 700;
  color: #FCD34D; text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 14px;
  animation: spw-slideIn .6s ease .2s both;
}
.spw__badge-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #F59E0B;
  animation: spw-dotPulse 2s ease-in-out infinite; flex-shrink: 0;
}

/* Titolo */
.spw__title {
  font-size: clamp(1.6rem, 2.6vw, 2.55rem);
  font-weight: 900; color: #F0EDE5;
  margin: 0 0 10px; letter-spacing: -.03em; line-height: 1.07;
}
.spw__title-line { display: block; }
.spw__title-line--1 { animation: spw-slideUp .7s ease .28s both; opacity: 0; }
.spw__title-line--2 { animation: spw-slideUp .7s ease .40s both; opacity: 0; }
.spw__accent {
  background: linear-gradient(135deg, #F59E0B, #F97316, #FDE68A, #F59E0B);
  background-size: 300% 300%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: spw-accentFlow 4s ease infinite;
}

/* Sottotitolo */
.spw__sub {
  font-size: .84rem; line-height: 1.65;
  color: rgba(240,237,229,.38);
  margin: 0 0 18px;
  animation: spw-slideUp .7s ease .48s both; opacity: 0;
}
.spw__sub strong { color: rgba(245,158,11,.75); font-weight: 700; }

/* KPI cards — larghezza 100% della colonna */
.spw__kpis {
  display: flex; gap: 8px;
  width: 100%;
  margin-bottom: 18px;
}
.spw__kpi {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px; padding: 9px 12px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  flex: 1; min-width: 0;
  transition: all .3s ease;
  animation: spw-kpiPop .6s ease both;
}
.spw__kpi:nth-child(1){ animation-delay: .50s; opacity: 0; }
.spw__kpi:nth-child(2){ animation-delay: .62s; opacity: 0; }
.spw__kpi:nth-child(3){ animation-delay: .74s; opacity: 0; }
.spw__kpi:hover {
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.2);
  transform: translateY(-2px);
}
.spw__kpi--highlight { border-color: rgba(245,158,11,.16); background: rgba(245,158,11,.05); }
.spw__kpi-icon {
  width: 26px; height: 26px; border-radius: 7px;
  background: rgba(245,158,11,.1);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.spw__kpi-icon svg { width: 13px; height: 13px; stroke: #F59E0B; }
.spw__kpi-data { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.spw__kpi-num  { display: flex; align-items: baseline; gap: 1px; }
.spw__kpi-val  { font-size: 17px; font-weight: 800; color: #F59E0B; line-height: 1.1; white-space: nowrap; }
.spw__kpi-pct  { font-size: 14px; font-weight: 800; color: #F59E0B; }
.spw__kpi-pre  { font-size: 8px; color: rgba(240,237,229,.32); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.spw__kpi-lbl  { font-size: 8.5px; color: rgba(240,237,229,.45); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── CTA ── */
.spw__cta-wrap {
  display: flex; flex-direction: column; align-items: flex-start;
  animation: spw-slideUp .7s ease .72s both; opacity: 0;
}
.spw__cta {
  display: inline-flex; align-items: center;
  position: relative; overflow: hidden;
  border-radius: 13px;
  text-decoration: none !important;
  color: #fff !important;
  font-family: 'Outfit', sans-serif;
  animation: spw-ctaGlow 3s ease-in-out infinite;
  transition: transform .3s cubic-bezier(.16,1,.3,1);
  cursor: pointer;
}
.spw__cta-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #F59E0B 0%, #F97316 60%, #EF6C00 100%);
  border-radius: 13px; z-index: 0;
  transition: filter .22s ease;
}
.spw__cta-shine {
  position: absolute; top: 0; left: -150%; width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.30) 50%, transparent 70%);
  animation: spw-shimmer 3s ease-in-out infinite;
  z-index: 1; pointer-events: none;
}
.spw__cta-content {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 11px;
  padding: 14px 32px;
  font-weight: 800; font-size: .95rem;
  color: #fff !important;
  white-space: nowrap;
}
.spw__cta-icon svg { width: 18px; height: 18px; stroke: #fff; flex-shrink: 0; }
.spw__cta-text     { color: #fff !important; font-size: .95rem; font-weight: 800; }
.spw__cta-arrow    { display: flex; transition: transform .3s ease; }
.spw__cta-arrow svg{ stroke: #fff; }

.spw__cta:hover { transform: translateY(-3px) scale(1.03) !important; }
.spw__cta:hover .spw__cta-bg { filter: brightness(1.14); }
.spw__cta:hover .spw__cta-arrow { transform: translateX(5px); }
.spw__cta:active { transform: translateY(-1px) scale(.98) !important; }

/* trust */
.spw__cta-trust {
  display: flex; align-items: center; gap: 7px;
  margin-top: 9px;
  font-size: 10px; color: rgba(240,237,229,.26); font-weight: 500;
}
.spw__cta-sep { width: 3px; height: 3px; border-radius: 50%; background: rgba(240,237,229,.16); }

/* ── LIVE COUNTER + URGENCY: in basso nella colonna sinistra,
   nel normale flusso del documento (non absolute) ── */
.spw__bottom-strip {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  animation: spw-slideUp .7s ease .92s both; opacity: 0;
}
.spw__live-counter {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(245,158,11,.16);
  border-radius: 100px; padding: 6px 12px;
  font-size: 10.5px; color: rgba(240,237,229,.5);
  position: relative;
}
.spw__live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10B981; flex-shrink: 0; position: relative;
}
.spw__live-dot::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 7px; height: 7px; border-radius: 50%;
  background: #10B981;
  animation: spw-livePulse 2s ease-out infinite;
}
.spw__live-val  { font-weight: 800; color: #FDE68A; font-size: 13px; }
.spw__live-unit { font-weight: 700; color: rgba(253,224,71,.6); font-size: 10px; }
.spw__live-label{ white-space: nowrap; }

.spw__urgency {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.14);
  border-radius: 100px;
  font-size: 10px; color: rgba(240,237,229,.42);
}
.spw__urgency strong { color: #FCA5A5; font-weight: 700; }
.spw__urgency-text { white-space: nowrap; }

/* ═══════════════════════════════════════
   COLONNA DESTRA — scena (pannelli)
   ═══════════════════════════════════════ */
.spw__scene {
  grid-column: 2;
  position: relative;
  height: 100%;
  z-index: 3;
  /* overflow visible: il wrapper esterno taglia */
}

/* Pannelli: leggermente oltre il bordo dx per effetto scenico */
.spw__roof {
  position: absolute;
  bottom: -2%; right: -6%;
  width: 105%; height: 82%;
  pointer-events: none; z-index: 4;
}
.spw__panels-3d {
  position: absolute; inset: 0;
  transform: perspective(900px) rotateX(46deg) rotateZ(-6deg);
  transform-style: preserve-3d;
  animation: spw-panelFloat 10s ease-in-out infinite;
  transition: transform .5s ease-out;
}
/* 6 pannelli 3×2 — occupano tutta la scena */
.spw__panel3d { position: absolute; transform-style: preserve-3d; }
.spw__panel3d--1 { top: 0%;  left: 0%;  width: 30%; height: 46%; }
.spw__panel3d--2 { top: 0%;  left: 34%; width: 30%; height: 46%; }
.spw__panel3d--3 { top: 0%;  left: 68%; width: 30%; height: 46%; }
.spw__panel3d--4 { top: 52%; left: 0%;  width: 30%; height: 46%; }
.spw__panel3d--5 { top: 52%; left: 34%; width: 30%; height: 46%; }
.spw__panel3d--6 { top: 52%; left: 68%; width: 30%; height: 46%; }

.spw__panel-face {
  width: 100%; height: 100%; border-radius: 5px;
  background: linear-gradient(145deg, #091828 0%, #0f2848 35%, #163a6b 65%, #0d2240 100%);
  border: 1.5px solid rgba(30,68,120,.8);
  position: relative; overflow: hidden;
  box-shadow: 0 10px 36px rgba(0,0,0,.68), inset 0 1px 0 rgba(255,255,255,.07);
}
.spw__cell-grid {
  display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr);
  gap: 1.5px; padding: 3px; height: 100%; box-sizing: border-box;
}
.spw__cell { background: linear-gradient(135deg, #0e2a48, #153860); border-radius: 1px; }

.spw__panel3d--1 .spw__cell { animation: spw-cellGlow 4s ease-in-out 0s   infinite; }
.spw__panel3d--2 .spw__cell { animation: spw-cellGlow 4s ease-in-out .9s  infinite; }
.spw__panel3d--3 .spw__cell { animation: spw-cellGlow 4s ease-in-out 1.8s infinite; }
.spw__panel3d--4 .spw__cell { animation: spw-cellGlow 4s ease-in-out 2.7s infinite; }
.spw__panel3d--5 .spw__cell { animation: spw-cellGlow 4s ease-in-out 3.6s infinite; }
.spw__panel3d--6 .spw__cell { animation: spw-cellGlow 4s ease-in-out 4.5s infinite; }

.spw__panel-shine {
  position: absolute; top: 0; left: -130%; width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent 28%, rgba(255,255,255,.17) 50%, transparent 72%);
  animation: spw-shineSlide 5s ease-in-out infinite; z-index: 2; pointer-events: none;
}
.spw__panel3d--2 .spw__panel-shine { animation-delay: 1s; }
.spw__panel3d--3 .spw__panel-shine { animation-delay: 2s; }
.spw__panel3d--4 .spw__panel-shine { animation-delay: 3s; }
.spw__panel3d--5 .spw__panel-shine { animation-delay: 4s; }
.spw__panel3d--6 .spw__panel-shine { animation-delay: 5s; }
.spw__panel-reflection {
  position: absolute; bottom: 0; left: 0; right: 0; height: 36%;
  background: linear-gradient(180deg, transparent, rgba(245,158,11,.13)); z-index: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  .spw {
    grid-template-columns: 1fr;
    height: auto; min-height: 500px; max-height: none;
    padding-bottom: 210px;
  }
  .spw__content { padding: 40px 22px 20px; max-width: 100%; }
  .spw__scene   { position: absolute; inset: 0; z-index: 1; }
  .spw__roof    { width: 72%; right: 0; bottom: 0; height: 58%; opacity: .6; }
}
@media (max-width: 600px) {
  .spw  { padding-bottom: 175px; }
  .spw__kpis { flex-wrap: wrap; }
  .spw__cta  { width: 100%; }
  .spw__cta-content { justify-content: center; padding: 14px 22px; }
  .spw__roof  { opacity: .4; }
  .spw__logo-img { width: 130px; }
  .spw__title { font-size: clamp(1.4rem, 6vw, 2rem); }
  .spw__bottom-strip { flex-direction: column; align-items: flex-start; }
}
