/* ==========================================================================
   Giulia — assistente virtuale di Torinext (widget chat + personaggio)
   Stile: vetro smerigliato, gradiente blu brand -> viola, gli angoli morbidi
   del simbolo Torinext. Script: assets/js/giulia.js
   ========================================================================== */

:root {
  --gl-blue: #1C39BB;
  --gl-indigo: #4B3FE0;
  --gl-violet: #6D4AFF;
  --gl-lilac: #B48CFF;
  --gl-sky: #7FC8FF;
  --gl-grad: linear-gradient(135deg, #1C39BB 0%, #4B3FE0 55%, #7B5CFF 100%);
  --gl-grad-text: linear-gradient(100deg, #1C39BB 0%, #5B4BFF 45%, #A06BFF 100%);
  --gl-ink: #0B1640;
  --gl-text: #2B3558;
  --gl-muted: #646D90;
  --gl-faint: #959CBA;
  --gl-glass: rgba(255, 255, 255, 0.72);
  --gl-card: #FFFFFF;
  --gl-line: rgba(28, 57, 187, 0.10);
  --gl-panel-bg:
    radial-gradient(70% 38% at 0% 0%, rgba(180, 140, 255, 0.26), transparent 70%),
    radial-gradient(55% 32% at 100% 22%, rgba(127, 200, 255, 0.20), transparent 70%),
    radial-gradient(80% 45% at 50% 100%, rgba(109, 74, 255, 0.12), transparent 70%),
    #F5F4FC;
  --gl-shadow: 0 30px 70px -18px rgba(11, 22, 64, 0.38), 0 10px 24px -10px rgba(28, 57, 187, 0.22);
  --gl-ease: cubic-bezier(.2, 1.15, .35, 1);
  --gl-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gl-display: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ==========================================================================
   Il personaggio: una sfera di vetro iridescente con un viso essenziale.
   Tutte le misure sono in em: la dimensione si sceglie con font-size.
   ========================================================================== */
.gl-orb {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  border-radius: 50%;
  isolation: isolate;
  --lx: 0;
  --ly: 0;
}
.gl-orb__body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 30% 22%, #8A8CFF 0%, #4F42EA 45%, #2A2DB5 100%);
  box-shadow:
    0 0.06em 0.16em -0.02em rgba(28, 31, 143, 0.45),
    0 0.18em 0.42em -0.12em rgba(91, 75, 255, 0.55);
}
.gl-orb__body::before {           /* colori iridescenti che scorrono, come vetro liquido */
  content: "";
  position: absolute;
  inset: -35%;
  background: conic-gradient(from 210deg, #2D43D6, #6D4AFF, #C59BFF, #8FD3FF, #FFC2EC, #7B5CFF, #2D43D6);
  opacity: 0.95;
  filter: blur(0.08em) saturate(1.15);
  mix-blend-mode: screen;
  animation: gl-spin 14s linear infinite;
}
.gl-orb__body::after {            /* ombreggiatura 3D, riflesso sul bordo, alone interno */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(85% 85% at 72% 84%, rgba(20, 22, 110, 0.38), transparent 60%),
    radial-gradient(60% 40% at 50% 104%, rgba(143, 211, 255, 0.75), transparent 70%),
    radial-gradient(100% 100% at 50% 50%, transparent 62%, rgba(255, 255, 255, 0.35) 72%, transparent 76%);
  box-shadow:
    inset 0 0.02em 0.03em rgba(255, 255, 255, 0.7),
    inset 0 -0.05em 0.12em rgba(11, 15, 70, 0.5),
    inset 0 0 0.16em rgba(197, 155, 255, 0.55);
}
.gl-orb__shine {                  /* riflesso principale + punto di luce */
  position: absolute;
  top: 7%;
  left: 17%;
  width: 40%;
  height: 26%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25) 55%, rgba(255, 255, 255, 0));
  transform: rotate(-28deg);
  z-index: 2;
  pointer-events: none;
}
.gl-orb__shine::after {
  content: "";
  position: absolute;
  right: -62%;
  top: 112%;
  width: 16%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  filter: blur(0.01em);
}
.gl-orb__face {
  position: absolute;
  left: 50%;
  top: 53%;
  width: 52%;
  height: 34%;
  transform: translate(calc(-50% + var(--lx) * 14%), calc(-50% + var(--ly) * 12%));
  z-index: 3;
  transition: transform 0.45s var(--gl-ease);
}
.gl-eye {
  position: absolute;
  top: 6%;
  width: 19%;
  height: 50%;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFFFFF 0%, #EEE9FF 100%);
  box-shadow: 0 0 0.04em rgba(255, 255, 255, 0.95), 0 0 0.12em rgba(197, 155, 255, 0.85);
  transform-origin: 50% 60%;
  animation: gl-blink 5.6s infinite;
}
.gl-eye--l { left: 16%; }
.gl-eye--r { right: 16%; }
.gl-mouth {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 22%;
  height: 18%;
  transform: translateX(-50%);
  border: 0.026em solid rgba(255, 255, 255, 0.95);
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transition: height 0.12s ease, width 0.2s ease, border-radius 0.2s ease;
}
.gl-orb__face::before, .gl-orb__face::after {   /* guance appena accennate */
  content: "";
  position: absolute;
  top: 58%;
  width: 16%;
  height: 12%;
  border-radius: 50%;
  background: rgba(255, 170, 225, 0.45);
  filter: blur(0.02em);
}
.gl-orb__face::before { left: 2%; }
.gl-orb__face::after { right: 2%; }

/* galleggia piano, con l'ombra a terra */
.gl-orb--float { animation: gl-float 5.2s ease-in-out infinite; }
.gl-orb--float::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -0.16em;
  height: 0.07em;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(36, 30, 120, 0.28), transparent);
  animation: gl-shadow 5.2s ease-in-out infinite;
  z-index: -1;
}

