/* ==========================================================================
   Login — Claymorphism
   Soft, puffy, dual-shadow surfaces on a light panel, sitting on the
   dark navy gradient background.
   ========================================================================== */

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  padding: clamp(12px, 4vw, 32px);
  padding-top: max(clamp(12px, 4vw, 32px), env(safe-area-inset-top));
  padding-bottom: max(clamp(12px, 4vw, 32px), env(safe-area-inset-bottom));
  padding-left: max(clamp(12px, 4vw, 32px), env(safe-area-inset-left));
  padding-right: max(clamp(12px, 4vw, 32px), env(safe-area-inset-right));
}

.clay-card {
  width: 100%;
  max-width: clamp(340px, 30vw + 120px, 460px);   /* wider on tablets, capped on big monitors */
  margin: auto;                           /* centres, but scrolls instead of clipping on short screens */
  background: var(--clay-bg);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 44px) clamp(18px, 4.5vw, 36px) clamp(20px, 4vw, 32px);
  box-shadow:
    -14px -14px 28px var(--clay-shadow-light),
     14px  14px 28px var(--clay-shadow-dark);
  position: relative;
}

.clay-badge {
  width: clamp(52px, 14vw, 64px);
  height: clamp(52px, 14vw, 64px);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--clay-accent);
  box-shadow:
    -6px -6px 14px var(--clay-shadow-light),
     6px  6px 14px var(--clay-shadow-dark);
  margin-bottom: var(--space-4);
}

.clay-card h1 {
  color: var(--text-on-light);
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
}

.clay-subtitle {
  color: #5c6c8a;
  margin-top: var(--space-1);
  margin-bottom: clamp(18px, 4vw, 32px);
  font-size: clamp(0.88rem, 2.8vw, 0.95rem);
}

.clay-form {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 3vw, 24px);
}

.clay-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.clay-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-700);
}

.clay-optional {
  font-weight: 400;
  color: #8291ad;
}

.clay-field input {
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-height: 48px;
  font-size: 1rem;
  background: var(--clay-bg);
  color: var(--text-on-light);
  box-shadow:
    inset -5px -5px 10px var(--clay-shadow-light),
    inset  5px  5px 10px var(--clay-shadow-dark);
  transition: box-shadow 0.2s ease;
  width: 100%;
}

.clay-field input::placeholder { color: #97a3bd; }

.clay-field input:focus {
  box-shadow:
    inset -3px -3px 7px var(--clay-shadow-light),
    inset  3px  3px 7px var(--clay-shadow-dark),
    0 0 0 3px rgba(var(--accent-strong-rgb), 0.25);
}

.clay-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.clay-password-wrap input { padding-right: 44px; }

.clay-toggle-pw {
  position: absolute;
  right: 6px;
  min-width: 40px; min-height: 40px;
  color: #8291ad;
  padding: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.clay-toggle-pw:hover { color: var(--navy-600); }

.clay-error {
  overflow-wrap: anywhere;
  background: rgba(239, 91, 107, 0.12);
  color: #b3283a;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 0;
}

.clay-submit {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 15px;
  min-height: 50px;
  width: 100%;
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
  background: var(--clay-accent);
  box-shadow:
    -6px -6px 14px var(--clay-shadow-light),
     6px  6px 14px var(--clay-shadow-dark);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clay-submit:hover { transform: translateY(-1px); }
.clay-submit:active {
  transform: translateY(1px);
  box-shadow:
    inset -4px -4px 10px rgba(255,255,255,0.25),
    inset  4px  4px 10px rgba(0,0,0,0.2);
}

.clay-submit[disabled] { opacity: 0.7; pointer-events: none; }

.btn-spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: var(--white);
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}

/* display:inline-block above beats the browser's default [hidden]{display:none},
   so without this rule the spinner is always visible and always spinning. */
.btn-spinner[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- Responsive ---------- */

/* Phones: keep the card clear of the theme button in the top-right corner,
   and use lighter shadows so they don't spill off the screen edge. */
@media (max-width: 520px) {
  .login-screen { padding-top: max(64px, calc(env(safe-area-inset-top) + 56px)); }
  .clay-card {
    max-width: 100%;
    box-shadow:
      -8px -8px 18px var(--clay-shadow-light),
       8px  8px 18px var(--clay-shadow-dark);
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .clay-card { border-radius: var(--radius-md); }
  .clay-field input { padding: 12px 14px; }
}

/* Short screens (phones in landscape, small laptop windows): tighten up */
@media (max-height: 640px) {
  .login-screen { padding-top: max(60px, calc(env(safe-area-inset-top) + 52px)); }
  .clay-badge { width: 44px; height: 44px; margin-bottom: var(--space-3); }
  .clay-badge svg { width: 26px; height: 26px; }
  .clay-subtitle { margin-bottom: var(--space-3); }
  .clay-form { gap: 12px; }
  .clay-card { padding-top: 20px; padding-bottom: 20px; }
}

/* Landscape phones: two-column layout (title left, form right) so no scrolling is needed */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 600px) {
  .clay-card {
    max-width: 720px;
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    grid-template-rows: auto auto 1fr;   /* spare height goes below the title, not between items */
    column-gap: 28px;
    align-items: start;
  }
  .clay-badge, .clay-card h1, .clay-subtitle { grid-column: 1; }
  .clay-form { grid-column: 2; grid-row: 1 / span 3; }
}

/* Large / ultra-wide monitors */
@media (min-width: 1600px) {
  .clay-card { max-width: 500px; }
}
