* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: #000;
  color: #f3f3f3;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
}

main {
  width: min(100%, 1100px);
  margin: auto;
  padding: 10px 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  width: 82px;
  height: 82px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

h1 {
  font-size: 21px;
  letter-spacing: 0.16em;
  font-weight: 500;
  margin: -1px 0 8px;
}

.instructions {
  max-width: 720px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.3;
}

.instructions p {
  margin: 0 0 5px;
}

.player {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 6px auto 0;
}

video {
  display: block;
  width: 100%;
  max-height: 43vh;
  aspect-ratio: 16 / 9;
  background: #000;
  object-fit: contain;
}

nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 38px;
  margin: 8px 0 0;
}

nav a {
  color: #ddd;
  text-decoration: none;
  font-size: 14px;
}

/* PAGINE TESTUALI - SEPARAZIONE NAVIGAZIONE */

main > p + nav,
main > h2 + nav {
  margin-top: 36px;
}

/* SELETTORE LINGUA */

.language-switch {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 5;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: #888;
}

.language-switch a,
.language-switch a:visited {
  color: #888;
  text-decoration: none;
}

.language-switch strong {
  color: #f3f3f3;
  font-weight: 500;
}

.language-switch span {
  margin: 0 5px;
  color: #555;
}

.language-switch a:hover {
  color: #fff;
}

/* PULSANTE PLAY CENTRALE - NASCOSTO DI DEFAULT */

.desktop-play {
  display: none;
}

.desktop-play.hidden {
  display: none !important;
}

/* AVVERTENZE */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.overlay.hidden {
  display: none;
}

.modal {
  width: min(100%, 470px);
  border: 1px solid #777;
  background: #0b0b0b;
  padding: 28px 24px;
  text-align: left;
  line-height: 1.45;
  font-size: 16px;
}

.modal p {
  margin: 0 0 17px;
}

.modal button {
  display: block;
  margin: 25px auto 0;
  padding: 11px 28px;
  border: 1px solid #ddd;
  background: #eee;
  color: #111;
  font-size: 16px;
  cursor: pointer;
}

/* SMARTPHONE VERTICALE */

@media (max-width: 699px) and (orientation: portrait) {
  main {
    padding: 8px 10px 30px;
  }

  .logo {
    width: 140px;
    height: 140px;
  }

  h1 {
    font-size: 19px;
    margin: -1px 0 8px;
  }

  .instructions {
    font-size: 14px;
    line-height: 1.22;
  }

  .instructions p {
    margin-bottom: 3px;
  }

  .player {
    margin-top: 10px;
  }

  video {
    max-height: none;
  }

  nav {
    flex-direction: column;
    gap: 12px;
    margin: 28px 0 8px;
  }

  main > p + nav,
  main > h2 + nav {
    margin-top: 40px;
  }

  .modal {
    font-size: 15px;
    padding: 24px 20px;
  }

  .language-switch {
    top: 10px;
    right: 10px;
    font-size: 11px;
  }
}

/* SMARTPHONE ORIZZONTALE */

