/*
  KOMUNIFY PROTOTYPE -- shared stylesheet
  Theme: SPLIT v4 (adopted 2026-07-05). Tokens mirror stellar-hackathon/src/App.css.
  Molecules mirror stellar-hackathon/design-system-docs.html.
  Rule: NO raw hex in screen files. Everything goes through these tokens/classes.
*/

:root {
  color-scheme: dark;

  /* backgrounds */
  --color-bg-primary: #0b0b0a;
  --color-bg-elevated: #131311;
  --color-bg-input: #0d0d0b;
  --color-bg-accent-tint: rgba(250, 214, 87, 0.12);
  --color-bg-success-tint: rgba(62, 207, 142, 0.14);
  --color-bg-warning-tint: rgba(255, 138, 92, 0.14);

  /* content */
  --color-content-primary: #ecd9c1;
  --color-content-secondary: #928e85;
  --color-content-accent: #fad657;
  --color-content-on-accent: #201607;
  --color-content-success: #3ecf8e;
  --color-content-warning: #ff8a5c;
  --color-content-danger: #ff6b6b;

  /* border */
  --color-border-medium: #262521;
  --color-border-accent: #fad657;
  --color-border-hover: #3a362c;

  /* board motifs */
  --glow-split: rgba(250, 214, 87, 0.35); /* EXCLUSIVELY for the split-flow visual */

  /* spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 32px;
  --space-7: 48px;

  /* radius scale */
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* fonts */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg-primary);
  color: var(--color-content-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  line-height: 1.5;
}

/* ---------- layout ---------- */

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* desktop chrome */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-medium);
  margin-bottom: var(--space-2);
}
.topbar .logo { font-size: 20px; }
.topbar-nav { display: flex; align-items: center; gap: var(--space-4); }
.topbar-nav a {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-content-secondary);
  text-decoration: none;
  transition: color 140ms ease;
}
.topbar-nav a:hover,
.topbar-nav a.active { color: var(--color-content-accent); }

/* desktop layout grids */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); align-items: stretch; }
.grid-dash { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); align-items: start; }
.grid-detail { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-4); align-items: start; }
.grid-dash .stat-strip { flex-direction: column; }
.grid-dash .stat-strip .stat-chip { flex: 0 0 auto; }

header { text-align: center; margin-bottom: var(--space-2); }

.logo { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.logo::first-letter { color: var(--color-content-accent); }
a.logo { color: inherit; text-decoration: none; display: inline-block; }

.tagline { color: var(--color-content-secondary); font-size: 14px; margin: 6px 0 0; }

/* two-tone headline (board motif: line 1 cream, line 2 gold) */
.headline {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}
.headline .gold { color: var(--color-content-accent); display: block; }

/* numbered section label (board motif: gold number + mono uppercase) */
.num-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-content-secondary);
}
.num-label .num { color: var(--color-content-accent); margin-right: 6px; }

/* ---------- atoms ---------- */

.card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.card h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }

.card.center { text-align: center; padding: 36px var(--space-5); }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.row.tight { justify-content: flex-start; gap: var(--space-2); margin-top: var(--space-1); }

.label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-content-secondary);
}

.balance {
  font-size: 30px;
  font-weight: 700;
  margin: 6px 0 10px;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  font-size: 13px;
  font-family: var(--font-mono);
}

.pill { font-size: 11px; font-weight: 700; border-radius: var(--radius-full); padding: 3px 9px; }
.pill.ok { background: var(--color-bg-success-tint); color: var(--color-content-success); }
.pill.warn { background: var(--color-bg-warning-tint); color: var(--color-content-warning); }
.pill.accent { background: var(--color-bg-accent-tint); color: var(--color-content-accent); }

button, .btn {
  background: var(--color-content-accent);
  color: var(--color-content-on-accent);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

button:hover, .btn:hover { filter: brightness(1.06); }

button:disabled { opacity: 0.55; cursor: not-allowed; }

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--color-content-primary);
  border: 1px solid var(--color-border-medium);
  font-weight: 600;
}

.btn.block { display: block; width: 100%; }

form { display: flex; flex-direction: column; gap: var(--space-3); }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--color-content-secondary); }

input {
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--color-content-primary);
  font-size: 14px;
  font-family: inherit;
}

input:focus { outline: none; border-color: var(--color-border-accent); }

.hint { color: var(--color-content-secondary); font-size: 13px; margin: 8px 0 12px; }
.error { color: var(--color-content-danger); font-size: 13px; margin: 10px 0 0; }
.success { color: var(--color-content-success); font-size: 13px; margin: 12px 0 0; }
.success a, footer a { color: inherit; }

footer {
  text-align: center;
  color: var(--color-content-secondary);
  font-size: 12px;
  margin-top: var(--space-3);
}
footer a:hover { color: var(--color-content-accent); }

/* ---------- molecules (from design-system-docs.html) ---------- */

/* avatar group (partner communities cluster) */
.avatar-group { display: flex; align-items: center; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--color-bg-elevated);
  background: var(--color-bg-accent-tint);
  color: var(--color-content-accent);
}
.avatar + .avatar { margin-left: -8px; }
.avatar.a2 { background: var(--color-bg-success-tint); color: var(--color-content-success); }
.avatar.a3 { background: var(--color-bg-warning-tint); color: var(--color-content-warning); }
.avatar-note { font-size: 12px; color: var(--color-content-secondary); margin-left: 10px; }

