/* ==========================================================================
   The Wise Guy · Sistema Standard Pagina (Priorita 1b)
   Componente unico .twg-ph (page-hero) + blocchi ricorrenti condivisi.
   Caratteri: solo var(--font-sans) e var(--font-mono).
   Temi: dark & light (AA contrast). Griglia: --twg-container-max / --twg-gutter.
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  --twg-ph-accent: #c084fc;
  --twg-ph-accent-2: #22d3ee;
  --twg-ph-glow-1: rgba(168, 85, 247, 0.16);
  --twg-ph-glow-2: rgba(34, 211, 238, 0.11);
  --twg-sec-py: clamp(48px, 6vw, 72px);
}

:root[data-theme="light"] {
  --twg-ph-accent: #6d28d9;
  --twg-ph-accent-2: #0e7490;
  --twg-ph-glow-1: rgba(124, 58, 237, 0.09);
  --twg-ph-glow-2: rgba(14, 116, 144, 0.08);
}

/* Accenti tematici opzionali (cambiano SOLO colore/glow, mai misure o posizioni) */
.twg-ph--cyan { --twg-ph-accent: #22d3ee; --twg-ph-glow-1: rgba(34, 211, 238, 0.16); --twg-ph-glow-2: rgba(168, 85, 247, 0.10); }
:root[data-theme="light"] .twg-ph--cyan { --twg-ph-accent: #0e7490; }

.twg-ph--emerald { --twg-ph-accent: #34d399; --twg-ph-glow-1: rgba(52, 211, 153, 0.14); --twg-ph-glow-2: rgba(34, 211, 238, 0.10); }
:root[data-theme="light"] .twg-ph--emerald { --twg-ph-accent: #047857; }

.twg-ph--amber { --twg-ph-accent: #fbbf24; --twg-ph-glow-1: rgba(251, 191, 36, 0.13); --twg-ph-glow-2: rgba(168, 85, 247, 0.10); }
:root[data-theme="light"] .twg-ph--amber { --twg-ph-accent: #b45309; }

.twg-ph--rose { --twg-ph-accent: #fb7185; --twg-ph-glow-1: rgba(251, 113, 133, 0.14); --twg-ph-glow-2: rgba(168, 85, 247, 0.10); }
:root[data-theme="light"] .twg-ph--rose { --twg-ph-accent: #be123c; }

/* ── Componente unico Page Hero (.twg-ph) ────────────────────────────────── */
.twg-ph {
  display: block !important;
  position: relative;
  width: 100%;
  max-width: none !important;
  margin: 0;
  padding-block: 148px 52px;
  padding-inline: 0 !important;
  border-bottom: 1px solid var(--border-subtle);
  background:
    radial-gradient(880px 420px at 86% 6%, var(--twg-ph-glow-1), transparent 70%),
    radial-gradient(680px 360px at 6% 96%, var(--twg-ph-glow-2), transparent 72%),
    transparent;
}

/* Quando .twg-ph segue una barra di sezione inline sticky (.aa-bar, #twg-barra) */
main.aa:has(.twg-ph) {
  padding-top: 76px !important;
}
main:has(> .aa-bar) .twg-ph,
.twg-ph--after-bar {
  padding-top: 32px;
}

.twg-ph > .twg-container {
  max-width: var(--twg-container-max, 1360px);
  padding-inline: var(--twg-gutter, 24px);
  margin-inline: auto;
  box-sizing: border-box;
}

.twg-ph-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr) !important;
  grid-template-areas: none !important;
  grid-template-rows: auto !important;
  gap: clamp(28px, 3.8vw, 56px) !important;
  align-items: start !important;
}

.twg-ph--solo .twg-ph-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}

.twg-ph-grid > .twg-ph-copy,
.twg-ph-grid > .twg-ph-media {
  grid-area: auto !important;
  grid-column: auto !important;
  grid-row: auto !important;
  align-self: start !important;
}

@media (max-width: 960px) {
  .twg-ph-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

.twg-ph-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.twg-ph-eyebrow {
  margin: 0 0 14px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--twg-ph-accent);
}

.twg-ph-eyebrow svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.twg-ph-h1 {
  margin: 0 0 16px;
  padding: 0;
  max-width: 22ch;
  font-family: var(--font-sans);
  font-size: clamp(2.125rem, 3.6vw, 3.25rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.028em;
  color: var(--fg-primary);
  text-wrap: balance;
}

.twg-ph-h1 em,
.twg-ph-h1 .twg-ph-em,
.twg-ph-h1 .accent-gradient-text {
  font-style: normal;
  background: linear-gradient(125deg, #c084fc 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
:root[data-theme="light"] .twg-ph-h1 em,
:root[data-theme="light"] .twg-ph-h1 .twg-ph-em,
:root[data-theme="light"] .twg-ph-h1 .accent-gradient-text {
  background: linear-gradient(125deg, #6d28d9 0%, #0e7490 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.twg-ph-lead {
  margin: 0 0 24px;
  padding: 0;
  max-width: 60ch;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--fg-secondary);
  text-wrap: pretty;
}

.twg-ph-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.twg-ph-actions .btn,
.twg-ph-actions .button,
.twg-ph-actions .twg-btn {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.twg-ph-actions .btn-primary,
.twg-ph-actions .twg-btn:not(.twg-btn--ghost) {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #ffffff !important;
  box-shadow: 0 10px 26px -12px rgba(124, 58, 237, 0.72);
}

.twg-ph-actions .btn-primary:hover,
.twg-ph-actions .twg-btn:not(.twg-btn--ghost):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -10px rgba(124, 58, 237, 0.85);
}

.twg-ph-actions .btn-secondary,
.twg-ph-actions .twg-btn--ghost,
.twg-ph-actions .button.enterprise-config-link {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  color: var(--fg-primary) !important;
}

.twg-ph-actions .btn-secondary:hover,
.twg-ph-actions .twg-btn--ghost:hover {
  background: var(--bg-card-solid);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.twg-ph-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 18px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--fg-secondary);
}

.twg-ph-meta .twg-pmark {
  font-size: clamp(22px, 2vw, 28px);
}

/* Slot Media: sempre a destra desktop, sempre sotto mobile */
.twg-ph-media {
  margin: 0;
  min-width: 0;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-solid);
  box-shadow: var(--shadow-card);
}

.twg-ph-media > img,
.twg-ph-media > picture:not(.twg-pc-bg) > img,
.twg-ph-media > video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.twg-ph-media figcaption {
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--fg-muted);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-solid);
}

.twg-ph-media--panel {
  padding: 20px;
  overflow: visible;
}

/* Adattamenti puliti per area riservata /clienti/* (#twc-page-head) */
#twg-cruscotto .twg-ph {
  padding-block: 0 28px;
  margin-bottom: 24px;
  background: none;
}
#twg-cruscotto .twg-ph > .twg-container {
  max-width: none;
  padding-inline: 0;
}

@media (max-width: 960px) {
  .twg-ph-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}

@media (max-width: 759px) {
  .twg-ph {
    padding-block: 124px 36px;
  }
  main.aa:has(.twg-ph) {
    padding-top: 66px !important;
  }
  main:has(> .aa-bar) .twg-ph,
  .twg-ph--after-bar {
    padding-top: 24px;
  }
  .twg-ph-lead {
    font-size: 1rem;
  }
  .twg-ph-actions .btn,
  .twg-ph-actions .button,
  .twg-ph-actions .twg-btn {
    min-height: 44px;
  }
}

/* ── Blocchi ricorrenti standardizzati ──────────────────────────────────── */
.twg-sec {
  padding-block: var(--twg-sec-py);
}
.twg-sec--tight {
  padding-block: clamp(32px, 4vw, 48px);
}
.twg-sec--alt {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.twg-sec-head {
  max-width: 68ch;
  margin-bottom: clamp(24px, 3vw, 36px);
}
.twg-sec-eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--twg-ph-accent);
}
.twg-sec-h2 {
  margin: 0 0 10px;
  font-family: var(--font-sans);
  font-size: clamp(1.625rem, 2.7vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--fg-primary);
  text-wrap: balance;
}
.twg-sec-lead {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg-secondary);
  text-wrap: pretty;
}

