/* Visto — token e componenti condivisi tra app e pagina cliente.
   Palette e caratteri dal brand book (ottobre 2026). */

:root {
  --crema: #fffdf7;
  --carta: #ffffff;
  --bosco: #003711;
  --bosco-hover: #0b4a1f;
  --oliva: #3b5d00;
  --rosso: #fa3333;
  --inchiostro: #e02a2a;
  --burro: #ffe06b;
  --burro-cornice: #f2c230;
  --burro-testo: #6b4e00;
  --lime: #e3e019;
  --verde-ok: #1e7b45;
  --verde-ok-fondo: #e8f3ea;
  --linea: #d6ded4;
  --linea-forte: #b9c6b6;
  --nebbia: #eef2ec;
  --testo: #003711;
  --testo-2: #56685a;
  --testo-3: #7d8c80;

  --font-marchio: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-testo: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 20px;

  --anim: 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--crema);
  color: var(--testo);
  font-family: var(--font-testo);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------- Marchio ---------- */

.logo {
  font-family: var(--font-marchio);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--rosso);
  line-height: 1;
  text-decoration: none;
}

h1,
h2,
.titolo {
  font-family: var(--font-marchio);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.005em;
  margin: 0;
}

/* ---------- Pulsanti ---------- */

.btn {
  --btn-bg: var(--bosco);
  --btn-fg: var(--crema);
  --btn-bd: var(--bosco);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1.5px solid var(--btn-bd);
  border-radius: var(--r-m);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--anim), border-color var(--anim), transform 80ms;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  --btn-bg: var(--bosco-hover);
  --btn-bd: var(--bosco-hover);
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn--chiaro {
  --btn-bg: var(--nebbia);
  --btn-fg: var(--bosco);
  --btn-bd: var(--nebbia);
}
.btn--chiaro:hover {
  --btn-bg: #e2e9df;
  --btn-bd: #e2e9df;
}

.btn--bordo {
  --btn-bg: transparent;
  --btn-fg: var(--bosco);
  --btn-bd: var(--linea-forte);
}
.btn--bordo:hover {
  --btn-bg: var(--nebbia);
  --btn-bd: var(--linea-forte);
}

.btn--whatsapp {
  --btn-bg: #1f7a4a;
  --btn-bd: #1f7a4a;
}
.btn--whatsapp:hover {
  --btn-bg: #186a3f;
  --btn-bd: #186a3f;
}

.btn--piccolo {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: var(--r-s);
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--bosco);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  cursor: pointer;
}

/* ---------- Campi ---------- */

.campo {
  display: grid;
  gap: 6px;
}
.campo > span {
  font-size: 14px;
  font-weight: 600;
}
.campo small {
  color: var(--testo-2);
  font-size: 13px;
}
.input,
.campo input,
.campo textarea,
.campo select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--linea-forte);
  border-radius: var(--r-s);
  background: var(--carta);
  font-size: 16px;
}
.campo textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}
.input:focus,
.campo input:focus,
.campo textarea:focus,
.campo select:focus {
  outline: none;
  border-color: var(--bosco);
  box-shadow: 0 0 0 3px rgba(227, 224, 25, 0.55);
}

/* ---------- Stato (etichette sempre leggibili) ---------- */

.stato {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.stato::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.stato--draft {
  color: var(--testo-2);
}
.stato--pending {
  color: var(--bosco);
}
.stato--approved {
  color: var(--verde-ok);
}
.stato--changes {
  color: var(--burro-testo);
}
.stato--changes::before {
  background: var(--burro-cornice);
}

/* ---------- Anteprima post (feed realistico) ---------- */

.feed {
  background: var(--carta);
  color: #0f1419;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
}
.feed__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.feed__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--nebbia);
}
.feed__avatar--testo {
  display: grid;
  place-items: center;
  font-family: var(--font-marchio);
  font-weight: 700;
  font-size: 14px;
  color: var(--crema);
  background: var(--oliva);
}
.feed__who {
  min-width: 0;
  flex: 1;
}
.feed__name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #65676b;
  font-size: 12px;
}
.feed__meta svg {
  width: 12px;
  height: 12px;
}
.feed__more {
  width: 20px;
  height: 20px;
  color: #262626;
  flex: none;
}
.feed__media {
  position: relative;
  background: #f0f0f0;
  aspect-ratio: 1 / 1;
}
.feed__media--portrait {
  aspect-ratio: 4 / 5;
}
.feed__media--story {
  aspect-ratio: 9 / 16;
}
.feed__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.feed__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 4px;
  color: #262626;
}
.feed__actions svg {
  width: 24px;
  height: 24px;
}
.feed__actions .feed__save {
  margin-left: auto;
}
.feed__caption {
  padding: 4px 12px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.feed__caption--sopra {
  padding: 0 12px 10px;
}
.feed__caption b {
  font-weight: 600;
  margin-right: 4px;
}
.feed__caption.is-corta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* il padding sotto mostrerebbe la riga tagliata: lo spazio lo dà il margine */
  padding-bottom: 0;
  margin-bottom: 4px;
}
.feed__altro {
  border: 0;
  background: none;
  padding: 0 12px 12px;
  color: #737373;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.feed__bar {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid #e4e6eb;
  margin: 0 12px;
  padding: 6px 0 8px;
  color: #65676b;
  font-weight: 600;
  font-size: 13px;
}
.feed__bar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.feed__bar svg {
  width: 18px;
  height: 18px;
}

