/* ============================================================
   CrumpIT — Auth pages (login + register) @layer pages
   Two-panel card: brand side + form side. Reuses shell form
   controls, buttons + tokens.
   ============================================================ */

@layer pages {

  .auth {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: calc(var(--header-h) + var(--sp-16)) var(--sp-6) var(--sp-16);
  }

  .auth-card {
    width: 100%;
    max-width: 940px;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--shadow-2);
  }

  /* ---- brand panel ---- */
  .auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--sp-10);
    padding: var(--sp-10);
    color: #fff;
    background:
      radial-gradient(circle at 80% 12%, rgba(255,255,255,0.14), transparent 45%),
      linear-gradient(160deg, var(--accent-dim), #061726 72%);
    overflow: hidden;
  }
  .auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 22px);
    opacity: 0.5;
  }
  .auth-brand__logo img { height: 40px; width: auto; position: relative; }
  .auth-brand__slogan {
    position: relative;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-32);
    line-height: 1.05;
    letter-spacing: var(--ls-display);
    text-transform: uppercase;
  }
  .auth-brand__slogan .u-accent { color: #9bd9ff; }
  .auth-brand__list { position: relative; display: flex; flex-direction: column; gap: var(--sp-3); }
  .auth-brand__list li {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-family: var(--font-ui);
    font-weight: 500;
    color: rgba(255,255,255,0.9);
  }
  .auth-brand__list svg { width: 18px; height: 18px; flex-shrink: 0; color: #9bd9ff; }

  /* ---- form panel ---- */
  .auth-form { padding: var(--sp-10); }
  .auth-form__logo { display: none; margin-bottom: var(--sp-6); }
  .auth-form__logo img { height: 34px; }
  .auth-form__head { margin-bottom: var(--sp-8); }
  .auth-form__head h1 { font-size: var(--fs-32); }
  .auth-form__head p { color: var(--text-muted); margin-top: var(--sp-2); }

  .input-wrap { position: relative; }
  .input-wrap .input { padding-right: 3rem; }
  .pw-toggle {
    position: absolute;
    top: 50%; right: 0.4rem;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    transition: color var(--dur-base) var(--ease), background-color var(--dur-base) var(--ease);
  }
  .pw-toggle:hover { color: var(--text); background: var(--surface-alt); }
  .pw-toggle svg { width: 18px; height: 18px; }
  .pw-toggle .i-eye-off { display: none; }
  .pw-toggle.is-show .i-eye { display: none; }
  .pw-toggle.is-show .i-eye-off { display: block; }

  .checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--sp-2);
    font-family: var(--font-ui);
    font-size: var(--fs-14);
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1.4;
  }
  .checkbox input {
    accent-color: var(--accent);
    width: 16px; height: 16px;
    margin-top: 1px;
    flex-shrink: 0;
  }
  .checkbox a { color: var(--accent); }

  .auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
    margin: var(--sp-1) 0 var(--sp-6);
  }
  .link-accent {
    color: var(--accent);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: var(--fs-14);
  }
  .link-accent:hover { text-decoration: underline; }

  .auth-submit { width: 100%; }
  .auth-alt {
    text-align: center;
    margin-top: var(--sp-6);
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: var(--fs-14);
  }
  .auth-alt a { color: var(--accent); font-weight: 600; }

  /* checkbox as a .field for validation errors */
  .field--check { gap: var(--sp-2); }
  .field--check .field-error { margin-top: 0; }

  /* server-side error banner */
  .auth-alert {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: var(--fs-14);
    line-height: 1.4;
  }

  /* logo fallback when no image is set */
  .auth-brand__name,
  .auth-form__logo .auth-brand__name {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-24);
    color: var(--text);
    letter-spacing: 0.04em;
  }

  /* honeypot — visually + programmatically hidden, off-screen (not display:none,
     so bots that skip hidden fields still fill it) */
  .crumpit-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  /* ---- responsive ---- */
  @media (max-width: 760px) {
    .auth-card { grid-template-columns: 1fr; max-width: 460px; }
    .auth-brand { display: none; }
    .auth-form__logo { display: block; }
    .auth-form { padding: var(--sp-8); }
  }
}