/* split allocation rows */
.alloc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: var(--space-3);
  row-gap: 6px;
  padding: var(--space-2) 0;
}

.alloc-name {
  font-size: 13px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alloc-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-content-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}

.alloc-amt {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
}

.alloc-track {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--color-bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.alloc-fill { height: 100%; background: var(--color-content-accent); border-radius: var(--radius-full); }
.alloc-fill.dim { opacity: 0.55; }
.alloc-fill.dimmer { opacity: 0.3; }

/* split-flow visual: the ONE sanctioned use of the gold glow */
.split-flow { box-shadow: 0 0 24px var(--glow-split); border-color: var(--color-content-accent); }

/* dashboard stat chips */
.stat-strip { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.stat-chip {
  flex: 1 1 140px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  transition: border-color 140ms ease;
}
.stat-chip:hover { border-color: var(--color-border-hover); }

.stat-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stat-delta { font-size: 12px; color: var(--color-content-success); margin-top: 2px; }

/* entitlement / benefit lines */
.benefit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-medium);
}
.benefit-line:last-child { border-bottom: none; }

.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-full);
  padding: 3px 9px;
  white-space: nowrap;
}
.badge.locked { color: var(--color-content-secondary); border: 1px solid var(--color-border-medium); background: transparent; }
.badge.unlocked { color: var(--color-content-success); background: var(--color-bg-success-tint); border: 1px solid transparent; }

/* stepper */
.stepper { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }

.step { display: flex; align-items: center; gap: 6px; flex-shrink: 1; min-width: 0; }

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.step.done .step-dot { background: var(--color-content-accent); color: var(--color-content-on-accent); }
.step.active .step-dot { background: var(--color-bg-accent-tint); color: var(--color-content-accent); border: 1px solid var(--color-content-accent); }
.step.todo .step-dot { background: transparent; color: var(--color-content-secondary); border: 1px solid var(--color-border-medium); }

.step-name {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.step.done .step-name { color: var(--color-content-primary); }
.step.active .step-name { color: var(--color-content-accent); }
.step.todo .step-name { color: var(--color-content-secondary); }

.step-line { flex: 1 1 16px; height: 1px; background: var(--color-border-medium); min-width: 6px; }
.step-line.lit { background: var(--color-content-accent); opacity: 0.5; }

/* toast (tx status) */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
}

.toast-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex-shrink: 0; }

.toast.pending .toast-dot { background: var(--color-content-accent); animation: pulse 1.6s ease-in-out infinite; }
.toast.tx-success { border-color: var(--color-bg-success-tint); }
.toast.tx-success .toast-dot { background: var(--color-content-success); }
.toast.tx-fail { border-color: var(--color-bg-warning-tint); }
.toast.tx-fail .toast-dot { background: var(--color-content-danger); }

.toast .t-msg { flex: 1; min-width: 0; }
.toast .t-sub { color: var(--color-content-secondary); font-size: 12px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* skeleton */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-bg-input) 25%, var(--color-bg-elevated) 50%, var(--color-bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s linear infinite;
}
.sk-line { height: 12px; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }
.sk-line.w80 { width: 80%; }
.sk-balance { height: 30px; width: 55%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* activity feed rows (traction dashboard) */
.feed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border-medium);
  font-size: 13px;
}
.feed-row:last-child { border-bottom: none; }
.feed-when { font-family: var(--font-mono); font-size: 11px; color: var(--color-content-secondary); white-space: nowrap; }

/* partner content preview (benefits icon + partner.html) */
.icon-link {
  display: inline-flex;
  align-items: center;
  color: var(--color-content-secondary);
  transition: color 140ms ease;
  flex-shrink: 0;
}
.icon-link:hover { color: var(--color-content-accent); }

.btn.sm, button.sm { padding: 6px 12px; font-size: 13px; }

.content-type {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-content-secondary);
}
.content-title { font-size: 13px; font-weight: 600; margin-top: 2px; }
.content-meta { font-size: 12px; color: var(--color-content-secondary); margin-top: 2px; }

.preview-pane {
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-2) 0 var(--space-3);
}

.media-ph {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}
.play-dot {
  width: 0;
  height: 0;
  border-left: 14px solid var(--color-content-secondary);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 3px;
}

.module-line { display: flex; align-items: center; gap: var(--space-2); padding: 6px 0; font-size: 13px; }
.module-num { font-family: var(--font-mono); font-size: 11px; color: var(--color-content-secondary); min-width: 18px; }

/* listing layer: price treatment */
.price-was {
  color: var(--color-content-secondary);
  text-decoration: line-through;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.price-now { font-weight: 700; font-variant-numeric: tabular-nums; }

/* motion discipline: 150-200ms, ease-out, opacity/transform only */
.fade-in { animation: fadeIn 180ms ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .toast.pending .toast-dot, .fade-in { animation: none; }
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-dash, .grid-detail { grid-template-columns: 1fr; }
  .grid-dash .stat-strip { flex-direction: row; }
}

@media (max-width: 640px) {
  .stepper { flex-wrap: wrap; }
  .headline { font-size: 26px; }
  .topbar { flex-wrap: wrap; }
}
