/* The look, in the shape shadcn/ui uses: a small set of colour roles held as
 * HSL channels, one radius, and a handful of parts (button, input, card, badge)
 * that every screen is built from. ADR 0004 says why, and what it costs.
 *
 * Colours are stored as bare channels ("240 10% 3.9%") and always used through
 * `hsl(var(--token))`. That is what lets any colour take an alpha at the point
 * of use, `hsl(var(--primary) / 0.9)`, which is how the hover states are built.
 * A token written as a finished colour breaks every one of those.
 *
 * Self-contained, like every web-project: no shared tokens, no web font.
 */

:root {
  color-scheme: light dark;

  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --success: 142 71% 35%;
  --success-foreground: 0 0% 98%;
  --destructive: 0 72% 45%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 10% 3.9%;

  --radius: 0.625rem;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-sm: 0 1px 2px 0 hsl(var(--foreground) / 0.05);
  --shadow: 0 1px 3px 0 hsl(var(--foreground) / 0.07), 0 1px 2px -1px hsl(var(--foreground) / 0.07);
  --shadow-md: 0 4px 12px -2px hsl(var(--foreground) / 0.1), 0 2px 6px -2px hsl(var(--foreground) / 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 7% 6.5%;
    --muted: 240 4% 12%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 4% 14%;
    --accent-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 4% 14%;
    --secondary-foreground: 0 0% 98%;
    --success: 142 60% 45%;
    --success-foreground: 240 10% 3.9%;
    --destructive: 0 70% 58%;
    --destructive-foreground: 240 10% 3.9%;
    --border: 240 4% 16%;
    --input: 240 4% 18%;
    --ring: 240 5% 70%;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.5), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 14px -2px rgb(0 0 0 / 0.55), 0 2px 6px -2px rgb(0 0 0 / 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

/* -------------------------------------------------------------------------- */
/* Type                                                                       */
/* -------------------------------------------------------------------------- */

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-size: 1.875rem;
  font-weight: 650;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

p {
  margin: 0;
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tagline,
.lead,
.muted {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

.tagline {
  margin-top: 0.375rem;
}

code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: hsl(var(--muted));
  border-radius: calc(var(--radius) - 4px);
  padding: 0.1em 0.4em;
}

a {
  color: inherit;
  text-decoration-color: hsl(var(--muted-foreground) / 0.5);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover {
  text-decoration-color: hsl(var(--foreground));
}

/* -------------------------------------------------------------------------- */
/* Card                                                                       */
/* -------------------------------------------------------------------------- */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.card-header {
  padding: 1.25rem 1.25rem 0;
}

.card-header .lead {
  margin-top: 0.375rem;
}

.card-content {
  padding: 1.25rem;
}

/* -------------------------------------------------------------------------- */
/* Button                                                                     */
/* -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.9375rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

/* The ring sits outside a gap the size of the page background, which is how
 * shadcn keeps a focus ring readable on top of any surface. */
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.button:active {
  transform: translateY(1px);
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.button-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-sm);
}

.button-primary:hover {
  background: hsl(var(--primary) / 0.88);
  box-shadow: var(--shadow);
}

.button-outline {
  background: hsl(var(--background));
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-sm);
}

.button-outline:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--ring) / 0.35);
}

.button-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.button-secondary:hover {
  background: hsl(var(--secondary) / 0.75);
}

.button-ghost {
  background: transparent;
  color: hsl(var(--muted-foreground));
}

.button-ghost:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Signing out throws a credential away, so the button says so on approach
 * rather than looking like every other button until it is too late. */
.button-danger {
  background: hsl(var(--background));
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.button-danger:hover {
  background: hsl(var(--destructive) / 0.1);
  border-color: hsl(var(--destructive) / 0.4);
  color: hsl(var(--destructive));
}

/* -------------------------------------------------------------------------- */
/* Input                                                                      */
/* -------------------------------------------------------------------------- */

.input {
  display: block;
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem;
  background: transparent;
  color: inherit;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  font-family: inherit;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: hsl(var(--muted-foreground));
}

.input:hover {
  border-color: hsl(var(--ring) / 0.4);
}

.input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

textarea.input {
  height: auto;
  min-height: 4.5rem;
  padding: 0.5rem 0.75rem;
  line-height: 1.55;
  resize: vertical;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.field-row .input {
  flex: 1 1 13rem;
  width: auto;
  min-width: 0;
}

/* -------------------------------------------------------------------------- */
/* Badge                                                                      */
/* -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 0.0625rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.badge-outline {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.badge-success {
  background: hsl(var(--success));
  color: hsl(var(--success-foreground));
}

.badge-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

/* -------------------------------------------------------------------------- */
/* The setup steps                                                            */
/* -------------------------------------------------------------------------- */

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.75rem 2.75rem;
}

/* The line joining one step to the next, drawn behind the numbers. */
.steps > li::after {
  content: "";
  position: absolute;
  left: 0.9375rem;
  top: 2rem;
  bottom: 0.25rem;
  width: 1px;
  background: hsl(var(--border));
}

.steps > li:last-child {
  padding-bottom: 0;
}

.steps > li:last-child::after {
  display: none;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  font-weight: 600;
}

.steps p,
.steps ul {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.steps h3 {
  color: hsl(var(--foreground));
}

.step-action {
  margin-top: 0.875rem;
}

/* One thing GitHub's form asks for. The label sits above its answer so the
 * reader can match the page against the form field by field, instead of
 * finding three instructions inside one paragraph. */
.action {
  margin-top: 1rem;
  padding-left: 0.875rem;
  border-left: 2px solid hsl(var(--border));
}

.action-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--foreground));
}

