/* Pinsta web app. One stylesheet, no framework, no build step. */

/*
 * Pinsta brand tokens. Values from Branding/pinsta-brand/tokens.css — do not
 * adjust them here; change them there and copy across.
 *
 * The one rule that shapes every decision below: **brass is an accent, never
 * type on a light background.** Measured, it is 2.28:1 on paper — a fail for
 * text and a fail for non-text contrast too, so it is not used for focus rings
 * or borders either. On ink it is 7.13:1 and perfectly good, which is why the
 * only brass on this app sits in the mark and on the dark top bar.
 *
 * Everything else is ink (16.24:1 on paper, AAA) and slate (4.77:1, AA).
 */
:root {
  --pinsta-ink: #101b2e;
  --pinsta-brass: #c9a227;
  --pinsta-paper: #faf8f3;
  --pinsta-slate: #5f7086;
  --pinsta-mist: #edf0f3;

  --ink: var(--pinsta-ink);
  --ink-muted: var(--pinsta-slate);
  --border: var(--pinsta-mist);
  --border-strong: #c4ccd6;
  --surface: #ffffff;
  --surface-alt: var(--pinsta-paper);

  /* Primary actions are ink on paper, not brass. See the note above. */
  --brand: var(--pinsta-ink);
  --brand-dark: #050b16;

  --danger: #a3291a;
  --warn: #7a5200;
  --success: #14684a;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--surface-alt);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* The one dark surface, and therefore the only place brass may appear as
   anything other than the bar inside the mark. */
.topbar {
  background: var(--pinsta-ink);
  color: var(--pinsta-paper);
  border-bottom: 1px solid var(--pinsta-ink);
}

.topbar .fine,
.topbar .muted {
  color: #b9c3d1;
}

.topbar .link {
  color: var(--pinsta-brass);
}

.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.wordmark {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--pinsta-paper);
}

.topbar .spacer {
  margin-left: auto;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.narrow {
  max-width: 420px;
}

h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

h2 {
  font-size: 15px;
  margin: 0 0 10px;
}

h3 {
  font-size: 13px;
  margin: 16px 0 6px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p {
  margin: 0 0 12px;
}

.lede {
  color: var(--ink-muted);
  margin-bottom: 20px;
}

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

.fine {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.card-head h2 {
  margin: 0;
}

.card-head .spacer {
  margin-left: auto;
}

/* ---- forms ---- */

label.field {
  display: block;
  margin-bottom: 12px;
}

label.field span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

input[type='text'],
input[type='email'],
input[type='password'],
select {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  color: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 93, 140, 0.16);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row.tight {
  gap: 6px;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-alt);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--ink);
}

.btn-danger {
  background: #fff;
  border-color: #e5bdb6;
  color: var(--danger);
}

.btn-small {
  padding: 5px 9px;
  font-size: 12.5px;
}

.link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- banners ---- */

.banner {
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 12px;
}

.banner-ok {
  background: #eef8f3;
  border-color: #bfe3d3;
  color: var(--success);
}

.banner-warn {
  background: #fdf6e6;
  border-color: #ecd9a8;
  color: var(--warn);
}

.banner-error {
  background: #fdf0ee;
  border-color: #f0c8c1;
  color: var(--danger);
}

.banner-info {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--ink);
}

/* ---- tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 650;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.scroll {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.pill-ok {
  background: #eef8f3;
  border-color: #bfe3d3;
  color: var(--success);
}

.pill-warn {
  background: #fdf6e6;
  border-color: #ecd9a8;
  color: var(--warn);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.empty {
  padding: 18px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ---- dialog ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 36, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.dialog {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px 18px;
  width: min(480px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(16, 24, 32, 0.24);
}

.dialog h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.dialog input[type='text'] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font: inherit;
  font-weight: 550;
  color: var(--ink-muted);
  cursor: pointer;
}

.tab[aria-selected='true'] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
