/*
  Il sistema visivo comune al sito, all'app e al pannello: i colori dal logo (nero e taupe), Inter per
  tutto, i bottoni, i campi, le pillole, il caricamento con il logo, avvisi e finestre, le entrate animate.
*/
@import url('../vendor/fonts/fonts.css');

:root {
  --bianco: #ffffff;
  --fondo: #fbfbfa;
  --fondo-2: #f4f3f1;
  --fondo-3: #ecebe8;
  --inchiostro: #0b0b0c;
  --inchiostro-2: #3a3a3f;
  --grigio: #86868b;
  --grigio-2: #aeaeb2;
  --linea: #e8e7e4;
  --linea-2: #d8d7d3;
  --taupe: #b39a85;
  --taupe-scuro: #8a7462;
  --taupe-chiaro: #efe7df;
  --taupe-alone: rgba(179, 154, 133, .22);
  --notte: #08080a;
  --notte-linea: #26262c;
  --testo-notte: #f5f5f7;
  --grigio-notte: #9b9ba1;
  --rosso: #ff3b30;
  --verde: #1f9d57;
  /* il rosso delle cose che non si disfano (cancellare) e dei guasti nel pannello */
  --guasto: #c62828;

  --ombra-1: 0 1px 2px rgba(15, 15, 20, .04), 0 1px 1px rgba(15, 15, 20, .03);
  --ombra-2: 0 2px 6px rgba(15, 15, 20, .04), 0 14px 36px rgba(15, 15, 20, .07);
  --ombra-3: 0 40px 90px rgba(15, 15, 20, .18), 0 8px 24px rgba(15, 15, 20, .08);

  --r-l: 22px;
  --r-xl: 30px;

  --facile: cubic-bezier(.2, .8, .2, 1);
  --molla: cubic-bezier(.34, 1.4, .64, 1);

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  --larghezza: 1240px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--inchiostro);
  font: 400 16px/1.55 var(--sans);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, canvas, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--taupe-chiaro); }

