/* =========================================================================
   Apocaliptic — authentication screen
   =========================================================================
   Self-hosted font, no external requests. The sliding panel is a progressive
   enhancement: without JavaScript each route renders its own panel and both
   forms still submit normally.
   ========================================================================= */

@font-face { font-family: Poppins; font-weight: 300; font-display: swap;
             src: url("/fonts/poppins-300.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 400; font-display: swap;
             src: url("/fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap;
             src: url("/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap;
             src: url("/fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap;
             src: url("/fonts/poppins-700.woff2") format("woff2"); }

/* Animatable angle for the rotating border sweep. Unsupported browsers simply
   render a static border instead. */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  --ink:        #05070c;
  --ink-2:      #0a0e17;
  --glass:      rgba(18, 24, 38, .58);
  --line:       rgba(255, 255, 255, .10);
  --line-2:     rgba(255, 255, 255, .18);

  --fg:         #eef3fb;
  --fg-dim:     #9aa7bd;
  --fg-faint:   #6a768c;

  /* Brand red leads; cyan is the counter-tone in the sweep and on links. */
  --neon:       #e8503f;
  --neon-2:     #00e5ff;
  --neon-3:     #ff8a3d;
  --neon-glow:  rgba(232, 80, 63, .55);
  --cyan-glow:  rgba(0, 229, 255, .40);

  --ok:         #35d07f;
  --warn:       #e3b341;
  --bad:        #ff5d6c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body.auth-body {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px 16px;
  background: var(--ink);
  color: var(--fg);
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* =======================================================  background  ==== */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
  will-change: transform;
}
.aurora span:nth-child(1) {
  width: 46vmax; height: 46vmax;
  top: -16vmax; left: -12vmax;
  background: radial-gradient(circle, var(--neon), transparent 68%);
  animation: drift-a 22s ease-in-out infinite;
}
.aurora span:nth-child(2) {
  width: 40vmax; height: 40vmax;
  bottom: -14vmax; right: -10vmax;
  background: radial-gradient(circle, var(--neon-2), transparent 68%);
  animation: drift-b 27s ease-in-out infinite;
  opacity: .34;
}
.aurora span:nth-child(3) {
  width: 30vmax; height: 30vmax;
  top: 42%; left: 52%;
  background: radial-gradient(circle, var(--neon-3), transparent 70%);
  animation: drift-c 31s ease-in-out infinite;
  opacity: .22;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(14vmax, 9vmax) scale(1.16); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-12vmax, -8vmax) scale(1.22); }
}
@keyframes drift-c {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-62%, -38%) scale(1.3); }
}

/* A faint grid so the dark areas aren't dead flat. */
.grid-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 78%);
}

/* ============================================================  card  ===== */

.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
}

.auth-card {
  position: relative;
  padding: 36px 34px 30px;
  border-radius: 24px;
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(1.5);
  -webkit-backdrop-filter: blur(26px) saturate(1.5);
  box-shadow:
    0 40px 90px rgba(0, 0, 0, .62),
    0 0 0 1px var(--line) inset,
    0 0 70px -30px var(--neon-glow);
  overflow: hidden;
  transition: height 520ms cubic-bezier(.65, 0, .2, 1);
}

/* Rotating conic sweep along the border. */
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: conic-gradient(
    from var(--angle),
    transparent 0%,
    var(--neon) 12%,
    var(--neon-3) 22%,
    transparent 38%,
    transparent 62%,
    var(--neon-2) 76%,
    transparent 92%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: sweep 7s linear infinite;
  pointer-events: none;
}
@keyframes sweep { to { --angle: 360deg; } }

/* Sheen that drifts across the glass. */
.auth-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 34%, rgba(255,255,255,.055) 50%, transparent 66%);
  background-size: 260% 100%;
  animation: sheen 9s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 100% { background-position: 130% 0; }
  50%      { background-position: -30% 0; }
}

/* ===========================================================  brand  ===== */

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-bottom: 26px;
}
.auth-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--neon), var(--neon-3));
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 0 26px -4px var(--neon-glow);
}
.auth-brand-text { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.auth-brand-text b { font-weight: 700; }
.auth-brand-text span { color: var(--fg-faint); font-weight: 300; }

/* ==========================================================  panels  ===== */

.auth-track { position: relative; }

.auth-panel { display: none; }
.auth-panel.is-active { display: block; }

/* With JS both panels are laid out and cross-faded instead. */
.js .auth-track { display: grid; }
.js .auth-panel {
  display: block;
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(26px) scale(.985);
  transition: opacity 360ms ease, transform 460ms cubic-bezier(.65,0,.2,1), visibility 0s 460ms;
}
.js .auth-panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 420ms ease 90ms, transform 520ms cubic-bezier(.2,.9,.25,1) 60ms, visibility 0s;
}

.auth-panel h2 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.02em;
  text-align: center;
  margin-bottom: 4px;
}
.auth-sub {
  text-align: center;
  color: var(--fg-dim);
  font-size: 13px;
  font-weight: 300;
  margin-bottom: 22px;
}