.action-body > * + * {
  margin-top: 0.5rem;
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.plain-list li + li {
  margin-top: 0.25rem;
}

/* The permission rows, built from `permissions.js`. Name, level and reason each
 * hold their own column so the three are read as a table, not as prose. */
.permissions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.375rem;
}

.permission {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.permission-name {
  font-weight: 600;
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
}

.permission-level {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.permission-why {
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
}

/* -------------------------------------------------------------------------- */
/* Callout                                                                    */
/* -------------------------------------------------------------------------- */

.callout {
  border: 1px solid hsl(var(--border));
  border-left-width: 3px;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  background: hsl(var(--muted) / 0.6);
}

.callout > * + * {
  margin-top: 0.5rem;
}

.callout-warning {
  border-left-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.07);
  margin-bottom: 1.25rem;
}

.callout-inline {
  border-left-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.07);
  color: hsl(var(--foreground));
}

.callout-title {
  font-weight: 600;
}

.callout-list {
  margin: 0;
  padding-left: 1.1rem;
}

.callout-list li + li {
  margin-top: 0.25rem;
}

/* -------------------------------------------------------------------------- */
/* Labelled field                                                             */
/* -------------------------------------------------------------------------- */

.field {
  margin-top: 0.875rem;
}

.field-label {
  display: block;
  margin-bottom: 0.3125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.field-help {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* -------------------------------------------------------------------------- */
/* The connection report                                                      */
/* -------------------------------------------------------------------------- */

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-top: 1px solid hsl(var(--border));
}

.check:first-child {
  border-top: 0;
  padding-top: 0;
}

.check .badge {
  margin-top: 0.125rem;
  flex: 0 0 auto;
}

.check-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.check-detail {
  margin-top: 0.125rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.check.failed .check-detail {
  color: hsl(var(--destructive));
}

/* -------------------------------------------------------------------------- */
/* The board                                                                  */
/* -------------------------------------------------------------------------- */

.board-heading-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.25rem;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-label {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

/* The arrow is drawn here rather than left to the browser, because the native
 * one keeps the operating system's colours and ignores the dark palette. */
.select {
  appearance: none;
  height: 2.25rem;
  padding: 0 2rem 0 0.75rem;
  background-color: hsl(var(--background));
  background-image: linear-gradient(45deg, transparent 50%, hsl(var(--muted-foreground)) 50%),
    linear-gradient(135deg, hsl(var(--muted-foreground)) 50%, transparent 50%);
  background-position: right 1rem center, right 0.7rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: inherit;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.select:hover {
  background-color: hsl(var(--accent));
  border-color: hsl(var(--ring) / 0.4);
}

.select:focus-visible {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

.subheading {
  margin-top: 1.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--foreground));
}

.tokens {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--muted) / 0.4);
  transition: border-color 0.15s ease;
}

.token-row:hover {
  border-color: hsl(var(--ring) / 0.3);
}

/* Settings holds several blocks in one card, so each needs air above it. */
#settings-view .subheading:first-of-type {
  margin-top: 0;
}

#settings-view .token-guide-slot {
  margin-top: 0.75rem;
}

.board-counts {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.status {
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.issues {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.issue {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.875rem 1rem 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.issue:hover {
  border-color: hsl(var(--ring) / 0.28);
  box-shadow: var(--shadow-md);
}

.issue:focus-within {
  border-color: hsl(var(--ring) / 0.5);
  box-shadow: var(--shadow-md);
}

.issue-where {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* An issue and a pull request sit in the same list, so the kind has to be
 * readable at a glance and not only from the word in the badge. */
.badge-issue {
  background: hsl(var(--success) / 0.15);
  color: hsl(var(--success));
  border-color: hsl(var(--success) / 0.3);
}

.badge-pull {
  background: hsl(262 60% 50% / 0.15);
  color: hsl(262 60% 45%);
  border-color: hsl(262 60% 50% / 0.3);
}

@media (prefers-color-scheme: dark) {
  .badge-pull {
    color: hsl(262 70% 75%);
  }
}

.issue-title {
  display: inline-block;
  margin-top: 0.125rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.issue-title:hover {
  text-decoration: underline;
  text-decoration-color: hsl(var(--foreground));
}

.issue-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3125rem;
  margin-top: 0.5rem;
}

.issue .note {
  margin-top: 0.75rem;
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
  display: grid;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

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

@media (max-width: 30rem) {
  .page {
    padding: 2rem 1rem 3rem;
  }

  .card-header,
  .card-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .field-row .input {
    flex-basis: 100%;
  }

  .field-row .button {
    width: 100%;
  }
}

/* A hover state is feedback, not decoration, so the colours stay and only the
 * movement goes. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .button:active {
    transform: none;
  }
}
