/* Sign-in, evondev ui-ux skill, "rebuild keeping the brand" (review.md mode 2).
   Page frame kept from the old page: the robot stage (top on phones, left on wide screens) and
   the form panel. Tokens, buttons, inputs, segmented tabs, brand mark and the robot figure come
   from ui.css (linked first); this file keeps only the sign-in layout and its 48px auth controls. */

/* ---------- frame: stage + panel ---------- */
.login {
  min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start;
  padding-bottom: env(safe-area-inset-bottom);
}
.stage {
  position: relative; display: grid; gap: 12px; align-content: start;
  padding: calc(16px + env(safe-area-inset-top)) 16px 20px;
  background: var(--stage); border-bottom: 1px solid var(--hairline); border-radius: 0 0 24px 24px; overflow: hidden;
}
.stage .robot-fig { width: min(56%, 260px); justify-self: center; margin: 0 0 4px; }
.stage-text { display: grid; gap: 4px; }
.stage h1 { font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.stage p { color: var(--muted); max-width: 40ch; text-wrap: pretty; }

.panel { padding: 20px 16px 32px; }
.panel-inner { display: grid; gap: 20px; width: min(400px, 100%); margin: 0 auto; }

@media (max-height: 700px) and (max-width: 899px) {
  /* Short phones: a smaller robot keeps the sign-in button in the first screen. */
  .stage .robot-fig { width: min(42%, 200px); }
  .stage p { display: none; }
}
@media (min-width: 640px) {
  .stage { padding-left: 24px; padding-right: 24px; }
}
@media (min-width: 900px) {
  .login { grid-template-columns: minmax(0, 7fr) minmax(400px, 5fr); align-content: stretch; }
  .stage {
    grid-template-rows: auto 1fr; padding: 32px 48px 56px;
    border-bottom: 0; border-right: 1px solid var(--hairline); border-radius: 0 24px 24px 0;
  }
  .stage .robot-fig { width: min(78%, 520px); justify-self: start; align-self: end; margin: 0 0 24px -1%; }
  .stage-text { gap: 8px; }
  .stage h1 { font-size: 32px; line-height: 1.2; max-width: 18ch; }
  .stage p { font-size: 16px; max-width: 36ch; }
  .panel { display: grid; align-content: center; padding: 48px clamp(32px, 5vw, 72px); }
  .panel-inner { margin: 0; }
}

/* ---------- form: auth controls are 48px and full width ---------- */
.auth { display: grid; gap: 8px; }
.auth .btn { margin-top: 8px; }
.panel .btn { display: flex; width: 100%; height: 48px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.panel .btn-outline { font-weight: 500; }
.field input { height: 48px; }
/* The fields sit on the page, not on a card, so in the dark they lift a little off the paper. */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .field input { background: color-mix(in srgb, #ffffff 4%, var(--surface)); }
}
:root[data-theme="dark"] .field input { background: color-mix(in srgb, #ffffff 4%, var(--surface)); }
:root[data-theme="dark"] {
.field input { background: color-mix(in srgb, #ffffff 4%, var(--surface)); }
}

.password { position: relative; }
.password input { padding-right: 52px; }
.reveal {
  position: absolute; top: 0; bottom: 0; right: 2px; margin: auto 0; width: 44px; height: 44px;
  display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); cursor: pointer; transition: color 0.15s var(--ease);
}
.reveal:hover, .reveal[aria-pressed="true"] { color: var(--ink); }

.alt { display: grid; gap: 16px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Keep the sign-in identity aligned with Soul One. */
.stage .brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; font-size: 22px; font-weight: 700; color: var(--ink); text-decoration: none; min-height: 44px; }
.login-logo { display: block; width: 32px; height: 32px; object-fit: contain; }
.stage .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 6px; }

/* Recovery shares the sign-in panel and its controls. */
.text-button { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; padding: 8px 0; min-height: 44px; }
.text-button:hover { text-decoration: underline; }
.text-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.forgot-password { justify-self: end; margin-top: -12px; }
.recovery { display: grid; gap: 24px; }
.recovery[hidden], .auth[hidden], .segmented[hidden], .alt[hidden] { display: none; }
.back-login { display: flex; align-items: center; gap: 8px; justify-self: start; color: var(--muted); }
.recovery-heading h2 { margin: 0 0 10px; font-size: 28px; line-height: 1.25; letter-spacing: -.6px; }
.recovery-heading p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--muted); }
.recovery-status { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 13px; line-height: 1.6; }
@media (max-width: 899px) { .recovery { gap: 18px; } .recovery-heading h2 { font-size: 24px; } }

.field[hidden] { display: none; }
.reset-login { display: inline-flex; justify-content: center; text-decoration: none; }

/* Keep both sign-in methods above the phone browser controls. */
@media (max-width: 899px) {
  .login { --login-extra-space: clamp(0px, calc(25svh - 185px), 26px); }
  .stage { grid-template-columns: minmax(0, 1fr); gap: calc(14px + var(--login-extra-space) * .5); align-items: center; padding-top: calc(30px + var(--login-extra-space) * .5 + env(safe-area-inset-top)); padding-bottom: calc(20px + var(--login-extra-space) * .5); }
  .stage .brand { grid-column: 1; font-size: 20px; }
  .stage .robot-fig { grid-column: 1; grid-row: 2; width: calc(128px + var(--login-extra-space) * 1.5); margin: 0; }
  .stage-text { grid-column: 1; grid-row: 3; text-align: center; justify-items: center; }
  .stage h1 { max-width: 28ch; font-size: 20px; line-height: 1.3; }
  .stage p { display: none; }
  .panel { padding-top: calc(24px + var(--login-extra-space) * .5); }
  .panel-inner { gap: calc(14px + var(--login-extra-space) * .25); }
  .auth { gap: calc(8px + var(--login-extra-space) * .125); }
  .alt { gap: 12px; }
  .panel { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  #username-note:not(:has(span:not([hidden]))), #password-note:not(:has(span:not([hidden]))) { display: none; }
  .forgot-password { margin-top: 0; }
}

@media (max-width: 899px) and (max-height: 700px) {
  .stage { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: 12px; gap: 8px; }
  .stage .brand { min-height: 36px; }
  .stage .robot-fig { width: 96px; }
  .stage h1 { font-size: 18px; }
}

/* Sign-in has a quiet page header and one focused account panel. */
.sign-in .login-header { display: flex; justify-content: space-between; align-items: center; width: min(1160px, 100%); margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 24px 20px; }
.sign-in .login-header .brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.sign-in .home-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 14px; }
.sign-in .home-link:hover { color: var(--accent); }

.sign-in .login { width: min(1160px, 100%); min-height: calc(100svh - 84px - env(safe-area-inset-top)); margin: 0 auto; padding: 24px 24px calc(48px + env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 72px; align-items: center; align-content: center; }
.sign-in .stage { display: flex; flex-direction: column; gap: 32px; padding: 0; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.sign-in .stage-text { text-align: left; justify-items: start; gap: 16px; }
.sign-in .stage h2 { font-size: clamp(32px, 3.4vw, 44px); font-weight: 700; line-height: 1.2; letter-spacing: -.035em; }
.sign-in .stage p { display: block; max-width: 34ch; font-size: 16px; line-height: 1.7; }
.sign-in .stage .robot-fig { width: min(86%, 340px); margin: 0; align-self: flex-start; }
.sign-in .panel { display: block; padding: 32px; border-radius: 24px; border: 1px solid var(--hairline); background: var(--surface); }
.sign-in .panel-inner { width: 100%; margin: 0; gap: 20px; }
.sign-in .panel-heading { display: grid; gap: 8px; margin-bottom: 4px; }
.sign-in .panel-heading h1 { font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.25; }
.sign-in .panel-heading p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.sign-in .auth { gap: 8px; }
.sign-in .alt { gap: 14px; }
.sign-in .forgot-password { margin-top: -4px; }
.sign-in #username-note:not(:has(span:not([hidden]))), .sign-in #password-note:not(:has(span:not([hidden]))) { display: none; }
@media (max-width: 899px) {
  .sign-in .login-header { padding: calc(16px + env(safe-area-inset-top)) 24px 12px; }
  .sign-in .login-header .brand { font-size: 20px; }
  .sign-in .login { width: min(448px, 100%); min-height: calc(100svh - 72px - env(safe-area-inset-top)); padding: 24px 24px calc(32px + env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr); gap: 0; align-content: center; }
  .sign-in .stage { display: none; }
  .sign-in .panel { padding: 0; border: 0; border-radius: 0; background: transparent; }
  .sign-in .panel-heading { gap: 8px; margin-bottom: 8px; }
  .sign-in .panel-heading h1 { font-size: 28px; }
  .sign-in .panel-inner { gap: 20px; }
  .sign-in .forgot-password { min-height: 36px; }
}
@media (max-width: 899px) and (max-height: 700px) {
  .sign-in .login { padding-top: 12px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .sign-in .panel-inner { gap: 16px; }
  .sign-in .panel-heading { margin-bottom: 4px; }
  .sign-in .panel-heading h1 { font-size: 26px; }
}

/* Preserve the original desktop layout; the redesign is phone-only. */
.sign-in .desktop-brand { display: none; }
@media (min-width: 900px) {
  .sign-in .login-header { display: none; }
  .sign-in .login { width: 100%; min-height: 100dvh; margin: 0; padding: 0; grid-template-columns: minmax(0, 7fr) minmax(400px, 5fr); gap: 0; align-items: stretch; align-content: stretch; }
  .sign-in .stage { display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: 32px 48px 56px; background: var(--stage); border-right: 1px solid var(--hairline); border-radius: 0 24px 24px 0; overflow: hidden; }
  .sign-in .desktop-brand { display: inline-flex; grid-row: 1; }
  .sign-in .stage .robot-fig { grid-row: 2; width: min(78%, 520px); justify-self: start; align-self: end; margin: 0 0 24px -1%; }
  .sign-in .stage-text { grid-row: 3; gap: 8px; }
  .sign-in .stage h2 { font-size: 32px; line-height: 1.2; letter-spacing: -.015em; max-width: 18ch; text-wrap: balance; }
  .sign-in .stage p { font-size: 16px; max-width: 36ch; }
  .sign-in .panel { display: grid; align-content: center; padding: 48px clamp(32px, 5vw, 72px); border: 0; border-radius: 0; background: transparent; }
  .sign-in .panel-inner { width: min(400px, 100%); margin: 0; gap: 20px; }
  .sign-in .panel-heading { display: none; }
  .sign-in .forgot-password { margin-top: -12px; }
  .sign-in .alt { gap: 16px; }
  .sign-in #username-note:not(:has(span:not([hidden]))), .sign-in #password-note:not(:has(span:not([hidden]))) { display: block; }
}