.twg-card {
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-solid);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.twg-card:hover {
  border-color: var(--border-medium);
}

.twg-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.twg-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.twg-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1023px) {
  .twg-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .twg-grid-2, .twg-grid-3, .twg-grid-4 { grid-template-columns: minmax(0, 1fr); }
}

.twg-box-30s {
  border-radius: 18px;
  border: 1px solid var(--border-medium);
  background: linear-gradient(135deg, color-mix(in srgb, var(--twg-ph-accent) 8%, transparent), transparent 65%), var(--bg-card-solid);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
}

/* Override di unificazione per selettori legacy che wrappiamo con .twg-ph */
.twg-ph .p1v-dual-img,
.twg-ph .pp-media,
.twg-ph .rg-hero-media,
.twg-ph .aa-fig,
.twg-ph .gi-photo--hero,
.twg-ph .acv-frame,
.twg-ph .wb-hero-photo {
  margin: 0 !important;
  max-width: 100% !important;
  border-radius: 20px;
}
.twg-ph .nov-eyebrow,
.twg-ph .pp-eyebrow,
.twg-ph .cc-eyebrow,
.twg-ph .aa-kicker,
.twg-ph .g-kicker,
.twg-ph .gi-kicker,
.twg-ph .wb-kicker,
.twg-ph .wjp-eyebrow,
.twg-ph .acv-kicker,
.twg-ph .rg-eyebrow {
  margin: 0 0 14px !important;
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
}
.twg-ph h1,
.twg-ph .pp-h1,
.twg-ph .nov-h1,
.twg-ph .cc-h1,
.twg-ph .cc-h1-board,
.twg-ph .wjp-h1,
.twg-ph .acv-h1,
.twg-ph .display-section {
  margin: 0 0 16px !important;
  padding: 0 !important;
  font-family: var(--font-sans) !important;
  font-size: clamp(2.125rem, 3.6vw, 3.25rem) !important;
  font-weight: 800 !important;
  line-height: 1.08 !important;
  letter-spacing: -0.028em !important;
  max-width: 22ch !important;
  text-wrap: balance;
}
.twg-ph .twg-ph-lead,
.twg-ph .pp-lead,
.twg-ph .nov-lead,
.twg-ph .cc-lead,
.twg-ph .cc-dek,
.twg-ph .aa-lead,
.twg-ph .g-lead,
.twg-ph .gi-lead,
.twg-ph .wb-lead,
.twg-ph .wjp-lead,
.twg-ph .acv-lead,
.twg-ph .rg-lead,
.twg-ph .lead-copy,
.twg-ph .p-lead {
  margin: 0 0 24px !important;
  font-family: var(--font-sans) !important;
  font-size: 1.0625rem !important;
  line-height: 1.6 !important;
  max-width: 60ch !important;
}
@media (max-width: 759px) {
  .twg-ph .twg-ph-lead,
  .twg-ph .pp-lead,
  .twg-ph .nov-lead,
  .twg-ph .cc-lead,
  .twg-ph .cc-dek,
  .twg-ph .aa-lead,
  .twg-ph .g-lead,
  .twg-ph .gi-lead,
  .twg-ph .wb-lead,
  .twg-ph .wjp-lead,
  .twg-ph .acv-lead,
  .twg-ph .rg-lead,
  .twg-ph .lead-copy,
  .twg-ph .p-lead {
    font-size: 1rem !important;
  }
}

