/* login-alive.css — decorative layer for the login / sign-up screens.
   Purely visual: no IDs or behavior from app.js are changed. */
:root {
  --la-glow: rgba(255, 196, 92, 0.22);
  --la-kernel-a: rgba(232, 170, 70, 0.7);
  --la-kernel-b: rgba(255, 236, 190, 0.95);
  --la-card-bg: rgba(255, 255, 255, 0.62);
  --la-card-border: rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] {
  --la-glow: rgba(255, 170, 60, 0.16);
  --la-kernel-a: rgba(255, 190, 100, 0.28);
  --la-kernel-b: rgba(255, 236, 200, 0.22);
  --la-card-bg: rgba(28, 28, 30, 0.55);
  --la-card-border: rgba(255, 255, 255, 0.07);
}

/* background canvas */
body.la-on #login, body.la-on #teacherLogin, body.la-on #teacherSignup { position: relative; z-index: 1; }

/* card */
.la-card {
  --mx: 50%; --my: 0%;
  padding: 36px 40px 32px; border-radius: 28px;
  background:
    radial-gradient(420px circle at var(--mx) var(--my), var(--la-glow), transparent 60%),
    var(--la-card-bg);
  border: 1px solid var(--la-card-border);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  max-width: 480px !important; box-sizing: border-box;
}
@media (max-width: 560px) { .la-card { padding: 28px 20px 24px; margin-left: 12px !important; margin-right: 12px !important; } }
.la-card.la-enter { animation: la-card-in .9s cubic-bezier(.2, 1.4, .35, 1) both; }
@keyframes la-card-in {
  0% { opacity: 0; transform: translateY(28px) scale(.96); }
  100% { opacity: 1; transform: none; }
}
.la-card h2 { margin-bottom: 24px !important; }

/* inputs */
.la-card .login-input {
  transition: border-color .2s ease, box-shadow .25s ease, transform .25s cubic-bezier(.2,1.6,.4,1), background-color .2s ease;
}
.la-card .login-input:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--input-border)); }
.la-card .login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 6px 18px rgba(255, 170, 60, .12);
  transform: translateY(-1px);
}
.la-card .login-input:focus-visible { outline: none; }
.la-card a.login-link:focus-visible,
.la-card button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* magnetic primary button */
.la-card .login-buttons button {
  background: var(--accent) !important; color: #fff !important; border-color: transparent !important;
  min-width: 160px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: box-shadow .2s ease, background-color .2s ease;
  will-change: transform;
}
.la-card .login-buttons button:hover { background: var(--accent-hover) !important; }

/* ----- mascot rig ----- */
.la-logo { position: relative; display: inline-block; width: 150px; height: 150px; margin: -12px 0 -8px; }
.la-logo > img.la-src { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none !important; animation: none !important; }
.la-logo.la-ready > img.la-src { opacity: 0; }
.la-rig {
  position: absolute; inset: 0; cursor: pointer; transform-origin: 50% 85%;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .16)); will-change: transform; opacity: 0;
}
[data-theme="dark"] .la-rig { filter: brightness(1.06) drop-shadow(0 6px 18px rgba(255, 190, 110, .14)); }
.la-logo.la-ready .la-rig { opacity: 1; }
.la-rig img { position: absolute; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; will-change: transform; max-width: none; }
.la-rig .la-base { inset: 0; width: 100%; height: 100%; }
.la-blush { position: absolute; width: 9%; height: 5%; border-radius: 50%; background: rgba(255, 110, 110, .55); filter: blur(2px); opacity: 0; transition: opacity .35s ease; }
.la-logo.la-shy .la-blush { opacity: 1; }
.la-kernel { position: absolute; width: 14%; height: 14%; left: 43%; top: 30%; pointer-events: none; }
.la-logo:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 24px; }

@media (prefers-reduced-motion: reduce) {
  .la-card.la-enter { animation: la-fade .4s ease both; }
  @keyframes la-fade { from { opacity: 0; } to { opacity: 1; } }
  #la-bg { display: none; }
  .la-logo > img.la-src { opacity: 1 !important; }
  .la-rig { display: none; }
}

