/* =====================================================================
   Hollow Finch — login / sign-up / setup screens
   Loaded after portal.css. Animations use transform + opacity only.
   ===================================================================== */

body.auth-page {
  min-height: 100vh; margin: 0; overflow-x: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; background: #120a17; color: #fff;
}

/* ---------- Animated background ---------- */
.auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; contain: strict; transform: translateZ(0); }
.auth-bg::before {
  content: ''; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg at 50% 50%, #BB5098, #7A5197, #E28144, #BB5098, #7A5197, #BB5098);
  opacity: .55; animation: hf-spin 40s linear infinite; will-change: transform;
}
.auth-bg::after {   /* darkening veil so text stays readable */
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(18,10,23,.35), rgba(18,10,23,.85) 70%);
}
.auth-blob {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  background: radial-gradient(circle closest-side, var(--c) 0%, var(--c) 35%, transparent 100%);
  opacity: .55; will-change: transform; z-index: 1;
}
.auth-blob.b1 { --c: #BB5098; top: -18vmax; left: -12vmax; animation: hf-float1 22s ease-in-out infinite alternate; }
.auth-blob.b2 { --c: #7A5197; bottom: -20vmax; right: -14vmax; animation: hf-float2 26s ease-in-out infinite alternate; }
.auth-blob.b3 { --c: #E28144; width: 26vmax; height: 26vmax; top: 55%; left: 8%; opacity: .35; animation: hf-float3 18s ease-in-out infinite alternate; }

.auth-particles { position: absolute; inset: 0; z-index: 2; }
.auth-particles span {
  position: absolute; bottom: -20px; left: var(--x); width: var(--s); height: var(--s);
  border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 0 12px rgba(255,255,255,.6);
  opacity: 0; animation: hf-rise var(--d) linear infinite; animation-delay: var(--delay); will-change: transform, opacity;
}

/* admin: deeper palette + subtle grid */
.auth-admin { background: #07050c; }
.auth-admin .auth-bg::before {
  background: conic-gradient(from 90deg at 50% 50%, #2a1440, #7A5197, #1a0f26, #BB5098, #2a1440);
  opacity: .7; animation-duration: 60s;
}
.auth-admin .auth-blob.b1 { --c: #5a2d7c; }
.auth-admin .auth-blob.b2 { --c: #BB5098; opacity: .35; }
.auth-admin .auth-blob.b3 { --c: #E28144; opacity: .18; }
.auth-grid {
  position: absolute; inset: -40px; z-index: 2; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 40px 40px; animation: hf-grid 14s linear infinite; will-change: transform;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 70%);
          mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 70%);
}

/* ---------- Card ---------- */
.auth-shell { position: relative; z-index: 5; width: 100%; max-width: 440px; }
.auth-shell.wide { max-width: 680px; }
.auth-card {
  position: relative; padding: 30px 26px 28px; border-radius: 24px;
  background: rgba(30, 18, 38, .78);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.12);
  animation: hf-card-in .8s cubic-bezier(.2,.8,.2,1) both;
}
.auth-card::before {   /* animated pink rim light */
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(187,80,152,.9), transparent 40%, transparent 60%, rgba(226,129,68,.8));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: .7;
}
.auth-admin .auth-card { background: rgba(14, 9, 20, .82); border-color: rgba(187,80,152,.3); }
@media (min-width: 560px) { .auth-card { padding: 38px 40px 34px; } }

.auth-stagger > * { animation: hf-rise-in .6s cubic-bezier(.2,.8,.2,1) both; }
.auth-stagger > *:nth-child(1) { animation-delay: .15s; }
.auth-stagger > *:nth-child(2) { animation-delay: .22s; }
.auth-stagger > *:nth-child(3) { animation-delay: .29s; }
.auth-stagger > *:nth-child(4) { animation-delay: .36s; }
.auth-stagger > *:nth-child(5) { animation-delay: .43s; }
.auth-stagger > *:nth-child(6) { animation-delay: .50s; }
.auth-stagger > *:nth-child(7) { animation-delay: .57s; }
.auth-stagger > *:nth-child(n+8) { animation-delay: .64s; }

.auth-logo-pill {
  display: block; width: 190px; margin: 0 auto; padding: 10px 22px; border-radius: 999px;
  background: #fff; box-shadow: 0 10px 30px rgba(187,80,152,.35); transition: transform .3s;
}
.auth-logo-pill:hover { transform: translateY(-2px) scale(1.02); }
.auth-logo-pill img { width: 100%; height: auto; }
.auth-tagline {
  text-align: center; margin: 12px 0 0; font-family: 'Playfair Display', Georgia, serif; font-style: italic;
  font-size: 1.05rem; letter-spacing: .04em; color: #f3c6e2;
}
.admin-badge {
  position: relative; overflow: hidden; display: flex; width: max-content; margin: 14px auto 0;
  align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  background: linear-gradient(135deg, #E28144, #BB5098); color: #fff; box-shadow: 0 6px 20px rgba(226,129,68,.35);
}
.admin-badge::after {  /* shimmer sweep */
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: translateX(-120%); animation: hf-shimmer 3.2s ease-in-out infinite;
}
.auth-card h1 { text-align: center; font-size: 1.45rem; margin: 18px 0 4px; color: #fff; }
.auth-sub { text-align: center; color: #cdbfd6; margin: 0 0 22px; font-size: .9rem; }

/* ---------- Floating-label fields ---------- */
.field { position: relative; margin-bottom: 18px; }
.field-input {
  width: 100%; height: 56px; padding: 22px 16px 8px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16); background: rgba(10,6,14,.45); color: #fff;
  font: inherit; font-size: .95rem; outline: none; transition: border-color .25s;
}
.field.has-toggle .field-input { padding-right: 50px; }
.field label {
  position: absolute; left: 17px; top: 18px; color: #b9aac5; font-size: .95rem; pointer-events: none;
  transform-origin: left top; transition: transform .22s cubic-bezier(.2,.8,.2,1), color .22s;
}
.field-input:focus + label,
.field-input:not(:placeholder-shown) + label { transform: translateY(-11px) scale(.76); color: #f3a6d6; }
.field-input:-webkit-autofill + label { transform: translateY(-11px) scale(.76); }
.field-input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 1000px #1c1222 inset; transition: background-color 9999s; }
.field-glow {   /* focus glow: opacity-only fade of a pre-rendered shadow */
  position: absolute; inset: 0; border-radius: 14px; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 3px rgba(187,80,152,.35), 0 0 24px rgba(187,80,152,.45); transition: opacity .25s;
}
.field-input:focus { border-color: rgba(187,80,152,.85); }
.field-input:focus ~ .field-glow { opacity: 1; }
.field.is-invalid .field-input { border-color: #f46a6a; }
.field.is-invalid .field-glow { opacity: 1; box-shadow: 0 0 0 3px rgba(244,106,106,.3); }
.field-error { display: block; font-size: .76rem; color: #ffaaaa; min-height: 0; margin-top: 4px; opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; }
.field.is-invalid .field-error { opacity: 1; transform: none; }
.field-hint { display: block; font-size: .74rem; color: #9d8ea8; margin-top: 4px; }
.pw-toggle {
  position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: #b9aac5; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform .2s, color .2s;
}
.pw-toggle:hover { color: #fff; transform: scale(1.08); }
.pw-toggle .eye-closed { display: none; }
.pw-toggle[aria-pressed="true"] .eye-open { display: none; }
.pw-toggle[aria-pressed="true"] .eye-closed { display: block; }

.auth-check { display: flex; gap: 10px; align-items: flex-start; font-size: .85rem; color: #d8cce0; margin: 4px 0 18px; cursor: pointer; }
.auth-check input { accent-color: #BB5098; width: 17px; height: 17px; margin-top: 2px; flex-shrink: 0; }
.auth-check a { color: #f3a6d6; }
.auth-form-grid { display: grid; gap: 0 16px; }
@media (min-width: 600px) { .auth-form-grid { grid-template-columns: 1fr 1fr; } .auth-form-grid .span-2 { grid-column: span 2; } }

/* ---------- Submit button ---------- */
.btn-auth {
  position: relative; overflow: hidden; width: 100%; height: 54px; border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 1rem; letter-spacing: .02em; color: #fff;
  background: linear-gradient(135deg, #BB5098 0%, #7A5197 55%, #E28144 130%);
  box-shadow: 0 12px 30px rgba(187,80,152,.4); transition: transform .2s, box-shadow .2s;
}
.btn-auth::before {   /* shine sweep on hover */
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: translateX(-130%);
}
.btn-auth:hover { transform: translateY(-2px); }
.btn-auth:hover::before { transform: translateX(260%); transition: transform .8s ease; }
.btn-auth:active { transform: translateY(0) scale(.99); }
.btn-auth .btn-label { display: inline-block; transition: opacity .2s, transform .2s; }
.btn-spinner {
  position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; opacity: 0; transform: scale(.6);
  transition: opacity .2s, transform .2s;
}
.btn-auth.is-loading { pointer-events: none; }
.btn-auth.is-loading .btn-label { opacity: 0; transform: translateY(8px); }
.btn-auth.is-loading .btn-spinner { opacity: 1; transform: scale(1); animation: hf-spin .7s linear infinite; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.45);
  width: 20px; height: 20px; margin: -10px 0 0 -10px; transform: scale(0); animation: hf-ripple .65s ease-out forwards;
}

/* ---------- Alerts inside the card ---------- */
.auth-card .alert { border-radius: 12px; animation: hf-rise-in .4s ease both; }
.auth-card .alert-success { position: relative; padding-left: 44px; }
.auth-card .alert-success::before {
  content: ''; position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%;
  background: #34c38f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23062a1c' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / 14px no-repeat;
  animation: hf-pop .5s .25s cubic-bezier(.3,1.6,.5,1) both;
}

/* error shake / success glow on the whole card */
.auth-card.shake { animation: hf-shake .5s cubic-bezier(.36,.07,.19,.97) both; }
.auth-card.success-glow::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(52,195,143,.6), 0 0 40px rgba(52,195,143,.35); opacity: 0; animation: hf-glow 1.6s ease both;
}

.auth-links { position: relative; z-index: 5; text-align: center; margin-top: 18px; font-size: .88rem; color: #cdbfd6; animation: hf-rise-in .6s .7s ease both; }
.auth-links a { color: #fff; font-weight: 500; }
.auth-links a:hover { color: #f3a6d6; }
.auth-note { text-align: center; font-size: .76rem; color: #a998b4; margin: 16px 0 0; }
.auth-note a { color: #f3a6d6; }


/* member variant: brighter, more colourful backdrop */
.auth-member .auth-bg::before { opacity: .75; }
.auth-member .auth-bg::after { background: radial-gradient(circle at 50% 40%, rgba(18,10,23,.15), rgba(18,10,23,.7) 75%); }
/* while scrolling (class set by auth.js) the background holds still → smooth scroll */
.is-scrolling .auth-bg *, .is-scrolling .auth-bg::before { animation-play-state: paused !important; }

/* ---------- Keyframes ---------- */
@keyframes hf-spin { to { transform: rotate(360deg); } }
@keyframes hf-float1 { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes hf-float2 { to { transform: translate(-12vmax, -8vmax) scale(1.1); } }
@keyframes hf-float3 { to { transform: translate(30vw, -20vh) scale(1.3); } }
@keyframes hf-grid { to { transform: translate(40px, 40px); } }
@keyframes hf-rise {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translateY(-110vh) scale(1); opacity: 0; }
}
@keyframes hf-card-in { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes hf-rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hf-shimmer { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@keyframes hf-ripple { to { transform: scale(26); opacity: 0; } }
@keyframes hf-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes hf-shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); }
}
@keyframes hf-glow { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .auth-bg::before, .auth-blob, .auth-grid, .auth-particles span, .admin-badge::after { animation: none !important; }
  .auth-particles { display: none; }
  .auth-card, .auth-stagger > *, .auth-links, .auth-card .alert, .auth-card.shake { animation: none !important; }
  .btn-auth, .btn-auth::before, .field label, .field-glow, .pw-toggle, .auth-logo-pill { transition: none !important; }
  .btn-auth.is-loading .btn-spinner { animation-duration: 1.5s !important; }
}
