/* ==========================================================================
   Energia al Futuro – Form di registrazione (AIN)
   ========================================================================== */

/* --- Font DIN --------------------------------------------------------------
   I file woff2/woff vanno messi accanto a questo CSS (o aggiornare gli url). */

@font-face {
  font-family: "Din";
  src: url("../assets/font/DIN-Regular.woff2") format("woff2"),
    url("../assets/font/DIN-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Din";
  src: url("../assets/font/DIN-Light.woff2") format("woff2"),
    url("../assets/font/DIN-Light.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Din";
  src: url("../assets/font/DIN-Medium.woff2") format("woff2"),
    url("../assets/font/DIN-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Din";
  src: url("../assets/font/DIN-Bold.woff2") format("woff2"),
    url("../assets/font/DIN-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- Variabili ------------------------------------------------------------ */

:root {
  --blu: #0F233C;
  --bianco: #FFFFFF;
  --chiaro: #C6D4E3;
  /* testi secondari su blu */
  --azzurro: #7EC8F5;
  /* focus */
  --riga: rgba(255, 255, 255, 0.3);
  --placeholder: #8A97A8;
  --errore: #FFB3BA;
  --errore-bordo: #FF8A95;
}

/* --- Base ----------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--blu);
  color: var(--bianco);
  font-family: "Din", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.new {
  background-image: url(../img/ain-bg-mobile.jpg) !important;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

@media screen and (min-width: 768px) {
  body.new {
      background-image: url(../img/ain-bg.jpg) !important;
    }
}

a {
  color: var(--bianco);
}

a:hover {
  color: var(--chiaro);
}

:focus-visible {
  outline: 2px solid var(--azzurro);
  outline-offset: 2px;
}

/* --- Layout --------------------------------------------------------------- */

.page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 20px 40px;
}

.container {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* --- Intro (logo e dati evento) ------------------------------------------- */

.intro {
  display: flex;
  gap: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--riga);
}

.intro-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo {
  display: block;
  width: 160px;
  height: auto;
  margin-bottom: 22px;
  object-fit: contain;
  object-position: top;
}

.date {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chiaro);
}

.title {
  margin: 0;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.15;
}

.subtitle {
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
  color: var(--chiaro);
}

.venue {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

/* --- Form ----------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.form-header {
  margin-bottom: 24px;
}

.form-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
}

.form-header p {
  margin: 0;
  font-size: 15px;
  color: var(--chiaro);
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--bianco);
  border-radius: 3px;
  background: var(--bianco);
  color: var(--blu);
  font: inherit;
  font-size: 16px;
}

.field input::placeholder {
  color: var(--placeholder);
}

/* Consenso privacy */

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--chiaro);
  margin: 24px 0;
}

.consent input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--bianco);
}

.consent label {
  cursor: pointer;
}

/* Bottone */

.btn {
  width: 100%;
  height: 52px;
  margin-top: 8px;
  border: 0;
  border-radius: 3px;
  background: var(--bianco);
  color: var(--blu);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn:hover {
  background: var(--blu);
  color: var(--bianco);
  border: 1px solid var(--bianco);
}

/* --- Stati di errore -------------------------------------------------------
   Classi pensate per lo script di validazione:
   aggiungere .is-invalid al .field (o al .consent) per mostrare il messaggio. */

.error {
  display: none;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--errore);
}

.error--consent {
  margin-top: -12px;
}

.field.is-invalid input {
  border-color: var(--errore-bordo);
  box-shadow: 0 0 0 2px rgba(255, 138, 149, 0.35);
}

.field.is-invalid .error,
.consent.is-invalid+.error {
  display: block;
}

.consent.is-invalid label {
  color: var(--errore);
}

/* --- Responsive ----------------------------------------------------------- */

@media screen and (max-width: 992px) {
  .intro {
    flex-direction: column;
  }
}

@media (min-width: 600px) {
  .page {
    padding: 72px 40px 48px;
  }

  .logo {
    width: 208px;
  }

  .title {
    font-size: 42px;
  }

  .fields {
    grid-template-columns: repeat(2, 1fr);
  }

  .field--full {
    grid-column: 1 / -1;
  }
}