/* stile.css — mondo · Stock Gain. I token stanno qui e in DESIGN.md con gli stessi nomi; nei componenti niente valori a mano. */
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 100% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --nero: #000000;
  --bianco: #fefefe;
  --oro: #f0b429;
  --rosa: #ef9696;
  --bg-app: #121212;
  --bg-elevated: #1a1a1a;
  --bg-elevated-2: #222222;
  --text: #ececec;
  --text-muted: #a8a8a8;
  --text-faint: #8f8f8f;
  --filo: rgba(254, 254, 254, 0.08);
  --filo-forte: rgba(254, 254, 254, 0.16);
  --oro-tenue: rgba(240, 180, 41, 0.14);
  --velo: rgba(0, 0, 0, 0.6);

  --fs-xs: 12px;
  --fs-s: 13px;
  --fs-m: 15px;
  --fs-l: 18px;
  --fs-titolo: 32px;
  --fs-accesso: 40px;
  --moneta: 160px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --r-sm: 8px;
  --r: 12px;
  --r-pill: 999px;
  --ombra-2: 0 16px 48px rgba(0, 0, 0, 0.6);
  --bersaglio: 44px;
  --larghezza-menu: 288px;
  --altezza-barra: 56px;

  --font: "Archivo", ui-sans-serif, sans-serif;
  --largo: 118%;
  --curva: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-press: 120ms;
  --dur-menu: 200ms;

  --icona-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E");
  --icona-lucchetto: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
  --icona-freccia: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --icona-esterno: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--oro);
  accent-color: var(--oro);
}
::selection { background: var(--oro); color: var(--nero); }
h1 { font-stretch: var(--largo); font-weight: 700; font-size: var(--fs-titolo); line-height: 1.15; margin: 0 0 var(--sp-2); color: var(--bianco); text-wrap: balance; letter-spacing: -0.01em; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }

.icona { display: inline-block; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; flex: none; }
.icona-menu { --m: var(--icona-menu); width: 24px; height: 24px; }
.icona-lucchetto { --m: var(--icona-lucchetto); width: 16px; height: 16px; }
.icona-esterno { --m: var(--icona-esterno); width: 16px; height: 16px; }

.caricamento { padding: var(--sp-6); color: var(--text-faint); margin: 0; }