/* stati: guarda intorno, pensa, parla, felice */
.gl-orb[data-state="idle"]:not(.is-tracking) .gl-orb__face { animation: gl-look 10s ease-in-out infinite; }
.gl-orb[data-state="think"] .gl-orb__face { transform: translate(-38%, -60%); }
.gl-orb[data-state="think"] .gl-eye { height: 38%; animation: gl-blink 2.4s infinite; }
.gl-orb[data-state="think"] .gl-mouth { width: 12%; height: 8%; border-radius: 999px; border-top: 0.026em solid #fff; }
.gl-orb[data-state="think"] .gl-orb__body::before { animation-duration: 2.6s; }
.gl-orb[data-state="talk"] .gl-mouth { animation: gl-talk 0.3s ease-in-out infinite alternate; }
.gl-orb[data-state="happy"] .gl-eye {
  height: 28%;
  top: 14%;
  background: transparent;
  border: 0.026em solid #fff;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  animation: none;
  box-shadow: none;
}
.gl-orb[data-state="happy"] .gl-mouth { width: 30%; height: 28%; }
.gl-orb[data-state="happy"] .gl-orb__face::before,
.gl-orb[data-state="happy"] .gl-orb__face::after { background: rgba(255, 170, 225, 0.75); }
.gl-orb[data-state="happy"] { animation: gl-hop 0.7s ease 2; }

@keyframes gl-spin { to { transform: rotate(360deg); } }
@keyframes gl-blink {
  0%, 45%, 49%, 100% { transform: scaleY(1); }
  47% { transform: scaleY(0.08); }
}
@keyframes gl-look {
  0%, 28%, 100% { transform: translate(-50%, -50%); }
  36%, 48% { transform: translate(-62%, -50%); }
  58%, 70% { transform: translate(-38%, -55%); }
  80% { transform: translate(-50%, -50%); }
}
@keyframes gl-talk {
  from { height: 8%; width: 18%; border-radius: 999px; border-top: 0.026em solid #fff; }
  to { height: 26%; width: 22%; border-radius: 40% 40% 999px 999px; border-top: 0.026em solid #fff; }
}
@keyframes gl-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.05em); }
}
@keyframes gl-shadow {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50% { transform: scaleX(0.82); opacity: 0.6; }
}
@keyframes gl-hop {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-0.1em) scale(1.04, 0.97); }
}

