/* The public index page (recruiting) only -- white, the words "Coming
   soon", and the login in the top right corner. The admin side keeps
   css/portal.css and the agent side css/agent.css. */
:root {
  --bg: #ffffff;
  --text: #1a2230;
  --text-muted: #6b7584;
  --border: #d9dee5;
  --primary: #2f6fde;
  --primary-hover: #2459b8;
  --error: #c8392f;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --header-height: 3.5rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  /* Room for the fixed header, so it never covers the page. */
  padding-top: var(--header-height);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Login: a fixed header across the top, the form on the right --- */

.public-login {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.public-login form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.public-login input {
  width: 11rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

.public-login input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.public-login button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  background: var(--primary);
  color: #fff;
}

.public-login button:hover {
  background: var(--primary-hover);
}

/* A login error shows just under the header, on the right. */
#result {
  position: absolute;
  top: 100%;
  right: 1.5rem;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

#result.error {
  color: var(--error);
}

/* --- The page itself --- */

.public-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.public-soon {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

@media (max-width: 560px) {
  :root {
    --header-height: 8.5rem;
  }

  .public-login {
    padding: 0 1rem;
  }

  #result {
    right: 1rem;
  }

  .public-login input {
    width: 100%;
  }

  .public-login form {
    width: 100%;
  }

  .public-login button {
    width: 100%;
  }
}

/* --- The application form (shown when applications are open) --- */

body.has-apply .public-main {
  flex: none;
  min-height: 40vh;
}

.public-apply {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.public-apply h2 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.public-apply-intro {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.apply-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.apply-wide {
  grid-column: 1 / -1;
}

.apply-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.apply-optional {
  color: var(--text-muted);
  font-weight: 400;
}

.apply-field input,
.apply-field textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  resize: vertical;
}

.apply-field input:focus,
.apply-field textarea:focus,
.apply-consent input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* A field people never see, that bots fill in. */
.apply-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.apply-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.apply-consent input {
  margin-top: 0.2rem;
}

#apply-send {
  margin-top: 1.25rem;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  background: var(--primary);
  color: #fff;
}

#apply-send:hover {
  background: var(--primary-hover);
}

#apply-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.apply-message {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.apply-message.success {
  background: #e7f6ee;
  color: #1e7a4a;
}

.apply-message.error {
  background: #fdecea;
  color: var(--error);
}

@media (max-width: 560px) {
  .apply-grid {
    grid-template-columns: 1fr;
  }
}

/* --- The contract signing page (sign.html), which has no login header --- */

body.public-plain {
  padding-top: 0;
}

.public-sign {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.sign-html {
  line-height: 1.5;
}

.sign-html:empty {
  display: none;
}

.sign-pdf {
  display: block;
  width: 100%;
  height: 70vh;
  margin: 1.25rem 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.public-sign textarea {
  resize: vertical;
}

.sign-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.sign-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.sign-item.reading .sign-item-name {
  font-weight: 600;
}

.sign-item-num {
  color: var(--text-muted);
  margin-right: 0.4rem;
}

.sign-item-actions {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.sign-signed {
  color: #1e7a4a;
  font-weight: 600;
  font-size: 0.9rem;
}

.sign-primary,
.sign-secondary {
  cursor: pointer;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font);
}

.sign-primary {
  border: none;
  background: var(--primary);
  color: #fff;
}

.sign-primary:hover {
  background: var(--primary-hover);
}

.sign-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.sign-secondary {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.sign-secondary:hover {
  border-color: var(--text-muted);
}

/* The applicant's ID, uploaded before signing. */
.sign-id {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sign-id-status {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
}

.sign-id-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.sign-id-upload input[type="file"] {
  flex: 1;
  min-width: 0;
}

/* Parts of the signing page are shown and hidden as the applicant signs;
   hidden wins over each part's own display. */
.public-sign [hidden] {
  display: none !important;
}

/* The thank-you message after a contract is signed (Settings > Contract). */
.public-thanks {
  width: 100%;
  max-width: 640px;
  margin: 1.5rem auto 0;
  padding: 1rem 1.25rem;
  border-radius: 6px;
  background: #e7f6ee;
  color: #1e7a4a;
  line-height: 1.5;
}

.public-thanks[hidden] {
  display: none;
}
