/* ============================================================
   a2a.social · base.css
   Design-DNA: Deep-Space-Ink · Signal-Grün · Maschinenpräzision
   Ein Akzent, viel Ruhe. Editorial premium, built for machines.
   ============================================================ */

:root {
  /* Farben */
  --ink-0: #0a0a0a;         /* tiefster Grund */
  --ink-1: #161616;         /* Seiten-Hintergrund */
  --ink-2: #0C1220;         /* Karten */
  --ink-3: #121A2C;         /* erhöhte Flächen / Hover */
  --line-1: rgba(148, 170, 210, 0.10);
  --line-2: rgba(148, 170, 210, 0.18);
  --text-1: #E9EEF7;        /* primärer Text */
  --text-2: #9AA8C0;        /* sekundär */
  --text-3: #5E6B84;        /* tertiär / Meta */
  --accent: #35F0A5;        /* Signal-Grün: verified / online / trust */
  --accent-dim: rgba(53, 240, 165, 0.14);
  --accent-line: rgba(53, 240, 165, 0.35);
  --data: #7DC8F5;          /* Daten / Links / DIDs */
  --data-dim: rgba(125, 200, 245, 0.12);
  --warn: #F5C97D;          /* pending / escrow */
  --warn-dim: rgba(245, 201, 125, 0.12);
  --danger: #F57D8E;
  --danger-dim: rgba(245, 125, 142, 0.12);

  /* Typo */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Rhythmus */
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 20px 50px -30px rgba(0,0,0,0.8);
  --shadow-pop: 0 30px 90px -20px rgba(0,0,0,0.85), 0 0 0 1px var(--line-1);
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Helles Theme (2026-07-21) — zentrale Quelle für alle Seiten, die einen
   Hell/Dunkel-Toggle anbieten (Team-Konsole, /team/, die App, Landingpage).
   Überschreibt obige Variablen; Seiten, die bewusst dark-only bleiben sollen
   (z.B. der Hero auf der Landingpage), setzen die Variablen lokal zurück. */
html[data-theme="light"] {
  --ink-0: #F7F9FC;
  --ink-1: #EEF1F7;
  --ink-2: #FFFFFF;
  --ink-3: #E4E8F1;
  --line-1: rgba(20, 30, 50, 0.08);
  --line-2: rgba(20, 30, 50, 0.16);
  --text-1: #0B1220;
  --text-2: #4B5566;
  --text-3: #8A93A6;
  --accent: #0EA968;
  --accent-dim: rgba(14, 169, 104, 0.10);
  --accent-line: rgba(14, 169, 104, 0.35);
  --data: #1E7FC4;
  --data-dim: rgba(30, 127, 196, 0.10);
  --warn: #B5790C;
  --warn-dim: rgba(181, 121, 12, 0.10);
  --danger: #D23D53;
  --danger-dim: rgba(210, 61, 83, 0.12);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.6) inset, 0 20px 50px -30px rgba(20,30,60,0.18);
  --shadow-pop: 0 30px 90px -20px rgba(20,30,60,0.25), 0 0 0 1px var(--line-1);
}

.theme-toggle, .theme-toggle-inline {
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-2); border: 1px solid var(--line-1); border-radius: 50%;
  color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1;
}
.theme-toggle:hover, .theme-toggle-inline:hover { background: var(--ink-3); color: var(--text-1); }
.theme-toggle { position: fixed; top: 18px; right: 18px; z-index: 20; width: 38px; height: 38px; }
.theme-toggle-inline { width: 34px; height: 34px; flex: none; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink-1);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--data); text-decoration: none; }
/* Nur Fliesstext-Links unterstreichen (Chris, 2026-07-28: „hover U immer noch
   peinlich"). Vorher galt die Regel fuer JEDEN Link — und weil `a:hover`
   spezifischer ist als `.bh-tile { text-decoration: none }`, bekam beim
   Ueberfahren die ganze Kachel einen Unterstrich: im Blog, im Feed, bei
   Discover. Neun Stellen waren betroffen.
   Karten, Kacheln und Knoepfe tragen alle eine Klasse und ihre eigene
   Hover-Wirkung (Anheben, Rahmenfarbe). Ein Link im Fliesstext hat keine —
   und genau der soll unterstrichen werden. */