/* Override di unificazione sezione .twg-ph su fogli che avevano background propri */
.twg-ph.nov-hero,
.twg-ph.pp-hero,
.twg-ph.cc-hero,
.twg-ph.acv-hero,
.twg-ph.wjp-hero,
.twg-ph.rg-hero,
.twg-ph.g-hero,
.twg-ph.aa-hero,
.twg-ph.gi-intro,
.twg-ph.wb-hero,
.twg-ph.enterprise-intro {
  display: block !important;
  padding-block: 148px 52px !important;
  padding-inline: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
}
main:has(> .aa-bar) .twg-ph.aa-hero,
main:has(> .aa-bar) .twg-ph.rg-hero {
  padding-top: 32px !important;
}
@media (max-width: 759px) {
  .twg-ph.nov-hero,
  .twg-ph.pp-hero,
  .twg-ph.cc-hero,
  .twg-ph.acv-hero,
  .twg-ph.wjp-hero,
  .twg-ph.rg-hero,
  .twg-ph.g-hero,
  .twg-ph.aa-hero,
  .twg-ph.gi-intro,
  .twg-ph.wb-hero,
  .twg-ph.enterprise-intro {
    padding-block: 124px 36px !important;
  }
  main:has(> .aa-bar) .twg-ph.aa-hero,
  main:has(> .aa-bar) .twg-ph.rg-hero {
    padding-top: 24px !important;
  }
}

