/* ─────────────────────────────────────────────────────────────────────────
   Kadili Cloud — signed-out screens
   Depends on kadili.css for tokens and base components.
   ───────────────────────────────────────────────────────────────────────── */

@layer components {

  .auth-body {
    min-height: 100dvh;
    background: var(--bg);
  }

  .skip {
    position: absolute;
    left: -9999px;
    top: var(--sp-3);
    padding: 0.6rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 100;
  }
  .skip:focus { left: var(--sp-3); }

  /* Split canvas ────────────────────────────────────────────────────────── */

  .auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
    min-height: 100dvh;
  }

  .auth__panel {
    display: grid;
    place-items: center;
    padding: var(--sp-6) var(--sp-5);
  }

  .auth__inner {
    width: min(100%, 25.5rem);
    display: grid;
    gap: var(--sp-5);
  }

  .auth__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    text-decoration: none;
    color: inherit;
    justify-self: start;
  }
  .auth__brand-name {
    font-weight: 640;
    letter-spacing: var(--tracking-flat);
  }

  .auth__head { display: grid; gap: var(--sp-2); }
  .auth__title {
    font-size: var(--text-xl);
    font-weight: 660;
    letter-spacing: var(--tracking-tight);
    line-height: 1.2;
  }
  .auth__sub { font-size: var(--text-base); line-height: 1.55; }

  .auth__glyph {
    display: grid;
    place-items: center;
    width: 52px; height: 52px;
    border-radius: var(--radius-lg);
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: var(--sp-2);
  }
  .auth__glyph--ok    { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
  .auth__glyph--alert { background: color-mix(in srgb, var(--alert) 13%, transparent); color: var(--alert); }

  .auth__alt { margin-top: var(--sp-2); }
  .auth__foot { text-align: center; line-height: 1.7; }
  .auth__foot a { color: var(--fg-muted); }
  .auth__foot a:hover { color: var(--accent); }

  .auth__actions {
    display: grid;
    gap: var(--sp-3);
    justify-items: center;
    margin-top: var(--sp-4);
  }

  /* Right-hand proof panel ──────────────────────────────────────────────── */

  .auth__aside {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
      radial-gradient(120% 90% at 80% 10%, color-mix(in srgb, var(--blue-600) 26%, transparent), transparent 62%),
      linear-gradient(160deg, var(--slate-950), #0B1D38 60%, #08356F);
    color: #E8F0FA;
    padding: var(--sp-7);
  }

  .auth__aside-inner {
    position: relative;
    display: grid;
    gap: var(--sp-5);
    max-width: 26rem;
  }

  /* Concentric signal arcs — the same motif as the mark, drawn large. */
  .auth__rings {
    position: absolute;
    inset: -12rem -6rem auto auto;
    width: 32rem; height: 32rem;
    pointer-events: none;
    opacity: 0.5;
  }
  .auth__rings span {
    position: absolute;
    inset: 0;
    margin: auto;
    border: 1px solid color-mix(in srgb, #7FB0FF 34%, transparent);
    border-radius: 50%;
    animation: ring-breathe 6s var(--ease-in-out) infinite;
  }
  .auth__rings span:nth-child(1) { width: 24%;  height: 24%; animation-delay: 0s; }
  .auth__rings span:nth-child(2) { width: 46%;  height: 46%; animation-delay: 0.5s; }
  .auth__rings span:nth-child(3) { width: 70%;  height: 70%; animation-delay: 1s; }
  .auth__rings span:nth-child(4) { width: 100%; height: 100%; animation-delay: 1.5s; }

  @keyframes ring-breathe {
    0%, 100% { opacity: 0.30; transform: scale(1); }
    50%      { opacity: 0.85; transform: scale(1.035); }
  }

  .auth__claim {
    font-size: var(--text-2xl);
    font-weight: 620;
    line-height: 1.22;
    letter-spacing: var(--tracking-tight);
  }

  .auth__points {
    display: grid;
    gap: var(--sp-3);
    list-style: none;
    padding: 0;
    font-size: var(--text-base);
    color: color-mix(in srgb, #E8F0FA 78%, transparent);
  }
  .auth__points li {
    position: relative;
    padding-left: 1.6rem;
    line-height: 1.5;
  }
  .auth__points li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.55em;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--blue-400);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue-400) 20%, transparent);
  }

  /* Form extras ─────────────────────────────────────────────────────────── */

  .field__reveal { position: relative; }
  .field__reveal .input { padding-right: 2.9rem; }

  .reveal-btn {
    position: absolute;
    right: 0.4rem; top: 50%;
    transform: translateY(-50%);
    display: grid; place-items: center;
    width: 2.1rem; height: 2.1rem;
    border: 0; border-radius: var(--radius-sm);
    background: transparent;
    color: var(--fg-muted);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  }
  .reveal-btn:hover { color: var(--fg); background: var(--surface-alt); }
  .reveal-btn.is-on { color: var(--accent); }

  .check {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    font-size: var(--text-sm);
    color: var(--fg-muted);
    cursor: pointer;
    line-height: 1.5;
  }
  .check input {
    appearance: none;
    flex: 0 0 auto;
    width: 1.125rem; height: 1.125rem;
    margin-top: 0.08rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  }
  .check input:checked {
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / 72% no-repeat;
    border-color: var(--accent);
  }
  .check input:focus-visible { outline: none; box-shadow: var(--ring); }

  /* Disclosure ("I have a promo code", "Wrong number?") */
  .disclose { border-top: 1px solid var(--border-soft); padding-top: var(--sp-3); }
  .disclose__summary {
    font-size: var(--text-sm);
    font-weight: 560;
    color: var(--accent);
    cursor: pointer;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
  }
  .disclose__summary::-webkit-details-marker { display: none; }
  .disclose__summary::before {
    content: '';
    width: 0; height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform var(--dur-fast) var(--ease);
  }
  .disclose[open] .disclose__summary::before { transform: rotate(90deg); }
  .disclose__body { margin-top: var(--sp-3); animation: disclose-in var(--dur) var(--ease); }

  @keyframes disclose-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
  }

  /* Password strength */
  .meter { display: grid; gap: var(--sp-2); }
  .meter__bar {
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--border-soft);
    overflow: hidden;
  }
  .meter__bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--alert);
    transition: width var(--dur) var(--ease), background var(--dur) var(--ease);
  }
  .meter[data-level='2'] .meter__bar span { background: var(--warn); }
  .meter[data-level='3'] .meter__bar span { background: var(--blue-500); }
  .meter[data-level='4'] .meter__bar span { background: var(--ok); }

  /* One-time code boxes */
  .otp {
    display: flex;
    gap: var(--sp-2);
    justify-content: center;
  }
  .otp__box {
    width: 3rem;
    height: 3.5rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  }
  .otp__box:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
  }
  .otp__box.is-filled { border-color: var(--accent-line); background: var(--accent-soft); }

  /* Button loading state */
  .btn__spin {
    width: 15px; height: 15px;
    border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 620ms linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .btn.is-busy { pointer-events: none; opacity: 0.75; }

  .flashes { display: grid; gap: var(--sp-3); }
  .toast__icon { flex: 0 0 auto; margin-top: 1px; }
  .toast--ok    .toast__icon { color: var(--ok); }
  .toast--warn  .toast__icon { color: var(--warn); }
  .toast--alert .toast__icon { color: var(--alert); }
  .toast--info  .toast__icon { color: var(--accent); }
  .toast__body { flex: 1; font-size: var(--text-sm); line-height: 1.5; }
  .toast__close {
    flex: 0 0 auto;
    border: 0; background: transparent;
    color: var(--fg-subtle);
    cursor: pointer;
    padding: 2px;
    border-radius: 6px;
  }
  .toast__close:hover { color: var(--fg); }

  .pricing-note {
    border-top: 1px solid var(--border-soft);
    padding-top: var(--sp-4);
    text-align: center;
    line-height: 1.6;
  }

  /* Error page */
  .errorpage {
    min-height: 100dvh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: var(--sp-4);
    text-align: center;
    padding: var(--sp-6);
  }
  .errorpage__code {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--accent);
    letter-spacing: var(--tracking-tight);
  }
  .errorpage__title { font-size: var(--text-xl); font-weight: 620; }
  .errorpage__debug {
    text-align: left;
    max-width: 46rem;
    overflow: auto;
    padding: var(--sp-4);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: pre-wrap;
  }
}

/* Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 920px) {
  .auth { grid-template-columns: 1fr; }
  /* The proof panel is dropped rather than stacked: a person signing in on a
     phone wants the form, not a second screenful of marketing above it. */
  .auth__aside { display: none; }
}

@media (max-width: 420px) {
  .auth__panel { padding: var(--sp-5) var(--sp-4); }
  .otp__box { width: 2.5rem; height: 3.1rem; font-size: var(--text-md); }
}

@media (prefers-reduced-motion: reduce) {
  .auth__rings span,
  .btn__spin { animation: none; }
  .disclose__body { animation: none; }
}