@media (max-height: 699px) and (orientation: landscape) {

  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  body {
    position: relative;
  }

  main {
    position: relative;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 6px 10px;

    display: grid;
    grid-template-columns: 195px minmax(0, 1fr) 225px;
    grid-template-rows: 1fr;
    column-gap: 8px;

    align-items: center;
    overflow: hidden;
  }

  header {
    position: absolute;
    left: 10px;
    top: -18px;
    width: 195px;
    height: auto;
    margin: 0;
    padding: 0;

    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .logo {
    width: 190px;
    height: 190px;
    margin: 0 auto;
    object-fit: cover;
  }

  h1 {
    position: absolute;
    left: -9999px;
  }

  nav {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: 195px;
    margin: 0;

    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;

    gap: 14px;
  }

  nav a {
    font-size: 15px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .player {
    grid-column: 2;
    grid-row: 1;

    width: 100%;
    max-width: none;
    margin: 0;

    align-self: center;
  }

  video {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100% - 12px);

    aspect-ratio: 16 / 9;
    background: #000;
    object-fit: contain;
  }

  .instructions {
    position: absolute;
    right: 10px;
    top: 10px;
    bottom: 10px;

    width: 225px;
    max-width: 225px;
    margin: 0;
    padding: 0 3px;

    font-size: 13px;
    line-height: 1.15;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .instructions::before {
    content: "AGAI 60S";

    display: block;
    margin: 0;

    font-size: 17px;
    line-height: 1.1;
    letter-spacing: 0.16em;
    font-weight: 500;
  }

  .instructions p {
    margin: 0;
  }

  .modal {
    font-size: 14px;
    padding: 18px 20px;
  }

  .language-switch {
    top: auto;
    right: 8px;
    bottom: 3px;
    font-size: 10px;
  }
}

/* TABLET */

@media (min-width: 700px) and (max-width: 1099px) and (orientation: portrait) {
  main {
    padding-top: 18px;
  }

  .logo {
    width: 140px;
    height: 140px;
  }

  h1 {
    font-size: 27px;
    margin: 0 0 14px;
  }

  .instructions {
    font-size: 18px;
    line-height: 1.34;
  }

  .instructions p {
    margin-bottom: 6px;
  }

  .player {
    margin-top: 20px;
  }
}

/* PC GRANDE */

@media (min-width: 1100px) {
  .logo {
    width: 140px;
    height: 140px;
  }

  h1 {
    font-size: 21px;
    margin: -2px 0 6px;
  }

  .instructions {
    font-size: 15px;
    line-height: 1.25;
  }

  .instructions p {
    margin-bottom: 4px;
  }

  .player {
    max-width: 980px;
    margin-top: 6px;
  }

  video {
    max-height: 43vh;
  }

  nav {
    margin-top: 7px;
  }

  main > p + nav,
  main > h2 + nav {
    margin-top: 36px;
  }

  /* PLAY CENTRALE SOLO SU PC */

  .desktop-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 82px;
    height: 82px;
    padding: 0 0 0 6px;

    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.55);
    color: #fff;

    font-size: 42px;
    line-height: 1;

    cursor: pointer;
    z-index: 2;
  }

  .desktop-play:hover {
    background: rgba(0, 0, 0, 0.72);
  }
}

/* LINK TESTUALI */

main a {
  color: #f3f3f3;
  text-decoration: none;
}

main a:visited {
  color: #f3f3f3;
}

main a:hover {
  color: #ffffff;
  text-decoration: underline;
}


/* ==========================================================
   SISTEMA COMUNE PAGINE TESTUALI AGAI
   ========================================================== */

/*
   Questa struttura viene utilizzata da tutte le pagine
   informative del sito.

   La tipografia e la navigazione vengono quindi definite
   una sola volta.
*/

.agai-text-page {
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 24px 55px;

  display: block;
  text-align: center;
}

/* NAVIGAZIONE COMUNE */

.agai-text-nav {
  width: 100%;
  margin: 0 auto;
  padding: 34px 90px 0;

  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;

  gap: 14px 40px;
}

