/* Base styles and shared components. Tokens from docs/SPEC.md section 13.
   Area stylesheets: public.css (browse, ask detail, static pages),
   account.css (sign-in, dashboard, settings, claim flow),
   maintain.css (submit project, ask editor, console), curate.css. */

:root {
  --paper: #f3f4f2;
  --card: #ffffff;
  --ink: #17181a;
  --ink-soft: #33363a;
  --muted: #5a5e63;
  --line: #d7d9d4;
  --line-strong: #b9bcb6;
  --ember: #d2380f;
  --ember-text: #b92f0b;
  --ember-on-ink: #ff6a3d;
  --cobalt: #2447c9;
  --pine: #1f6b4f;
  --mustard: #e2a91b;
  --grey-fill: #e4e6e2;

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --gutter: clamp(16px, 5vw, 80px);
  --radius-btn: 4px;
  --radius-card: 6px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--ink);
}
a:hover {
  color: var(--ember-text);
}

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

img {
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
}

p {
  margin: 0 0 1em;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  z-index: 10;
}
.skip-link:focus {
  left: 16px;
}

/* ---- Layout -------------------------------------------------------------- */

.container {
  /* 1280px of content plus the gutters (border-box). */
  max-width: calc(1280px + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.container--narrow {
  max-width: calc(880px + 2 * var(--gutter));
}
.section {
  padding-top: 48px;
  padding-bottom: 96px;
}
.stack > * + * {
  margin-top: 24px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

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

.display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.95;
  font-size: clamp(40px, 6vw, 72px);
}
h2.display,
.display--md {
  font-size: clamp(32px, 4vw, 48px);
}
h3.display,
.display--sm {
  font-size: 26px;
  line-height: 1;
}
.eyebrow,
.label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ember-text);
}
.label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.lede {
  font-size: 20px;
  color: var(--ink-soft);
  max-width: 640px;
}
.page-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-header__inner {
  padding-top: 14px;
  padding-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}
.brand--on-ink {
  color: var(--paper);
}
/* The logo (views/brand.tsx). "TOKENS" takes the link's color. */
.brand__lockup {
  display: block;
  flex: none;
  width: auto;
  height: 40px;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
  font-size: 15px;
  font-weight: 500;
}
.site-nav > a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.account-menu {
  position: relative;
}
.account-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}
.account-menu summary::-webkit-details-marker {
  display: none;
}
.account-menu ul {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 5;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 24px rgba(23, 24, 26, 0.12);
}
.account-menu li a,
.account-menu li .link-button {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  width: 100%;
  text-decoration: none;
}
.avatar {
  border-radius: 50%;
}

.site-footer {
  background: var(--ink);
  color: var(--paper);
}
.site-footer__inner {
  padding-top: 40px;
  padding-bottom: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
}
.site-footer p {
  margin: 0;
  font-size: 14px;
  color: #c9ccc6;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  font-size: 14px;
}
.footer-nav a {
  color: var(--paper);
  text-decoration: none;
  display: flex;
  align-items: center;
  min-height: 44px;
}
.footer-nav a:hover {
  color: var(--ember-on-ink);
}

/* ---- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-sm {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 500;
}
.btn-primary {
  background: var(--ember);
  color: #fff;
}
.btn-primary:hover {
  background: var(--ember-text);
  color: #fff;
}
.btn-ink {
  background: var(--ink);
  color: var(--paper);
}
.btn-ink:hover {
  background: var(--ink-soft);
  color: var(--paper);
}
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-outline:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn-danger {
  background: transparent;
  color: var(--ember-text);
  border-color: var(--ember-text);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Chips, tags, pips, badges ------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.chip[aria-pressed="true"],
.chip[aria-current="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 500;
}
.size {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.pips {
  display: inline-flex;
  gap: 3px;
}
.pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}
.pip--on {
  background: currentColor;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border: 1.5px solid var(--ink);
}
.badge--open {
  background: transparent;
}
.badge--claimed {
  background: var(--grey-fill);
  border-color: var(--grey-fill);
}
.badge--in_review {
  background: var(--mustard);
  border-color: var(--mustard);
}
.badge--merged {
  background: var(--ink);
  color: var(--paper);
}

/* ---- Panels, banners, tables --------------------------------------------- */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 24px;
}
.banner {
  border-radius: var(--radius-card);
  padding: 16px 20px;
  border: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 24px;
}
.banner p:last-child,
.banner ul:last-child {
  margin-bottom: 0;
}
.banner--warn {
  background: #fbf1d6;
  border-color: var(--mustard);
}
.banner--error {
  background: #fbe5de;
  border-color: var(--ember);
}
.flash {
  padding: 14px 0;
  font-weight: 500;
}
.flash--notice {
  background: var(--ink);
  color: var(--paper);
}
.flash--error {
  background: var(--ember);
  color: #fff;
}
.empty-state {
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  color: var(--ink-soft);
}

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table .num {
  text-align: right;
  font-family: var(--font-mono);
}

dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
}
dl.kv dt {
  color: var(--muted);
}
dl.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---- Forms ------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 720px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 0;
  padding: 0;
  margin: 0;
}
.field label,
.field legend {
  font-weight: 600;
}
.field legend {
  margin-bottom: 6px;
}
.hint {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select {
  font: inherit;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
.field textarea.mono {
  font-family: var(--font-mono);
  font-size: 14px;
}
.field--error input,
.field--error textarea,
.field--error select {
  border-color: var(--ember);
}
.field-error {
  margin: 0;
  color: var(--ember-text);
  font-size: 14px;
  font-weight: 500;
}
.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}
.checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ---- Rendered maintainer Markdown --------------------------------------- */

.prose {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 17px;
}
.prose code {
  background: var(--grey-fill);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
