/* Maquette de référence : docs/formatopia.png (980x553) — charte (couleurs, polices) reprise de formatopia.fr.
   Cotes calculées pour un écran de 1440px de large (1rem = 16px = 10.89px de maquette) ; la taille de base
   suit min(largeur / 980, hauteur / 553) pour garder les proportions de la maquette à toutes les tailles. */
html {
  font-size: 16px;
  font-size: clamp(12px, min(1.111vw, 1.969vh), 32px);
}

body {
  margin: 0;
  background: #f1f0ea;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

#content.fp-login {
  --fp-bg: #f1f0ea;
  --fp-ink: #1c2a2e;
  --fp-ink-soft: #4a5b5f;
  --fp-teal: #1f6f64;
  --fp-teal-deep: #154f47;
  --fp-border: #dcd7c9;
  --fp-field-border: #e4e2da;
  --fp-card: #fff;

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  /* Marges latérales de la maquette : 62px à gauche, 48px à droite. */
  padding: 3.5rem 4.4rem 3.5rem 5.7rem;
  box-sizing: border-box;
  overflow: hidden;
  color: var(--fp-ink);
  background: var(--fp-bg);
}

/* Aplats verts dans les coins, derrière l'encart. */
#content.fp-login::before,
#content.fp-login::after {
  content: '';
  position: absolute;
  z-index: 0;
  background: var(--fp-teal);
}

#content.fp-login::before {
  top: 0;
  left: 0;
  width: 15vw;
  height: 25vh;
}

#content.fp-login::after {
  right: 0;
  bottom: 0;
  width: 13vw;
  height: 22vh;
}

.fp-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 31.75rem minmax(0, 1fr);
  gap: 1.75rem;
  width: 100%;
  max-width: 80rem;
}

/* ---------- Encart de connexion ---------- */

.fp-card {
  display: flex;
  flex-direction: column;
  padding: 4.25rem 4.9rem 4.6rem;
  box-sizing: border-box;
  border: 1px solid var(--fp-border);
  border-radius: 1.25rem;
  background: var(--fp-card);
  box-shadow: 0 1.5rem 3rem -1.5rem rgba(28, 42, 46, .18);
}

.fp-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.fp-brand-mark {
  flex: none;
  width: 4.4rem;
  height: 4.4rem;
}

.fp-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fp-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2.45rem;
  font-weight: 600;
  line-height: 1.05;
  color: var(--fp-ink);
}

.fp-brand-tagline {
  margin-top: .2rem;
  font-size: .82rem;
  line-height: 1.2;
  color: var(--fp-teal-deep);
}

.fp-title {
  margin: 2.6rem 0 0;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 3.9rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--fp-ink);
}

.fp-title span {
  display: block;
  margin-top: .3rem;
  font-size: .37em;
  line-height: 1.2;
  letter-spacing: 0;
}

.fp-title strong {
  font-weight: 600;
  color: var(--fp-teal);
}

.fp-lead {
  margin: 1.6rem 0 1.9rem;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--fp-ink);
}

.fp-fields {
  width: 100%;
}

/* ---------- Champs ---------- */

.fp-input {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: .8rem;
}

#content.fp-login .fp-input input {
  width: 100%;
  height: 2.95rem;
  margin: 0;
  padding: 0 1rem 0 2.85rem;
  box-sizing: border-box;
  border: 1px solid var(--fp-field-border);
  border-radius: .5rem;
  outline: none;
  box-shadow: none;
  color: var(--fp-ink);
  background: #fff;
  font: inherit;
  font-size: .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}

#content.fp-login .fp-input input::placeholder {
  color: var(--fp-ink-soft);
  opacity: 1;
}

#content.fp-login .fp-input input:focus {
  border-color: var(--fp-teal);
  box-shadow: 0 0 0 3px rgba(31, 111, 100, .15);
}

#content.fp-login .fp-input input:autofill,
#content.fp-login .fp-input input:-webkit-autofill,
#content.fp-login .fp-input input:-webkit-autofill:hover,
#content.fp-login .fp-input input:-webkit-autofill:focus,
#content.fp-login .fp-input input:-webkit-autofill:active {
  box-shadow: 0 0 0 1000px #fff inset;
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--fp-ink);
  caret-color: var(--fp-ink);
}

.fp-input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  z-index: 1;
  display: flex;
  width: 1.2rem;
  height: 1.2rem;
  color: var(--fp-teal);
  transform: translateY(-50%);
  pointer-events: none;
}

.fp-input-icon svg {
  width: 100%;
  height: 100%;
}

#content.fp-login .password-field input {
  padding-right: 3rem;
}

#content.fp-login .password-field input[type='password']::-ms-reveal,
#content.fp-login .password-field input[type='password']::-ms-clear {
  display: none;
}

#content.fp-login .password-toggle {
  position: absolute;
  right: .4rem;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  border-radius: .375rem;
  color: var(--fp-teal);
  opacity: .55;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
  transition: opacity .15s ease;
}

#content.fp-login .password-toggle:hover,
#content.fp-login .password-toggle:focus-visible,
#content.fp-login .password-toggle[aria-pressed='true'] {
  opacity: 1;
}

#content.fp-login .password-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* ---------- Boutons ---------- */

.fp-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 2.3rem;
}