/* Overrides specifici per container hero full-bleed di sezione */
main.gi:has(> .twg-ph),
main.enterprise-page:has(> .twg-ph),
main.p1v-standalone-main:has(> .twg-ph),
main.wb-os:has(> .twg-ph),
main.guide:has(> .twg-ph),
main.nov-main:has(> .twg-ph),
main.tk-shell:has(> .twg-ph),
body.wjp-page main:has(> .twg-ph),
main.rg-shell:has(> .twg-ph),
main.rg-shell:has(> .rg-inner > .twg-ph),
main.rg-shell:has(#twgWizardHost) {
  padding-top: 0 !important;
  margin-top: var(--twg-bar-height, 40px) !important;
}
main.enterprise-page:has(> .twg-ph) {
  padding-top: 0 !important;
  margin-top: var(--twg-bar-height, 40px) !important;
}
main.rg-shell:has(> .twg-ph),
main.rg-shell:has(> .rg-inner > .twg-ph),
main.rg-shell:has(#twgWizardHost) {
  max-width: none !important;
  padding-inline: 0 !important;
}
main.rg-shell:has(#twgWizardHost) > .rg-inner {
  max-width: none !important;
  padding: 0 !important;
}
main.rg-shell:has(#twgWizardHost) .wz-root,
main.rg-shell:has(#twgWizardHost) .wz-approfondisci,
main.rg-shell:has(#twgWizardHost) .rg-notice {
  max-width: var(--twg-container-max, 1360px);
  padding-inline: var(--twg-gutter, 24px);
  margin-inline: auto;
}
main.rg-shell:has(#twgWizardHost) .wz-root:has(.twg-ph) {
  max-width: none !important;
  padding-inline: 0 !important;
}
main.rg-shell:has(#twgWizardHost) .twg-ph.wz-intro-stage {
  border-radius: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 0 !important;
  padding-top: 32px !important;
}
main.rg-shell.rg-shell--unico {
  padding-top: 76px !important;
}
main.rg-shell.rg-shell--unico:has(> .twg-ph),
main.rg-shell.rg-shell--unico:has(#twgWizardHost) {
  padding-top: 76px !important;
}
main.rg-shell:has(> .twg-ph) > :not(.twg-ph),
main.rg-shell:has(> .rg-inner > .twg-ph) .rg-inner > :not(.twg-ph) {
  max-width: var(--twg-container-max, 1360px);
  padding-inline: var(--twg-gutter, 24px);
  margin-inline: auto;
}

/* Configuratore: quando si entra in un reparto (#cgHome[hidden]) nasconde anche la hero di apertura */
main.cg:has(> .twg-ph) { max-width: none !important; padding: 0 0 72px !important; }
main.cg:has(> .twg-ph) > .cg-grid { max-width: var(--twg-container-max, 1360px); padding-inline: var(--twg-gutter, 24px); margin: 28px auto 0; }
main.cg:has(#cgHome[hidden]) > .twg-ph { display: none !important; }
main.cg:has(#cgHome[hidden]) > .cg-grid { margin-top: 128px; }
main.cg > .twg-ph .cg-cerca { max-width: none; width: 100%; }

/* Enterprise: evita doppio padding-top sul video quando c'e' la .twg-ph prima */
main.enterprise-page:has(> .twg-ph) .enterprise-opening { padding-top: 0; }

/* The Wise Jam: deck dentro colonna destra hero e wjp-subnav subito sotto hero */
.twg-ph .wjp-deck { margin-block-start: 0 !important; }
.twg-ph .wjp-studio-visual { margin-top: 16px; }
/* ── 1e / 1e-bis · Carte Vive (.twg-pc: foto tematiche scuro/chiaro solo su schede di testo) ── */
.twg-pc {
  position: relative;
  overflow: hidden;
  container-type: inline-size;
  isolation: isolate;
  transition: border-color 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
}
.twg-pc > :not(.twg-pc-bg):not(.twg-pc-scrim) {
  position: relative;
  z-index: 2;
}
.twg-pc-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}
.twg-pc-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0.34;
  transform: scale(1.001);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  will-change: transform;
}
:root:not([data-theme="light"]) .twg-pc-img.is-light { display: none !important; }
:root[data-theme="light"] .twg-pc-img.is-dark { display: none !important; }
:root[data-theme="light"] .twg-pc-img { opacity: 0.28; }

.twg-pc-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    158deg,
    rgba(9, 12, 24, 0.90) 0%,
    rgba(11, 15, 30, 0.78) 50%,
    rgba(8, 10, 20, 0.92) 100%
  );
  transition: opacity 0.35s ease, background 0.35s ease;
}
:root[data-theme="light"] .twg-pc-scrim {
  background: linear-gradient(
    158deg,
    rgba(248, 250, 252, 0.92) 0%,
    rgba(241, 245, 249, 0.80) 50%,
    rgba(248, 250, 252, 0.94) 100%
  );
}

