/*
 * One stylesheet for every page. No framework, no build step. Layouts are
 * single-column first and widen at 720px and 1000px.
 */

/* Fonts are self-hosted; see fonts/README.md for sources and licenses. */
@font-face {
  font-family: "Silkscreen";
  src: url("fonts/Silkscreen-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("fonts/Silkscreen-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

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

html {
  color-scheme: dark;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-mono);
  font-variant-numeric: tabular-nums;
  /* Code ligatures would turn ">_" and ">=" into other shapes. */
  font-variant-ligatures: none;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

code,
kbd {
  font: inherit;
  color: var(--text);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap {
  width: 100%;
  max-width: 1128px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* A skip link is the first focusable element on every page. */
.skip {
  position: absolute;
  left: var(--gutter);
  top: -80px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  z-index: 2;
}
.skip:focus {
  top: 8px;
}

/* Uppercase, tracked-out labels: navigation, chips, table headers. */
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.accent {
  color: var(--accent);
}

/* ---- Header and footer ------------------------------------------------ */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 28px;
}

/* The pixel face is drawn on an 8px grid; sizes stay multiples of 8. */
.wordmark {
  color: var(--text);
  font: 700 24px/1 var(--font-display);
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark .caret {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
/* An icon-only link keeps its accessible name in aria-label. */
.site-nav .icon-link {
  display: inline-flex;
  line-height: 0;
}
.site-nav a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
}
.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}

.site-footer {
  margin-top: 72px;
  padding-bottom: 48px;
  color: var(--muted);
  font-size: 13px;
}
.site-footer::before {
  content: "";
  display: block;
  margin-bottom: 24px;
  border-top: 1px dashed var(--border);
}
.site-footer p + p {
  margin-top: 6px;
}

/* ---- Panels ------------------------------------------------------------ */

/*
 * A titled panel: thin rounded border with the title sitting in the top
 * edge, as the TUI draws it. The title's background is split so it covers
 * the border on both the page and the panel side.
 */
.panel {
  position: relative;
  padding: 28px 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.panel-title {
  position: absolute;
  top: -9px;
  left: 16px;
  max-width: calc(100% - 32px);
  padding: 0 8px;
  overflow: hidden;
  background: linear-gradient(var(--bg) 0 8px, var(--panel) 8px);
  color: var(--text);
  font: 400 16px/1 var(--font-display);
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

/* A section label followed by a dashed rule that fills the row. */
.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rule::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--border);
}
.rule > .rule-end {
  order: 2;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- Chips and buttons ------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 20px;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
a.chip:hover {
  color: var(--text);
}
/* Selection is a solid fill, announced with aria-current. */
.chip[aria-current="true"],
.chip.is-on {
  background: var(--accent);
  color: var(--on-accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 3px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font: 700 13px/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.button:hover {
  filter: brightness(1.08);
}
.button.is-quiet {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text);
}

/* A command with its copy button. */
.command {
  display: flex;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
}
.command code {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  /* A long command wraps so all of it, an invite code included, is shown. */
  overflow-wrap: anywhere;
  font-weight: 700;
}
.command code::before {
  content: "$ ";
  color: var(--accent);
}
.command .button {
  border-radius: 0 2px 2px 0;
}
.command-note {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Landing ----------------------------------------------------------- */

.hero {
  display: grid;
  gap: 40px;
  padding-top: 24px;
  padding-bottom: 8px;
}
.hero h1 {
  margin-top: 16px;
  font: 400 32px/1.25 var(--font-display);
  text-transform: uppercase;
}
.hero .lede {
  max-width: 56ch;
  margin-top: 20px;
  color: var(--text);
  font-size: 16px;
}
.hero .command {
  width: 440px;
  margin-top: 28px;
}

.sample-note {
  margin-top: 10px;
  text-align: right;
}

/* The agents counted, as one centered line that wraps on a narrow screen. */
.works-with {
  margin-top: 56px;
  text-align: center;
}
.works-with-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 0;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  font-size: 16px;
}
.works-with-list li {
  padding: 0 22px;
}
.works-with-list li + li {
  border-left: 1px solid var(--border);
}

.section {
  margin-top: 64px;
}
.section > .rule {
  margin-bottom: 28px;
}

.cards {
  display: grid;
  gap: 28px;
}

.ticks li {
  position: relative;
  padding-left: 22px;
}
.ticks li + li {
  margin-top: 8px;
}
.ticks li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}
.ticks.is-yes li::before {
  content: "+";
  color: var(--up);
}
.ticks.is-no li::before {
  content: "×";
  color: var(--down);
}
.ticks.is-dot li::before {
  content: "·";
  color: var(--accent);
}
.panel-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 13px;
}

.steps {
  display: grid;
  gap: 24px;
  counter-reset: step;
}
.steps li {
  min-width: 0;
  counter-increment: step;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  color: var(--accent);
  font: 700 24px/1 var(--font-display);
}
.steps h3 {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.steps p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.glossary {
  display: grid;
  gap: 14px 20px;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
}
.glossary dt {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

/* ---- Board table ------------------------------------------------------- */

.board-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}

.standings {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
}
.standings th {
  padding: 0;
}
.standings td {
  padding: 9px 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.standings .col-rank {
  width: 44px;
  padding-left: 10px;
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}
.standings .col-name {
  width: 100%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.standings .col-value {
  font-weight: 700;
  text-align: right;
}
.standings .col-move {
  min-width: 88px;
  padding-right: 12px;
  color: var(--muted);
  text-align: right;
}
.standings tr.rank-1 .col-rank {
  color: var(--gold);
}
.standings tr.rank-2 .col-rank {
  color: var(--silver);
}
.standings tr.rank-3 .col-rank {
  color: var(--bronze);
}
/* The highlighted row: coral edge, tint, and accent text, as in the TUI. */
.standings tr.is-current td {
  background: var(--current-row);
}
.standings tr.is-current td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
.standings tr.is-current .col-name,
.standings tr.is-current .col-value {
  color: var(--accent);
}
.standings a {
  color: inherit;
  text-decoration: none;
}
.standings a:hover {
  text-decoration: underline;
}

.who {
  display: flex;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
}
.who-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
abbr.tag {
  cursor: help;
  text-decoration: none;
}
.tag {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--muted);
  font: 700 12px/1 var(--font-mono);
  text-transform: uppercase;
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
}
.avatar.is-large {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  font-size: 32px;
}

.move-up {
  color: var(--up);
}
.move-down {
  color: var(--down);
}
.move-new {
  color: var(--warning);
}

.board-foot {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Data pages -------------------------------------------------------- */

main.wrap {
  padding-top: 24px;
}
.wrap.is-narrow {
  max-width: 760px;
}

/* States: loading, waking, not found, and failures. Each is a panel with
   words in it, never an empty layout. */
.state-line {
  padding: 40px 0;
}
.state {
  max-width: 640px;
  margin: 40px auto 0;
}
.state .panel-title {
  white-space: normal;
}
.state-lede {
  font-size: 16px;
}
.state-lede + .muted {
  margin-top: 10px;
}
.state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.notice-level {
  color: var(--error);
}
.caret-blink {
  color: var(--accent);
  animation: blink 1.1s steps(1, end) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 16px 0 44px;
}
.profile-head > div {
  min-width: 0;
}
.profile-name {
  overflow: hidden;
  font: 700 28px/1.3 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-link {
  color: var(--muted);
  font-size: 13px;
}
.profile-share {
  margin-left: auto;
}
.panel-actions {
  margin-top: 16px;
}

.pair {
  display: grid;
  gap: 28px;
}

.tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 48px;
}
.tile dd {
  margin-top: 6px;
}
.tile-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.fineprint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

.board-layout {
  display: grid;
  gap: 28px;
  margin-top: 16px;
}
.board-layout > * {
  min-width: 0;
}
.rail {
  display: grid;
  gap: 28px;
  align-content: start;
}
.board-empty {
  margin-top: 16px;
  color: var(--muted);
}

.facts {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
}
.facts dd {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
  text-align: right;
}
.standing-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
  color: var(--accent);
  font-weight: 700;
}

.invite-group {
  margin: 6px 0 8px;
  overflow-wrap: anywhere;
  font: 400 32px/1.25 var(--font-display);
  text-transform: uppercase;
}
.steps.is-stacked {
  grid-template-columns: 1fr;
  margin-top: 28px;
}
.steps.is-stacked p {
  margin-bottom: 12px;
}
.steps.is-stacked .command-note:empty {
  display: none;
}

/* ---- Wider screens ----------------------------------------------------- */

@media (min-width: 720px) {
  .hero h1 {
    font-size: 40px;
  }
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1000px) {
  .pair {
    grid-template-columns: 1fr 1fr;
  }
  .board-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
    align-items: center;
    gap: 56px;
    padding-top: 40px;
  }
}

@media (max-width: 719px) {
  :root {
    --gutter: 16px;
  }
  .wordmark {
    font-size: 16px;
  }
  .hero h1 {
    font-size: 24px;
  }
  /* Wrapped rows have no fixed first item, so the dividers give way to space. */
  .works-with-list {
    gap: 8px 20px;
    font-size: 14px;
  }
  .works-with-list li {
    padding: 0;
  }
  .works-with-list li + li {
    border-left: 0;
  }
  .hero .command {
    width: 100%;
  }
  .panel {
    padding: 24px 14px 18px;
  }
  .standings td {
    padding: 8px 4px;
  }
  .standings .col-rank {
    width: 32px;
    padding-left: 4px;
  }
  .standings .col-move {
    min-width: 0;
    padding-right: 6px;
  }
  /* A tag drops under its name rather than squeezing the name out. */
  .who {
    flex-wrap: wrap;
  }
  .who-name {
    max-width: calc(100% - 34px);
  }
  .section {
    margin-top: 48px;
  }
  .glossary {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .glossary dd {
    margin-bottom: 12px;
  }
  .profile-name,
  .invite-group {
    font-size: 24px;
  }
  .profile-head {
    flex-wrap: wrap;
    margin-bottom: 36px;
  }
  .profile-share {
    flex-basis: 100%;
    margin-left: 0;
  }
  .tile-value {
    font-size: 22px;
  }
  .state {
    margin-top: 16px;
  }
}

/* Nothing here animates except the loading indicator; this turns that off
   too and guards anything added later. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
