/* Login page */

.login-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: clip;
}

.login-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 0;
}

.login-main {
  flex: 1;
  display: grid;
  gap: 28px;
  align-content: start;
  padding-top: 20px;
}

/* ---------- Hero ---------- */

.login-hero {
  position: relative;
  display: grid;
  align-content: start;
  padding-top: 40px;
  padding-inline-end: 34%;
  min-height: 232px;
}

.hero-dial {
  position: absolute;
  z-index: 2; /* sits over the login card's corner on phones */
  inset-inline-end: -88px;
  top: -6px;
  width: 232px;
  pointer-events: none;
}

.login-hero h1 {
  font-size: clamp(36px, 10vw, 64px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

/* ---------- Card ---------- */

.login-card {
  position: relative;
  z-index: 1;
  /* Pull the card up under the altimeter, so Gilad's details fit on the first screen */
  margin-top: -112px;
  padding: 26px 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.step {
  display: grid;
  gap: 22px;
}

.step[hidden] {
  display: none;
}

.step:not([hidden]) {
  animation: rise 0.45s var(--ease-out) both;
}

.step-head {
  display: grid;
  gap: 6px;
}

.step-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  /* keep titles clear of the altimeter covering the card's corner */
  padding-inline-end: 112px;
}

.step-head p {
  color: var(--ink-2);
}

.sent-to {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

.back-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 10px 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.back-link:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.inline-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- OTP ---------- */

.otp {
  position: relative;
}

.otp-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  outline: none;
  cursor: text;
}

.otp-input::selection {
  background: transparent;
}

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.otp-boxes span {
  display: grid;
  place-items: center;
  height: 62px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  font: 500 28px/1 var(--font-mono);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s var(--ease-out);
}

.otp-boxes span.filled {
  border-color: var(--ink-3);
}

.otp-input:focus + .otp-boxes span.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.otp-input:focus + .otp-boxes span.active:empty::after {
  content: "";
  width: 2px;
  height: 28px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}

.otp.invalid .otp-boxes span {
  border-color: var(--danger);
}

.otp.invalid .otp-boxes {
  animation: shake 0.4s var(--ease-out);
}

@keyframes shake {
  20%, 60% {
    transform: translateX(-6px);
  }
  40%, 80% {
    transform: translateX(6px);
  }
}

.resend {
  margin-top: -6px;
  color: var(--ink-3);
  font-size: 15px;
  text-align: center;
}

/* ---------- Larger screens ---------- */

@media (min-width: 560px) {
  .login-shell {
    padding: 0 32px;
  }

  .login-card {
    padding: 34px 32px 30px;
  }

  .hero-dial {
    inset-inline-end: -40px;
    width: 280px;
  }

  /* Bigger headline and dial: start the card lower, still under the dial's edge */
  .login-hero {
    min-height: 300px;
  }

  .login-card {
    margin-top: -96px;
  }
}

@media (min-width: 920px) {
  .login-card {
    margin-top: 0;
  }

  .step-head h2 {
    padding-inline-end: 0;
  }

  .login-main {
    grid-template-columns: 1.1fr minmax(380px, 440px);
    align-items: center;
    align-content: center;
    gap: 64px;
    padding: 24px 0 40px;
  }

  .login-hero {
    align-content: center;
    padding-top: 0;
    padding-inline-end: 0;
    padding-bottom: 300px;
  }

  .hero-dial {
    inset-inline-end: auto;
    inset-inline-start: 0;
    top: auto;
    bottom: 0;
    width: 270px;
  }
}

@media (min-width: 920px) and (min-height: 820px) {
  .login-hero {
    padding-bottom: 340px;
  }

  .hero-dial {
    width: 310px;
  }
}

/* ---------- Single-card pages (rigger, 404) ---------- */

.rigger-main .login-card {
  margin-top: 0;
}

.rigger-main .step-head h2 {
  padding-inline-end: 0;
}

.login-main.rigger-main {
  width: min(460px, 100%);
  margin: 0 auto;
  padding-top: 40px;
  grid-template-columns: 1fr;
  align-content: start;
}

.rigger-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Short phones (iPhone SE and similar): tighten spacing so Gilad's details still fit */
@media (max-width: 919px) and (max-height: 700px) {
  .login-main {
    padding-top: 6px;
  }

  .login-hero {
    padding-top: 30px;
  }

  .login-card {
    padding-bottom: 20px;
  }

  .login-card .step {
    gap: 16px;
  }

  .login-shell .site-footer {
    padding-top: 18px;
  }

  /* Emblem beside the text instead of above it, to save height */
  .login-shell .footer-sign {
    flex-direction: row;
    gap: 12px;
  }

  .login-shell .footer-sign img {
    width: 46px;
  }
}