.twg-pc p { color: var(--fg-secondary); }
:root:not([data-theme="light"]) .twg-pc p { color: #e2e8f0; }
:root[data-theme="light"] .twg-pc p { color: #1e293b; }

.twg-pc:hover,
.twg-pc:focus-within,
.twg-pc.is-open {
  border-color: color-mix(in srgb, var(--accent-cyan) 70%, var(--border-medium));
  box-shadow: 0 14px 36px color-mix(in srgb, var(--accent-cyan) 16%, transparent);
}
.twg-pc:hover .twg-pc-img,
.twg-pc:focus-within .twg-pc-img,
.twg-pc.is-open .twg-pc-img {
  transform: scale(1.07);
  opacity: 0.74;
}
:root[data-theme="light"] .twg-pc:hover .twg-pc-img,
:root[data-theme="light"] .twg-pc:focus-within .twg-pc-img,
:root[data-theme="light"] .twg-pc.is-open .twg-pc-img {
  opacity: 0.62;
}
.twg-pc:hover .twg-pc-scrim,
.twg-pc:focus-within .twg-pc-scrim,
.twg-pc.is-open .twg-pc-scrim {
  background: linear-gradient(
    160deg,
    rgba(9, 12, 24, 0.74) 0%,
    rgba(11, 15, 30, 0.65) 48%,
    rgba(8, 10, 20, 0.85) 100%
  );
}
:root[data-theme="light"] .twg-pc:hover .twg-pc-scrim,
:root[data-theme="light"] .twg-pc:focus-within .twg-pc-scrim,
:root[data-theme="light"] .twg-pc.is-open .twg-pc-scrim {
  background: linear-gradient(
    160deg,
    rgba(248, 250, 252, 0.80) 0%,
    rgba(241, 245, 249, 0.68) 48%,
    rgba(248, 250, 252, 0.88) 100%
  );
}

/* Dettaglio / "Cosa ottieni" con lettura sempre contrastata e transizione morbida */
.twg-pc-detail {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-card-solid) 86%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--fg-secondary);
  transition: border-color 0.28s ease, background-color 0.28s ease, color 0.28s ease, transform 0.28s ease, box-shadow 0.28s ease;
}
.twg-pc-detail strong {
  color: var(--accent-emerald);
}
:root[data-theme="light"] .twg-pc-detail strong {
  color: #065f46;
}
:root[data-theme="light"] .twg-pc-detail {
  background: rgba(255, 255, 255, 0.90);
  color: #1e293b;
}
.twg-pc:hover .twg-pc-detail,
.twg-pc:focus-within .twg-pc-detail,
.twg-pc.is-open .twg-pc-detail {
  border-color: var(--accent-cyan);
  background: color-mix(in srgb, var(--bg-card-solid) 95%, transparent);
  color: var(--fg-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent-cyan) 16%, transparent);
}
:root[data-theme="light"] .twg-pc:hover .twg-pc-detail,
:root[data-theme="light"] .twg-pc:focus-within .twg-pc-detail,
:root[data-theme="light"] .twg-pc.is-open .twg-pc-detail {
  background: rgba(255, 255, 255, 0.97);
  color: #0f172a;
}