/* ======================================================  form fields  ==== */

.field {
  position: relative;
  margin-bottom: 22px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 15px 14px 7px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--fg);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 200ms, background 200ms, box-shadow 200ms;
}
.field textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  resize: none;
  padding-top: 22px;
}
.field input::placeholder,
.field textarea::placeholder { color: transparent; }

.field input:hover, .field textarea:hover { border-color: var(--line-2); }

.field input:focus, .field textarea:focus {
  background: rgba(255, 255, 255, .06);
  border-color: var(--neon);
  box-shadow: 0 0 0 3.5px rgba(232, 80, 63, .16), 0 0 26px -8px var(--neon-glow);
}

/* Floating label: rises when focused or filled. */
.field label {
  position: absolute;
  top: 15px;
  left: 15px;
  color: var(--fg-dim);
  font-size: 14.5px;
  font-weight: 300;
  pointer-events: none;
  transform-origin: left top;
  transition: transform 200ms cubic-bezier(.2,.9,.25,1), color 200ms;
}
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label {
  transform: translateY(-9px) scale(.74);
  color: var(--neon);
}
.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label { transform: translateY(-11px) scale(.74); }

/* Chrome's autofill repaints the field; keep it on-theme. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px #141b29 inset;
  caret-color: var(--fg);
}

.field.invalid input,
.field.invalid textarea { border-color: var(--bad); }
.field.invalid input:focus,
.field.invalid textarea:focus { box-shadow: 0 0 0 3.5px rgba(255, 93, 108, .18); }

.field-msg {
  display: block;
  margin: 7px 2px 0;
  font-size: 11.5px;
  font-weight: 300;
  color: var(--bad);
}

/* Reveal-password eye. */
.peek {
  position: absolute;
  top: 10px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--fg-faint);
  cursor: pointer;
  transition: color 180ms, background 180ms;
}
.peek:hover { color: var(--fg); background: rgba(255,255,255,.06); }

.caps {
  display: none;
  margin: 7px 2px 0;
  font-size: 11.5px;
  color: var(--warn);
}
.caps.on { display: block; }

/* Password strength. */
.meter { display: flex; gap: 4px; margin: 9px 2px 0; }
.meter i {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,.10);
  transition: background 260ms;
}
.meter.s1 i:nth-child(1)                        { background: var(--bad); }
.meter.s2 i:nth-child(-n+2)                     { background: var(--warn); }
.meter.s3 i:nth-child(-n+3)                     { background: #8bd450; }
.meter.s4 i                                     { background: var(--ok); }
.meter-label {
  margin: 5px 2px 0;
  font-size: 11px;
  font-weight: 300;
  color: var(--fg-faint);
  min-height: 15px;
}

/* ==========================================================  extras  ===== */

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -6px 2px 20px;
  font-size: 12.5px;
  font-weight: 300;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-dim);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--neon);
  cursor: pointer;
}

.btn-neon {
  position: relative;
  width: 100%;
  height: 47px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(100deg, var(--neon), var(--neon-3));
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .012em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 26px -8px var(--neon-glow), 0 0 0 1px rgba(255,255,255,.10) inset;
  transition: transform 180ms, box-shadow 260ms, filter 200ms;
}
.btn-neon:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 14px 34px -8px var(--neon-glow), 0 0 44px -12px var(--neon-glow);
  filter: brightness(1.06);
}
.btn-neon:active { transform: translateY(0); }
/* Light sweeping across the button on hover. */
.btn-neon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.34) 50%, transparent 70%);
  background-size: 250% 100%;
  background-position: 160% 0;
  transition: background-position 750ms ease;
}
.btn-neon:hover::after { background-position: -60% 0; }

.swap {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 300;
  color: var(--fg-dim);
}
.swap button {
  background: none;
  border: none;
  padding: 0 0 1px;
  color: var(--neon-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms, text-shadow 200ms;
}
.swap button:hover {
  border-bottom-color: var(--neon-2);
  text-shadow: 0 0 14px var(--cyan-glow);
}

/* ==========================================================  alerts  ===== */

.notice {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  margin-bottom: 20px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 300;
  line-height: 1.5;
}
.notice svg { flex: 0 0 auto; margin-top: 1px; }
.notice-error { background: rgba(255,93,108,.10); border-color: rgba(255,93,108,.34); color: #ffaeb5; }
.notice-ok    { background: rgba(53,208,127,.10); border-color: rgba(53,208,127,.34); color: #86e5b4; }
.notice ul { margin: 5px 0 0; padding-left: 16px; }
.notice li { margin: 2px 0; }
.notice strong { font-weight: 600; }

/* =========================================================  a11y/etc  ==== */

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

.hint {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  font-weight: 300;
  color: var(--fg-faint);
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 22px 24px; border-radius: 20px; }
  .auth-panel h2 { font-size: 22px; }
}

/* Motion is decoration here — none of it carries meaning. */
@media (prefers-reduced-motion: reduce) {
  .aurora span,
  .auth-card::before,
  .auth-card::after { animation: none !important; }
  * { transition-duration: 1ms !important; }
}
