/* =====================================================================
   Inicio de sesión · pantalla dividida (campus + formulario)
   - Si existe assets/img/campus.jpg se usa como foto del panel izquierdo.
   ===================================================================== */

.auth { min-height: 100vh; min-height: 100dvh; background: #fff; }

.auth__wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* ---- Panel izquierdo ------------------------------------------------- */
.auth__art {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  padding: 2.2rem 2.4rem 2.4rem;
  color: #fff;
  background:
    radial-gradient(70% 55% at 100% 0%, rgba(217, 185, 106, .38), transparent 65%),
    radial-gradient(80% 60% at 0% 100%, rgba(140, 106, 36, .75), transparent 70%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-900) 50%, var(--navy-950) 100%);
}
/* Con foto: imagen + velo para que el texto se lea */
.auth__art.has-photo {
  background:
    linear-gradient(180deg, rgba(11, 41, 21, .55) 0%, rgba(11, 41, 21, .05) 35%, rgba(11, 41, 21, .1) 55%, rgba(11, 41, 21, .8) 100%),
    var(--foto) center / cover no-repeat,
    var(--navy-900);
}
/* Emblema de fondo: la huella del logo y sus raíces creciendo hasta el borde inferior */
.auth__emblem {
  position: absolute; z-index: -1; top: 11%; bottom: 0; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none; user-select: none;
}
/* La huella al centro del panel */
.auth__emblem img { width: min(40%, 290px); flex: none; opacity: .14; filter: brightness(0) invert(1); }
/* Las raíces arrancan de la huella y se abren a todo lo ancho hasta los bordes */
.auth__roots { flex: 1; width: 100%; min-height: 0; margin-top: -2px; opacity: .34; }
.auth__roots .r path {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: raiz 2.6s var(--ease) forwards;
}
.auth__roots .r--tronco path:nth-child(1) { animation-duration: 2.2s; }
.auth__roots .r--tronco path:nth-child(n+2) { animation-delay: .5s; }
.auth__roots .r--tronco path:nth-child(n+4) { animation-delay: .9s; }
.auth__roots .r--morada path { animation-delay: calc(.3s + var(--i, 0) * .12s); }
.auth__roots .r--morada path:nth-child(n+11) { animation-duration: 1.4s; }
.r-brotes circle { opacity: 0; transform-box: fill-box; transform-origin: center; animation: brote .5s var(--ease) 2.4s forwards; }
.r-brotes circle:nth-child(2n) { animation-delay: 2.6s; }
@keyframes raiz  { to { stroke-dashoffset: 0; } }
@keyframes brote { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: none; } }