.twg-pc-cue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-card-solid) 86%, transparent);
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.twg-pc:hover .twg-pc-cue,
.twg-pc:focus-within .twg-pc-cue,
.twg-pc.is-open .twg-pc-cue {
  border-color: var(--accent-cyan);
  color: var(--fg-primary);
}
.twg-pc-cue:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Rampa / linea connettrice progressiva per sequenze orizzontali/verticali */
[data-twg-flow] {
  position: relative;
}
.twg-flow-line {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 26px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.55), rgba(34, 211, 238, 0.65), rgba(52, 211, 153, 0.55));
  pointer-events: none;
  z-index: 0;
  transform-origin: left center;
  transform: scaleX(0.08);
  opacity: 0.45;
  transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
[data-twg-flow].is-drawn .twg-flow-line {
  transform: scaleX(1);
  opacity: 0.9;
}
[data-twg-flow] > article,
[data-twg-flow] > .mt-step,
[data-twg-flow] > .twg-card {
  position: relative;
  z-index: 1;
}

@media (max-width: 1023px) {
  .twg-flow-line { display: none; }
}

/* Entrata spaziale allo scorrimento senza mai sbiadire il testo sotto la piega (opacity resta 1) */
@keyframes twg-pc-enter {
  from {
    transform: translateY(14px) scale(0.988);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .twg-pc[data-twg-reveal] {
      animation: twg-pc-enter auto linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 28%;
    }
  }
  html.twg-pc-io .twg-pc[data-twg-reveal]:not(.is-inview) {
    transform: translateY(14px);
  }
  html.twg-pc-io .twg-pc[data-twg-reveal] {
    transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1) var(--twg-stagger, 0ms), border-color 0.25s ease, box-shadow 0.25s ease;
  }
  html.twg-pc-io .twg-pc[data-twg-reveal].is-inview {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .twg-pc,
  .twg-pc-img,
  .twg-pc-scrim,
  .twg-pc-detail,
  .twg-pc-cue,
  .twg-flow-line {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}


/* ── 1e v2 · Carte Vive con finestra fotografica superiore + swap in sede a «Cosa ottieni» ── */
.twg-pc:has(.twg-pc-swap) {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 318px;
}
.twg-pc.mt-step:has(.twg-pc-swap) { min-height: 332px; }
.twg-pc.mt-close-box:has(.twg-pc-swap) { min-height: 170px; }
.twg-pc.ct-ch-card:has(.twg-pc-swap) { min-height: 336px; }
.twg-pc.ct-step:has(.twg-pc-swap) { min-height: 280px; }

.twg-pc:has(.twg-pc-swap) .twg-pc-img {
  object-position: center 32%;
  opacity: 1;
  filter: contrast(1.04) saturate(1.06) brightness(0.96);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) .twg-pc-img {
  opacity: 1;
  filter: contrast(0.98) saturate(1.02) brightness(1.04);
}
.twg-pc:has(.twg-pc-swap) .twg-pc-scrim {
  background: linear-gradient(
    180deg,
    rgba(8, 11, 22, 0.14) 0%,
    rgba(8, 11, 22, 0.24) 36%,
    rgba(8, 11, 22, 0.55) 60%,
    rgba(7, 10, 20, 0.64) 100%
  );
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) .twg-pc-scrim {
  background: linear-gradient(
    180deg,
    rgba(248, 250, 252, 0.12) 0%,
    rgba(248, 250, 252, 0.24) 36%,
    rgba(248, 250, 252, 0.56) 60%,
    rgba(248, 250, 252, 0.65) 100%
  );
}
.twg-pc:has(.twg-pc-swap) .twg-pc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 58px;
}
.twg-pc.ct-ch-card:has(.twg-pc-swap) .twg-pc-top,
.twg-pc:has(.twg-pc-swap) .ct-ch-head {
  margin-bottom: 34px;
}
.twg-pc:has(.twg-pc-swap) :is(.p1v-ico--sm, .mt-step-ico, .ct-ch-ico, .mt-step-num, .ct-ch-sla) {
  background: rgba(9, 13, 26, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(148, 163, 184, 0.34);
}
.twg-pc:has(.twg-pc-swap) .mt-step-num {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.42);
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) :is(.p1v-ico--sm, .mt-step-ico, .ct-ch-ico, .mt-step-num, .ct-ch-sla) {
  background: rgba(255, 255, 255, 0.64);
  border-color: rgba(15, 23, 42, 0.16);
}
.twg-pc:has(.twg-pc-swap) .twg-pc-body {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.twg-pc:has(.twg-pc-swap) h3 {
  margin: 0;
  color: #f8fafc;
  text-shadow: 0 2px 10px rgba(4, 7, 16, 0.92), 0 1px 2px rgba(4, 7, 16, 0.96);
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) h3 {
  color: #0b1120;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.95), 0 0 14px rgba(255, 255, 255, 0.85);
}
.twg-pc:has(.twg-pc-swap) :is(.twg-pc-lead, p) {
  margin: 0;
  color: #f1f5f9;
  text-shadow: 0 1px 8px rgba(4, 7, 16, 0.88);
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) :is(.twg-pc-lead, p) {
  color: #0f172a;
  font-weight: 500;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.92);
}
.twg-pc:has(.twg-pc-swap) .ct-ch-head {
  padding: 6px 8px;
  margin-inline: -6px;
  border-radius: 12px;
  background: rgba(8, 11, 22, 0.56);
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) .ct-ch-head {
  background: rgba(248, 250, 252, 0.62);
}