.agai-text-nav a,
.agai-text-nav a:visited {
  color: #bdbdbd;
  text-decoration: none;

  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.agai-text-nav a:hover {
  color: #ffffff;
  text-decoration: none;
}

.agai-text-nav .current-page {
  color: #ffffff;
}

/* AREA CONTENUTO */

.agai-text-stage {
  width: 100%;
  min-height: calc(100vh - 65px);

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 30px 0 55px;
}

.agai-text-content {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0;

  text-align: center;

  font-size: 16px;
  line-height: 1.55;
}

/* TITOLO COMUNE */

.agai-text-title {
  width: 100%;
  margin: 0 0 64px;

  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  font-weight: 500;

  text-align: center;
}

/* PARAGRAFI COMUNI */

.agai-text-content p {
  margin: 0 0 22px;
}

/* FRASE INTRODUTTIVA IN EVIDENZA */

.agai-text-intro {
  max-width: 720px;
  margin: 0 auto 42px !important;

  font-size: 18px;
  line-height: 1.5;
  font-weight: 700;
}

/* DOMANDA / FRASE CENTRALE IN EVIDENZA */

.agai-text-question {
  margin: 34px 0 !important;

  font-size: 19px;
  line-height: 1.4;
  font-weight: 700;
}

/* CHIUSURA */

.agai-text-ending {
  margin: 38px 0 0 !important;

  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
}


/* ==========================================================
   PAGINE TESTUALI - SMARTPHONE VERTICALE
   ========================================================== */

@media (max-width: 699px) and (orientation: portrait) {

  .agai-text-page {
    width: 100%;
    min-height: 100vh;
    padding: 0 22px 46px;

    display: block;
  }

  .agai-text-page .language-switch {
    position: absolute;
    top: 14px;
    right: 14px;
    bottom: auto;

    font-size: 11px;
  }

  .agai-text-nav {
    width: 100%;
    padding: 58px 0 0;

    display: grid;
    grid-template-columns: 1fr 1.7fr;

    column-gap: 18px;
    row-gap: 10px;

    align-items: center;
    justify-content: center;
  }

  .agai-text-nav a,
  .agai-text-nav a:visited {
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
  }

  .agai-text-nav a:last-child {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .agai-text-stage {
    width: 100%;
    min-height: auto;

    display: block;

    padding: 58px 0 0;
  }

  .agai-text-content {
    width: 100%;
    max-width: 560px;

    margin: 0 auto;

    font-size: 13.5px;
    line-height: 1.42;
  }

  .agai-text-title {
    max-width: 360px;
    margin: 0 auto 48px;

    font-size: 26px;
    line-height: 1.2;
    letter-spacing: 0.025em;
  }

  .agai-text-content p {
    margin: 0 0 18px;
  }

  .agai-text-intro {
    max-width: 520px;
    margin: 0 auto 31px !important;

    font-size: 14.5px;
    line-height: 1.42;
  }

  .agai-text-question {
    margin: 26px 0 !important;

    font-size: 15.5px;
    line-height: 1.4;
  }

  .agai-text-ending {
    margin: 29px 0 0 !important;

    font-size: 15.5px;
    line-height: 1.4;
  }
}


/* ==========================================================
   PAGINE TESTUALI - SMARTPHONE ORIZZONTALE
   ========================================================== */

@media (max-height: 699px) and (orientation: landscape) {

  html:has(.agai-text-page),
  body:has(.agai-text-page) {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body:has(.agai-text-page) {
    position: static;
  }

  .agai-text-page {
    position: static;

    width: 100%;
    max-width: none;
    height: auto;
    min-height: 100vh;

    margin: 0;
    padding: 0 34px 40px;

    display: block;
    overflow: visible;
  }

  .agai-text-page .language-switch {
    position: absolute;
    top: 12px;
    right: 18px;
    bottom: auto;

    font-size: 10px;
  }

  .agai-text-nav {
    position: static;

    width: 100%;
    max-width: 1000px;
    height: auto;

    margin: 0 auto;
    padding: 24px 90px 0;

    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;

    gap: 8px 28px;
  }

  .agai-text-nav a,
  .agai-text-nav a:visited {
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .agai-text-stage {
    position: static;

    width: 100%;
    min-height: auto;

    display: block;

    padding: 48px 0 0;
  }

  .agai-text-content {
    width: 100%;
    max-width: 800px;

    margin: 0 auto;

    font-size: 14px;
    line-height: 1.45;
    text-align: center;
  }

  .agai-text-title {
    position: static;

    width: 100%;
    margin: 0 0 42px;

    font-size: 27px;
    line-height: 1.2;
    letter-spacing: 0.03em;

    text-align: center;
  }

  .agai-text-content p {
    margin: 0 0 18px;
  }

  .agai-text-intro {
    max-width: 760px;
    margin: 0 auto 30px !important;

    font-size: 15.5px;
    line-height: 1.4;
  }

  .agai-text-question {
    margin: 26px 0 !important;

    font-size: 16px;
    line-height: 1.4;
  }

  .agai-text-ending {
    margin: 30px 0 0 !important;

    font-size: 16px;
    line-height: 1.4;
  }
}

/* ==========================================================
   PAGINE TESTUALI AGAI - PC
   MASTER: distribuzione verticale evidente
   ========================================================== */

@media (min-width: 1100px) {

  .agai-text-nav {
    padding-top: 34px;
  }

  .agai-text-stage {
    min-height: 0;
    display: block;
    padding: 105px 0 90px;
  }

  .agai-text-content {
    max-width: 820px;
    font-size: 16px;
    line-height: 1.6;
  }

  .agai-text-title {
    margin: 0 0 72px;
    font-size: 34px;
    line-height: 1.15;
  }

  .agai-text-content p {
    margin: 0 0 34px;
  }

  .agai-text-intro {
    margin: 0 auto 55px !important;
  }

  .agai-text-question {
    margin: 46px 0 !important;
  }

  .agai-text-ending {
    margin: 50px 0 0 !important;
  }
}
/* ==========================================================
   HOME AGAI - RIFINITURA PC
   Menu in alto, contenuto più equilibrato, lingua più visibile
   ========================================================== */

@media (min-width: 1100px) {

  body > .language-switch {
    top: 16px;
    right: 20px;
    font-size: 14px;
    color: #bdbdbd;
  }

  body > .language-switch a,
  body > .language-switch a:visited {
    color: #bdbdbd;
  }

  body > .language-switch strong {
    color: #ffffff;
    font-weight: 600;
  }

  main:not(.agai-text-page) {
    width: min(100%, 1100px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 14px 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  main:not(.agai-text-page) .home-nav {
    order: 0;
    width: 100%;
    margin: 0 auto;
    padding: 34px 90px 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 40px;
  }

  main:not(.agai-text-page) .home-nav a,
  main:not(.agai-text-page) .home-nav a:visited {
    color: #bdbdbd;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
  }

  main:not(.agai-text-page) .home-nav a:hover {
    color: #ffffff;
    text-decoration: none;
  }

  main:not(.agai-text-page) header {
    order: 1;
    margin-top: 42px;
  }

  main:not(.agai-text-page) .logo {
    width: 165px;
    height: 165px;
  }

  main:not(.agai-text-page) h1 {
    margin: 2px 0 18px;
    font-size: 25px;
    line-height: 1.15;
    letter-spacing: 0.12em;
    font-weight: 500;
  }

  main:not(.agai-text-page) .instructions {
    order: 2;
    max-width: 820px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.45;
  }

  main:not(.agai-text-page) .instructions p {
    margin: 0 0 10px;
  }

  main:not(.agai-text-page) .player {
    order: 3;
    width: 100%;
    max-width: 980px;
    margin: 24px auto 0;
  }

  main:not(.agai-text-page) video {
    max-height: 46vh;
  }
}

/* ==========================================================
   HOME AGAI - SMARTPHONE ORIZZONTALE
   Rifinitura menu e selettore lingua
   ========================================================== */

@media (max-height: 699px) and (orientation: landscape) {

  /* Solo HOME: menu stabile sotto il logo.
     Mantiene visibili tutti e quattro i link senza dipendere
     dal bordo inferiore variabile del browser. */
  main:not(.agai-text-page) nav.home-nav {
    top: 196px;
    bottom: auto;
    gap: 10px;
  }

  main:not(.agai-text-page) nav.home-nav a {
    font-size: 14px;
    line-height: 1.1;
  }

  /* Solo HOME: il selettore lingua resta visibile e leggibile
     senza finire nell'angolo inferiore. */
  body > .language-switch {
    top: 10px;
    right: 12px;
    bottom: auto;
    font-size: 12px;
    line-height: 1;
    z-index: 6;
  }

  body > .language-switch a,
  body > .language-switch a:visited {
    color: #bdbdbd;
  }

  body > .language-switch strong {
    color: #ffffff;
    font-weight: 600;
  }
}
/* ==========================================================
   HOME AGAI - NAVIGAZIONE UNIFORMATA ALLE PAGINE INTERNE
   ========================================================== */

/* HOME PC: stessa riga delle pagine interne */
@media (min-width: 1100px) {
  main:not(.agai-text-page) .home-nav {
    width: 100%;
    margin: 0 auto;
    padding: 34px 90px 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px 40px;
  }

  main:not(.agai-text-page) .home-nav > * {
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
  }

  main:not(.agai-text-page) .home-nav .current-page {
    color: #ffffff;
  }
}

/* HOME SMARTPHONE VERTICALE: stessa geometria delle pagine interne */
@media (max-width: 699px) and (orientation: portrait) {
  main:not(.agai-text-page) .home-nav {
    width: 100%;
    margin: 28px 0 8px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1.7fr;
    column-gap: 18px;
    row-gap: 10px;
    align-items: center;
    justify-content: center;
  }

  main:not(.agai-text-page) .home-nav > * {
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
  }

  main:not(.agai-text-page) .home-nav .current-page {
    color: #ffffff;
  }

  main:not(.agai-text-page) .home-nav > :last-child {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

/* HOME SMARTPHONE ORIZZONTALE: conserva la disposizione già approvata */
@media (max-height: 699px) and (orientation: landscape) {
  main:not(.agai-text-page) nav.home-nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    top: 196px;
    bottom: auto;
    gap: 10px;
  }

  main:not(.agai-text-page) nav.home-nav > * {
    font-size: 14px;
    line-height: 1.1;
    white-space: nowrap;
    text-align: center;
  }

  main:not(.agai-text-page) nav.home-nav .current-page {
    color: #ffffff;
  }
}