/* ==========================================================================
   Pulsante fluttuante
   ========================================================================== */
.gl-launcher {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: 600 0.9rem/1.2 var(--gl-font);
  color: var(--gl-ink);
  -webkit-tap-highlight-color: transparent;
}
.gl-launcher__ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: var(--gl-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  font-size: 48px;
  transition: transform 0.3s var(--gl-ease);
}
.gl-launcher__ring::before {     /* bordo a gradiente */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 1.5px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.9), rgba(109, 74, 255, 0.55), rgba(127, 200, 255, 0.6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.gl-launcher__ring::after {      /* alone che pulsa */
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(109, 74, 255, 0.4);
  animation: gl-pulse 3.6s ease-out infinite;
}
.gl-launcher:hover .gl-launcher__ring,
.gl-launcher:focus-visible .gl-launcher__ring { transform: scale(1.06); }
.gl-launcher:focus-visible { outline: none; }
.gl-launcher:focus-visible .gl-launcher__ring { box-shadow: var(--gl-shadow), 0 0 0 3px #fff, 0 0 0 5px var(--gl-blue); }
.gl-launcher__label {
  order: -1;
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px -14px rgba(11, 22, 64, 0.4), inset 0 0 0 1px rgba(28, 57, 187, 0.06);
  opacity: 0;
  transform: translateX(8px) scale(0.97);
  transform-origin: 100% 100%;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s var(--gl-ease);
  white-space: nowrap;
  text-align: left;
}
.gl-launcher__label small { font-weight: 400; font-size: 0.78rem; color: var(--gl-muted); }
.gl-launcher:hover .gl-launcher__label,
.gl-launcher:focus-visible .gl-launcher__label { opacity: 1; transform: none; }
.gl-launcher__dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #22C55E;
  border: 2.5px solid #fff;
}
.gl-open .gl-launcher { opacity: 0; pointer-events: none; transform: scale(0.8); transition: opacity 0.2s, transform 0.2s; }
@keyframes gl-pulse {
  0% { transform: scale(1); opacity: 0.85; }
  70%, 100% { transform: scale(1.32); opacity: 0; }
}

/* ==========================================================================
   Pannello della chat
   ========================================================================== */
.gl-panel {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: min(408px, calc(100vw - 40px));
  height: min(680px, calc(100dvh - 40px));
  border-radius: 28px 28px 10px 28px;
  background: var(--gl-panel-bg);
  box-shadow: var(--gl-shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.95);
  font: 400 0.9375rem/1.55 var(--gl-font);
  color: var(--gl-text);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transform-origin: 100% 100%;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.4s var(--gl-ease), visibility 0s linear 0.4s;
}
.gl-open .gl-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.25s ease, transform 0.4s var(--gl-ease), visibility 0s;
}
.gl-panel *, .gl-panel *::before, .gl-panel *::after { box-sizing: border-box; }

.gl-head {
  position: relative;
  z-index: 3;            /* il menu resta sopra al personaggio del benvenuto */
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 13px 16px;
  background: rgba(255, 255, 255, 0.62);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}