.twg-pc:has(.twg-pc-swap):is(:hover, :focus-within, .is-open) {
  border-color: color-mix(in srgb, var(--accent-cyan) 76%, var(--border-medium));
  box-shadow: 0 16px 40px color-mix(in srgb, var(--accent-cyan) 20%, transparent);
}
.twg-pc:has(.twg-pc-swap):is(:hover, :focus-within, .is-open) .twg-pc-img {
  transform: scale(1.07);
  opacity: 1;
  filter: contrast(1.06) saturate(1.12) brightness(1.06);
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap):is(:hover, :focus-within, .is-open) .twg-pc-img {
  opacity: 1;
  filter: contrast(1.02) saturate(1.05) brightness(1.06);
}
.twg-pc:has(.twg-pc-swap):is(:hover, :focus-within, .is-open) .twg-pc-scrim {
  background: linear-gradient(
    180deg,
    rgba(8, 11, 22, 0.04) 0%,
    rgba(8, 11, 22, 0.14) 40%,
    rgba(8, 11, 22, 0.40) 68%,
    rgba(7, 10, 20, 0.52) 100%
  );
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap):is(:hover, :focus-within, .is-open) .twg-pc-scrim {
  background: linear-gradient(
    180deg,
    rgba(248, 250, 252, 0.04) 0%,
    rgba(248, 250, 252, 0.14) 40%,
    rgba(248, 250, 252, 0.42) 68%,
    rgba(248, 250, 252, 0.54) 100%
  );
}

