/* ============================================================
   IT Impresa · AI Assistant Demo
   Standalone demo page — brand-inspired, not a clone.
   Palette inspired by it-impresa.it (orange #FF6900, deep red
   #CF2E2E, charcoal #313131, clean white surfaces).
   ============================================================ */

:root {
  --brand-primary: #ff6900;
  --brand-primary-dark: #e85d00;
  --brand-secondary: #cf2e2e;
  --brand-grad: linear-gradient(120deg, var(--brand-primary), var(--brand-secondary));

  --ink: #23272f;            /* dark charcoal text */
  --ink-soft: #4c5561;
  --ink-faint: #6b7480;

  --surface: #ffffff;
  --surface-alt: #f6f7f9;
  --border: #e5e8ec;

  --hero-bg: #171b22;        /* deep charcoal for hero */
  --hero-bg-2: #1f2530;
  --hero-text: #f4f6f8;
  --hero-text-soft: #b7bec9;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;

  --shadow-soft: 0 10px 30px rgba(23, 27, 34, 0.08);
  --shadow-card: 0 4px 16px rgba(23, 27, 34, 0.06);

  --font: "Urbanist", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;

  --max-width: 1220px;
  --anim-base: 550ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface-alt);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; }
em { font-style: normal; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  top: -48px; left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: top 200ms ease;
}
.skip-link:focus { top: 0; }

/* ---------- focus ---------- */
:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.topbar :focus-visible,
.hero :focus-visible { outline-color: #ffb27a; }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(23, 27, 34, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--hero-text);
}
.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand-grad);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.brand__word {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.topbar__badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.badge--accent {
  color: #fff;
  background: var(--brand-grad);
}
.badge--muted {
  color: var(--hero-text-soft);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 500;
}
.badge__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: badge-dot 2.4s ease-in-out infinite;
}
@keyframes badge-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  color: var(--hero-text);
  background:
    radial-gradient(1000px 460px at 85% -10%, rgba(255, 105, 0, 0.16), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(207, 46, 46, 0.12), transparent 55%),
    linear-gradient(180deg, var(--hero-bg-2), var(--hero-bg));
  overflow: hidden;
}
.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}
.hero__pill {
  display: inline-block;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 145, 70, 0.45);
  background: rgba(255, 105, 0, 0.12);
  color: #ffc39e;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 22px;
}
.hero__title {
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
}
.hero__title em {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  font-size: clamp(16px, 1.6vw, 18.5px);
  color: var(--hero-text-soft);
  max-width: 34em;
  margin-bottom: 12px;
}
.hero__note {
  font-size: 13px;
  color: rgba(183, 190, 201, 0.75);
  max-width: 38em;
  margin-bottom: 26px;
}
.hero__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hero__hint {
  min-height: 22px;
  margin-top: 12px;
  font-size: 13.5px;
  color: #ffc39e;
  opacity: 0;
  transition: opacity 300ms ease;
}
.hero__hint.is-visible { opacity: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  position: relative;
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 8px 22px rgba(255, 105, 0, 0.32);
}
.btn--primary:hover {
  box-shadow: 0 10px 26px rgba(255, 105, 0, 0.42);
  transform: translateY(-1px);
}
.btn--primary::after {           /* ambient pulse: only 2 iterations */
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid rgba(255, 140, 60, 0.55);
  opacity: 0;
  pointer-events: none;
  animation: cta-pulse 2.2s ease-out 2;
  animation-delay: 1.4s;
}
@keyframes cta-pulse {
  0%   { opacity: 0; transform: scale(1); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.12); }
}

.btn--ghost {
  color: var(--hero-text);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.13);
}

/* ---------- hero side panel ---------- */
.panel {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-soft);
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}
.panel__avatar {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--brand-grad);
  color: #fff;
  flex-shrink: 0;
}
.panel__title {
  font-size: 16px;
  font-weight: 700;
}
.panel__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #8fd4a8;
  margin-top: 2px;
}
.panel__status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3fbf6f;
}
.panel__status.is-demo { color: #ffc39e; }
.panel__status.is-demo .panel__status-dot { background: var(--brand-primary); }

.panel__ask-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hero-text-soft);
  margin-bottom: 12px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--hero-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.chip:hover {
  background: rgba(255, 105, 0, 0.16);
  border-color: rgba(255, 140, 60, 0.55);
  transform: translateY(-1px);
}
.panel__foot {
  font-size: 13px;
  color: var(--hero-text-soft);
}

