/* =============================================================
   ENTERPRISE POLISH — global refinements layer
   Loaded after all other CSS. Additive, non-breaking.
   ============================================================= */

/* ---------- VARIABLES ---------- */
:root {
  --pol-section-y-mobile: clamp(48px, 10vw, 64px);
  --pol-section-y-desktop: clamp(64px, 7vw, 96px);
  --pol-radius-sm: 8px;
  --pol-radius-md: 12px;
  --pol-radius-lg: 18px;
  --pol-radius-xl: 24px;
  --pol-shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 2px 6px rgba(15,23,42,.04);
  --pol-shadow-md: 0 4px 16px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --pol-shadow-lg: 0 12px 40px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.06);
  --pol-shadow-glow-green: 0 0 0 0 rgba(42,179,74,0), 0 12px 40px rgba(42,179,74,.18);
  --pol-shadow-glow-violet: 0 0 0 0 rgba(110,63,243,0), 0 12px 40px rgba(110,63,243,.18);
  --pol-ease: cubic-bezier(.4, 0, .2, 1);
  --pol-ease-out: cubic-bezier(.16, 1, .3, 1);
  --pol-text-primary: #0f172a;
  --pol-text-secondary: #475569;
  --pol-text-muted: #64748b;
}

/* ---------- TYPOGRAPHY OPTIMIZATIONS ---------- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-feature-settings: "kern", "liga", "calt", "ss01", "cv11";
  letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
  font-feature-settings: "kern", "liga", "ss01";
  text-wrap: balance;
}

h1 { letter-spacing: -0.03em; }
h2 { letter-spacing: -0.025em; }

p {
  text-wrap: pretty;
}

/* ---------- SECTION PADDING SYSTEM (responsive) ---------- */
.pol-sec        { padding-block: var(--pol-section-y-mobile); }
.pol-sec-sm     { padding-block: clamp(36px, 6vw, 56px); }
.pol-sec-lg     { padding-block: clamp(56px, 12vw, 112px); }
@media (min-width: 768px) {
  .pol-sec      { padding-block: var(--pol-section-y-desktop); }
}

/* ---------- HERO PAD HARMONIZATION ---------- */
@media (max-width: 768px) {
  /* Reduce inline-styled hero padding on mobile by overriding common patterns */
  section[style*="padding:80px"],
  section[style*="padding: 80px"],
  section[style*="padding:88px"],
  section[style*="padding: 88px"] {
    padding-top: 56px !important;
    padding-bottom: 40px !important;
  }
  section[style*="padding:72px 0"],
  section[style*="padding: 72px 0"],
  section[style*="padding:64px 0"],
  section[style*="padding: 64px 0"] {
    padding-top: 44px !important;
    padding-bottom: 44px !important;
  }
}

/* ---------- CARD HOVER ELEVATIONS ---------- */
.pol-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--pol-radius-lg);
  padding: 28px;
  transition: transform .35s var(--pol-ease-out),
              box-shadow .35s var(--pol-ease-out),
              border-color .35s var(--pol-ease-out);
}
.pol-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--pol-shadow-lg);
  border-color: rgba(42, 179, 74, .25);
}

/* Apply subtle hover to inline-styled product/feature cards */
a[style*="background:#EAFBEF"],
a[style*="background:#EFF6FF"],
a[style*="background:#EDE9FE"],
a[style*="background:#FEF3C7"],
a[style*="background:#F0FDF4"],
a[style*="background:#FEF2F2"] {
  transition: transform .3s var(--pol-ease-out), box-shadow .3s var(--pol-ease-out) !important;
}

/* ---------- BUTTON REFINEMENTS ---------- */
a[style*="border-radius:10px"][style*="font-weight:8"],
button[style*="border-radius:10px"][style*="font-weight:8"] {
  transition: transform .2s var(--pol-ease-out),
              box-shadow .25s var(--pol-ease-out),
              filter .2s var(--pol-ease-out) !important;
  will-change: transform;
}
a[style*="border-radius:10px"][style*="font-weight:8"]:hover,
button[style*="border-radius:10px"][style*="font-weight:8"]:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: var(--pol-shadow-md);
}
a[style*="border-radius:10px"][style*="font-weight:8"]:active,
button[style*="border-radius:10px"][style*="font-weight:8"]:active {
  transform: translateY(0);
  filter: brightness(.98);
}

/* ---------- LINK FOCUS A11Y ---------- */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #2AB34A;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- DETAILS / FAQ POLISH ---------- */
details[style*="background:#fff"],
details[style*="background:#f8fafc"] {
  transition: box-shadow .3s var(--pol-ease-out), border-color .3s var(--pol-ease-out);
}
details[style*="background:#fff"]:hover,
details[style*="background:#f8fafc"]:hover {
  box-shadow: var(--pol-shadow-sm);
  border-color: rgba(42, 179, 74, .25) !important;
}
details[open] summary span {
  transform: rotate(45deg);
}
details summary span {
  transition: transform .25s var(--pol-ease-out);
  display: inline-block;
}

/* ---------- GRADIENT TEXT FALLBACK PROTECTION ---------- */
[style*="-webkit-background-clip:text"],
[style*="-webkit-background-clip: text"] {
  background-clip: text !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
}

/* ---------- IMAGES & ICONS POLISH ---------- */
img {
  image-rendering: -webkit-optimize-contrast;
}

