/* design-system.css — Rally's shared visual tokens + base components.
   See docs/rally-design-system.md. Tokens are defined ONCE here; every
   page links this file instead of declaring its own palette — that's how
   style drift starts (CLAUDE.md: client code must not duplicate constants,
   and the same instinct applies to design tokens, not just server ones).

   Applied to wallet.html first (this piece). Other pages — feed, watch,
   chat.html, chat-client.css — are NOT yet wired to this file; that's the
   doc's "apply across all pages" step, done separately, later.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Color — 6 named values (the doc's exact palette) */
  --bg: #0B0D10;
  --surface: #14171C;
  --surface-2: #1B1F26;
  --border: #262B34;
  --text: #E8EBF0;
  --text-dim: #8B93A1;
  --accent: #3B82F6;
  --accent-hover: #5B9BFF;

  /* Reserved status ramp — badges ONLY, nowhere else in the UI. The doc's
     signature: gold is the single warm thing on screen because nothing
     else is allowed to be warm. If you're tempted to reach for --gold on
     a button or highlight, stop — that's the bug the doc calls out by
     name. */
  --bronze: #C77B4A;
  --silver: #C4CAD4;
  --gold: #F2B33D;

  /* NOT in the doc's token list. The doc doesn't define a failure/success
     semantic, but a money app needs a legible "this failed" signal —
     added this one color, kept as far from the amber/gold/bronze family
     as possible (a cool-leaning crimson, not orange-red) so it never
     reads as competing with the badge ramp. Flag it if you'd rather this
     be handled without an extra color at all. */
  --danger: #E5484D;

  /* Shape */
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-pill: 999px;

  /* Space rhythm */
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Money — tabular numerals so figures align and don't jitter; the doc's
   explicit instruction, money should feel precise. */
.money, .tabular-nums { font-variant-numeric: tabular-nums; }

/* Type scale — retire "everything at 15px" */
.h-page    { font-size: 24px; font-weight: 600; margin: 0; color: var(--text); }
.h-section { font-size: 18px; font-weight: 600; margin: 0; color: var(--text); }
.label     { font-size: 13px; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.caption   { font-size: 13px; color: var(--text-dim); }

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

/* Shared header — quiet, --surface, hairline bottom border. Same
   treatment on every page (doc: "same treatment everywhere"). */
header.site-header {
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
header.site-header .brand { color: var(--text); font-weight: 700; font-size: 16px; }
header.site-header a { color: var(--text-dim); text-decoration: none; font-size: 14px; }
header.site-header a:hover { color: var(--text); }
header.site-header a.active { color: var(--text); font-weight: 600; }
header.site-header .whoami { color: var(--text-dim); font-size: 13px; white-space: nowrap; }
/* Logged-out Discovery visitor (pieceC-discovery.md) — the one nav link
   that replaces the whoami/create-menu slot instead of sitting beside it. */
header.site-header a.login-link { margin-left: auto; color: var(--accent); }

/* Corner wallet widget (docs/pieceD-wallet-widget.md) — read-only glance at
   the balance, --text-dim like the rest of the quiet chrome. Deliberately
   not warm-coloured: warmth is reserved for badges, not a money display.
   .header-right (not .whoami alone) carries margin-left:auto, so the
   widget + name move as one pushed-right group. */
header.site-header .header-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
header.site-header .wallet-widget { display: flex; align-items: center; gap: 4px; }
header.site-header .wallet-amount {
  color: var(--text-dim); font-size: 13px; text-decoration: none;
  font-variant-numeric: tabular-nums;
}
header.site-header .wallet-amount:hover { color: var(--text); }
header.site-header .wallet-hide-toggle {
  background: none; border: 1px solid transparent; color: var(--text-dim);
  font-size: 13px; line-height: 1; cursor: pointer; padding: 2px 5px;
  border-radius: var(--radius-control);
}
header.site-header .wallet-hide-toggle:hover { color: var(--text); }
header.site-header .wallet-hide-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* + Create dropdown (docs/pieceB-nav-create-upload.md) — built by
   site-header.js, styled here alongside the rest of the header. */
header.site-header .create-menu { position: relative; }
header.site-header .create-menu-btn {
  font: inherit; font-size: 14px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 6px 12px; cursor: pointer;
}
header.site-header .create-menu-btn:hover { border-color: var(--accent); }
header.site-header .create-menu-list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-control); box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  min-width: 170px; display: flex; flex-direction: column; gap: 2px; padding: 4px;
}
header.site-header .create-menu-list a,
header.site-header .create-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; font: inherit; font-size: 14px;
  background: none; border: none; border-radius: var(--radius-control);
  padding: 8px 10px; color: var(--text); text-decoration: none; cursor: pointer;
}
header.site-header .create-menu-list a:hover { background: var(--surface-2); color: var(--text); }
/* Visibly present, genuinely inert — a real disabled <button>, not a
   styled span (see site-header.js). No live-streaming infra exists yet. */
header.site-header .create-menu-item[disabled] { color: var(--text-dim); cursor: default; }
header.site-header .create-menu-item .soon {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 1px 6px;
}

@media (max-width: 480px) {
  header.site-header { flex-wrap: wrap; row-gap: var(--space-1); }
  header.site-header a, header.site-header .create-menu-btn { font-size: 13px; }
}

/* Cards — depth from value (--bg -> --surface -> --surface-2), not shadow soup */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Controls */
input, select, button, .btn {
  font: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 8px 12px;
}
button, .btn { cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button:disabled:hover { border-color: var(--border); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Settings toggle (docs/minimal-creator-role.md's Creator switch) — real
   checkbox, visually hidden the same clip-rect way upload.html's file input
   already is, so it stays keyboard/AT accessible instead of being a div
   with a click handler pretending to be a control. */
.toggle { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.toggle input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.toggle-track {
  width: 40px; height: 22px; border-radius: var(--radius-pill); flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border); position: relative;
  transition: background-color .15s ease, border-color .15s ease;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-dim); transition: transform .15s ease, background-color .15s ease;
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); background: #fff; }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Focus-visible — keyboard accessibility floor */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Status feedback text — deliberately not warm; see the reserved-ramp
   note above. Pending reads as "active" (the doc's own word for accent
   blue); confirmed is full-strength text, not a color switch; error is
   the one place --danger earns its keep. */
.status-ok      { color: var(--text); font-weight: 600; }
.status-pending { color: var(--accent); }
.status-err     { color: var(--danger); }

/* Badge — the crafted hero (doc: "gets the most care of any element").
   Pill, tier colour as a rich tint + matching border, uppercase,
   font-weight 700, small but unmissable. */
.badgePill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-bronze { background: rgba(199, 123, 74, .16); color: var(--bronze); border-color: rgba(199, 123, 74, .45); }
.badge-silver { background: rgba(196, 202, 212, .16); color: var(--silver); border-color: rgba(196, 202, 212, .45); }
.badge-gold   { background: rgba(242, 179, 61, .18);  color: var(--gold);   border-color: rgba(242, 179, 61, .55); }
/* Mod isn't a support tier — not part of the reserved warm ramp on
   purpose, kept cool/green so it never competes with badge gold. Matches
   chat-client.css's own .mod treatment (same values, different class
   name — chat's badges use its own scoped class set; see that file). */
.badge-mod    { background: rgba(76, 175, 136, .18);  color: #7fd9b3;      border-color: rgba(76, 175, 136, .45); }

/* Modal — the one floating thing allowed a subtle shadow */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: var(--space-3);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
