/* Splash screen and admin login. Colours are taken from the Skyspan logo. */
:root {
  --sky-950: #071f38;
  --sky-900: #0a2f52;
  --sky-800: #0f4577;
  --sky-700: #155f99;
  --sky-600: #1b75bc; /* logo blue */
  --sky-300: #7cbcef;
  --sun: #fbb040;     /* logo paper plane */
  --ink: #14202e;
  --ink-muted: #5a6778;
  --line: #d5dee8;
  --field: #f7f9fc;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-line: #fecdca;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body.auth {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--sky-800);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Textured blue ground ----------
   Layers, top to bottom: fine grain, faint globe meridians and an orbit swoosh
   echoing the logo, two soft light pools, and the base gradient. */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--sky-800);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cg stroke-opacity='.07'%3E%3Ccircle cx='1180' cy='420' r='560'/%3E%3Cellipse cx='1180' cy='420' rx='300' ry='560' transform='rotate(-24 1180 420)'/%3E%3Cellipse cx='1180' cy='420' rx='140' ry='560' transform='rotate(-24 1180 420)'/%3E%3Cellipse cx='1180' cy='420' rx='560' ry='250' transform='rotate(-24 1180 420)'/%3E%3Cellipse cx='1180' cy='420' rx='560' ry='80' transform='rotate(-24 1180 420)'/%3E%3C/g%3E%3Cpath stroke-opacity='.1' stroke-width='3' d='M-40 820 C 380 1040 1080 1010 1640 470'/%3E%3Cpath stroke-opacity='.05' stroke-width='2' d='M-40 900 C 460 1100 1180 1060 1640 600'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse 70% 55% at 18% 12%, rgba(124, 188, 239, 0.45), transparent 62%),
    radial-gradient(ellipse 75% 70% at 92% 105%, rgba(7, 31, 56, 0.85), transparent 65%),
    linear-gradient(155deg, var(--sky-600) 0%, var(--sky-800) 52%, var(--sky-950) 100%);
  background-size: 220px 220px, cover, auto, auto, auto;
  background-position: 0 0, center, 0 0, 0 0, 0 0;
}

/* ---------- Splash ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  cursor: pointer;
}
.js .splash { display: grid; }
.js.splash-skip .splash,
.splash[hidden] { display: none; }

.splash-inner {
  display: grid;
  justify-items: center;
  gap: 2.25rem;
  padding: 1.5rem;
}

.splash-logo {
  width: min(56vw, 240px);
  height: auto;
  filter: drop-shadow(0 14px 34px rgba(3, 18, 34, 0.35));
  animation: logo-in 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.splash-bar {
  width: min(40vw, 150px);
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  animation: fade-in 0.4s 0.5s ease both;
}
.splash-bar::after {
  content: "";
  display: block;
  height: 100%;
  background: var(--sun);
  transform-origin: left center;
  animation: bar-fill 1.9s 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.splash.is-leaving { animation: splash-out 0.6s ease both; }

@keyframes logo-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes bar-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes splash-out {
  to { opacity: 0; transform: scale(1.03); visibility: hidden; }
}

/* ---------- Login ---------- */
.login-stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

/* While the splash plays the card waits underneath, then rises in. */
.js .login-stage {
  opacity: 0;
  transform: translateY(18px);
}
.js.splash-skip .login-stage,
.js.splash-done .login-stage {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 2.25rem 2rem 2rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 32px 64px -24px rgba(3, 18, 34, 0.6),
    0 12px 24px -12px rgba(3, 18, 34, 0.3);
}

.login-logo {
  display: block;
  width: 96px;
  height: auto;
  margin: 0 auto 1.5rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}

.login-sub {
  margin: 0 0 1.75rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.alert {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9rem;
}

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.field input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--sky-600);
  box-shadow: 0 0 0 3px rgba(27, 117, 188, 0.22);
}

.password-wrap { position: relative; }

.toggle-password {
  display: none;
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sky-600);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.toggle-password:hover { background: rgba(27, 117, 188, 0.08); }
.toggle-password:focus-visible {
  outline: 2px solid var(--sky-600);
  outline-offset: 1px;
}
.js .toggle-password { display: block; }
.js .password-wrap input { padding-right: 4.25rem; }

.btn-login {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #ffffff;
  background: var(--sky-600);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn-login:hover { background: var(--sky-700); }
.btn-login:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}
.btn-login:disabled {
  background: #9fb3c6;
  cursor: not-allowed;
}

.login-foot {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 420px) {
  .login-card { padding: 1.75rem 1.25rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-logo,
  .splash-bar,
  .splash-bar::after,
  .splash.is-leaving {
    animation-duration: 1ms;
    animation-delay: 0s;
  }
  .js.splash-skip .login-stage,
  .js.splash-done .login-stage {
    transition: none;
  }
}
