/* ==========================================================
   SNEAKERS HUB - css/login.css
   Extra styles for the CREATIVE LOGIN page (login.html only).
   It is loaded AFTER style.css, so it uses the same theme colors.

   HOW IT WORKS:
   The login section has a "state" in its data-state attribute:
     intro   -> only the big sneaker is shown, in the middle
     open    -> the sneaker slid to the left, the login form appeared on the right
     success -> after a successful login (the sneaker returns to the middle)
   login.js changes the state. This file animates the change.
   ========================================================== */


/* ==========================================================
   1. THE STAGE (the whole login area)
   ========================================================== */
.login-stage {
  --login-ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: relative;
  display: grid;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
  padding: 2.5rem 0 3rem;
  overflow: hidden;
  background:
    radial-gradient(55% 60% at 50% 40%, var(--glow), transparent 70%),
    var(--bg);
  transition: background-color var(--theme-transition);
}

.login-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 2rem;
}


/* ==========================================================
   2. LEFT SIDE: the sneaker and its caption
   ========================================================== */
.login-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 1s var(--login-ease);
}

/* intro (and success): the sneaker sits in the MIDDLE of the stage.
   The left column is moved right by half of its width (+ half of the gap). */
.login-stage[data-state="intro"] .login-left,
.login-stage[data-state="success"] .login-left {
  transform: translateX(calc(50% + 1rem)) scale(1.1);
}

/* ---- The sneaker (a big button) ---- */
.login-shoe {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 1;
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: max-width 1s var(--login-ease);
  -webkit-tap-highlight-color: transparent;
}

.login-stage:not([data-state="intro"]) .login-shoe {
  max-width: 380px;
  cursor: default;
}

.login-shoe:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 8px;
}

/* the circle and the photo sit on top of each other */
.login-shoe-circle,
.login-shoe-img {
  grid-area: 1 / 1;
}

.login-shoe-circle {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(145deg, var(--primary), var(--surface-2));
  border-radius: 50%;
  box-shadow: 0 0 90px var(--glow);
  opacity: 0.92;
  transition: transform 0.6s ease, background var(--theme-transition), box-shadow var(--theme-transition);
}

.login-stage[data-state="intro"] .login-shoe:hover .login-shoe-circle {
  transform: scale(1.05);
}

.login-shoe-img {
  position: relative;
  width: 74%;
  aspect-ratio: 1 / 1.1;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: 28px;
  box-shadow: var(--shadow);
  animation: loginFloat 6s ease-in-out infinite;
}

/* ---- "Tap the sneaker" hint ---- */
.login-tap {
  position: absolute;
  left: 50%;
  bottom: 2%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: loginPulse 2.2s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.login-stage:not([data-state="intro"]) .login-tap {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

/* ---- The text under the sneaker (appears after the click) ---- */
.login-caption {
  max-width: 420px;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: max-height 0.8s var(--login-ease), margin-top 0.8s var(--login-ease),
              opacity 0.6s ease 0.45s, transform 0.6s ease 0.45s;
}

.login-stage:not([data-state="intro"]) .login-caption {
  max-height: 260px;
  margin-top: 1.4rem;
  opacity: 1;
  transform: none;
}

.login-caption h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 800;
}

.login-caption p {
  margin-top: 0.5rem;
  color: var(--text-muted);
}


/* ==========================================================
   3. RIGHT SIDE: the login form
   ========================================================== */
.login-panel {
  transition: opacity 0.7s ease 0.25s, transform 1s var(--login-ease) 0.1s;
}

/* hidden: in the intro, and after a successful login */
.login-stage[data-state="intro"] .login-panel,
.login-stage[data-state="success"] .login-panel {
  opacity: 0;
  transform: translateX(80px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.8s var(--login-ease), visibility 0s linear 0.8s;
}

/* visible: after the click */
.login-stage[data-state="open"] .login-panel {
  opacity: 1;
  transform: none;
  visibility: visible;
}

.login-panel .auth-card {
  width: 100%;
  animation: none;
}


/* ==========================================================
   4. ANIMATIONS
   ========================================================== */
@keyframes loginFloat {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-14px) rotate(-3deg); }
}

@keyframes loginPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.06); }
}


/* ==========================================================
   5. PHONES AND TABLETS
   The sneaker stays on top (smaller) and the form opens below it.
   ========================================================== */
@media (max-width: 900px) {
  .login-stage {
    padding: 1.5rem 0 2.5rem;
  }

  .login-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* no sliding sideways: the sneaker only grows a little in the intro */
  .login-stage[data-state="intro"] .login-left,
  .login-stage[data-state="success"] .login-left {
    transform: scale(1.04);
  }

  .login-shoe {
    max-width: 340px;
  }

  .login-stage:not([data-state="intro"]) .login-shoe {
    max-width: 210px;
  }

  /* the form opens downwards instead of sliding in from the side */
  .login-panel {
    transition: opacity 0.7s ease 0.25s, max-height 1.1s ease;
  }

  .login-stage[data-state="intro"] .login-panel,
  .login-stage[data-state="success"] .login-panel {
    max-height: 0;
    overflow: hidden;
    transform: none;
    transition: opacity 0.4s ease, max-height 0.6s ease, visibility 0s linear 0.6s;
  }

  .login-stage[data-state="open"] .login-panel {
    max-height: 1800px;
  }
}