/* ==========================================================================
   auth.css — login / signup
   Composition borrowed from the reference: large title, short subtitle,
   underline fields with uppercase micro-labels and leading icons, action at
   the foot of the card, secondary link below.

   Colour, type and buttons come from theme.css — no new palette here.
   Scoped to .auth so nothing leaks into the rest of the app.
   ========================================================================== */

body:has(.auth) {
  background: var(--c-050) !important;
  margin: 0 !important;
}

body:has(.auth) .mobile-nav,
body:has(.auth) .sidebar-container { display: none !important; }

/* layout.html wraps every page in `<div class="d-flex">`. On desktop that
   stays a flex row, so the auth screen became a flex item hugging the left
   edge instead of filling the viewport and centring. */
body:has(.auth) > .d-flex {
  display: block !important;
  min-height: 100dvh;
}

.auth {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--c-white);
  border: 0;
  border-radius: 0;
  padding: var(--sp-5) var(--sp-3)
           calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

.auth__body {
  margin-top: auto;
  margin-bottom: auto;
  padding-bottom: var(--sp-5);
}

.auth__titlerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 6px;
  padding-right: 4px;
}

/* Product mark, carried over from the previous login screen, including its
   pulse — the original was scale(1) -> scale(1.1) -> scale(1) over 2s. Sized
   to balance the title rather than crowd it. */
.auth__mark {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--c-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--c-white);
  animation: auth-pulse 2s ease-in-out infinite;
}

/* The glow: a ring that breathes out from behind the mark. */
.auth__mark::before,
.auth__mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--c-900);
  opacity: .18;
  z-index: -1;
  animation: auth-halo 2s ease-out infinite;
}

.auth__mark::after { animation-delay: 1s; }

@keyframes auth-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

@keyframes auth-halo {
  0%   { transform: scale(1);   opacity: .22; }
  70%  { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth__mark,
  .auth__mark::before,
  .auth__mark::after { animation: none; }
  .auth__mark::before,
  .auth__mark::after { opacity: 0; }
}

.auth__title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.026em;
  color: var(--c-black);
  margin: 0;
}

.auth__subtitle {
  font-size: var(--t-small);
  color: var(--c-500);
  margin: 0 0 var(--sp-5);
}

/* ---- Fields ---- */
.auth__field {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  grid-template-areas:
    ".    label  label"
    "icon input  action";
  align-items: center;
  column-gap: 10px;
  padding: 6px 2px 10px;
  border-bottom: 1px solid var(--c-200);
  margin-bottom: var(--sp-3);
  transition: border-color .15s ease;
}

.auth__field:focus-within { border-bottom-color: var(--c-900); }

.auth__icon {
  grid-area: icon;
  text-align: center;
  font-size: 13px;
  line-height: 1;
  color: var(--c-400);
}

.auth__field:focus-within .auth__icon { color: var(--c-900); }

.auth__label { grid-area: label; }
.auth__input { grid-area: input; }

.auth__label {
  font-size: var(--t-meta);
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-400);
  margin-bottom: 2px;
}

.auth__input {
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 16px;           /* 16px stops iOS zooming on focus */
  font-weight: 500;
  color: var(--c-900);
  padding: 0;
  width: 100%;
}

.auth__input::placeholder { color: var(--c-300); font-weight: 400; }

.auth__forgot {
  grid-area: action;
  font-size: var(--t-meta);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-400);
}

/* ---- Action: the system button, full width ---- */
.auth__actions { margin-top: var(--sp-4); }

.auth__actions .btn {
  width: 100%;
  gap: var(--sp-1);
}

/* ---- Footer ---- */
.auth__foot {
  text-align: center;
  font-size: var(--t-small);
  color: var(--c-500);
  margin: 0;
}

.auth__foot a {
  color: var(--c-900);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Messages ---- */
.auth__alert {
  border: 1px solid;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: var(--t-small);
  margin-bottom: var(--sp-3);
}
.auth__alert--error   { background: var(--s-error-bg);   color: var(--s-error);   border-color: rgba(180,35,24,.18); }
.auth__alert--success { background: var(--s-success-bg); color: var(--s-success); border-color: rgba(15,123,79,.18); }
.auth__alert--info,
.auth__alert--warning { background: var(--s-warning-bg); color: var(--s-warning); border-color: rgba(161,98,7,.20); }

/* On a wider screen it reads better as a contained card again. */
@media (min-width: 768px) {
  .auth { align-items: center; padding: var(--sp-4); }
  .auth__card {
    min-height: 600px;
    border: var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5) var(--sp-4) var(--sp-4);
  }
}

/* ==========================================================================
   Hover: the sign-in action picks up the brand accent
   theme.css sets .btn-dark:hover to a grey, so this needs to outrank it.
   ========================================================================== */
.auth__actions .btn:hover,
.auth__actions .btn:focus-visible {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

/* The mark answers the hover too, so the whole screen responds as one. */
.auth:has(.auth__actions .btn:hover) .auth__mark {
  background: var(--accent);
  transition: background-color .15s ease;
}

.auth__mark { transition: background-color .15s ease; }