/* ---------- SCROLLBAR REFINEMENT (desktop) ---------- */
@media (hover: hover) {
  body::-webkit-scrollbar           { width: 12px; }
  body::-webkit-scrollbar-track     { background: #f1f5f9; }
  body::-webkit-scrollbar-thumb     { background: #cbd5e1; border: 2px solid #f1f5f9; border-radius: 8px; }
  body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
}

/* ---------- SMOOTH SCROLL ANCHORS ---------- */
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- PILL/BADGE CONSISTENCY ---------- */
[style*="border-radius:999px"][style*="padding:6px"],
[style*="border-radius:999px"][style*="padding: 6px"] {
  letter-spacing: 0.01em;
}

/* ---------- INPUT POLISH ---------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
textarea,
select {
  transition: border-color .2s var(--pol-ease), box-shadow .2s var(--pol-ease) !important;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 179, 74, .18);
  border-color: #2AB34A !important;
}
/* Dark theme inputs (forms inside dark hero) */
section[style*="linear-gradient(135deg,#6E3FF3"] input:focus,
section[style*="linear-gradient(135deg, #6E3FF3"] input:focus,
section[style*="background:#0f172a"] input:focus {
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .35) !important;
  border-color: #FBBF24 !important;
}

/* ---------- TABLE POLISH ---------- */
table[style*="border-collapse:collapse"] tr {
  transition: background-color .2s var(--pol-ease);
}
table[style*="border-collapse:collapse"] tbody tr:hover {
  background-color: #f8fafc;
}

/* ---------- HEADER REFINEMENT ---------- */
header.sticky {
  backdrop-filter: saturate(1.5) blur(10px);
  -webkit-backdrop-filter: saturate(1.5) blur(10px);
}

/* ---------- BREADCRUMB POLISH ---------- */
nav[style*="font-size:.85rem"] a {
  position: relative;
  transition: opacity .2s var(--pol-ease);
}
nav[style*="font-size:.85rem"] a:hover {
  opacity: .8;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ---------- COUNTERS — visual emphasis ---------- */
[data-counter] {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

/* ---------- SELECTION ---------- */
::selection {
  background-color: rgba(42, 179, 74, .25);
  color: #0f172a;
}

/* ---------- LOAD-IN ANIMATION (subtle) ---------- */
@keyframes pol-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
main > section:first-child > div {
  animation: pol-fade-up .6s var(--pol-ease-out) both;
}
@media (prefers-reduced-motion: reduce) {
  main > section:first-child > div { animation: none; }
}

/* ---------- MOBILE TYPOGRAPHY GUARD ---------- */
@media (max-width: 480px) {
  h1 { font-size: clamp(1.7rem, 7vw, 2.4rem) !important; line-height: 1.12 !important; }
  h2 { font-size: clamp(1.4rem, 5.5vw, 2rem) !important; line-height: 1.18 !important; }
}

/* ---------- DISPLAY HEADINGS — cap massimo per evitare overflow di parole lunghe ---------- */
.display-0 {
  font-size: clamp(2.5rem, 6.5vw, 5.5rem) !important;
  word-break: keep-all;
  overflow-wrap: break-word;
  hyphens: auto;
}
.display-1 {
  font-size: clamp(2.2rem, 5.5vw, 4.5rem) !important;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ---------- GRID OVERFLOW PROTECTION ---------- */
/* Le parole lunghe italiane (accompagniamo, professionalità) possono spingere fuori
   le colonne grid. min-width:0 forza il rispetto della larghezza della track. */
.grid > *,
[class*="grid-cols"] > * {
  min-width: 0;
}

/* ---------- GRID GAP HARMONIZATION ---------- */
.grid[style*="gap:14px"]    { row-gap: 14px; }
.grid[style*="gap:16px"]    { row-gap: 16px; }
.grid[style*="gap:18px"]    { row-gap: 18px; }
.grid[style*="gap:20px"]    { row-gap: 20px; }

/* ---------- CARD MICRO-INTERACTION (lift on hover for clickable cards) ---------- */
a[href*="/prodotti/"],
a[href*="/per/"] {
  display: block;
  transition: transform .3s var(--pol-ease-out), box-shadow .3s var(--pol-ease-out) !important;
}
a[href*="/prodotti/"]:hover,
a[href*="/per/"]:hover {
  text-decoration: none;
}

/* ---------- ICON CONSISTENCY (emoji size in heroes) ---------- */
section[style*="linear-gradient"] [style*="font-size:3.5rem"],
section[style*="linear-gradient"] [style*="font-size: 3.5rem"],
section[style*="linear-gradient"] [style*="font-size:4rem"],
section[style*="linear-gradient"] [style*="font-size: 4rem"] {
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.18));
}

/* ---------- CTA BUTTONS — ARROW MICRO-ANIMATION ---------- */
a[style*="background:#FBBF24"][style*="color:#0f172a"]::after,
a[style*="background:#fff"][style*="color:#6E3FF3"]::after,
a[style*="background:#fff"][style*="color:#229A3F"]::after {
  /* Disabled by default — only triggered when text contains arrow */
}

/* ---------- DISABLED ACTIONS ---------- */
[disabled], button[disabled], a[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ---------- PRINT STYLES (clean B/W) ---------- */
@media print {
  header, footer, .cb-root, .cw-root,
  [class*="early-bird"], [class*="exit-intent"], [class*="social-proof"] {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
  }
  a { text-decoration: underline; color: #000 !important; }
}
