/* The registry (BRAND.md section 11, "packages.torb.dev"): the package page, its chips and its table of versions. */

.registry-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 24px 104px;
}

.registry-search input,
.search-form input {
  width: 240px;
  height: 36px;
  padding: 0 12px;
  font-family: var(--torb-font-sans);
  font-size: var(--torb-type-ui-size);
  color: var(--torb-text);
  background: var(--torb-background);
  border: 1px solid var(--torb-border-control);
  border-radius: var(--torb-radius-small);
}

.registry-search input::placeholder,
.search-form input::placeholder {
  color: var(--torb-text-subtle);
}

/* A package's name is code, so it is set in Geist Mono 700; a version has tabular figures. */

.package-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.package-name {
  margin: 0;
  font-family: var(--torb-font-mono);
  font-feature-settings: var(--torb-font-mono-features);
  font-size: var(--torb-type-heading-2-size);
  font-weight: 700;
  line-height: var(--torb-type-heading-2-line-height);
  letter-spacing: var(--torb-type-heading-2-tracking);
  overflow-wrap: anywhere;
}

.package-version {
  font-size: var(--torb-type-heading-4-size);
  font-variant-numeric: tabular-nums;
  color: var(--torb-text-muted);
}

.package-description {
  margin: 12px 0 0;
  max-width: 62ch;
}

.package-keywords {
  margin-top: 16px;
}

/* The main action is the primary, ink button next to the command it copies - never the red one. */

.install {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin: 32px 0 8px;
}

.install .code-block {
  flex: 1 1 280px;
  margin: 0;
}

.install .button {
  height: 46px;
}

.package-section {
  margin-top: 40px;
}

.package-section h2 {
  margin: 0 0 12px;
  font-size: var(--torb-type-heading-4-size);
  font-weight: 700;
  line-height: 1.3;
}

.package-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 24px;
  margin: 0;
}

.package-facts dt {
  color: var(--torb-text-muted);
}

.package-facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.package-facts code,
.package-versions code {
  font-weight: 500;
}

/* Neutral chips: a hairline and the surface, no colour of a state. */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 2px 10px;
  font-family: var(--torb-font-mono);
  font-size: var(--torb-type-small-size);
  line-height: var(--torb-type-small-line-height);
  color: var(--torb-text-muted);
  background: var(--torb-surface);
  border: 1px solid var(--torb-border);
  border-radius: var(--torb-radius-small);
  overflow-wrap: anywhere;
}

.chips-none {
  margin: 0;
  color: var(--torb-text-muted);
}

/* Every version: the date, and for a yanked one the warning tint, the word and the reason. */

.package-versions th:first-child,
.package-versions td:first-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.package-versions tr.yanked td {
  color: var(--torb-warning-text);
  background: var(--torb-warning-surface);
  border-bottom-color: var(--torb-warning-border);
}

.yanked-word {
  font-weight: 600;
}

.yanked-reason {
  overflow-wrap: anywhere;
}

.package-notice {
  margin: 24px 0 0;
  padding: 12px 16px;
  color: var(--torb-warning-text);
  background: var(--torb-warning-surface);
  border: 1px solid var(--torb-warning-border);
  border-radius: var(--torb-radius-small);
}

/* The account pages (tools/registry/src/account.trb): a labelled field, a text input, a form row, the list of
   identities, passkeys and recovery codes, and the table of tokens - tokens by role, the primary button ink. */

.account h1 {
  margin: 0 0 16px;
}

.account h2 {
  margin: 40px 0 12px;
  font-size: var(--torb-type-heading-4-size);
  font-weight: 700;
  line-height: 1.3;
}

.account p {
  max-width: 62ch;
  margin: 0 0 12px;
}

.account code {
  overflow-wrap: anywhere;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 12px;
}

.field {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 6px;
  max-width: 360px;
}

.field-label {
  color: var(--torb-text-muted);
}

.text-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-family: var(--torb-font-mono);
  font-size: var(--torb-type-ui-size);
  color: var(--torb-text);
  background: var(--torb-background);
  border: 1px solid var(--torb-border-control);
  border-radius: var(--torb-radius-small);
}

.record-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--torb-border);
}

.record-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--torb-border);
}

.record-list form {
  margin: 0 0 0 auto;
}

.record-warning {
  color: var(--torb-warning-text);
}

.recovery-codes li {
  font-family: var(--torb-font-mono);
  font-feature-settings: var(--torb-font-mono-features);
}

.account-tokens td form {
  margin: 0;
}

.account-actions {
  margin-top: 40px;
}

/* The search page: the field and its button, the status line, and one row per package that the script renders. */

.search-title {
  margin: 0 0 24px;
  font-size: var(--torb-type-heading-2-size);
  line-height: var(--torb-type-heading-2-line-height);
  letter-spacing: var(--torb-type-heading-2-tracking);
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.search-form input {
  flex: 1 1 280px;
  width: auto;
  height: 46px;
}

.search-note,
.search-status {
  margin: 16px 0 0;
  color: var(--torb-text-muted);
}

.search-status-error {
  padding: 12px 16px;
  color: var(--torb-warning-text);
  background: var(--torb-warning-surface);
  border: 1px solid var(--torb-warning-border);
  border-radius: var(--torb-radius-small);
}

.search-results {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.search-result {
  padding: 20px 0;
  border-top: 1px solid var(--torb-border);
}

.search-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.search-result-name {
  font-family: var(--torb-font-mono);
  font-feature-settings: var(--torb-font-mono-features);
  font-size: var(--torb-type-heading-4-size);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.search-result-version,
.search-result-dependents {
  font-variant-numeric: tabular-nums;
  color: var(--torb-text-muted);
}

.search-result-description {
  margin: 8px 0 0;
  max-width: 62ch;
  overflow-wrap: anywhere;
}

.search-result .chips {
  margin-top: 12px;
}

.search-pages {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--torb-border);
}

.search-pages:empty {
  display: none;
}

@media (max-width: 640px) {
  .registry-search input {
    width: 140px;
  }

  .package-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .package-facts dd {
    margin-bottom: 12px;
  }

  .field {
    max-width: none;
  }
}
