/* Contri. One stylesheet for the site and the app.

   Direction
   - Product: ajo savings circles for Nigerians; a NEAR contract holds the pot
     and pays each turn.
   - Character: steady, communal, exact.
   - World: adire indigo on cotton, the collector's ledger card.
   - Moments: the turn ring, and the seat NFT the contract draws.
   - Signature: numbered seats around a ring (logo, favicon, ring, NFT).

   System: 4px spacing grid, weights 400 and 500 (600 only for the wordmark),
   one accent (adire indigo), three text roles, hairlines, one easing curve.
   One typeface, Instrument Sans, self-hosted so no font request leaves the site. */

@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff") format("woff");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  /* Neutral ramp, cotton paper */
  --paper: #f3f4f0;
  --surface: #ffffff;
  --raised: #eceee9;
  --line: #dcdfe4;
  /* Text roles */
  --ink: #161a2c;
  --ink-2: #4b5168;
  --ink-3: #6b7186;
  /* One accent */
  --adire: #243b7a;
  --adire-soft: #e4e8f3;
  --on-adire: #ffffff;
  /* Meaning only */
  --leaf: #1d7549;
  --leaf-soft: #e1f0e6;
  --amber: #8a5000;
  --amber-soft: #f7ecd8;
  --red: #b42318;
  --red-soft: #fbe5e1;

  --r-s: 6px;
  --r: 10px;
  --r-l: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0d14;
    --surface: #11141c;
    --raised: #1a1e28;
    --line: #232838;
    --ink: #eef0f5;
    --ink-2: #a3a9b8;
    --ink-3: #7a8296;
    --adire: #a3b6f3;
    --adire-soft: #1b2440;
    --on-adire: #0b0d14;
    --leaf: #4cc38a;
    --leaf-soft: #13291e;
    --amber: #e8b05a;
    --amber-soft: #2e230f;
    --red: #e5484d;
    --red-soft: #341517;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/24px var(--font);
  font-feature-settings: "kern", "calt";
}
img, svg { display: block; max-width: 100%; }
a { color: var(--adire); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--adire); outline-offset: 2px; border-radius: 4px; }
h1[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 500; }
h1 { font-size: 28px; line-height: 32px; }
@media (min-width: 560px) { h1 { font-size: 32px; line-height: 36px; } }
h2 { font-size: 20px; line-height: 28px; margin-top: 12px; }
h3 { font-size: 18px; line-height: 24px; }
p { margin: 0; }
.lead { font-size: 18px; line-height: 28px; color: var(--ink-2); }
.hint { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.sub { color: var(--ink-2); }
.kicker { color: var(--ink-2); }
.code, .code-block { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.code-block {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 15px;
  line-height: 24px;
  user-select: all;
}

/* ---------- App frame ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  font-stretch: 88%;
  text-decoration: none;
}
.wordmark svg { width: 24px; height: 24px; color: var(--adire); }
.wordmark .hole { fill: var(--paper); }
.topbar nav { display: flex; gap: 20px; }
.topbar nav a { color: var(--ink-2); text-decoration: none; transition: color 150ms var(--ease); }
.topbar nav a:hover { color: var(--ink); }

main#view { max-width: 640px; margin: 0 auto; padding: 8px 16px 64px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 4px; }
.narrow { max-width: 512px; }
.loading { color: var(--ink-2); }
.back { width: fit-content; color: var(--ink-2); text-decoration: none; transition: color 150ms var(--ease); }
.back::before { content: "\2190\00a0"; }
.back:hover { color: var(--ink); }

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

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font: inherit;
  font-weight: 500;
  line-height: 24px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease);
}
.button:active, button:active { transform: scale(0.98); }
.primary { background: var(--adire); color: var(--on-adire); }
.primary:hover { background: color-mix(in srgb, var(--adire) 88%, var(--ink)); }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.secondary:hover { border-color: var(--ink-3); }
.text { min-height: 40px; padding: 0; background: none; color: var(--adire); text-decoration: underline; text-underline-offset: 3px; }
.text.danger { color: var(--red); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions.row { flex-direction: row; flex-wrap: wrap; }
.actions.row > * { flex: 1 1 160px; }
@media (min-width: 560px) { .actions:not(.row) { flex-direction: row; flex-wrap: wrap; } }

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

.field { display: flex; flex-direction: column; gap: 8px; }
.field label, legend { font-weight: 500; }
input[type="text"], input:not([type]), select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: inherit;
  transition: border-color 150ms var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--adire); box-shadow: 0 0 0 3px var(--adire-soft); }
fieldset { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.choice:has(input:checked) { border-color: var(--adire); background: var(--adire-soft); }
.choice input { flex: none; width: 16px; height: 16px; margin-top: 4px; accent-color: var(--adire); }
.choice > span { display: flex; flex-direction: column; gap: 4px; }
.choice strong { font-weight: 500; }
.networks { display: flex; flex-direction: column; gap: 8px; }
.summary { color: var(--ink-2); }
.summary:empty, .progress:empty { display: none; }
.progress { color: var(--adire); font-weight: 500; }

details.more { padding-top: 12px; border-top: 1px solid var(--line); }
details > summary { min-height: 32px; color: var(--adire); font-weight: 500; cursor: pointer; }
details[open] > summary { margin-bottom: 12px; }
details > :not(summary) + :not(summary) { margin-top: 12px; }
details.share { padding: 16px; background: var(--surface); border: 1px solid var(--adire); border-radius: var(--r-l); }

.callout { padding: 12px 16px; background: var(--amber-soft); color: var(--ink); border-radius: var(--r); }
.empty { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; color: var(--ink-2); }

/* ---------- Circle list ---------- */

.circle-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.circle-row {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms var(--ease);
}
.circle-row:hover { border-color: var(--ink-3); }
.row-title { font-size: 18px; line-height: 24px; font-weight: 500; }
.row-sub { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.row-status { margin-top: 4px; font-weight: 500; }
.row-status.due, .status.due { color: var(--amber); }
.row-status.good, .status.good { color: var(--leaf); }
.row-status.quiet, .status.quiet { color: var(--ink-2); }
.status { font-size: 17px; line-height: 24px; font-weight: 500; }

/* ---------- The ring: the screen's one moment ---------- */

.ring { position: relative; display: grid; width: min(100%, 340px); aspect-ratio: 1; margin: 8px auto; }
.ring > * { grid-area: 1 / 1; }
.ring-art { width: 100%; height: 100%; overflow: visible; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 8; }
.ring-progress { fill: none; stroke: var(--adire); stroke-width: 8; stroke-linecap: round; }
.seat circle { fill: var(--surface); stroke: var(--ink-3); stroke-width: 2; }
.seat text { fill: var(--ink); font-family: var(--font); font-weight: 500; font-variant-numeric: tabular-nums; }
.seat.empty circle { stroke: var(--line); stroke-dasharray: 3 3; }
.seat.empty text { fill: var(--ink-3); }
.seat.listed circle { stroke: var(--amber); stroke-dasharray: 5 3; }
.seat.paid circle { stroke: var(--leaf); stroke-width: 4; stroke-dasharray: none; }
.seat.you circle { fill: var(--adire-soft); }
.seat.current circle { fill: var(--surface); stroke: var(--adire); stroke-width: 4; stroke-dasharray: none; }
.seat.current.paid circle { stroke: var(--leaf); }
.seat.received circle { fill: var(--adire); stroke: var(--adire); }
.seat.received.paid circle { stroke: var(--leaf); }
.seat.received text { fill: var(--on-adire); }
.you-label { fill: var(--adire); font-family: var(--font); font-size: 15px; font-weight: 500; }
.ring-center { display: flex; align-items: center; justify-content: center; padding: 22%; text-align: center; pointer-events: none; }
.ring-center > span { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-2); }
.ring-center .big { color: var(--ink); font-size: 44px; line-height: 44px; font-weight: 500; font-stretch: 80%; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ring-center .small { font-size: 13px; line-height: 16px; }

/* ---------- Members, payouts, facts ---------- */

.members { margin: 0; padding: 0; list-style: none; counter-reset: turn; border-top: 1px solid var(--line); }
.member {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  grid-template-areas: "n who name" "n tags deposit";
  align-items: baseline;
  gap: 4px 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  counter-increment: turn;
}
.member::before { content: counter(turn); grid-area: n; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.member .who { grid-area: who; font-weight: 500; overflow-wrap: anywhere; }
.member.me .who { color: var(--adire); }
.member.empty .who { color: var(--ink-3); font-weight: 400; }
.member .role { margin-left: 8px; color: var(--ink-3); font-size: 14px; font-weight: 400; }
.member .tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 4px; }
.member > .text { grid-area: name; justify-self: end; min-height: 24px; font-size: 14px; }
.deposit-note { grid-area: deposit; justify-self: end; color: var(--ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.tag { padding: 2px 8px; border-radius: var(--r-s); background: var(--adire-soft); color: var(--adire); font-size: 13px; line-height: 20px; font-weight: 500; }
.tag.good { background: var(--leaf-soft); color: var(--leaf); }
.tag.due { background: var(--amber-soft); color: var(--amber); }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.strong { background: var(--adire); color: var(--on-adire); }
.name-form { grid-column: 2 / -1; display: flex; gap: 8px; }
.name-form input { min-height: 40px; padding: 8px 12px; }
.name-form button { min-height: 40px; padding: 8px 16px; }

.payouts { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.payouts li { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }

.facts { display: grid; grid-template-columns: minmax(112px, auto) 1fr; gap: 12px 16px; margin: 0; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }
@media (max-width: 420px) { .facts { grid-template-columns: 1fr; gap: 4px; } .facts dd { margin-bottom: 8px; } }

.balance-line { font-size: 17px; }
.amount { font-weight: 500; font-variant-numeric: tabular-nums; }
.money { padding-top: 8px; }

.seat-nft { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.seat-nft img { border-radius: var(--r-s); background: var(--paper); }
.seat-nft h2 { margin: 0 0 4px; font-size: 18px; line-height: 24px; }
@media (max-width: 380px) { .seat-nft { grid-template-columns: 1fr; } }

.explore { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .explore { grid-template-columns: 1fr 1fr; } }
.explore-card { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.explore-card .ring { width: 112px; margin: 0; }
.explore-card .ring-center { padding: 18%; }
.explore-card .ring-center .big { font-size: 20px; line-height: 24px; }
.explore-card .ring-center span { font-size: 12px; line-height: 16px; }
.explore-card h2 { margin: 0; font-size: 18px; line-height: 24px; }

/* ---------- Notices ---------- */

#notices { position: fixed; right: 0; bottom: 16px; left: 0; z-index: 10; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.notice { max-width: 544px; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--paper); pointer-events: auto; }
.notice.error { background: var(--red); color: #ffffff; }

/* ---------- Site pages ---------- */

.site { max-width: 1088px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 760px) { .site { padding: 0 32px; } }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 24px; }
.site-header nav a:not(.button) { color: var(--ink-2); text-decoration: none; transition: color 150ms var(--ease); }
.site-header nav a:not(.button):hover, .site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header .button { min-height: 36px; padding: 6px 16px; }
@media (max-width: 560px) { .site-header nav a.hide-sm { display: none; } }

.hero { display: grid; align-items: center; gap: 40px; padding: 48px 0 64px; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.1fr 0.9fr; gap: 48px; padding: 96px 0 112px; } }
.hero h1 { max-width: 12ch; font-size: 44px; line-height: 46px; font-weight: 500; font-stretch: 80%; letter-spacing: -0.02em; }
@media (min-width: 560px) { .hero h1 { font-size: 56px; line-height: 58px; letter-spacing: -0.03em; } }
@media (min-width: 1024px) { .hero h1 { font-size: 72px; line-height: 74px; } }
.hero .lead { max-width: 576px; margin-top: 20px; }
@media (min-width: 560px) { .hero .lead { font-size: 20px; line-height: 30px; } }
.hero .actions { margin-top: 32px; }
.hero-ring { justify-self: center; width: 100%; max-width: 400px; }
.hero-ring .ring { width: 100%; }
.hero-note { margin-top: 8px; color: var(--ink-2); font-size: 14px; line-height: 20px; text-align: center; }

.band { padding: 64px 0; border-top: 1px solid var(--line); }
@media (min-width: 760px) { .band { padding: 96px 0; } }
.band > h2 { max-width: 22ch; margin: 0 0 32px; font-size: 28px; line-height: 32px; font-stretch: 88%; letter-spacing: -0.01em; }
@media (min-width: 760px) { .band > h2 { font-size: 36px; line-height: 40px; } }
.band .intro { max-width: 640px; margin: -16px 0 32px; color: var(--ink-2); font-size: 18px; line-height: 28px; }
.band .after { margin-top: 20px; color: var(--ink-2); }

.steps { display: grid; gap: 24px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(2, 1fr); gap: 32px 48px; } }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; counter-increment: step; }
.steps li::before { content: counter(step); grid-row: span 2; display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--adire); border-radius: 50%; color: var(--adire); font-weight: 500; font-variant-numeric: tabular-nums; }
.steps p { color: var(--ink-2); }

.split { display: grid; gap: 32px; }
@media (min-width: 760px) { .split { grid-template-columns: 1fr 1fr; gap: 48px; } }
.split h3 { margin-bottom: 8px; }
.split p { color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
.seen { width: 100%; overflow: hidden; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.seen th, .seen td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.seen thead th { background: var(--raised); color: var(--ink-2); font-size: 14px; font-weight: 500; }
.seen tbody th { font-weight: 500; }
.seen tr:last-child > * { border-bottom: 0; }

.faq { display: flex; flex-direction: column; max-width: 736px; }
.faq details { padding: 16px 0; border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { color: var(--ink); font-size: 18px; line-height: 28px; }
.faq details p { max-width: 640px; margin-top: 8px; color: var(--ink-2); }

.prose { display: flex; flex-direction: column; gap: 16px; max-width: 672px; padding: 32px 0 64px; }
.prose h1 { margin-bottom: 8px; }
.prose h2 { margin-top: 24px; }
.prose ul { display: flex; flex-direction: column; gap: 8px; margin: 0; padding-left: 20px; }
.prose .updated { color: var(--ink-2); }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; padding: 32px 0 48px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 15px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: var(--ink-2); }
.built-on { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; text-decoration: none; }
.built-on svg { width: 16px; height: 16px; }
.built-on:hover { text-decoration: underline; }

/* ---------- Motion: one entrance, and the ring filling ---------- */

@media (prefers-reduced-motion: no-preference) {
  .ring-progress { transition: stroke-dasharray 400ms var(--ease); }
  .hero-ring .ring-progress { animation: fill 1200ms 200ms var(--ease) both; }
  @keyframes fill { from { stroke-dasharray: 0 800; } }
}
.actions.row > .button, .actions.row > button { padding-inline: 12px; }
