:root {
  --carta: #f4ece3;        /* the warm paper behind everything */
  --chat: #fcf8f3;         /* the chat window */
  --bolla: #ecdfd1;        /* the question bubbles */
  --bolla-su: #e5d5c4;     /* a question under the pointer */
  --accento: #c2502c;      /* Pantile terracotta: the outline, the mark, the read sign */
  --inchiostro: #221c18;   /* text and the answer bubbles */
  --sulla-scura: #f7efe6;  /* text on the answer bubbles */
  --grigio: #8c8075;       /* times, status, typing dots */
  --linea: rgba(34, 28, 24, 0.09);
  --r: 1.45em;             /* bubble radius */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: "Schibsted Grotesk Variable", system-ui, sans-serif;
  font-size: clamp(11.5px, min(0.55vw + 8.6px, 1.75vh + 1.5px), 16.5px);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.scena {
  min-height: 100%;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 40px) clamp(10px, 3vw, 40px);
}

.chat {
  width: min(36em, 100%);
  background: var(--chat);
  border-radius: 1.6em;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 1px var(--linea),
    0 1px 1px rgba(34, 28, 24, 0.04),
    0 6px 14px -6px rgba(70, 40, 20, 0.12),
    0 28px 60px -24px rgba(70, 40, 20, 0.22);
  padding: 0.95em 1em 1.1em;
  position: relative;
}
.chat::before { /* a hairline of light along the top edge */
  content: ""; position: absolute; inset: 0 12% auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,1), transparent);
  border-radius: 1px;
}

.chat__testa {
  display: flex; align-items: center; gap: 0.7em;
  padding: 0 0.15em 0.85em;
  margin-bottom: 0.85em;
  border-bottom: 1px solid var(--linea);
}
.chat__nome { display: grid; line-height: 1.2; flex: 1; min-width: 0; }
.chat__nome strong { font-weight: 650; font-size: 1em; letter-spacing: -0.01em; }
.chat__stato { color: var(--grigio); font-size: 0.8em; }
.chat__ora { font-family: "Geist Mono Variable", ui-monospace, monospace; font-size: 0.7em; color: var(--grigio); white-space: nowrap; }

/* the round studio mark: the svg is centred by the grid, never by the line box */
.marchio {
  flex: none;
  width: 2.4em; height: 2.4em;
  border-radius: 50%;
  background: var(--accento);
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 2px 6px -2px rgba(150, 50, 20, 0.45);
}
.marchio svg { display: block; width: 62%; height: 62%; fill: none; stroke: #fff6ee; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.marchio--piccolo { width: 2.1em; height: 2.1em; }

.faq { list-style: none; display: grid; gap: 0.5em; }

.voce { display: grid; grid-template-columns: minmax(0, 1fr); }

.domanda {
  /* GSAP owns the width (100% at rest, half when open) and the border colour */
  width: 100%;
  justify-self: start;
  display: flex; align-items: center; gap: 0.75em;
  text-align: left;
  font: inherit; color: inherit;
  font-weight: 520; letter-spacing: -0.005em;
  line-height: 1.3;
  background: var(--bolla);
  border: 1px solid transparent;
  border-radius: var(--r) var(--r) var(--r) 0.3em;
  padding: 0.72em 0.62em 0.72em 1.05em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .25s ease;
}
.domanda__testo { flex: 1; min-width: 0; }
.domanda:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
@media (hover: hover) {
  .domanda:hover { background: var(--bolla-su); }
}

.segno {
  flex: none;
  width: 1.75em; height: 1.75em;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--chat);
  box-shadow: 0 0 0 1px var(--linea), 0 1px 2px rgba(34,28,24,.08);
}
.segno svg { display: block; width: 66%; height: 66%; fill: none; stroke: var(--inchiostro); stroke-width: 1.6; stroke-linecap: round; }

.segno { transition: background-color .3s ease, box-shadow .3s ease; }
.segno svg path { transition: stroke .3s ease; }
.aperta .segno { background: var(--accento); box-shadow: 0 0 0 1px rgba(0,0,0,0), 0 2px 6px -2px rgba(150, 50, 20, .45); }
.aperta .segno svg path { stroke: #fff6ee; }
@media (hover: hover) {
  .domanda:hover .segno { box-shadow: 0 0 0 1px rgba(34,28,24,.16), 0 2px 5px -1px rgba(34,28,24,.14); }
}

.risposta { height: 0; overflow: hidden; }
.risposta__riga {
  display: flex; justify-content: flex-end; align-items: flex-end; gap: 0.5em;
  padding-top: 0.5em;
}
.bolla {
  position: relative;
  max-width: min(76%, 25em);
  background: var(--inchiostro);
  color: var(--sulla-scura);
  border-radius: var(--r) var(--r) 0.3em var(--r);
  padding: 0.75em 1.05em 0.8em;
  line-height: 1.42;
  font-size: 0.97em;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 10px 24px -14px rgba(34, 28, 24, 0.55);
  transform-origin: 100% 100%;
  overflow: hidden; /* the rising text never shows below the bubble */
}
.bolla__testo { font-weight: 420; }

/* the typing dots: a small pill in the bottom right corner of the answer, the bubble is clipped to it while typing */
.puntini {
  position: absolute; right: 0; bottom: 0;
  width: 3.9em; height: 2.55em;
  display: flex; align-items: center; justify-content: center; gap: 0.3em;
  pointer-events: none;
}
.puntini i {
  display: block; width: 0.42em; height: 0.42em; border-radius: 50%;
  background: rgba(247, 239, 230, 0.55);
}

.meta {
  display: flex; justify-content: flex-end; align-items: center; gap: 0.6em;
  margin: 0.35em calc(2.1em + 0.5em) 0.2em 0;
  font-family: "Geist Mono Variable", ui-monospace, monospace;
  font-size: 0.66em; color: var(--grigio); letter-spacing: 0.01em;
}
.letto { display: inline-flex; align-items: center; gap: 0.35em; color: var(--accento); }
.letto svg { width: 1.7em; height: 0.95em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.letto path { stroke-dasharray: 1; stroke-dashoffset: 1; }

@media (max-width: 560px) {
  .chat { padding: 0.8em 0.75em 0.9em; border-radius: 1.3em; }
  .chat__ora { display: none; }
  .chat__testa { padding-bottom: 0.65em; margin-bottom: 0.65em; }
  .faq { gap: 0.4em; }
  .domanda { padding: 0.6em 0.5em 0.6em 0.9em; }
  .bolla { max-width: 82%; padding: 0.62em 0.9em 0.66em; }
}

@media (prefers-reduced-motion: reduce) {
  .domanda { transition: none; }
}
