/* /mnt/volumadd/www/sondaggio.openfieldstudio.it/public/assets/stile.css */

:root {
    --blu: #073854;         /* blu del logo OpenField Studio */
    --blu-scuro: #04263a;
    --sabbia: #c8a77d;      /* sabbia del logo: solo decorativo */
    --sabbia-chiara: #f6efe6;
    --fondo: #f7f5f1;
    --carta: #ffffff;
    --testo: #1d2730;
    --testo-tenue: #4a5865;  /* contrasto 7:1 su bianco */
    --bordo: #cfd6dc;
    --errore: #a4161a;
    --errore-fondo: #fdf1f1;
    --fuoco: #0b63c4;
    --raggio: 12px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--fondo);
    color: var(--testo);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.6;
}

a { color: var(--blu); text-underline-offset: 2px; }
a:hover { color: var(--blu-scuro); }

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

.sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* Testata con logo centrato */
.testata {
    text-align: center;
    padding: 2rem 1rem 1.25rem;
    background: var(--carta);
    border-bottom: 4px solid var(--sabbia);
}
.logo {
    display: inline-block;
    width: min(240px, 60vw);
    height: auto;
}

.pagina {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.scheda {
    background: var(--carta);
    border: 1px solid var(--bordo);
    border-radius: var(--raggio);
    padding: 1.5rem;
    margin: 0 0 1.25rem;
}

h1 {
    color: var(--blu);
    font-size: clamp(1.6rem, 4.5vw, 2.1rem);
    line-height: 1.2;
    margin: 0 0 1rem;
}
h2 { color: var(--blu); font-size: 1.25rem; margin: 1.75rem 0 .5rem; }

.intro { border-top: 6px solid var(--blu); }
.intro p { margin: 0 0 .9rem; }
.intro .nota {
    background: var(--sabbia-chiara);
    border-left: 4px solid var(--sabbia);
    padding: .75rem 1rem;
    border-radius: 0 8px 8px 0;
    margin: 1.25rem 0 0;
    font-size: .975rem;
}

.legenda-obbligo { color: var(--testo-tenue); font-size: .95rem; margin: 0 0 1rem; }

/* Domande */
fieldset.domanda { min-width: 0; }
.domanda > legend {
    float: left;          /* evita il bordo che taglia la legenda */
    width: 100%;
    padding: 0;
    margin: 0 0 .5rem;
    font-weight: 650;
    font-size: 1.1rem;
    line-height: 1.4;
}
.domanda > legend + * { clear: both; }
.numero { color: var(--blu); }
.obbligo { color: var(--errore); }

.aiuto { color: var(--testo-tenue); font-size: .95rem; margin: 0 0 .75rem; clear: both; }

.scelte { display: grid; gap: .4rem; clear: both; }

.scelta {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .55rem .75rem;
    border: 1px solid var(--bordo);
    border-radius: 8px;
    background: #fff;
}
.scelta:hover { border-color: var(--blu); }
.scelta:has(input:checked) { border-color: var(--blu); background: #eef3f7; }
.scelta label { flex: 1; cursor: pointer; }
.scelta input[type="radio"],
.scelta input[type="checkbox"] {
    width: 1.25rem; height: 1.25rem;
    margin: .2rem 0 0;
    accent-color: var(--blu);
    flex: none;
    cursor: pointer;
}
.scelta.altro { flex-wrap: wrap; }
.scelta.altro > label:first-of-type { flex: 0 0 auto; }
.campo-altro { flex: 1 1 12rem; }

.contatore { margin: .5rem 0 0; font-size: .95rem; color: var(--testo-tenue); min-height: 1.5em; }
.contatore.troppe { color: var(--errore); font-weight: 600; }

/* Scala da 1 a 5 */
.scala { clear: both; }
.riga-scala {
    border: 0;
    border-top: 1px solid #e6eaee;
    margin: 0;
    padding: .85rem 0 .75rem;
    min-width: 0;
}
.riga-scala:first-child { border-top: 0; padding-top: .25rem; }
.riga-scala legend { float: left; width: 100%; padding: 0; margin-bottom: .5rem; font-weight: 500; }
.voti { display: flex; gap: .5rem; clear: both; }
.voti input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
}
.voti label {
    flex: 1;
    min-height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--bordo);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    user-select: none;
}
.voti label:hover { border-color: var(--blu); }
.voti input:checked + label { background: var(--blu); border-color: var(--blu); color: #fff; }
.voti input:focus-visible + label { outline: 3px solid var(--fuoco); outline-offset: 2px; }
.estremi {
    display: flex;
    justify-content: space-between;
    color: var(--testo-tenue);
    font-size: .9rem;
    margin: .25rem 0 0;
}

/* Campi di testo */
input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    font: inherit;
    color: inherit;
    padding: .6rem .75rem;
    border: 1px solid #8a96a1;   /* contrasto 3:1 per i bordi dei campi */
    border-radius: 8px;
    background: #fff;
}
textarea { resize: vertical; min-height: 7rem; clear: both; display: block; }
#email label[for="email-campo"] { display: block; font-weight: 600; margin: .25rem 0 .35rem; clear: both; }
.consenso { margin-top: 1rem; border: 0; padding: 0; background: none; }
.consenso:hover, .consenso:has(input:checked) { background: none; }
.consenso label { font-size: .975rem; }

/* Errori */
.con-errore { border-color: var(--errore); border-width: 2px; }
.msg-errore {
    color: var(--errore);
    font-weight: 600;
    margin: 0 0 .75rem;
    clear: both;
}
.msg-errore::before { content: "⚠ "; }
.avviso.errore {
    background: var(--errore-fondo);
    border: 2px solid var(--errore);
    border-radius: var(--raggio);
    padding: 1rem 1.25rem;
    margin: 0 0 1.25rem;
}
.avviso.errore h2 { color: var(--errore); margin: 0 0 .5rem; font-size: 1.1rem; }
.avviso.errore ul { margin: 0; padding-left: 1.25rem; }
.avviso.errore a { color: var(--errore); }

/* Campo trappola anti-spam: nascosto a tutti */
.trappola { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Invio */
.invio { text-align: center; margin: 1.5rem 0 0; }
button[type="submit"] {
    font: inherit;
    font-weight: 650;
    font-size: 1.1rem;
    color: #fff;
    background: var(--blu);
    border: 0;
    border-radius: 999px;
    padding: .9rem 2.25rem;
    min-height: 48px;
    cursor: pointer;
}
button[type="submit"]:hover { background: var(--blu-scuro); }

/* Grazie */
.grazie { text-align: center; border-top: 6px solid var(--blu); padding: 2.5rem 1.5rem; }

/* Informativa */
.testo-lungo h2:first-of-type { margin-top: 1.25rem; }
.testo-lungo ul { padding-left: 1.25rem; }
.testo-lungo li { margin-bottom: .4rem; }
.torna { margin-top: 2rem; }

/* Piè di pagina */
.piede {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem 2.5rem;
    color: var(--testo-tenue);
    font-size: .9rem;
}
.piede p { margin: 0 0 .75rem; }

@media (max-width: 480px) {
    .scheda { padding: 1.15rem; }
    .voti { gap: .35rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
    .voti input:checked + label { outline: 3px solid CanvasText; }
}