#content.fp-login .fp-btn,
#content.fp-login .fp-forgot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 1rem;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: .45rem;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

#content.fp-login .fp-btn {
  flex: 0 0 auto;
  min-width: 9.5rem;
  color: #fff;
  background: var(--fp-teal);
}

#content.fp-login .fp-forgot {
  flex: 1 1 auto;
  border-color: var(--fp-border);
  color: var(--fp-ink);
  background: #fff;
}

#content.fp-login .fp-forgot span{
 display: inline-block;
 margin-left: 4px;
}

#content.fp-login .fp-btn:hover,
#content.fp-login .fp-btn:focus-visible {
  background: var(--fp-teal-deep);
  box-shadow: 0 .5rem 1.1rem rgba(21, 79, 71, .28);
  transform: translateY(-1px);
}

#content.fp-login .fp-forgot:hover,
#content.fp-login .fp-forgot:focus-visible {
  border-color: var(--fp-teal);
  color: var(--fp-teal);
}

#content.fp-login .fp-btn:focus-visible,
#content.fp-login .fp-forgot:focus-visible,
#content.fp-login .password-toggle:focus-visible {
  outline: 2px solid var(--fp-teal);
  outline-offset: 2px;
}

#content.fp-login .fp-btn:active,
#content.fp-login .fp-forgot:active {
  box-shadow: none;
  transform: translateY(0);
}

/* ---------- Mosaïque photos ---------- */

.fp-gallery {
  display: flex;
  flex-direction: column;
  gap: 1.65rem;
  min-height: 0;
}

.fp-row {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
}

.fp-row-top {
  gap: 1.65rem;
}

.fp-row-bottom {
  gap: 1.2rem;
}

/* Proportions de la maquette : 234/252 en haut, 285/206 en bas. */
.fp-row-top .fp-photo:first-child { flex: 234 1 0; }
.fp-row-top .fp-photo:last-child { flex: 252 1 0; }
.fp-row-bottom .fp-photo:first-child { flex: 285 1 0; }
.fp-row-bottom .fp-photo:last-child { flex: 206 1 0; }

.fp-photo {
  display: block;
  width: 0;
  height: 100%;
  min-width: 0;
  object-fit: cover;
  border-radius: .875rem;
  background: #e6f0ee;
}

.fp-row-top .fp-photo:last-child { object-position: 70% center; }
.fp-row-bottom .fp-photo:last-child { object-position: 40% center; }

/* ---------- Modale existante de récupération du mot de passe ---------- */

#modalRecupId {
  width: 40rem;
  max-width: calc(100% - 2rem);
  padding: 0;
  border-radius: .75rem;
  outline: none !important;
}

#modalRecupId .modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  text-align: center;
}

#modalRecupId iframe {
  width: 100%;
  height: 370px;
  border: 0;
}

.modal {
  top: 50% !important;
  transform: translateY(-50%) scaleX(0) scaleY(0) !important;
}

.modal.open {
  transform: translateY(-50%) scaleX(1) scaleY(1) !important;
}

/* LMS : le Form1 englobant et sa soumission restent gérés par le manager. */
#Form1 {
  margin: 0;
}

/* ---------- Écrans moyens : encart seul, bandeau photos au-dessus ---------- */

@media (max-width: 1024px) {
  html {
    font-size: 15px;
  }

  #content.fp-login {
    align-items: flex-start;
    padding: 3rem 2rem;
  }

  #content.fp-login::before {
    width: 22vw;
    height: 14rem;
  }

  #content.fp-login::after {
    width: 22vw;
    height: 10rem;
  }

  .fp-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    max-width: 34rem;
  }

  .fp-gallery {
    order: -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    height: 7.5rem;
  }

  .fp-row {
    display: contents;
  }

  .fp-photo {
    width: 100%;
    border-radius: .75rem;
  }

  .fp-card {
    padding: 3rem 3.25rem 3.5rem;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  html {
    font-size: 14px;
  }

  #content.fp-login {
    padding: 1.5rem 16px;
  }

  #content.fp-login::before {
    width: 30vw;
    height: 8rem;
  }

  #content.fp-login::after {
    width: 30vw;
    height: 6rem;
  }

  .fp-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: 6.5rem;
  }

  /* Deux photos suffisent sur petit écran. */
  .fp-row-top .fp-photo:last-child,
  .fp-row-bottom .fp-photo:last-child {
    display: none;
  }

  .fp-card {
    padding: 2rem 1.5rem 2.25rem;
    border-radius: 1rem;
  }

  .fp-brand {
    gap: .9rem;
  }

  .fp-brand-mark {
    width: 3.4rem;
    height: 3.4rem;
  }

  .fp-brand-name {
    font-size: 2rem;
  }

  .fp-title {
    margin-top: 2rem;
    font-size: 3.1rem;
  }

  .fp-title span {
    font-size: .45em;
  }

  /* 16px minimum : évite le zoom automatique d'iOS au focus. */
  #content.fp-login .fp-input input {
    height: 3.2rem;
    font-size: 16px;
  }

  .fp-actions {
    flex-direction: column;
    align-items: stretch;
    margin-top: 1.75rem;
  }

  #content.fp-login .fp-btn,
  #content.fp-login .fp-forgot {
    flex: none;
    width: 100%;
    height: 3rem;
    font-size: 1rem;
  }
}