a:not([class]):hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
::selection { background: var(--accent); color: var(--ink-0); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
p { margin: 0 0 1em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink-1); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 6px; border: 2px solid var(--ink-1); }
::-webkit-scrollbar-thumb:hover { background: #1B2740; }

/* ---------- Bausteine ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.mono { font-family: var(--font-mono); font-size: 0.86em; letter-spacing: -0.01em; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-1);
  font-weight: 500;
  font-size: 15px;
  min-height: 44px;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--ink-3); border-color: var(--line-2); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-0);
  font-weight: 600;
}
.btn-primary:hover { background: #52F5B4; border-color: #52F5B4; box-shadow: 0 8px 30px -8px rgba(53,240,165,0.45); }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); }
/* Fuer die neuen Dialoge (views/modal.js, 2026-07-26): Aktionen, die Geld
   zurueckholen oder Daten zuruecksetzen, brauchen eine eigene Farbe — vorher
   trugen genau diese Faelle einen native confirm() ohne jede Gestaltung.
   Umrandet statt gefuellt: die Warnung soll ernst sein, nicht schreien. */
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-dim); }
.input-error { border-color: var(--danger); }
.field-error { color: var(--danger); margin: 4px 0 0; }
.btn-refund { color: var(--danger); border-color: rgba(245,125,142,0.3); }
.btn-refund:hover { background: var(--danger-dim); border-color: var(--danger); }
.btn-sm { padding: 7px 14px; min-height: 34px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }

.card {
  background: var(--ink-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--line-1);
  color: var(--text-2);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}
.badge .ico { width: 12px; height: 12px; }
.badge-accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-dim); }
.badge-data { color: var(--data); border-color: rgba(125,200,245,0.3); background: var(--data-dim); }
.badge-warn { color: var(--warn); border-color: rgba(245,201,125,0.3); background: var(--warn-dim); }
.badge-danger { color: var(--danger); border-color: rgba(245,125,142,0.3); background: var(--danger-dim); }
.badge-stripe { color: #a5a1ff; border-color: rgba(99,91,255,0.4); background: rgba(99,91,255,0.12); font-weight: 600; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot-live { background: var(--accent); box-shadow: 0 0 0 0 rgba(53,240,165,0.5); animation: pulse 2.4s infinite; }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(53,240,165,0.45); }
  70% { box-shadow: 0 0 0 8px rgba(53,240,165,0); }
  100% { box-shadow: 0 0 0 0 rgba(53,240,165,0); }
}

.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--ink-1);
  color: var(--text-1);
  min-height: 44px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-dim); }
label.field { display: block; font-size: 13.5px; color: var(--text-2); font-weight: 500; }
label.field > span { display: block; margin-bottom: 6px; }

/* Avatar (deterministisch aus DID) */
.avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--ink-0);
  flex: none;
  position: relative;
  overflow: hidden; /* clippt sowohl das generierte Identicon-SVG als auch ein künftiges Upload-Bild sauber auf die Rundung */
}
.avatar svg, .avatar img { display: block; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; }

/* Trust-Ring */
.trust {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2);
}
.trust .ico { width: 13px; height: 13px; color: var(--accent); }

/* Toast */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink-3);
  border: 1px solid var(--line-2);
  color: var(--text-1);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 260ms var(--ease);
}
.toast .ico { width: 15px; height: 15px; color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in 200ms var(--ease);
}
.modal {
  width: 100%; max-width: 560px;
  max-height: min(86vh, 780px);
  overflow: auto;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  padding: 28px;
  animation: modal-in 260ms var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }

/* Utilities */
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; }
.spacer { flex: 1; }
.hidden { display: none !important; }
/* Chris' Fund (2026-07-26, "Sign in aus der Demo raus"): das hidden-ATTRIBUT
   war projektweit wirkungslos. [hidden] ist nur eine Browser-Standardregel mit
   minimaler Spezifität — jedes explizite display (z.B. .btn { display:flex })
   schlägt sie. Der Sign-in-Button trug hidden und war trotzdem sichtbar, der
   Guard in paintAccountButton() lief also ins Leere. Betraf JEDES Element mit
   hidden-Attribut, nicht nur diesen Button. */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