/* ── Fuori ─────────────────────────────────────────────── */
.accesso { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; max-width: 480px; padding: var(--sp-7) var(--sp-5); margin: 0 auto; text-align: center; }
.accesso-logo { width: var(--moneta); height: var(--moneta); display: block; margin-bottom: var(--sp-6); }
.accesso h1 { font-size: var(--fs-accesso); }
.accesso-testo { color: var(--text-muted); font-size: var(--fs-l); margin: 0 0 var(--sp-7); max-width: 36ch; }
.accesso .azioni { justify-content: center; }
.messaggio { min-height: 1.5em; margin: var(--sp-3) 0 0; color: var(--rosa); font-size: var(--fs-s); }
.versione-piede { margin: var(--sp-6) 0 0; font-size: var(--fs-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* La pillola del Secchione (regola 31, copiata da siti-belli/bottone-google.html) col bottone vero di Google sopra, trasparente (modo Management). */
.btn-google-posto { position: relative; display: inline-block; max-width: 100%; border-radius: 24px; }
.btn-google-posto:focus-within { outline: 2px solid #8ab4f8; outline-offset: 3px; }
.btn-google-reale { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; opacity: .01; border-radius: 24px; }
.btn-google-reale > * { transform: scaleY(1.12); transform-origin: center; }
@media (hover: hover) and (pointer: fine) {
  .btn-google-posto:hover .btn-google { background: #f8f9fa; border-color: #c6c9cc; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
}

/* ── Dentro ────────────────────────────────────────────── */
.barra { position: sticky; top: var(--mondo-barra-h, 0px); z-index: 5; height: var(--altezza-barra); display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-3); background: var(--nero); border-bottom: 1px solid var(--filo); }
.barra-logo, .menu-logo { border-radius: 50%; }
.barra-nome, .menu-nome { font-stretch: var(--largo); font-weight: 700; color: var(--bianco); }
.hamburger { width: var(--bersaglio); height: var(--bersaglio); display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); cursor: pointer; }

.menu {
  position: fixed; top: var(--mondo-barra-h, 0px); bottom: 0; left: 0; z-index: 20; width: min(var(--larghezza-menu), 86vw);
  display: flex; flex-direction: column; background: var(--nero); border-right: 1px solid var(--filo);
  transform: translateX(-100%); transition: transform var(--dur-menu) var(--curva); box-shadow: var(--ombra-2);
}
.menu.aperto { transform: translateX(0); }
.velo { position: fixed; inset: var(--mondo-barra-h, 0px) 0 0 0; z-index: 10; background: var(--velo); }
.menu-testa { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4) var(--sp-4); }

.programmi { list-style: none; margin: 0; padding: 0 var(--sp-2); flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-1); }
.programma {
  display: flex; align-items: center; gap: var(--sp-3); min-height: var(--bersaglio); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-weight: 600;
  transition: transform var(--dur-press) var(--curva);
}
.programma .nome { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.programma .icona { color: var(--text-faint); }
a.programma:active { transform: scale(0.97); }
a.programma:focus-visible { background: var(--oro-tenue); }
a.programma[aria-current="page"] { background: var(--filo); color: var(--bianco); }
.programma.chiuso { color: var(--text-faint); font-weight: 400; }
.programma.chiuso .logo { opacity: .45; }
.logo { width: 24px; height: 24px; flex: none; border-radius: 6px; object-fit: contain; display: grid; place-items: center; }
.logo.tondo { border-radius: 50%; }
.logo-emoji { font-size: 19px; line-height: 1; }
@media (hover: hover) and (pointer: fine) {
  a.programma:hover { background: var(--oro-tenue); }
  a.programma:hover .icona { color: var(--oro); }
}

/* La scheda utente del Secchione (regola 33, da siti-belli/scheda-utente.html). */
.piede-menu { border-top: 1px solid var(--filo); padding: var(--sp-3) var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.scheda-utente { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--bersaglio); padding: var(--sp-3); border: 0; border-radius: var(--r); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.scheda-utente:focus-visible { background: var(--oro-tenue); }
.scheda-utente .avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--oro-tenue); color: var(--oro); font-weight: 700; font-size: 15px; overflow: hidden; }
.scheda-utente .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.scheda-utente .nm, .scheda-utente .em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scheda-utente .nm { font-size: var(--fs-s); font-weight: 600; }
.scheda-utente .em { font-size: var(--fs-xs); color: var(--text-faint); }
.scheda-utente .nm-esci { display: none; color: var(--oro); }
.scheda-utente:focus-visible .nm-nome { display: none; }
.scheda-utente:focus-visible .nm-esci { display: inline; }
@media (hover: hover) and (pointer: fine) {
  .scheda-utente:hover { background: var(--oro-tenue); }
  .scheda-utente:hover .nm-nome { display: none; }
  .scheda-utente:hover .nm-esci { display: inline; }
}
.conferma-esci { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); background: var(--oro-tenue); font-size: var(--fs-s); }
.conferma-esci .dom { flex: 1 0 100%; font-weight: 600; }
.conferma-esci button { min-height: 32px; border: 1px solid var(--filo-forte); background: transparent; color: inherit; border-radius: var(--r-pill); padding: var(--sp-1) var(--sp-3); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.conferma-esci .si { background: var(--oro); border-color: var(--oro); color: var(--nero); }
.versione { font-size: var(--fs-xs); color: var(--text-faint); padding-left: var(--sp-3); font-variant-numeric: tabular-nums; }

.palco { padding: var(--sp-7) var(--sp-5) var(--sp-8); max-width: 720px; }

/* Le pagine di servizio del passaggio (/passa): un messaggio, due bottoni. */
.azioni { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.bottone { display: inline-flex; align-items: center; justify-content: center; min-height: var(--bersaglio); padding: 0 var(--sp-5); border: 1px solid var(--oro); border-radius: var(--r-pill); background: var(--oro); color: var(--nero); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform var(--dur-press) var(--curva); }
.bottone.secondario { background: transparent; border-color: var(--filo-forte); color: var(--text); }
.bottone:active { transform: scale(0.97); }
.riassunto { font-size: var(--fs-l); color: var(--text-muted); margin: 0 0 var(--sp-5); font-variant-numeric: tabular-nums; }
.nota { color: var(--text-faint); font-size: var(--fs-s); margin: 0; max-width: 60ch; }

/* La pagina «Impostazioni»: un gruppo apribile con le sue scelte, righe intere da cliccare. */
.solo-lettore { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gruppo { margin-top: var(--sp-6); background: var(--bg-elevated); border-radius: var(--r); }
.gruppo > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--sp-8); padding: var(--sp-3) var(--sp-4); border-radius: var(--r); font-weight: 600; font-size: var(--fs-l); color: var(--bianco); cursor: pointer; list-style: none; }
.gruppo > summary::-webkit-details-marker { display: none; }
.gruppo > summary::after { content: ""; flex: none; width: 20px; height: 20px; background: var(--text-muted); -webkit-mask: var(--icona-freccia) center / contain no-repeat; mask: var(--icona-freccia) center / contain no-repeat; transition: transform var(--dur-menu) var(--curva); }
.gruppo[open] > summary::after { transform: rotate(180deg); }
.gruppo-corpo { padding: 0 var(--sp-2) var(--sp-4); }
.scelte { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.scelta { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: var(--bersaglio); padding: var(--sp-3) var(--sp-2); border-radius: var(--r-sm); cursor: pointer; }
.scelta input { flex: none; width: 20px; height: 20px; margin: var(--sp-1) 0 0; }
.scelta > span { display: flex; flex-direction: column; min-width: 0; }
.scelta-nome { font-weight: 600; color: var(--bianco); }
.scelta-testo { color: var(--text-muted); }
.scelta:has(input:checked) { background: var(--oro-tenue); }
.scelta:has(input:focus-visible) { outline: 2px solid var(--oro); outline-offset: -2px; }
.scelte:disabled .scelta { cursor: default; opacity: .45; }
.stato { min-height: 1.5em; margin: var(--sp-3) var(--sp-2) 0; font-weight: 600; color: var(--text-muted); }
.stato[data-esito="ok"] { color: var(--oro); }
.stato[data-esito="errore"] { color: var(--rosa); }
#riprova-barra { margin: var(--sp-3) var(--sp-2) 0; }
.nota-barra { margin: var(--sp-3) var(--sp-2) 0; max-width: 60ch; font-size: var(--fs-s); color: var(--text-muted); }
@media (hover: hover) and (pointer: fine) { .scelte:not(:disabled) .scelta:not(:has(input:checked)):hover { background: var(--filo); } }

@media (min-width: 1024px) {
  .barra, .velo, .hamburger { display: none !important; }
  .menu { transform: none; box-shadow: none; transition: none; }
  .palco { margin-left: var(--larghezza-menu); padding: var(--sp-8) var(--sp-7); }
}
@media (max-width: 759px) {
  body { font-size: 16px; }
  :root { --fs-titolo: 28px; --fs-accesso: 36px; --moneta: 144px; }
  .palco { padding: var(--sp-6) var(--sp-4) var(--sp-8); }
}
@media (prefers-reduced-motion: reduce) {
  .menu, .programma, .gruppo > summary::after { transition: none; }
}

/* Il link all'informativa: piccolo, sottolineato, nella scheda utente e sotto il bottone d'accesso. */
.informativa { font-size: var(--fs-xs); color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; padding-left: var(--sp-3); }
.nota-privacy { margin: var(--sp-5) 0 0; }
.nota-privacy .informativa { padding-left: 0; font-size: var(--fs-s); }
.informativa:focus-visible { background: var(--oro-tenue); }
@media (hover: hover) and (pointer: fine) { .informativa:hover { color: var(--oro); } }

/* Con la suite la barra dei programmi è l'unica striscia in alto: sul telefono la testata di mondo non c'è (la moneta apre il cassetto). */
:root[data-mondo-barra="si"] .barra { display: none; }