/* ---------------------------------------------------------------- tipografia */
.titolo-xl, .titolo-m {
  margin: 0;
  font-weight: 600;
  text-wrap: balance;
}
.titolo-xl { font-size: clamp(36px, 5.4vw, 68px); line-height: 1.0; letter-spacing: -.04em; }
.titolo-m { font-size: 22px; line-height: 1.25; letter-spacing: -.02em; }
.testo-l { font-size: clamp(17px, 1.5vw, 21px); line-height: 1.5; color: var(--inchiostro-2); margin: 0; text-wrap: pretty; }
.testo { font-size: 16px; line-height: 1.6; color: var(--inchiostro-2); margin: 0; }
.testo-s { font-size: 14px; line-height: 1.5; color: var(--grigio); margin: 0; }
.numeri { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- struttura */
.contenitore { width: min(var(--larghezza), 100%); margin-inline: auto; padding-inline: 24px; }
.riga { display: flex; align-items: center; gap: var(--spazio, 12px); flex-wrap: wrap; }
.spinta { margin-left: auto; }

/* ---------------------------------------------------------------- bottoni */
.bottone {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 550; letter-spacing: -.01em; white-space: nowrap;
  transition: background .25s var(--facile), border-color .25s var(--facile), color .25s var(--facile),
    box-shadow .35s var(--facile), transform .25s var(--facile), opacity .25s;
  user-select: none;
}
.bottone svg { width: 18px; height: 18px; stroke-width: 1.8; }
.bottone:active { transform: scale(.97); }
.bottone:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--taupe-alone); }
.bottone--primario { background: var(--inchiostro); color: #fff; }
.bottone--primario:hover { background: #222226; box-shadow: 0 8px 24px rgba(11, 11, 12, .22), 0 0 0 6px var(--taupe-alone); }
.bottone--chiaro { background: var(--bianco); border-color: var(--linea-2); color: var(--inchiostro); }
.bottone--chiaro:hover { border-color: var(--inchiostro); }
.bottone--fantasma { background: transparent; color: var(--inchiostro-2); }
.bottone--fantasma:hover { background: var(--fondo-2); color: var(--inchiostro); }
.bottone--notte { background: #fff; color: var(--inchiostro); }
.bottone--notte:hover { box-shadow: 0 0 0 6px rgba(255, 255, 255, .14), 0 10px 30px rgba(0, 0, 0, .4); }
.bottone--vetro { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; }
.bottone--vetro:hover { background: rgba(255, 255, 255, .14); }
.bottone--grande { height: 54px; padding: 0 28px; font-size: 16px; }
.bottone--piccolo { height: 34px; padding: 0 14px; font-size: 13.5px; }
.bottone--tondo { width: 40px; padding: 0; }
.bottone[disabled], .bottone.spento { opacity: .35; pointer-events: none; }
/* un bottone che sceglie un file: il campo vero e' invisibile sopra il bottone */
.bottone-file { position: relative; overflow: hidden; }
.bottone-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------------------------------------------------------------- campi */
.campo-etichetta { display: block; font-size: 13.5px; font-weight: 550; color: var(--inchiostro-2); margin-bottom: 8px; }
.campo {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--linea-2); background: var(--bianco); font-size: 16px;
  transition: border-color .2s, box-shadow .25s var(--facile);
}
.campo::placeholder { color: var(--grigio-2); }
.campo:focus { outline: none; border-color: var(--inchiostro); box-shadow: 0 0 0 4px var(--taupe-alone); }

/* ---------------------------------------------------------------- pillole */
.pillola {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px;
  border-radius: 999px; font-size: 12.5px; font-weight: 550; letter-spacing: -.005em;
  background: var(--fondo-2); color: var(--inchiostro-2); white-space: nowrap;
}
.pillola::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pillola--pronta { background: #e9f6ee; color: var(--verde); }
.pillola--lavora { background: var(--taupe-chiaro); color: var(--taupe-scuro); }
.pillola--lavora::before { animation: battito 1.4s ease-in-out infinite; }
.pillola--bozza { background: var(--fondo-2); color: var(--grigio); }
@keyframes battito { 50% { transform: scale(1.8); opacity: .25; } }

/* controllo a segmenti, come in iOS */
.segmenti { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--fondo-2); border: 1px solid var(--linea); }
.segmenti button {
  border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 550; color: var(--grigio); transition: all .25s var(--facile);
}
.segmenti button.attivo { background: var(--bianco); color: var(--inchiostro); box-shadow: var(--ombra-1), 0 0 0 1px var(--linea); }
.segmenti--notte { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); }
.segmenti--notte button { color: var(--grigio-notte); }
.segmenti--notte button.attivo { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }

/* ---------------------------------------------------------------- Rosa al lavoro */
.marta {
  display: inline-flex; align-items: center; gap: 10px; height: 34px; padding: 0 14px 0 6px;
  border-radius: 999px; background: var(--bianco); border: 1px solid var(--linea); box-shadow: var(--ombra-1);
  font-size: 13.5px; font-weight: 550; color: var(--inchiostro-2);
}
.marta--notte { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: var(--testo-notte); box-shadow: none; }
.marta-sfera {
  position: relative; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 30% 30%, #fff 0, #e3d6ca 22%, var(--taupe) 55%, #5f4f43 100%);
  box-shadow: 0 0 0 0 var(--taupe-alone);
  animation: respiro 2.4s var(--facile) infinite;
}
.marta-sfera::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 1.5px solid transparent; border-top-color: var(--taupe); border-right-color: rgba(179, 154, 133, .4);
  animation: giro 1.1s linear infinite;
}
.marta.ferma .marta-sfera { animation: none; }
.marta.ferma .marta-sfera::after { display: none; }
@keyframes respiro { 50% { transform: scale(.86); box-shadow: 0 0 0 6px rgba(179, 154, 133, .12); } }
@keyframes giro { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- caricamento: il logo che si muove */
.caricamento {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: var(--fondo); transition: opacity .7s var(--facile), visibility .7s;
}
.caricamento--notte { background: var(--notte); }
.caricamento.via { opacity: 0; visibility: hidden; }
.caricamento-logo { position: relative; width: 92px; height: 103px; }
.caricamento-logo img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  animation-duration: 1.9s; animation-timing-function: var(--facile); animation-iteration-count: infinite;
}
.caricamento-logo .sx { animation-name: pannello-sx; }
.caricamento-logo .dx { animation-name: pannello-dx; }
.caricamento--notte .caricamento-logo .sx { filter: invert(1) brightness(1.8); }
@keyframes pannello-sx {
  0% { transform: translate(-22px, 10px) skewY(8deg); opacity: 0; }
  35%, 70% { transform: none; opacity: 1; }
  100% { transform: translate(-6px, -4px); opacity: 0; }
}
@keyframes pannello-dx {
  0%, 12% { transform: translate(22px, -12px) skewY(-8deg); opacity: 0; }
  45%, 72% { transform: none; opacity: 1; }
  100% { transform: translate(6px, 4px); opacity: 0; }
}
.caricamento-riga {
  position: absolute; left: 50%; bottom: calc(50% - 96px); transform: translateX(-50%);
  width: 120px; height: 2px; border-radius: 2px; background: var(--linea); overflow: hidden;
}
.caricamento--notte .caricamento-riga { background: var(--notte-linea); }
.caricamento-riga::after {
  content: ''; position: absolute; inset: 0; width: 40%; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--taupe), transparent);
  animation: corsa 1.3s var(--facile) infinite;
}
@keyframes corsa { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------------------------------------------------------------- avvisi e finestre */
.avvisi { position: fixed; z-index: 900; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.avviso {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px;
  background: var(--inchiostro); color: #fff; box-shadow: var(--ombra-3); font-size: 14.5px;
  animation: entra-su .45s var(--molla);
}
.avviso a { margin-left: auto; font-weight: 600; color: #e7d7c8; }
.avviso.via { animation: esce .3s var(--facile) forwards; }
@keyframes entra-su { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes esce { to { opacity: 0; transform: translateY(8px); } }

.velo {
  position: fixed; inset: 0; z-index: 800; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 10, 12, .38); animation: appare .3s var(--facile);
}
.finestra {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--bianco); border-radius: var(--r-xl); box-shadow: var(--ombra-3); padding: 28px;
  animation: entra-su .45s var(--molla);
}
@keyframes appare { from { opacity: 0; } }

/* Rosa al lavoro a tutto schermo */
.marta-lavora {
  position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; padding: 24px;
  background: rgba(251, 251, 250, .94); animation: appare .4s var(--facile);
}
.marta-lavora.via { opacity: 0; transition: opacity .5s var(--facile); }
.marta-lavora-corpo { display: grid; justify-items: center; gap: 14px; text-align: center; width: min(420px, 100%); }
.marta-lavora-sfera { position: relative; width: 84px; height: 84px; margin-bottom: 10px; }
.marta-lavora-sfera span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff 0, #eadfd4 18%, var(--taupe) 52%, #4d3f35 100%);
  animation: respiro 2.6s var(--facile) infinite;
}
.marta-lavora-sfera span:nth-child(2) { inset: -14px; background: none; border: 1.5px solid var(--taupe-alone); animation: onda 2.6s var(--facile) infinite; }
.marta-lavora-sfera span:nth-child(3) { inset: -28px; background: none; border: 1px solid rgba(179, 154, 133, .14); animation: onda 2.6s .5s var(--facile) infinite; }
@keyframes onda { 0% { transform: scale(.8); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
.marta-lavora-titolo { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.03em; }
.marta-lavora-passo { margin: 0; min-height: 24px; color: var(--grigio); font-size: 15.5px; }
.entra-passo { animation: entra-pagina .5s var(--facile); }
.marta-lavora-barra { width: 220px; height: 3px; border-radius: 3px; background: var(--linea); overflow: hidden; margin-top: 8px; }
.marta-lavora-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--taupe-scuro), var(--taupe)); transform-origin: left; transform: scaleX(0); }

/* cambio pagina: il browser passa dalla vecchia alla nuova con una dissolvenza breve, e il menu laterale resta fermo */
@view-transition { navigation: auto; }
.lato { view-transition-name: menu; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
::view-transition { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* entrata delle pagine e dei blocchi */
.entra { animation: entra-pagina .8s var(--facile) both; }
.entra--dopo { animation-delay: .08s; }
@keyframes entra-pagina { from { opacity: 0; transform: translateY(14px); } }
.rivela { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--facile), transform 1s var(--facile); }
.rivela.vista { opacity: 1; transform: none; }

/* lingua */
.lingua { display: inline-flex; gap: 2px; font-size: 13px; font-weight: 600; }
.lingua button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--grigio); }
.lingua button.attivo { color: var(--inchiostro); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .rivela { opacity: 1; transform: none; }
}