/* ===================== login-alive 2 ===================== */
@font-face {
  font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/fonts/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@property --la-sky-top { syntax: "<color>"; inherits: true; initial-value: #fdf3e4; }
@property --la-sky-bot { syntax: "<color>"; inherits: true; initial-value: #fbf8f2; }
@property --la-mood-glow { syntax: "<color>"; inherits: true; initial-value: rgba(255, 196, 92, .22); }

/* 1. time-of-day sky (only while a login panel is showing) */
body.la-on, body.la-sendoff {
  background:
    radial-gradient(1200px 700px at 50% -10%, var(--la-mood-glow), transparent 70%),
    linear-gradient(180deg, var(--la-sky-top), var(--la-sky-bot)) !important;
  min-height: 100vh;
}
/* stars + marquee haze at night */
body.la-on::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 2s ease;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent), radial-gradient(1px 1px at 28% 8%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 72% 14%, #fff9, transparent), radial-gradient(1px 1px at 86% 26%, #fff5, transparent),
    radial-gradient(1px 1px at 44% 22%, #fff5, transparent), radial-gradient(1.5px 1.5px at 58% 6%, #fff7, transparent),
    radial-gradient(900px 260px at 50% 105%, rgba(200, 40, 60, .22), transparent 70%);
}
[data-la-mood="night"] body.la-on::before { opacity: 1; }
/* links / text that sit outside the card stay readable on dark skies */
[data-la-mood="night"] body.la-on .la-card { --la-card-bg: rgba(255, 255, 255, .74); }
[data-theme="dark"][data-la-mood="night"] body.la-on .la-card { --la-card-bg: rgba(22, 24, 40, .62); }

/* 5. polish: frosted glass + grain + cursor-following gradient border */
.la-card {
  isolation: isolate;
  --la-glow: var(--la-mood-glow);
  border-color: transparent !important;
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 24px 60px -20px rgba(20, 12, 40, .35), var(--shadow-lg);
}
.la-card::before { /* grain */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  opacity: .14; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.la-card::after { /* gradient border */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1.5px;
  background:
    radial-gradient(260px circle at var(--mx) var(--my), rgba(255, 170, 60, .95), rgba(255, 110, 140, .55) 40%, transparent 70%),
    linear-gradient(160deg, rgba(255,255,255,.7), rgba(255,255,255,.12) 40%, rgba(255, 196, 92, .35));
  -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 exclude, linear-gradient(#000 0 0);
}
[data-theme="dark"] .la-card::before { opacity: .1; mix-blend-mode: soft-light; }
.la-card h2 {
  font-family: "Fredoka", "Avenir Next Rounded", ui-rounded, system-ui, sans-serif !important;
  font-weight: 600 !important; letter-spacing: .01em; font-size: clamp(26px, 4.2vw, 32px);
}

/* 4. idle juggle kernel sits above the head */
.la-kernel.la-juggle { left: 43%; top: 6%; width: 13%; height: 13%; }
.la-kernel.la-burst { left: 43%; top: 30%; width: 13%; height: 13%; z-index: 2; }

/* 2. sign-in send-off ghost card */
.la-ghost {
  z-index: 9999; pointer-events: none; box-sizing: border-box; overflow: visible;
  transition: transform 1.1s cubic-bezier(.5, -0.35, .7, 1) .25s, opacity .8s ease .55s, filter .9s ease .35s;
}
.la-ghost > *:not(.login-logo) { transition: opacity .35s ease; }
.la-ghost.la-ghost-go { transform: translateY(-40px) scale(.72); opacity: 0; filter: blur(6px); }
.la-ghost.la-ghost-go > *:not(.login-logo) { opacity: 0; }
.la-logo.la-cheer .la-rig { animation: la-cheer .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes la-cheer { 0% { transform: scale(1); } 30% { transform: translateY(-14px) scale(.9, 1.15); } 100% { transform: translateY(-6px) scale(1.18); } }

@media (prefers-reduced-motion: reduce) {
  .la-card::after { background: linear-gradient(160deg, rgba(255,255,255,.7), rgba(255,255,255,.12) 40%, rgba(255, 196, 92, .45)); }
  .la-ghost { display: none; }
}

/* real sky canvas (login-sky.js) sits under the kernel canvas */
/* display:none outside the login view (and astro) so no full-viewport fixed layer lingers on app pages */
/* top-level fixed layer sized to the large viewport (no resize/clear when iOS toolbars collapse), own compositing layer */
#la-sky { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100lvh; pointer-events: none; z-index: -1; display: none; transform: translateZ(0); -webkit-transform: translateZ(0); }
body.la-on #la-sky, body.la-sendoff #la-sky { display: block; }
.la-sky-on body.la-on::before { display: none; }
/* readable over every sky: slightly denser glass on dark or busy skies */
[data-la-wx="storm"] body.la-on .la-card, [data-la-wx="rain"] body.la-on .la-card { --la-card-bg: rgba(255, 255, 255, .78); }
[data-theme="dark"][data-la-wx] body.la-on .la-card { --la-card-bg: rgba(22, 24, 40, .66); }

/* subtle glass pill links (Teacher Login / Request Account / Back) */
.la-card .login-link-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.la-card a.login-link.la-pill {
  display: inline-flex; align-items: center; padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  text-decoration: none !important; color: inherit; opacity: .86;
  background: rgba(255, 255, 255, .38); border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 8px rgba(20, 12, 40, .08);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity .2s ease, background-color .2s ease, transform .2s cubic-bezier(.2,1.6,.4,1);
}
.la-card a.login-link.la-pill:hover { opacity: 1; background: rgba(255, 255, 255, .6); transform: translateY(-1px); }
[data-theme="dark"] .la-card a.login-link.la-pill { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); box-shadow: none; }
.la-card .login-note { font-size: 12.5px; opacity: .7; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .la-card a.login-link.la-pill { transition: none; } }