.auth__brand { display: flex; align-items: center; gap: .85rem; }
.auth__iso {
  flex: none; width: 54px; height: 54px; display: grid; place-items: center;
  border-radius: 16px; background: #fff; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6);
}
.auth__iso img { width: 40px; }
.auth__brand strong { display: block; font: 700 24px/1.05 var(--serif); text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.auth__brand small { font-size: 11px; font-weight: 700; letter-spacing: 2.6px; text-transform: uppercase; color: #E9D9A8; }

.auth__claim { margin-top: auto; max-width: 520px; }
.auth__claim h2 { font: 700 clamp(40px, 4.2vw, 60px)/1 var(--serif); text-shadow: 0 4px 24px rgba(0, 0, 0, .3); }
.auth__claim h2 em { font-style: italic; color: #E3C67A; }
.auth__claim p { margin-top: .8rem; font: italic 600 18px var(--serif); color: #DCEBDF; }
.has-photo .auth__claim { display: none; }   /* con foto, la imagen habla por sí sola */

/* Accesos rápidos (estilo botones apilados) */
.auth__quick { width: min(100%, 320px); display: grid; gap: .7rem; }
.qbtn, .qgroup button, .qgroup a {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  border: 0; cursor: pointer; text-align: left; font: 700 14.5px var(--font); color: #fff;
}
.qbtn { min-height: 52px; padding: .8rem 1rem; border-radius: 12px; box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .7); transition: transform .2s var(--ease), filter .2s; }
.qbtn:hover { transform: translateX(4px); filter: brightness(1.06); }
.qbtn > .bi:first-child { font-size: 1.15rem; }
.qbtn span, .qgroup span { flex: 1; }
.qbtn--red    { background: linear-gradient(135deg, #C9A24D, #8C6A24); }
.qbtn--purple { background: linear-gradient(135deg, #2E7D4A, #1E5631); }
.qgroup { border-radius: 12px; overflow: hidden; background: rgba(9, 32, 17, .84); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 12px 24px -14px rgba(0, 0, 0, .7); }
.qgroup__title { display: flex; align-items: center; gap: .65rem; padding: .85rem 1rem; font-size: 14.5px; font-weight: 800; background: rgba(255, 255, 255, .06); }
.qgroup button, .qgroup a { min-height: 50px; padding: .7rem 1rem .7rem 2.75rem; background: none; font-weight: 600; }
.qgroup button:hover, .qgroup a:hover { background: rgba(255, 255, 255, .07); }
.qgroup > * + * { border-top: 1px solid rgba(255, 255, 255, .06); }

/* ---- Panel derecho (formulario) -------------------------------------- */
.auth__panel { position: relative; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: #fff; }
.auth__box {
  width: 100%; max-width: 400px; margin: auto; padding: 3rem 1.5rem 2rem;
  animation: subir .6s .05s var(--ease) both;
}
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.auth__logo { height: 120px; width: auto; margin: 0 auto 1.4rem; }
.auth__head { margin-bottom: 1.6rem; text-align: center; }
.auth__head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.3px; color: var(--ink); }
.auth__head p { margin-top: .45rem; color: var(--ink-2); font-size: 14.5px; }
.auth__head .auth__example { margin-top: .2rem; font-size: 13px; color: var(--muted); }
.auth__example strong { color: var(--ink-2); font-weight: 600; }

/* Campos */
.auth__form .field__control { background: #F7F5F2; border-color: transparent; }
.auth__form .field__control:focus-within { background: #fff; border-color: var(--navy); }
.field__error { display: flex; gap: .35rem; align-items: center; margin-top: .4rem; font-size: 12.5px; font-weight: 700; color: var(--red-600); }
.field.is-invalid .field__control { background: #fff; border-color: var(--red); box-shadow: 0 0 0 4px rgba(209, 15, 31, .1); }
.field.is-invalid .field__control > .bi { color: var(--red); }
.field__clear {
  flex: none; margin-right: 6px; width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: #C3C6D3; cursor: pointer; font-size: .95rem;
}
.field__clear:hover { color: var(--muted); background: var(--line-2); }
.auth__remember { margin: -.2rem 0 1.2rem; }

.auth__form .btn--primary { border-radius: 12px; }
.auth__forgot-link {
  display: block; margin: 1.3rem auto 0; padding: .3rem .5rem; border: 0; background: none; cursor: pointer;
  font: 700 14px var(--font); color: var(--ink);
}
.auth__forgot-link:hover { color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }

.auth__help-fab {
  position: absolute; right: 1.5rem; bottom: 4.6rem;
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .95rem;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  font: 600 13.5px var(--font); color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.auth__help-fab .bi { color: var(--purple); font-size: 1.05rem; }
.auth__help-fab:hover { border-color: #E8D6A8; color: var(--purple); }

.auth__foot {
  display: flex; justify-content: center; flex-wrap: wrap; gap: .3rem 1.4rem;
  padding: 1.1rem 1.5rem; background: #F6F4F1; font-size: 12.5px; color: var(--muted); text-align: center;
}
.auth__trust { display: inline-flex; align-items: center; gap: .35rem; }
.auth__trust .bi { color: var(--green); }

/* ---- Ventanas de ayuda ------------------------------------------------ */
.dlg {
  width: min(92vw, 440px); padding: 1.5rem; border: 0; border-radius: 20px;
  color: var(--ink); box-shadow: var(--shadow-lg);
}
.dlg[open] { animation: subir .25s var(--ease); }
.dlg::backdrop { background: rgba(11, 41, 21, .55); backdrop-filter: blur(3px); }
.dlg header { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.dlg h2 { flex: 1; font-size: 18px; font-weight: 800; }
.dlg__icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 1.2rem; color: #fff; }
.dlg__icon--red    { background: var(--red); }
.dlg__icon--purple { background: var(--purple); }
.dlg__icon--navy   { background: var(--navy); }
.dlg__x { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--line-2); cursor: pointer; color: var(--ink-2); }
.dlg__x:hover { background: var(--line); }
.dlg p { font-size: 14px; color: var(--ink-2); margin-bottom: .6rem; }
.dlg__steps { margin: 0 0 1.3rem; padding-left: 1.2rem; display: grid; gap: .6rem; font-size: 14px; color: var(--ink-2); }
.dlg__steps a { font-weight: 700; }
.dlg__checks { list-style: none; margin: 0 0 1.3rem; padding: 0; display: grid; gap: .5rem; font-size: 14px; color: var(--ink-2); }
.dlg__checks .bi { color: var(--green); margin-right: .35rem; }

/* ---- Tablet ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .auth__wrap { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); }
  .auth__art { padding: 1.8rem; }
  .auth__help-fab { display: none; }
}

/* ---- Celular: cabecera con la marca + formulario --------------------- */
@media (max-width: 860px) {
  .auth__wrap { grid-template-columns: minmax(0, 1fr); }
  .auth__art {
    position: relative; height: auto; min-height: 210px; gap: 1rem;
    padding: calc(1.3rem + env(safe-area-inset-top)) 1.3rem 2.8rem;
  }
  .auth__art.has-photo { min-height: 240px; }
  .auth__emblem { top: 14px; }
  .auth__emblem img { width: 110px; }
  .auth__emblem img { opacity: .14; }
  .auth__roots { opacity: .25; }
  .auth__brand strong { font-size: 22px; }
  .auth__iso { width: 46px; height: 46px; border-radius: 14px; }
  .auth__iso img { width: 34px; }
  .auth__claim h2 { font-size: 30px; }
  .auth__claim h2 br { display: none; }
  .auth__claim p { font-size: 15px; margin-top: .4rem; }
  .auth__quick { display: none; }   /* en celular la ayuda está en los enlaces del formulario */

  .auth__panel {
    min-height: 0; margin-top: -1.6rem; border-radius: 26px 26px 0 0;
    box-shadow: 0 -12px 30px -18px rgba(0, 0, 0, .45);
  }
  .auth__box { padding: 1.8rem 1.25rem 1.5rem; max-width: 460px; }
  .auth__logo { display: none; }
  .auth__head { text-align: left; margin-bottom: 1.3rem; }
  .auth__head h1 { font-size: 22px; }
  .auth__help-fab { position: static; display: flex; margin: 0 auto 1.4rem; }
  .auth__foot { flex-direction: column; padding-bottom: calc(1.1rem + env(safe-area-inset-bottom)); }
}

@media (max-height: 760px) and (min-width: 861px) {
  .auth__logo { height: 86px; margin-bottom: 1rem; }
  .auth__box { padding-top: 2rem; }
  .auth__claim h2 { font-size: clamp(34px, 3.4vw, 48px); }
}

@media (prefers-reduced-motion: reduce) {
  .auth__box, .dlg[open] { animation: none; }
  .auth__roots .r path { stroke-dashoffset: 0; animation: none; }
  .r-brotes circle { opacity: 1; animation: none; }
}
