/*
 * Studenti Livatino, area riservata: accesso, iscrizione, nuova password,
 * privacy, schede interne, scambio libri, approvazioni. Stesso linguaggio
 * delle pagine pubbliche: fondo bianco, fili sottili, etichette in Cinzel,
 * niente ombre e niente angoli tondi. Le variabili sono quelle di stile.css,
 * che va caricato prima di questo file.
 */

:root {
  /* Rosso spento per le azioni che cancellano: 6,9:1 sul bianco. */
  --mattone: #9a3a2e;
}

/* ------------------------------------------------------- TESTATA, DESTRA
 * Nella terza colonna della testata: il collegamento all'area e le lingue.
 * Sta qui perche' compare su tutte le pagine: questo file va caricato
 * ovunque, non solo nell'area. */
.destra {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  min-width: 0;
}
.accesso {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-right: clamp(14px, 2.4vw, 28px);
  border-right: 1px solid var(--filo);
  font-family: var(--epigrafe);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--testo);
  transition: opacity .25s ease;
}
.accesso:hover { opacity: .6; }

/* Sul telefono stretto l'accesso resta solo nel menu. */
@media (max-width: 520px) {
  .accesso { display: none; }
}

/* ------------------------------------------------------- AMBIENTE DI PROVA */
.fascia-prova {
  margin: 0;
  padding: 11px 16px;
  background: var(--sabbia);
  color: var(--testo);
  text-align: center;
  font-family: var(--epigrafe);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .22em;
  line-height: 1.6;
  text-transform: uppercase;
}

/* Il capo delle pagine riservate e' piu' basso: subito al modulo. */
.capo--stretto {
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: clamp(24px, 4vw, 40px);
}
.capo--stretto h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------- AVVISI
 * Errore e conferma si distinguono anche in bianco e nero: filo spesso per
 * l'errore, filo sottile per la conferma. */
.avviso {
  width: min(640px, calc(100% - 32px));
  margin: 0 auto 2.4rem;
  padding: 18px 22px;
  background: var(--crema);
  border-left: 1px solid var(--testo);
  font-size: 1.05rem;
  line-height: 1.5;
}
.avviso p { margin: 0; }
.avviso p + p { margin-top: .9rem; }
.avviso--ok { border-left: 1px solid var(--testo); }
.avviso--errore { border-left: 5px solid var(--mattone); }

/* Il collegamento da copiare va a capo dove serve e si seleziona tutto
   con un tocco. */
.avviso-link code {
  display: block;
  padding: 10px 12px;
  background: var(--carta);
  border: 1px solid var(--filo);
  font-family: ui-monospace, Consolas, "Liberation Mono", monospace;
  font-size: .8rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}

/* ---------------------------------------------------------------- MODULI */
.modulo-pagina {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px clamp(72px, 9vw, 120px);
}
.modulo-pagina .sottotitolo { text-align: center; margin-bottom: 2.4rem; }

.modulo {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  margin: 0;
}

.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo-etichetta {
  font-family: var(--epigrafe);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--testo);
}
.campo-aiuto {
  font-size: .9rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--tenue);
}

/* Solo la linea sotto, scura abbastanza da vedersi (5,7:1). */
.campo input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--tenue);
  border-radius: 0;
  background: transparent;
  color: var(--testo);
  font: inherit;
  transition: background-color .2s ease, border-color .2s ease;
}
/* Il fuoco ispessisce la linea e scalda il fondo. Il contorno trasparente
   resta per la modalita' ad alto contrasto, dove la linea in piu' sparisce. */
.campo input:focus {
  outline: 2px solid transparent;
  border-bottom-color: var(--testo);
  box-shadow: 0 2px 0 0 var(--testo);
  background: var(--crema);
}
/* Dopo che si e' scritto qualcosa di sbagliato: linea rossa e piu' spessa. */
.campo input:user-invalid {
  border-bottom: 2px solid var(--mattone);
}

/* Due campi affiancati solo dove c'e' spazio. */
.due { display: grid; gap: 1.6rem; }
.due > * { min-width: 0; }
@media (min-width: 640px) {
  .due { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
}

/* Caselle di spunta: tutta la riga si tocca, alta almeno 44px. */
.spunta {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 44px;
  padding: 8px 0;
  font-size: 1rem;
  line-height: 1.45;
  cursor: pointer;
}
.modulo .spunta + .spunta { margin-top: -1rem; }
.spunta input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--testo);
  cursor: pointer;
}
.spunta input:focus-visible { outline: 2px solid var(--testo); outline-offset: 3px; }
.spunta a, .piccolo a { text-underline-offset: 4px; }