.twg-pc-swap {
  display: grid;
  align-items: end;
}
.twg-pc-swap > .twg-pc-lead,
.twg-pc-swap > .twg-pc-detail {
  grid-area: 1 / 1;
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.28s ease;
}
.twg-pc-swap > .twg-pc-lead { opacity: 1; transform: translateY(0); }
.twg-pc-swap > .twg-pc-detail { opacity: 0; transform: translateY(8px); pointer-events: none; }
.twg-pc:is(:hover, :focus-within, .is-open) .twg-pc-swap > .twg-pc-lead {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.twg-pc:is(:hover, :focus-within, .is-open) .twg-pc-swap > .twg-pc-detail {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.twg-pc:has(.twg-pc-swap) .twg-pc-detail {
  border-color: rgba(34, 211, 238, 0.65);
  background: rgba(8, 12, 24, 0.62);
  font-size: 13px;
  color: #f8fafc;
  box-shadow: 0 8px 22px rgba(8, 12, 24, 0.32);
}
.twg-pc:has(.twg-pc-swap) .twg-pc-detail strong { color: #34d399; }
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) .twg-pc-detail {
  background: rgba(255, 255, 255, 0.64);
  border-color: rgba(14, 116, 144, 0.55);
  color: #0b1120;
  font-weight: 550;
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) .twg-pc-detail strong { color: #065f46; }

.twg-pc:has(.twg-pc-swap) .twg-pc-cue {
  margin-top: 4px;
  background: rgba(8, 12, 24, 0.58);
  border-color: rgba(148, 163, 184, 0.34);
  color: #cbd5e1;
}
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap) .twg-pc-cue {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(15, 23, 42, 0.20);
  color: #0f172a;
}
.twg-pc-cue .cue-open { display: none; }
.twg-pc:is(:hover, :focus-within, .is-open) .twg-pc-cue .cue-rest { display: none; }
.twg-pc:is(:hover, :focus-within, .is-open) .twg-pc-cue .cue-open { display: inline; }
:root[data-theme="light"] .twg-pc:has(.twg-pc-swap):is(:hover, :focus-within, .is-open) .twg-pc-cue {
  color: #0e7490;
  border-color: #0e7490;
}
@media (prefers-reduced-motion: reduce) {
  .twg-pc-swap > .twg-pc-lead,
  .twg-pc-swap > .twg-pc-detail {
    transition: none !important;
    transform: none !important;
  }
}

/* ── P1-1EBIS-3 · Supporto Carte Vive su .fact-item, .twg-ph-media--panel e .pp-cta-box ── */
.fact-item.twg-pc {
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}
.twg-ph-media--panel.twg-pc {
  overflow: hidden;
}
.pp-cta-box > .twg-pc-scrim {
  max-width: none;
}
.whitepaper-box.twg-pc .playbook-cover {
  position: relative;
  z-index: 2;
}
