/* The way in, Console (Phase 6, BRIEF 5.9 + amendment).
   Login, signup, both password resets, the crew invite, the terms
   interstitial and the error page: a centred single column, the mark and
   the wordmark at the top, one panel, one primary action. Loaded by
   _auth_shell.html (and by legal_accept / error_page, which carry their
   own head) after the old stylesheets; tokens come from rd/tokens.css on
   <body class="... am-door">, below the desk only. Forms, fields, actions,
   Turnstile and CSP are untouched - this file only draws. The door stays
   dark (Yasuke, Sept 14): _auth_shell sets data-theme="dark" before paint;
   the error page keeps its own theme rule, so it gets dark or light. */

.am-door__brand { display: none; }

@media (max-width: 1099.98px) {
  body.cs.am-door.cs-auth {
    /* the old pages' inline styles read these two */
    --text-secondary: var(--text-2);
    --brand-text: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: calc(var(--space-8) + env(safe-area-inset-top)) var(--gutter) calc(var(--space-6) + env(safe-area-inset-bottom));
    background: var(--bg-app);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: var(--fs-16);
    line-height: var(--lh-16);
    -webkit-font-smoothing: antialiased;
  }
  body.cs.am-door.cs-auth :is(h1, h2, p, a, span, label, button, input, select, textarea, div) { font-family: var(--font-ui); }
  body.cs.am-door.cs-auth .wrap { width: 100%; max-width: 400px; margin: 0 auto; padding: 0; }
  body.cs.am-door.cs-auth .logo { display: none; }

  /* the mark and the wordmark */
  body.cs.am-door.cs-auth .am-door__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-6);
  }
  body.cs.am-door.cs-auth .am-door__mark {
    display: block;
    width: 40px;
    height: 40px;
    background: var(--accent);   /* the mark in the app's blue (Nov 23) */
    -webkit-mask: url("sheep-mark.png?v=1") center / contain no-repeat;
    mask: url("sheep-mark.png?v=1") center / contain no-repeat;
  }
  body.cs.am-door.cs-auth .am-door__word {
    font-size: var(--fs-28);
    line-height: var(--lh-28);
    font-weight: var(--fw-semi);
    letter-spacing: var(--track-tight);
    color: var(--text);
  }

  /* one panel */
  body.cs.am-door.cs-auth .card {
    width: 100%;
    margin: 0;
    padding: var(--space-5) var(--gutter);
    background: var(--bg-surface);
    border: var(--hairline) solid var(--border);
    border-radius: var(--radius-3);
    box-shadow: none;
    color: var(--text);
  }
  body.cs.am-door.cs-auth h1,
  body.cs.am-door.cs-auth .card > h1 {
    margin: 0 0 var(--space-1);
    font-family: var(--font-ui);
    font-size: var(--fs-20);
    line-height: var(--lh-20);
    font-weight: var(--fw-semi);
    letter-spacing: normal;
    text-align: left;
    color: var(--text);
  }
  body.cs.am-door.cs-auth .wrap > h1 { margin-bottom: var(--space-1); }
  body.cs.am-door.cs-auth .subtitle {
    margin: 0 0 var(--space-4);
    font-size: var(--fs-15);
    line-height: var(--lh-15);
    color: var(--text-2);
    text-align: left;
  }
  body.cs.am-door.cs-auth .wrap > .subtitle { margin-bottom: var(--space-4); }

  /* fields: label above, 44px, 16px text */
  body.cs.am-door.cs-auth form { display: block; margin: 0; }
  body.cs.am-door.cs-auth label,
  body.cs.am-door.cs-auth form > label:first-of-type {
    display: block;
    margin: var(--space-4) 0 6px;
    font-family: var(--font-ui);
    font-size: var(--fs-13);
    line-height: var(--lh-13);
    font-weight: var(--fw-medium);
    letter-spacing: normal;
    text-transform: none;
    color: var(--text-2);
  }
  body.cs.am-door.cs-auth form > label:first-of-type { margin-top: 0; }
  /* the old shell's field rule is body.cs + five :not()s; same weight here, and later */
  body.cs.am-door.cs-auth input:is([type="text"], [type="email"], [type="password"], [type="tel"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="file"]),
  body.cs.am-door.cs-auth select,
  body.cs.am-door.cs-auth textarea {
    width: 100%;
    min-height: var(--control-h);
    margin: 0;
    padding: 0 var(--space-3);
    background: var(--bg-raised);
    border: var(--hairline) solid var(--border-control);
    border-radius: var(--radius-2);
    box-shadow: none;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: var(--fs-16);
  }
  body.cs.am-door.cs-auth :is(input, select, textarea):focus { border-color: var(--accent); box-shadow: var(--focus-ring); outline: none; }
  body.cs.am-door.cs-auth .hint { margin: 6px 0 0; font-family: var(--font-ui); font-size: var(--fs-13); line-height: var(--lh-13); color: var(--text-2); }
  body.cs.am-door.cs-auth .checkbox-row { display: flex; align-items: flex-start; gap: var(--space-3); margin: var(--space-4) 0 0; }
  body.cs.am-door.cs-auth .checkbox-row input[type="checkbox"] { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent-solid); }
  body.cs.am-door.cs-auth .checkbox-row label { margin: 0; font-size: var(--fs-15); line-height: var(--lh-15); font-weight: var(--fw-regular); color: var(--text-2); }
  body.cs.am-door.cs-auth .cf-turnstile { margin: var(--space-4) 0 0; }

  /* the one primary */
  body.cs.am-door.cs-auth button,
  body.cs.am-door.cs-auth input[type="submit"] {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin: var(--space-5) 0 0;
    padding: 0 var(--space-4);
    background: var(--accent-solid);
    border: var(--hairline) solid var(--accent-edge);
    border-radius: var(--radius-2);
    box-shadow: none;
    color: var(--accent-on);
    font-family: var(--font-ui);
    font-size: var(--fs-16);
    font-weight: var(--fw-semi);
    letter-spacing: normal;
  }
  body.cs.am-door.cs-auth button:hover { filter: none; }
  body.cs.am-door.cs-auth button:active { opacity: 0.88; }
  body.cs.am-door.cs-auth button.btn-secondary { background: var(--bg-raised); border-color: var(--border); color: var(--text); }

  /* links: plain, accent; the quiet ones (Forgot password, Terms) grey */
  body.cs.am-door.cs-auth a { color: var(--accent); text-decoration: none; }
  body.cs.am-door.cs-auth p a:not(.btn)::after,
  body.cs.am-door.cs-auth .hint a::after { content: none; }
  body.cs.am-door.cs-auth .back-link {
    display: block;
    margin: var(--space-4) 0 0;
    font-size: var(--fs-15);
    font-weight: var(--fw-medium);
    text-align: center;
    color: var(--accent);
  }
  body.cs.am-door.cs-auth form > p,
  body.cs.am-door.cs-auth .card > p:not(.subtitle):not(.hint) { font-family: var(--font-ui); font-size: var(--fs-15); line-height: var(--lh-15); color: var(--text-2); }

  /* what went wrong / what happened */
  body.cs.am-door.cs-auth .error,
  body.cs.am-door.cs-auth .success {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
    padding: var(--space-3);
    border: 0;
    border-radius: var(--radius-2);
    font-size: var(--fs-15);
    line-height: var(--lh-15);
    color: var(--text);
  }
  body.cs.am-door.cs-auth .error { background: var(--bad-soft); }
  body.cs.am-door.cs-auth .error svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--bad); }
  body.cs.am-door.cs-auth .success { background: var(--ok-soft); }

  /* the terms interstitial: one row per document */
  body.cs.am-door.cs-auth .doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--row-h-1);
    margin: 0 calc(-1 * var(--gutter));
    padding: var(--space-2) var(--gutter);
    border-top: var(--hairline) solid var(--border-subtle);
  }
  body.cs.am-door.cs-auth .doc-row:first-child { margin-top: calc(-1 * var(--space-3)); border-top: 0; }
  body.cs.am-door.cs-auth .doc-name { font-size: var(--fs-16); font-weight: var(--fw-regular); color: var(--text); }
  body.cs.am-door.cs-auth .doc-link a { font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--accent); }

  /* the error page: the sheep (signed in), the code (a customer), the
     sentence, the way out as the one primary */
  body.cs.am-door.cs-auth .wrap:has(> .home),
  body.cs.am-door.cs-auth .wrap:has(> .code) { text-align: center; }
  body.cs.am-door.cs-auth .mascot-error { display: block; width: 168px; height: 168px; margin: 0 auto var(--space-4); }
  body.cs.am-door.cs-auth .personality-line { margin: 0 0 var(--space-1); font-size: var(--fs-15); font-weight: var(--fw-medium); color: var(--text-2); text-align: center; }
  body.cs.am-door.cs-auth .code { margin: 0 0 var(--space-1); font-size: var(--fs-34); line-height: var(--lh-34); font-weight: var(--fw-semi); color: var(--text-3); font-variant-numeric: tabular-nums; text-align: center; }
  body.cs.am-door.cs-auth .wrap:has(> .home) > h1,
  body.cs.am-door.cs-auth .wrap:has(> .code) > h1 { text-align: center; }
  body.cs.am-door.cs-auth .wrap > p:not(.subtitle):not(.code):not(.personality-line) { margin: 0 0 var(--space-5); font-size: var(--fs-15); line-height: var(--lh-15); color: var(--text-2); text-align: center; }
  body.cs.am-door.cs-auth .home {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 0 var(--space-4);
    background: var(--accent-solid);
    border: var(--hairline) solid var(--accent-edge);
    border-radius: var(--radius-2);
    color: var(--accent-on);
    font-size: var(--fs-16);
    font-weight: var(--fw-semi);
    text-decoration: none;
  }
  body.cs.am-door.cs-auth .home + .home { margin-top: var(--space-2); background: var(--bg-raised); border-color: var(--border); color: var(--text); }

  /* login: the card's own "Amos" is the wordmark, under the mark */
  body.cs.am-door--login.cs-auth .am-door__brand { margin-bottom: var(--space-4); }
  body.cs.am-door--login.cs-auth .card > h1 { font-size: var(--fs-28); line-height: var(--lh-28); letter-spacing: var(--track-tight); text-align: center; }
  body.cs.am-door--login.cs-auth .card > .subtitle { text-align: center; margin-bottom: var(--space-5); }
}
