/* SAYL login page (standalone /sayl/login) — from sayl-login-proto */
:root {
  --navy: #0d3558;
  --navy-deep: #0a2740;
  --gold: #c4a574;
  --sky-top: #f4f6f8;
  --sky-mid: #e8eef3;
  --sky-horizon: #d5e2ea;
  --muted: #8aa3b5;
  --line: rgba(120, 155, 180, 0.55);
  --font: "Montserrat", system-ui, -apple-system, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--navy);
  background: var(--sky-top);
  overflow-x: hidden;
}

/* —— Scène paysage —— */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 40% at 50% 58%, rgba(255, 255, 255, 0.95) 0%, transparent 70%),
    linear-gradient(
      180deg,
      var(--sky-top) 0%,
      var(--sky-mid) 48%,
      var(--sky-horizon) 68%,
      #c9d8e4 100%
    );
}

/* Même boîte que l'océan → le halo suit le soleil du PNG */
.horizon {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(140vw, 110rem);
  transform: translateX(-50%);
  line-height: 0;
}

.ocean {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
}

.sun-glow {
  position: absolute;
  left: 50%;
  /* Soleil du nouveau ocean.png (~79 % depuis le haut) */
  top: 78.5%;
  z-index: 0;
  width: 34%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 248, 230, 0.55) 28%,
    rgba(200, 220, 235, 0.18) 55%,
    transparent 72%
  );
  filter: blur(2px);
  pointer-events: none;
}

.cloud {
  position: absolute;
  z-index: 1;
  width: min(42vw, 30rem);
  height: auto;
  opacity: 0.9;
  /* pas de filter ici : ça fait saccader avec l'anim */
  pointer-events: none;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

/* Plus bas, derrière les montagnes — dérive lente, plus proches du centre */
.cloud--left {
  left: -2%;
  bottom: 8%;
  width: min(46vw, 34rem);
  animation: cloud-drift-left 40s linear infinite alternate;
}

.cloud--right {
  right: -3%;
  bottom: 4%;
  width: min(44vw, 32rem);
  animation: cloud-drift-right 46s linear infinite alternate;
}

@keyframes cloud-drift-left {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    /* s'approche du centre sans y entrer */
    transform: translate3d(14vw, 0, 0);
  }
}

@keyframes cloud-drift-right {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-13vw, 0, 0);
  }
}

/* —— Contenu login —— */
.login {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem 28vh;
  gap: 1.25rem;
  transition: padding 0.9s ease, gap 0.9s ease;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.logo-stack {
  position: relative;
  width: min(42vw, 15.5rem);
  aspect-ratio: 1;
  transition: width 0.9s ease;
}

.logo-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/*
 * Compas : le masque (trous autour Y/voile/vague) reste FIXE.
 * Seule l'image intérieure tourne → les découpes ne partent pas en rotation.
 */
.logo-compas {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.95;
  -webkit-mask-image: url("/sayl_wayfarer/static/src/img/login/logo/compas-mask.png");
  mask-image: url("/sayl_wayfarer/static/src/img/login/logo/compas-mask.png");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.logo-layer--compas {
  transform-origin: 50% 50%;
}

.logo-layer--vague,
.logo-layer--voile,
.logo-layer--y {
  z-index: 2;
}

.logo-layer--mouettes {
  z-index: 3;
}

.brand-title {
  display: block;
  width: min(72vw, 22rem);
  height: auto;
  margin-top: -1.25rem;
  /* cadre 1536×1024 très aéré → on cadre le texte central */
  aspect-ratio: 1536 / 1024;
  object-fit: cover;
  object-position: center 48%;
  max-height: 7.5rem;
  filter: contrast(1.05);
}

/* Formulaire intégré (pas de card) */
.auth {
  width: min(20rem, calc(100vw - 3rem));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.15rem;
  margin-top: 0.35rem;
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
  transition:
    opacity 0.7s ease,
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    max-height 0.85s ease,
    margin 0.85s ease;
}

/* —— Intro / boot & reverse à la connexion —— */
body.is-booting .login {
  padding-bottom: 12vh;
  gap: 0;
}

body.is-booting .logo-stack {
  width: min(52vw, 18rem);
}

body.is-booting .logo-layer--compas {
  animation: compas-spin 2.4s linear infinite;
}

body.is-ready .logo-layer--compas {
  animation: none;
}

body.is-booting .auth {
  opacity: 0;
  max-height: 0;
  margin: 0;
  pointer-events: none;
  transform: translateY(1.25rem);
}

body.is-booting .brand-title {
  opacity: 0.92;
}

body.is-ready .brand {
  transform: translateY(-0.35rem);
}

body.is-ready .auth {
  opacity: 1;
  max-height: 24rem;
  transform: translateY(0);
}

@keyframes compas-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.field {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  padding: 0.35rem 0 0.55rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.field:focus-within {
  border-bottom-color: rgba(13, 53, 88, 0.55);
  color: var(--navy);
}

.field-icon {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
}

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

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  padding: 0.15rem 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--navy-deep);
  /* Empêche le fond autofill navigateur */
  -webkit-text-fill-color: var(--navy-deep);
  caret-color: var(--navy-deep);
}

.field input::placeholder {
  color: var(--muted);
  opacity: 1;
  -webkit-text-fill-color: var(--muted);
}

/* Autofill Chrome/Safari : fond bleu/jaune → transparent */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--navy-deep) !important;
  caret-color: var(--navy-deep);
  border: 0;
  /* Astuce : paint un fond transparent indéfiniment */
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  box-shadow: 0 0 0 1000px transparent inset !important;
  transition: background-color 99999s ease-out;
  background-color: transparent !important;
  background-image: none !important;
}

