/* Used by every page: colours, text, the top bar, the page frame and cards. */

:root {
  --ink: #18181b;
  --muted: #6b6b76;
  --line: #e7e7ea;
  --line-strong: #d0d0d6;
  --page: #fafafa;
  --card: #ffffff;
  --accent: #2f5bd7;
  --accent-tint: #f3f6fe;
  --danger: #b42318;
  --ok: #1a7f4b;
}

* {
  box-sizing: border-box;
}

/* Without this, a class that sets "display" would show an element that has the hidden attribute. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1 {
  margin: 0 0 20px;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

p {
  margin: 0 0 12px;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.message {
  font-size: 0.9rem;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--ok);
}

.top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 20px;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Lets a long email shrink and end in "…" instead of pushing "Log out" off the bar. */
  min-width: 0;
}

.account-email {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

/* The login and signup pages: one small card in the middle. */
.page.narrow {
  max-width: 400px;
  padding-top: 12vh;
}

.page.narrow .brand {
  margin-bottom: 20px;
  text-align: center;
}

.page.narrow .below {
  margin-top: 20px;
  color: var(--muted);
  text-align: center;
}

.card {
  margin-bottom: 16px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* The card's own padding is the space below its last element. */
.card > :last-child,
.card form > :last-child {
  margin-bottom: 0;
}

.back {
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.back a {
  color: var(--muted);
}

.subtitle {
  margin: -14px 0 24px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .top-inner {
    padding: 10px 16px;
  }

  .account-email {
    display: none;
  }

  .page {
    padding: 24px 16px 56px;
  }

  .page.narrow {
    padding-top: 8vh;
  }

  .card {
    padding: 18px;
  }
}
