/* Studio Flow - Finestra chat */
.sfchat[hidden] { display: none !important; }
.sfchat { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.sfchat__overlay { position: absolute; inset: 0; background: rgba(0, 20, 30, .45); }
.sfchat__win {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 40px));
  background: var(--sfchat-bg, #fff);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  font-family: Inter, Arial, sans-serif;
}
.sfchat__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--sfchat-head-bg, #fff);
  color: var(--sfchat-head-text, #002333);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
  flex: 0 0 auto;
}
.sfchat__avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.sfchat__who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sfchat__name { font-family: "Fredoka", "Arial Rounded MT Bold", Arial, sans-serif; font-weight: 700; font-size: 17px; line-height: 1.2; color: var(--sfchat-head-text, #002333) !important; }
.sfchat__sub { font-size: 13px; opacity: .75; color: var(--sfchat-head-text, #002333) !important; }
.sfchat__close {
  flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: var(--sfchat-head-text, #002333); font-size: 30px; line-height: 1; cursor: pointer;
}
.sfchat__close:hover { background: rgba(0, 0, 0, .06); }
.sfchat__body {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 14px 22px; display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.sfchat__msg { flex: 0 0 auto; max-width: 82%; border-radius: 18px; overflow: hidden; }
.sfchat__msg--left { align-self: flex-start; background: var(--sfchat-l-bg, #EDF3F6); color: var(--sfchat-l-text, #002333); border-bottom-left-radius: 6px; }
.sfchat__msg--right { align-self: flex-end; background: var(--sfchat-r-bg, #005075); color: var(--sfchat-r-text, #fff); border-bottom-right-radius: 6px; }
.sfchat__msg--video, .sfchat__msg--image { max-width: 88%; }
.sfchat__media { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; }
.sfchat__text { margin: 0; padding: 10px 14px; font-size: 15px; line-height: 1.4; color: inherit !important; }
html.sfchat-open, html.sfchat-open body { overflow: hidden !important; }
@media (max-width: 767px) {
  .sfchat__win { width: 100vw; height: 100%; border-radius: 0; }
  .sfchat { align-items: stretch; }
}

/* 1.1.0 - Testata: scritta piccola + nome; inizio con titolo e testo; foto e video senza fumetto */
.sfchat__brand { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--sfchat-head-text, #002333) !important; opacity: .8; }
.sfchat__head { position: sticky; top: 0; z-index: 2; }
.sfchat__intro { padding: 6px 4px 12px; flex: 0 0 auto; }
.sfchat .sfchat__title {
  margin: 0 0 8px;
  font-family: "Fredoka", "Arial Rounded MT Bold", Arial, sans-serif !important;
  font-weight: 700; font-size: 28px; line-height: 1.08;
  color: var(--sfchat-title, #002333) !important; text-transform: none;
}
.sfchat .sfchat__lead { margin: 0; font-size: 15px; line-height: 1.45; color: var(--sfchat-intro, #002333) !important; }
.sfchat__msg--bare { background: transparent !important; border-radius: 16px; }
.sfchat__msg--bare .sfchat__media { border-radius: 16px; }

/* 1.2.0 - Righe dei messaggi con il pallino (logo) accanto a quelli di sinistra */
.sfchat__row { display: flex; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.sfchat__row--right { justify-content: flex-end; }
.sfchat__row .sfchat__msg { align-self: auto; }
.sfchat__row--left .sfchat__msg { max-width: calc(82% - 40px); }
.sfchat__row--left .sfchat__msg--bare, .sfchat__row--left .sfchat__msg--video, .sfchat__row--left .sfchat__msg--image { max-width: calc(88% - 40px); }
.sfchat__dot {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--sfchat-dot, #3CC27A); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.sfchat__dot img { width: 100%; height: 100%; object-fit: cover; }
.sfchat__dot--empty { visibility: hidden; }

/* 1.3.0 - Finestra rettangolare come il sito ufficiale (circa 660 x 535 su computer) */
.sfchat .sfchat__win { width: min(660px, calc(100vw - 24px)); height: min(535px, calc(100vh - 40px)); border-radius: 18px; }
.sfchat .sfchat__head { border-bottom: 0; padding: 14px 18px 8px; }
.sfchat .sfchat__body { padding: 6px clamp(14px, 4vw, 34px) 70px; }
.sfchat .sfchat__intro { text-align: center; padding: 4px 10px 14px; }
.sfchat .sfchat__title { --sfch-vscale: 1.36; font-size: clamp(24px, 3.6vw, 34px); line-height: 1.05; text-align: center; }
.sfchat .sfchat__title .sfch-v { font-size: calc(var(--sfch-vscale) * 1em); line-height: 0; }
.sfchat .sfchat__lead { text-align: center; }
/* fumetti con la codina */
.sfchat .sfchat__msg { position: relative; overflow: visible; }
.sfchat .sfchat__msg--text { border-radius: 18px; }
.sfchat .sfchat__msg--text.sfchat__msg--left { border-bottom-left-radius: 4px; }
.sfchat .sfchat__msg--text.sfchat__msg--right { border-bottom-right-radius: 4px; }
.sfchat .sfchat__msg--text.sfchat__msg--left::after,
.sfchat .sfchat__msg--text.sfchat__msg--right::after {
  content: ""; position: absolute; bottom: 0; width: 12px; height: 12px;
}
.sfchat .sfchat__msg--text.sfchat__msg--left::after { left: -6px; background: radial-gradient(circle at 0 0, transparent 11px, var(--sfchat-l-bg, #EDF3F6) 12px); }
.sfchat .sfchat__msg--text.sfchat__msg--right::after { right: -6px; background: radial-gradient(circle at 100% 0, transparent 11px, var(--sfchat-r-bg, #005075) 12px); }
.sfchat .sfchat__msg--bare, .sfchat .sfchat__msg--image, .sfchat .sfchat__msg--video { overflow: hidden; border-radius: 16px; }
.sfchat .sfchat__row--left .sfchat__msg { max-width: min(70%, calc(100% - 40px)); }
.sfchat .sfchat__row--right .sfchat__msg { max-width: 70%; }
.sfchat .sfchat__row .sfchat__msg--bare, .sfchat .sfchat__row .sfchat__msg--video, .sfchat .sfchat__row .sfchat__msg--image { max-width: min(62%, 360px); }
/* pallino con la freccia per scorrere giù */
.sfchat__down {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: var(--sfchat-head-text, #002333); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .2); transition: opacity .2s ease;
}
.sfchat__down.is-hidden { opacity: 0; pointer-events: none; }
@media (max-width: 767px) {
  .sfchat .sfchat__win { width: 100vw; height: 100%; border-radius: 0; }
  .sfchat .sfchat__row .sfchat__msg--bare, .sfchat .sfchat__row .sfchat__msg--video, .sfchat .sfchat__row .sfchat__msg--image { max-width: 78%; }
  .sfchat .sfchat__row--left .sfchat__msg, .sfchat .sfchat__row--right .sfchat__msg { max-width: 80%; }
}

/* 1.4.0 - Ultima parte: immagine grande senza fumetto, pallino sotto l'immagine */
.sfchat .sfchat__row--left .sfchat__msg--image.sfchat__msg--bare { max-width: min(70%, 440px); }
.sfchat .sfchat__msg--bare .sfchat__media { max-height: 360px; object-fit: contain; }
.sfchat .sfchat__msg--image.sfchat__msg--bare { background: transparent !important; }

/* 1.5.0 - Finestra più grande e con più spazio, come quella di air up */
.sfchat .sfchat__win { width: min(880px, calc(100vw - 40px)); height: min(760px, calc(100vh - 40px)); border-radius: 20px; font-family: Poppins, Inter, Arial, sans-serif; }
.sfchat .sfchat__head { padding: 18px 24px 10px; }
.sfchat .sfchat__avatar { width: 46px; height: 46px; }
.sfchat .sfchat__body { padding: 12px clamp(18px, 7vw, 72px) 96px; gap: 14px; }
.sfchat .sfchat__intro { padding: 10px 20px 26px; }
.sfchat .sfchat__title { font-size: clamp(26px, 3.4vw, 40px); }
.sfchat .sfchat__text { padding: 12px 18px; font-size: 15px; line-height: 1.5; }
/* più aria quando cambia chi parla */
.sfchat .sfchat__row--left + .sfchat__row--right,
.sfchat .sfchat__row--right + .sfchat__row--left { margin-top: 26px; }
.sfchat .sfchat__row { gap: 12px; }
.sfchat .sfchat__dot { flex-basis: 34px; width: 34px; height: 34px; }
.sfchat .sfchat__row--left .sfchat__msg, .sfchat .sfchat__row--right .sfchat__msg { max-width: min(62%, 420px); }
.sfchat .sfchat__row .sfchat__msg--bare, .sfchat .sfchat__row .sfchat__msg--video, .sfchat .sfchat__row .sfchat__msg--image { max-width: min(60%, 460px); }
.sfchat .sfchat__row .sfchat__msg--image.sfchat__msg--bare { max-width: min(62%, 480px); }
.sfchat .sfchat__msg--bare .sfchat__media { max-height: 420px; }
.sfchat .sfchat__down { bottom: 20px; width: 46px; height: 46px; }
@media (max-width: 767px) {
  .sfchat .sfchat__win { width: 100vw; height: 100%; border-radius: 0; }
  .sfchat .sfchat__body { padding: 8px 16px 90px; }
  .sfchat .sfchat__row--left .sfchat__msg, .sfchat .sfchat__row--right .sfchat__msg { max-width: 80%; }
  .sfchat .sfchat__row .sfchat__msg--bare, .sfchat .sfchat__row .sfchat__msg--video, .sfchat .sfchat__row .sfchat__msg--image { max-width: 80%; }
}

/* 1.5.1 - Foto e video più piccoli, come sul sito ufficiale (circa la metà di prima) */
.sfchat .sfchat__row .sfchat__msg--bare,
.sfchat .sfchat__row .sfchat__msg--video,
.sfchat .sfchat__row .sfchat__msg--image { max-width: min(34%, 270px); }
.sfchat .sfchat__row .sfchat__msg--image.sfchat__msg--bare { max-width: min(40%, 330px); }
.sfchat .sfchat__msg--video .sfchat__media,
.sfchat .sfchat__msg--image .sfchat__media,
.sfchat .sfchat__msg--bare .sfchat__media { max-height: 300px; }
@media (max-width: 767px) {
  .sfchat .sfchat__row .sfchat__msg--bare,
  .sfchat .sfchat__row .sfchat__msg--video,
  .sfchat .sfchat__row .sfchat__msg--image { max-width: 58%; }
}

/* 1.5.2 - Foto e video QUADRATI con gli angoli arrotondati, come sul sito ufficiale */
.sfchat .sfchat__row .sfchat__msg--video,
.sfchat .sfchat__row .sfchat__msg--image,
.sfchat .sfchat__row .sfchat__msg--bare { width: min(34%, 270px); max-width: min(34%, 270px); }
.sfchat .sfchat__msg--video .sfchat__media,
.sfchat .sfchat__msg--image .sfchat__media,
.sfchat .sfchat__msg--bare .sfchat__media {
  width: 100%; height: auto; max-height: none;
  aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px;
}
/* immagine con sfondo trasparente (es. "Un pod = 5 litri"): quadrata ma intera, senza tagli */
.sfchat .sfchat__msg--image.sfchat__msg--bare .sfchat__media { object-fit: contain; }
@media (max-width: 767px) {
  .sfchat .sfchat__row .sfchat__msg--video,
  .sfchat .sfchat__row .sfchat__msg--image,
  .sfchat .sfchat__row .sfchat__msg--bare { width: 58%; max-width: 58%; }
}

/* 1.5.3 - riquadri di foto e video leggermente piu' piccoli */
.sfchat .sfchat__row .sfchat__msg--video,
.sfchat .sfchat__row .sfchat__msg--image,
.sfchat .sfchat__row .sfchat__msg--bare { width: min(28%, 220px); max-width: min(28%, 220px); }
@media (max-width: 767px) {
  .sfchat .sfchat__row .sfchat__msg--video,
  .sfchat .sfchat__row .sfchat__msg--image,
  .sfchat .sfchat__row .sfchat__msg--bare { width: 48%; max-width: 48%; }
}