.field input:autofill {
  background: transparent !important;
}

.field-toggle {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  padding: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.field-toggle svg {
  width: 100%;
  height: 100%;
}

.field-toggle:hover {
  color: var(--navy);
}

.submit {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  color: var(--navy-deep);
  transition: transform 0.2s ease;
}

.submit-label {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    letter-spacing 0.25s ease,
    text-shadow 0.25s ease;
}

.submit-rule {
  display: block;
  width: 2.4rem;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold) 20%,
    var(--gold) 80%,
    transparent
  );
  opacity: 0.85;
  transition:
    width 0.25s ease,
    opacity 0.2s ease,
    box-shadow 0.25s ease;
}

.submit:hover {
  transform: translateY(-1px);
}

.submit:hover .submit-label {
  color: #062033;
  letter-spacing: 0.28em;
  text-shadow: 0 0 18px rgba(196, 165, 116, 0.45);
}

.submit:hover .submit-rule {
  width: 3.1rem;
  opacity: 1;
  box-shadow: 0 0 8px rgba(196, 165, 116, 0.55);
}

.submit:active {
  transform: translateY(0);
}

.forgot {
  margin-top: 0.15rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
}

.forgot:hover {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.auth-hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}

.auth-login-label {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--navy);
}

.info {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #0f766e;
  text-align: center;
}

.error {
  margin: 0;
  padding: 0;
  text-align: center;
  background: transparent;
  color: #b91c1c;
  font-size: 0.8rem;
}

.error.is-ok {
  color: #047857;
}


@media (max-width: 640px) {
  .login {
    padding-bottom: 26vh;
    gap: 0.75rem;
  }

  .logo-stack {
    width: min(48vw, 12.5rem);
  }

  .brand-title {
    width: min(80vw, 18rem);
    max-height: 6rem;
    margin-top: -0.85rem;
  }

  .cloud--left {
    left: -8%;
    bottom: 6%;
    opacity: 0.75;
  }

  .cloud--right {
    right: -10%;
    bottom: 3%;
    opacity: 0.75;
  }

  @keyframes cloud-drift-left {
    from {
      transform: translate3d(0, 0, 0);
    }
    to {
      transform: translate3d(10vw, 0, 0);
    }
  }

  @keyframes cloud-drift-right {
    from {
      transform: translate3d(0, 0, 0);
    }
    to {
      transform: translate3d(-9vw, 0, 0);
    }
  }
}

@media (min-width: 1100px) {
  .horizon {
    width: min(120vw, 120rem);
  }

  .cloud--left {
    bottom: 10%;
  }

  .cloud--right {
    bottom: 6%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud--left,
  .cloud--right {
    animation: none;
  }

  body.is-booting .logo-layer--compas {
    animation: none;
  }

  body.is-ready .brand,
  body.is-ready .auth {
    transition: none;
  }
}