/* Campo per i programmi automatici: fuori dallo schermo, ma nel modulo. */
.trappola {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --------------------------------------------------------------- BOTTONI */
.bottone, .bottone-leggero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 32px;
  border: 1px solid var(--testo);
  border-radius: 0;
  font-family: var(--epigrafe);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .24em;
  line-height: 1.3;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
.bottone { background: var(--testo); color: var(--carta); }
.bottone:hover { background: var(--inchiostro); border-color: var(--inchiostro); }

.bottone-leggero {
  min-height: 44px;
  padding: 10px 22px;
  font-size: .62rem;
  background: transparent;
  color: var(--testo);
}
.bottone-leggero:hover { background: var(--testo); color: var(--carta); }

.bottone-pericolo { border-color: var(--mattone); color: var(--mattone); }
.bottone-pericolo:hover { background: var(--mattone); border-color: var(--mattone); color: var(--carta); }
.bottone.bottone-pericolo { background: var(--mattone); color: var(--carta); }

.bottone:focus-visible, .bottone-leggero:focus-visible {
  outline: 2px solid var(--testo);
  outline-offset: 3px;
}

.modulo .bottone { width: 100%; margin-top: .8rem; }

.in-linea { display: inline-block; margin: 0; }
.voce--libro .in-linea { margin-top: 1.2rem; }

.azioni {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 1.2rem;
}

/* ----------------------------------------------------------------- SCHEDE
 * Le sezioni dell'area in una riga. Sul telefono la riga scorre da sola,
 * la pagina resta ferma. I margini automatici la centrano quando ci sta
 * e la lasciano partire da sinistra quando non ci sta. */
.schede {
  display: flex;
  align-items: center;
  column-gap: clamp(20px, 3vw, 36px);
  max-width: var(--largo);
  margin: 0 auto clamp(40px, 6vw, 72px);
  padding: 0 16px;
  border-top: 1px solid var(--filo);
  border-bottom: 1px solid var(--filo);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.schede > :first-child { margin-left: auto; }
.schede > :last-child  { margin-right: auto; }

.schede a, .schede-esci button {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 2px;
  font-family: var(--epigrafe);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--tenue);
  transition: color .25s ease;
}
.schede a:hover, .schede-esci button:hover { color: var(--testo); }
.schede a[aria-current] {
  color: var(--testo);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 8px;
}
/* Il contorno sta dentro, se no la riga che scorre lo taglia. */
.schede a:focus-visible, .schede-esci button:focus-visible {
  outline: 1px solid var(--testo);
  outline-offset: -6px;
}

.schede-esci {
  flex: none;
  margin: 0;
  padding-left: clamp(20px, 3vw, 36px);
  border-left: 1px solid var(--filo);
}
.schede-esci button {
  margin: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

/* ------------------------------------------------- ELENCHI E PICCOLE COSE */
.piccolo { font-size: .95rem; color: var(--tenue); }
.piccolo a { color: var(--testo); }

.nota--sinistra { text-align: left; }
.elenco .nota--sinistra { margin: 0 0 2rem; }

/* I titoli della privacy, come quelli delle voci. */
.voce-titolo {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  line-height: 1.2;
  margin: 2.4rem 0 .6rem;
}

.sezione-titolo--sinistra {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  text-align: left;
  margin: clamp(48px, 6vw, 72px) 0 1.4rem;
}
.conta {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--filo);
  font-family: var(--epigrafe);
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.6;
  color: var(--tenue);
}
/* Ogni gruppo di richieste comincia con il suo filo, non solo il primo. */
.sezione-titolo--sinistra + .voce { border-top: 1px solid var(--filo); }

/* Titoli, nomi e indirizzi scritti dagli studenti possono essere lunghi. */
.voce--libro h2, .voce--libro p, .voce--persona h3, .voce--persona p {
  overflow-wrap: anywhere;
}
.voce--persona p:not(.data) { margin: 0; color: var(--tenue); }

/* ----------------------------------------------------------- STATISTICHE
 * Numeri grandi in testa, un grafico a barre in un solo colore, liste con
 * barrette proporzionali, il registro in tabella. Tutto disegnato dal server. */
.statistiche {
  max-width: var(--largo);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) clamp(72px, 9vw, 120px);
}
.stat-tessere {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--filo);
  border: 1px solid var(--filo);
  margin: 0 0 1.4rem;
}
.stat-tessere--una { grid-template-columns: minmax(0, 320px); background: none; border: 0; }
.stat-tessera { background: var(--carta); padding: 22px 20px 18px; }
.stat-tessere--una .stat-tessera { border: 1px solid var(--filo); }
.stat-tessera .occhiello { margin: 0 0 .5rem; }
.stat-grande {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 1;
  margin: 0;
  font-variant-numeric: lining-nums tabular-nums;
}
.stat-avvertenza { max-width: 52em; margin: 0 0 3rem; }
.statistiche .sezione-titolo { margin-top: 3.2rem; }

.stat-grafico { display: block; width: 100%; height: auto; margin: 0 0 .8rem; }
.stat-grafico text { font-family: var(--epigrafe); letter-spacing: .04em; }
.stat-voce:hover path { opacity: .72; }

.stat-dettagli { margin: 0 0 2rem; }
.stat-dettagli summary {
  cursor: pointer;
  font-family: var(--epigrafe);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: 12px 0;
  min-height: 44px;
}

.stat-tabella { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.stat-tabella th, .stat-tabella td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--filo); vertical-align: top; }
.stat-tabella thead th {
  font-family: var(--epigrafe);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--tenue);
}
.stat-scorre { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.stat-registro { min-width: 640px; }
.stat-registro td:first-child { white-space: nowrap; }

.stat-colonne {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 56px);
  margin-top: 3.2rem;
}
.stat-lista h3 { margin: 0 0 .8rem; }
.stat-lista table { width: 100%; border-collapse: collapse; }
.stat-lista th, .stat-lista td { padding: 7px 0; border-bottom: 1px solid var(--filo); vertical-align: middle; }
.stat-lista th { text-align: left; font-weight: 400; overflow-wrap: anywhere; padding-right: 12px; }
.stat-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-right: 12px; }
.stat-perc { color: var(--tenue); font-size: .85em; margin-left: 4px; }
.stat-barretta { width: 28%; }
.stat-barretta svg { display: block; width: 100%; height: 6px; }

@media (max-width: 760px) {
  .stat-tessere { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-colonne { grid-template-columns: 1fr; }
}