.gl-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(109, 74, 255, 0.35), rgba(28, 57, 187, 0.25), transparent);
}
.gl-head .gl-orb { font-size: 42px; }
.gl-head__who { flex: 1; min-width: 0; }
.gl-head__name { display: flex; align-items: center; gap: 7px; font: 700 1.0625rem/1.2 var(--gl-display); color: var(--gl-ink); letter-spacing: -0.01em; }
.gl-head__status { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 0.76rem; color: var(--gl-muted); }
.gl-head__status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.gl-badge { padding: 2px 8px; border-radius: 999px; background: var(--gl-grad); color: #fff; font: 600 0.62rem/1.5 var(--gl-font); letter-spacing: .05em; text-transform: uppercase; }
.gl-iconbtn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--gl-ink);
  box-shadow: 0 4px 12px -6px rgba(11, 22, 64, 0.3), inset 0 0 0 1px rgba(28, 57, 187, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s;
}
.gl-iconbtn:hover { transform: scale(1.06); background: #fff; }
.gl-iconbtn:focus-visible { outline: 2px solid var(--gl-blue); outline-offset: 2px; }
.gl-iconbtn svg { width: 18px; height: 18px; }
.gl-menu {
  position: absolute;
  top: 60px;
  right: 14px;
  z-index: 5;
  min-width: 230px;
  padding: 6px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 44px -14px rgba(11, 22, 64, 0.38), inset 0 0 0 1px rgba(28, 57, 187, 0.06);
  animation: gl-in 0.25s var(--gl-ease) both;
}
.gl-menu[hidden] { display: none; }
.gl-menu button, .gl-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  font: 500 0.875rem/1.3 var(--gl-font);
  color: var(--gl-ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.gl-menu svg { width: 16px; height: 16px; color: var(--gl-violet); flex: none; }
.gl-menu button:hover, .gl-menu a:hover { background: #F2F0FD; }

/* ---------- Messaggi ---------- */
.gl-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 14px 8px;
  scroll-behavior: smooth;
}
.gl-body::-webkit-scrollbar { width: 6px; }
.gl-body::-webkit-scrollbar-thumb { background: rgba(28, 57, 187, 0.16); border-radius: 6px; }

.gl-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 6px 16px; }
.gl-welcome .gl-orb { font-size: 96px; margin: 8px 0 18px; }
.gl-welcome h2 { margin: 0 0 6px; font: 700 1.3rem/1.25 var(--gl-display); color: var(--gl-ink); letter-spacing: -0.015em; }
.gl-welcome h2 span { background: var(--gl-grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gl-welcome p { max-width: 30em; margin: 0; color: var(--gl-muted); font-size: 0.9rem; }

/* suggerimenti iniziali */
.gl-suggest { display: grid; gap: 8px; margin: 2px 0 14px; }
.gl-suggest__label { margin: 0 4px 2px; font-size: 0.72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gl-faint); }
.gl-sugg {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px 11px 11px;
  border: 0;
  border-radius: 16px 16px 16px 6px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 6px 18px -12px rgba(11, 22, 64, 0.35), inset 0 0 0 1px rgba(28, 57, 187, 0.07);
  font: 500 0.9rem/1.3 var(--gl-font);
  color: var(--gl-ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s var(--gl-ease), box-shadow 0.2s, background 0.2s;
  animation: gl-in 0.45s var(--gl-ease) both;
}
.gl-sugg:hover { background: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px -12px rgba(75, 63, 224, 0.45), inset 0 0 0 1px rgba(109, 74, 255, 0.35); }
.gl-sugg:focus-visible { outline: 2px solid var(--gl-blue); outline-offset: 2px; }
.gl-sugg__ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(28, 57, 187, 0.1), rgba(123, 92, 255, 0.16));
  color: var(--gl-indigo);
}
.gl-sugg__ico svg { width: 18px; height: 18px; }
.gl-sugg__txt { flex: 1; min-width: 0; }
.gl-sugg__txt small { display: block; margin-top: 1px; font-weight: 400; font-size: 0.78rem; color: var(--gl-muted); }
.gl-sugg__go { flex: none; width: 16px; height: 16px; color: var(--gl-faint); transition: transform 0.2s, color 0.2s; }
.gl-sugg:hover .gl-sugg__go { transform: translateX(2px); color: var(--gl-violet); }
.gl-sugg--hot { background: linear-gradient(135deg, #1C39BB, #5B4BFF 60%, #8B63FF); color: #fff; box-shadow: 0 12px 26px -12px rgba(75, 63, 224, 0.8); }
.gl-sugg--hot:hover { background: linear-gradient(135deg, #1C39BB, #5B4BFF 60%, #8B63FF); filter: brightness(1.06); }
.gl-sugg--hot .gl-sugg__ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.gl-sugg--hot .gl-sugg__txt small, .gl-sugg--hot .gl-sugg__go { color: rgba(255, 255, 255, 0.8); }

.gl-msg { display: flex; gap: 8px; margin: 0 0 12px; animation: gl-in 0.4s var(--gl-ease) both; }
.gl-msg--bot .gl-orb { font-size: 30px; margin-top: 2px; }
.gl-msg--bot .gl-orb .gl-eye { animation-duration: 6.8s; }
.gl-msg--user { justify-content: flex-end; }
.gl-bubble {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 18px 18px 18px 6px;
  background: var(--gl-card);
  box-shadow: 0 6px 18px -12px rgba(11, 22, 64, 0.32), inset 0 0 0 1px rgba(28, 57, 187, 0.05);
  overflow-wrap: anywhere;
}
.gl-bubble p { margin: 0 0 8px; }
.gl-bubble p:last-child { margin: 0; }
.gl-bubble ul { margin: 4px 0 8px; padding-left: 18px; }
.gl-bubble li { margin: 2px 0; }
.gl-bubble li::marker { color: var(--gl-violet); }
.gl-bubble strong { color: var(--gl-ink); font-weight: 600; }
.gl-msg--user .gl-bubble {
  border-radius: 18px 18px 6px 18px;
  background: var(--gl-grad);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(75, 63, 224, 0.7);
}
.gl-msg--user .gl-bubble strong { color: #fff; }
.gl-bubble--err { display: flex; gap: 10px; align-items: flex-start; background: #FFF6F7; box-shadow: inset 0 0 0 1px rgba(194, 40, 59, 0.18); color: #7A1F2B; }
.gl-bubble--err svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: #C2283B; }
.gl-retry { margin-top: 8px; padding: 6px 12px; border: 0; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px rgba(194, 40, 59, 0.3); font: 600 0.8rem/1.2 var(--gl-font); color: #C2283B; cursor: pointer; }
.gl-retry:hover { background: #FCE8EB; }
.gl-extras { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.gl-col { display: flex; flex-direction: column; max-width: 84%; }
.gl-col .gl-bubble { max-width: 100%; }
.gl-caret { display: inline-block; width: 6px; height: 1em; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--gl-violet); animation: gl-caret 0.9s steps(2) infinite; }
@keyframes gl-caret { 50% { opacity: 0; } }
@keyframes gl-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

.gl-typing { display: inline-flex; align-items: center; gap: 4px; padding: 3px 2px; }
.gl-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gl-violet); opacity: 0.35; animation: gl-dot 1.2s infinite; }
.gl-typing span:nth-child(2) { animation-delay: 0.15s; }
.gl-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gl-dot { 30% { opacity: 1; transform: translateY(-3px); } }

/* scelte rapide dopo una risposta */
.gl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px 38px; }
.gl-chip {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(109, 74, 255, 0.3);
  font: 500 0.86rem/1.2 var(--gl-font);
  color: var(--gl-indigo);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
  animation: gl-in 0.4s var(--gl-ease) both;
}
.gl-chip:hover { background: #fff; box-shadow: inset 0 0 0 1.5px var(--gl-violet); transform: translateY(-1px); }
.gl-chip:focus-visible { outline: 2px solid var(--gl-blue); outline-offset: 2px; }

/* card del portfolio */
.gl-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 28px -16px rgba(11, 22, 64, 0.45), inset 0 0 0 1px rgba(28, 57, 187, 0.05);
  animation: gl-in 0.45s var(--gl-ease) both;
}
.gl-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; background: #E7EBFB; }
.gl-card__body { padding: 10px 12px 12px; }
.gl-card__meta { display: flex; gap: 6px; align-items: center; font-size: 0.7rem; font-weight: 600; color: var(--gl-muted); text-transform: uppercase; letter-spacing: .06em; }
.gl-card__meta span + span::before { content: "·"; margin-right: 6px; }
.gl-card h3 { margin: 3px 0 4px; font: 700 1rem/1.25 var(--gl-display); color: var(--gl-ink); }
.gl-card p { margin: 0 0 10px; font-size: 0.84rem; line-height: 1.45; color: var(--gl-text); }
.gl-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  font: 600 0.84rem/1.2 var(--gl-font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.gl-btn:focus-visible { outline: 2px solid var(--gl-blue); outline-offset: 2px; }
.gl-btn--primary { background: var(--gl-grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(75, 63, 224, 0.7); }
.gl-btn--primary:hover { transform: translateY(-1px); filter: brightness(1.08); color: #fff; }
.gl-btn--ghost { background: #F2F0FD; color: var(--gl-ink); }
.gl-btn--ghost:hover { background: #E8E4FC; color: var(--gl-ink); }
.gl-btn svg { width: 15px; height: 15px; }

/* invito al preventivo */
.gl-cta {
  position: relative;
  padding: 14px;
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  box-shadow: 0 12px 28px -16px rgba(75, 63, 224, 0.55), inset 0 0 0 1px rgba(109, 74, 255, 0.22);
  animation: gl-in 0.45s var(--gl-ease) both;
}
.gl-cta__head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.gl-cta__head svg { flex: none; width: 34px; height: 34px; padding: 8px; border-radius: 11px; background: #E3F5EE; color: #12805C; }
.gl-cta__head strong { display: block; font: 700 0.9rem/1.25 var(--gl-display); color: var(--gl-ink); }
.gl-cta__head small { display: block; font-size: 0.78rem; color: var(--gl-muted); }
.gl-cta .gl-btn { width: 100%; padding: 12px 16px; font-size: 0.9375rem; }

/* ---------- Barra di scrittura ---------- */
.gl-foot { padding: 8px 12px 10px; }
.gl-form { display: flex; align-items: flex-end; gap: 8px; }
.gl-field {
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 50px;
  padding: 0 6px 0 16px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 10px 24px -16px rgba(11, 22, 64, 0.5), inset 0 0 0 1px rgba(28, 57, 187, 0.09);
  transition: box-shadow 0.15s;
}
.gl-field:focus-within { box-shadow: 0 10px 24px -16px rgba(11, 22, 64, 0.5), inset 0 0 0 1.5px rgba(109, 74, 255, 0.6), 0 0 0 4px rgba(109, 74, 255, 0.1); }
.gl-input {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  margin: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  font: 400 0.9375rem/1.4 var(--gl-font);
  color: var(--gl-ink);
}
.gl-input::placeholder { color: #9AA1BC; }
.gl-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: var(--gl-grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 24px -10px rgba(75, 63, 224, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s, filter 0.15s;
}
.gl-send:hover { transform: scale(1.05); filter: brightness(1.08); }
.gl-send:focus-visible { outline: 2px solid var(--gl-blue); outline-offset: 3px; }
.gl-send:disabled { opacity: 0.55; cursor: default; transform: none; }
.gl-send svg { width: 20px; height: 20px; }
.gl-send .gl-ico-send { display: none; }
.gl-form.has-text .gl-send .gl-ico-mic, .gl-form.no-mic .gl-send .gl-ico-mic { display: none; }
.gl-form.has-text .gl-send .gl-ico-send, .gl-form.no-mic .gl-send .gl-ico-send { display: block; }
.gl-send.is-listening { animation: gl-listen 1.2s ease-in-out infinite; }
@keyframes gl-listen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109, 74, 255, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(109, 74, 255, 0); }
}
.gl-note { margin: 8px 8px 0; font-size: 0.69rem; line-height: 1.4; color: var(--gl-faint); text-align: center; }
.gl-note a { color: inherit; }

.gl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Telefono: a tutto schermo ---------- */
@media (max-width: 560px) {
  .gl-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    transform: translateY(24px);
  }
  .gl-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .gl-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .gl-launcher__ring { width: 58px; height: 58px; font-size: 44px; }
  .gl-input { font-size: 16px; }   /* evita lo zoom automatico su iOS */
}
html.gl-lock, html.gl-lock body { overflow: hidden; }

/* ==========================================================================
   Sezione "Giulia" in homepage
   ========================================================================== */
.giulia-home { position: relative; }
.giulia-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  padding: clamp(28px, 4.5vw, 64px);
  border-radius: 32px 32px 32px 10px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(55% 70% at 100% 0%, rgba(180, 140, 255, 0.34), transparent 70%),
    radial-gradient(50% 60% at 85% 100%, rgba(127, 200, 255, 0.30), transparent 70%),
    radial-gradient(45% 60% at 0% 100%, rgba(28, 57, 187, 0.08), transparent 70%),
    linear-gradient(180deg, #FAF9FF, #F2F1FC);
  box-shadow: 0 40px 80px -48px rgba(11, 22, 64, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}
.giulia-card::before {       /* bordo sottile a gradiente */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(109, 74, 255, 0.35), rgba(255, 255, 255, 0.4) 40%, rgba(127, 200, 255, 0.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.giulia-card::after {        /* griglia di puntini che sfuma */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(28, 57, 187, 0.12) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(60% 70% at 78% 45%, #000, transparent 75%);
  mask-image: radial-gradient(60% 70% at 78% 45%, #000, transparent 75%);
}
.giulia-home__copy h2 { margin: 0 0 14px; }
.gl-grad-text { background: var(--gl-grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.giulia-home__lead { max-width: 33em; margin: 0 0 24px; color: var(--muted, #5A6487); }
.giulia-feats { display: grid; gap: 14px; margin: 0 0 28px; padding: 0; list-style: none; }
.giulia-feats li { display: flex; gap: 13px; align-items: flex-start; }
.giulia-feats svg {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 12px 12px 12px 4px;
  background: #fff;
  color: var(--gl-indigo);
  box-shadow: 0 8px 18px -12px rgba(75, 63, 224, 0.6), inset 0 0 0 1px rgba(109, 74, 255, 0.14);
}
.giulia-feats strong { display: block; font: 700 0.98rem/1.3 var(--gl-display); color: var(--gl-ink); }
.giulia-feats span { display: block; font-size: 0.9rem; color: var(--muted, #5A6487); }

.giulia-ask { display: flex; align-items: center; gap: 8px; max-width: 560px; padding: 7px 7px 7px 16px; border-radius: 999px; background: #fff; box-shadow: 0 18px 40px -22px rgba(11, 22, 64, 0.55), inset 0 0 0 1px rgba(28, 57, 187, 0.1); transition: box-shadow 0.2s; }
.giulia-ask:focus-within { box-shadow: 0 18px 40px -22px rgba(11, 22, 64, 0.55), inset 0 0 0 1.5px rgba(109, 74, 255, 0.6), 0 0 0 5px rgba(109, 74, 255, 0.1); }
.giulia-ask__spark { flex: none; width: 20px; height: 20px; color: var(--gl-violet); }
.giulia-ask .gl-input { min-width: 0; height: 48px; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.giulia-ask .gl-send { width: 48px; height: 48px; }
.giulia-sugg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.giulia-sugg .gl-chip { display: inline-flex; align-items: center; gap: 6px; }
.giulia-sugg .gl-chip svg { width: 14px; height: 14px; opacity: 0.7; }
.giulia-home__note { display: flex; align-items: center; gap: 7px; margin: 18px 0 0; font-size: 0.8rem; color: var(--gl-faint); }
.giulia-home__note svg { flex: none; width: 15px; height: 15px; }

/* palco del personaggio */
.giulia-stage { position: relative; display: grid; place-items: center; min-height: 460px; }
.giulia-stage .gl-orb { font-size: clamp(180px, 19vw, 240px); z-index: 1; }
.giulia-stage__halo {
  position: absolute;
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(123, 92, 255, 0.42), rgba(127, 200, 255, 0.14) 62%, transparent);
  filter: blur(22px);
  animation: gl-breathe 6s ease-in-out infinite;
}
.giulia-stage__ring {
  position: absolute;
  width: 92%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(109, 74, 255, 0.18);
  transform: rotateX(72deg);
}
.giulia-stage__ring::after {   /* un puntino che orbita */
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--gl-grad);
  box-shadow: 0 0 12px rgba(109, 74, 255, 0.8);
}
.giulia-stage__ring--a { animation: gl-orbit 18s linear infinite; }
.giulia-stage__ring--b { width: 70%; transform: rotateX(72deg) rotateY(28deg); border-color: rgba(127, 200, 255, 0.28); animation: gl-orbit 12s linear infinite reverse; }
.giulia-stage__ring--b::after { width: 7px; height: 7px; background: #8FD3FF; box-shadow: 0 0 10px rgba(127, 200, 255, 0.9); }
@keyframes gl-orbit { to { rotate: 360deg; } }
@keyframes gl-breathe { 0%, 100% { transform: scale(0.94); opacity: 0.85; } 50% { transform: scale(1.06); opacity: 1; } }

/* anteprima di chat che fluttua */
.gh-chat {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 8px;
  width: min(270px, 70%);
  font: 400 0.84rem/1.45 var(--gl-font);
}
.gh-chat--top { top: 4%; left: -2%; }
.gh-msg { padding: 9px 12px; border-radius: 14px; box-shadow: 0 14px 30px -16px rgba(11, 22, 64, 0.45); opacity: 0; transform: translateY(8px); }
.gh-msg--user { justify-self: end; max-width: 88%; border-radius: 14px 14px 4px 14px; background: var(--gl-grad); color: #fff; }
.gh-msg--bot { display: flex; gap: 8px; align-items: flex-start; max-width: 96%; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--gl-ink); }
.gh-msg--bot .gl-orb { font-size: 22px; margin-top: 1px; }
.gh-done {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 8%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border-radius: 16px 16px 4px 16px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 34px -16px rgba(11, 22, 64, 0.45);
  font: 400 0.8rem/1.3 var(--gl-font);
  color: var(--gl-muted);
  opacity: 0;
  transform: translateY(8px);
}
.gh-done svg { flex: none; width: 32px; height: 32px; padding: 7px; border-radius: 10px; background: #E3F5EE; color: #12805C; }
.gh-done strong { display: block; font: 700 0.86rem/1.3 var(--gl-display); color: var(--gl-ink); }
.is-visible .gh-msg, .is-visible .gh-done { animation: gh-pop 0.6s var(--gl-ease) forwards; }
.is-visible .gh-msg:nth-child(2) { animation-delay: 0.9s; }
.is-visible .gh-done { animation-delay: 1.8s; }
@keyframes gh-pop { to { opacity: 1; transform: none; } }

@media (max-width: 920px) {
  .giulia-card { grid-template-columns: 1fr; }
  .giulia-stage { min-height: 380px; order: -1; }
  .gh-chat--top { left: 0; }
}
@media (max-width: 560px) {
  .giulia-card { padding: 22px 18px 26px; border-radius: 24px 24px 24px 8px; }
  .giulia-stage { min-height: 340px; }
  .giulia-stage .gl-orb { font-size: 150px; }
  .gh-chat { width: 78%; font-size: 0.8rem; }
  .gh-done { right: 4px; bottom: 2%; }
  .giulia-ask { padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .gl-orb, .gl-orb *, .gl-orb::after, .gl-orb *::before, .gl-orb *::after,
  .gl-launcher__ring::after, .giulia-stage__halo, .giulia-stage__ring { animation: none !important; }
  .gl-msg, .gl-chip, .gl-sugg, .gl-card, .gl-cta, .gl-menu { animation: none; }
  .gh-msg, .gh-done { opacity: 1; transform: none; animation: none !important; }
  .gl-panel { transition: opacity 0.15s ease, visibility 0s; transform: none; }
}