/* ============================================================
   CAPABILITIES
   ============================================================ */
.capabilities {
  padding: 40px 0 8px;
}
.capabilities__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-card);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
  border-color: #ffd2b0;
}
.card__icon {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255, 105, 0, 0.1);
  color: var(--brand-primary-dark);
  margin-bottom: 14px;
}
.card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}
.card p {
  font-size: 14px;
  color: var(--ink-soft);
}

/* ============================================================
   TRUST STRIP
   ============================================================ */
.trust { padding: 30px 0 10px; }
.trust__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.trust__items {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.trust__sub {
  font-size: 13.5px;
  color: var(--ink-faint);
}

/* ============================================================
   FOOTER / DISCLAIMER
   ============================================================ */
.footer {
  margin-top: 26px;
  padding: 22px 24px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer p {
  max-width: var(--max-width);
  margin: 0 auto;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
}

/* ============================================================
   CHAT CUE (indica il launcher reale, live mode)
   ============================================================ */
.chat-cue {
  position: fixed;
  right: 26px;
  bottom: 30px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}
.chat-cue.is-visible { opacity: 1; }
.chat-cue__ring {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 105, 0, 0.75);
}
.chat-cue__ring::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 105, 0, 0.6);
  animation: cue-ring 1.6s ease-out 3;
}
@keyframes cue-ring {
  0%   { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.chat-cue__label {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================================
   FALLBACK MOCK CHAT
   ============================================================ */
.mock-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 50;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(23, 27, 34, 0.22);
  overflow: hidden;
}
.mock-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: #fff;
  background: var(--brand-grad);
}
.mock-panel__avatar {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.mock-panel__titles { flex: 1; min-width: 0; }
.mock-panel__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.mock-panel__tag {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.22);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mock-panel__close {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}
.mock-panel__close:hover { background: rgba(255, 255, 255, 0.26); }

.mock-panel__log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-alt);
}
.mock-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.mock-msg--user {
  align-self: flex-end;
  background: var(--brand-grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mock-msg--bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}
.mock-msg--demo {
  align-self: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 105, 0, 0.1);
  color: var(--brand-primary-dark);
  font-size: 11.5px;
  font-weight: 700;
}
.mock-panel__foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.mock-panel__note {
  font-size: 11.5px;
  color: var(--ink-faint);
  text-align: center;
}

.mock-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: 58px; height: 58px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 10px 26px rgba(255, 105, 0, 0.4);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.mock-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 105, 0, 0.5);
}
.mock-launcher[aria-expanded="true"] { transform: none; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 11px 20px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(23, 27, 34, 0.3);
  opacity: 0;
  transition: opacity 250ms ease, transform 250ms ease;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ============================================================
   ANIMATIONS (load-in)
   ============================================================ */
.anim {
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up var(--anim-base) cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.anim-1  { animation-delay: 60ms; }
.anim-2  { animation-delay: 140ms; }
.anim-3  { animation-delay: 220ms; }
.anim-4  { animation-delay: 300ms; }
.anim-5  { animation-delay: 380ms; }
.anim-6  { animation-delay: 460ms; }
.anim-7  { animation-delay: 420ms; }
.anim-8  { animation-delay: 510ms; }
.anim-9  { animation-delay: 600ms; }
.anim-10 { animation-delay: 690ms; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 34px;
    padding-top: 44px;
    padding-bottom: 44px;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar__inner {
    padding: 10px 16px;
    justify-content: center;
  }
  .hero__inner {
    padding: 36px 18px 40px;
  }
  .hero__title { font-size: clamp(26px, 7.5vw, 32px); }
  .hero__actions .btn { width: 100%; }
  .capabilities__inner, .trust__inner { padding-left: 18px; padding-right: 18px; }
  .cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .trust__inner { flex-direction: column; align-items: flex-start; gap: 4px; }
  .footer { padding: 18px 18px 24px; }
  .mock-panel { right: 16px; bottom: 92px; }
  .mock-launcher { right: 16px; bottom: 18px; }
  .chat-cue { right: 20px; bottom: 24px; }
  .footer p { text-align: left; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .badge__dot { animation: none; }
  .btn--primary::after { animation: none; display: none; }
  .chat-cue__ring::before { animation: none; opacity: 0.7; }
  .btn, .chip, .card, .mock-launcher { transition: none; }
}