/* TikTok: verticale con testo sopra l'immagine */
.feed--tiktok {
  background: #000;
  color: #fff;
}
.feed--tiktok .feed__media {
  aspect-ratio: 9 / 16;
  background: #111;
}
.feed__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 48px 56px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  font-size: 13px;
}
.feed__overlay b {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}
.feed__overlay p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.feed__rail {
  position: absolute;
  right: 8px;
  bottom: 18px;
  display: grid;
  gap: 16px;
  justify-items: center;
}
.feed__rail svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* Carosello */
.feed__media--giostra {
  overflow: hidden;
  touch-action: pan-y;
}
.giostra {
  display: flex;
  height: 100%;
  transition: transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.feed__media .giostra img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}
.giostra__conta {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 20, 25, 0.7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.giostra__freccia {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0f1419;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.giostra__freccia[hidden] {
  display: none;
}
.giostra__freccia svg {
  width: 16px;
  height: 16px;
}
.giostra__freccia--prima {
  left: 8px;
}
.giostra__freccia--dopo {
  right: 8px;
}
.giostra__freccia--dopo svg {
  transform: rotate(180deg);
}
.giostra__punti {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 0 0;
}
.feed__actions .giostra__punti {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 0;
}
.feed__actions {
  position: relative;
}
.giostra__punti span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7c7c7;
}
.giostra__punti span.is-ora {
  background: #0095f6;
}
.feed--facebook .giostra__punti span.is-ora,
.feed--linkedin .giostra__punti span.is-ora {
  background: #65676b;
}

/* Storia */
.feed--storia {
  border-radius: 12px;
  background: #111;
}
.feed--storia .feed__media {
  background: #222;
}
.storia-barra {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 2;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.45);
}
.storia-barra span {
  display: block;
  width: 35%;
  height: 100%;
  border-radius: 2px;
  background: #fff;
}
.storia-chi {
  position: absolute;
  top: 18px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.storia-chi .feed__avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}
.storia-chi span:last-child {
  opacity: 0.8;
}
.storia-risposta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 13px;
}
.storia-risposta span:first-child {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
}
.storia-risposta span:last-child {
  display: flex;
  gap: 12px;
}
.storia-risposta svg {
  width: 22px;
  height: 22px;
}
.feed-storia__testo {
  margin: 8px 12px 0;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.feed__etichetta {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Timbro "visto" ---------- */

.timbro {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 2;
  display: grid;
  justify-items: center;
  padding: 4px 12px 6px;
  border: 3px solid var(--inchiostro);
  border-radius: 10px;
  color: var(--inchiostro);
  background: rgba(255, 253, 247, 0.82);
  transform: rotate(-9deg);
  mix-blend-mode: multiply;
  pointer-events: none;
  box-shadow: inset 0 0 0 1.5px rgba(255, 253, 247, 0.9), inset 0 0 0 3px var(--inchiostro);
}
.timbro b {
  font-family: var(--font-marchio);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
}
.timbro small {
  font-family: var(--font-testo);
  font-weight: 600;
  font-size: 10px;
  line-height: 1.2;
  margin-top: 2px;
}
.timbro.is-nuovo {
  animation: timbra 420ms cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
@keyframes timbra {
  0% {
    opacity: 0;
    transform: rotate(-9deg) scale(1.9);
  }
  60% {
    opacity: 1;
    transform: rotate(-9deg) scale(0.94);
  }
  100% {
    transform: rotate(-9deg) scale(1);
  }
}

/* ---------- Avvisi brevi ---------- */

.toast-zona {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--r-m);
  background: var(--bosco);
  color: var(--crema);
  font-size: 15px;
  pointer-events: auto;
  animation: entra 200ms ease-out both;
}
.toast--errore {
  background: #7a1d1d;
}
@keyframes entra {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
