/* ═══════════════════════════════════════════════════════════
   teeparty — Design Tokens & Base Styles
    Design System — Brutalist Apple Aesthetic
   ═══════════════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────────────────── */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

/* ── Typography & Spacing Tokens ──────────────────────────── */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;

  --transition: 150ms ease;
  --transition-slow: 200ms ease;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --radius-card: 16px;
  --radius-button: 10px;

  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;

  --transition-micro: 100ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 350ms ease-out;
  --transition-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Black Mode (OLED) — default ─────────────────────────── */

:root,
[data-theme="black"] {
  color-scheme: dark;

  --color-bg-primary:     #000000;
  --color-bg-secondary:   #1c1c1e;
  --color-bg-tertiary:    #2c2c2e;
  --color-bg-elevated:    #1c1c1e;
  --color-bg-sunken:      #000000;
  --color-border:         #38383a;
  --color-border-hover:   #48484a;
  --color-border-focus:   rgba(79, 110, 247, 0.5);

  --color-text-primary:   #ffffff;
  --color-text-secondary: #98989d;
  --color-text-tertiary:  #636366;
  --color-text-mono:      #e5e5ea;

  --color-accent:         #4f6ef7;
  --color-accent-hover:   #6b85f9;
  --color-accent-subtle:  rgba(79, 110, 247, 0.15);

  --color-success:        #30d158;
  --color-success-bg:     rgba(48, 209, 88, 0.2);
  --color-warning:        #ffd60a;
  --color-warning-bg:     rgba(255, 214, 10, 0.2);
  --color-error:          #ff453a;
  --color-error-bg:       rgba(255, 69, 58, 0.2);

  --shadow-card:          0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-card-hover:    0 2px 8px rgba(0, 0, 0, 0.6);
  --shadow-float:         0 4px 16px rgba(0, 0, 0, 0.6);
  --shadow-glow-accent:   0 0 20px rgba(79, 110, 247, 0.15);
  --shadow-glow-key:      0 0 30px rgba(212, 168, 83, 0.12);
  --shadow-depth-1:       0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-depth-2:       0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-depth-3:       0 8px 24px rgba(0, 0, 0, 0.6);

  --hero-ascii-color:     #48484a;
  --hero-ascii-opacity:   0.85;

  /* Key / Gold tokens */
  --color-key-primary:    #d4a853;
  --color-key-glow:       rgba(212, 168, 83, 0.12);
  --color-key-bg:         rgba(212, 168, 83, 0.04);
  --color-key-border:     rgba(212, 168, 83, 0.30);

  /* Glass surface */
  --color-surface-glass:  rgba(28, 28, 30, 0.80);
}

/* ── Light Mode ──────────────────────────────────────────── */

[data-theme="light"] {
  color-scheme: light;

  --color-bg-primary:     #fafafa;
  --color-bg-secondary:   #ffffff;
  --color-bg-tertiary:    #f5f5f5;
  --color-bg-elevated:    #ffffff;
  --color-bg-sunken:      #f0f0f0;
  --color-border:         #e5e5e5;
  --color-border-hover:   #d1d1d1;
  --color-border-focus:   rgba(61, 92, 224, 0.4);

  --color-text-primary:   #1d1d1f;
  --color-text-secondary: #86868b;
  --color-text-tertiary:  #aeaeb2;
  --color-text-mono:      #1d1d1f;

  --color-accent:         #3d5ce0;
  --color-accent-hover:   #2d4ad0;
  --color-accent-subtle:  rgba(61, 92, 224, 0.08);

  --color-success:        #34c759;
  --color-success-bg:     rgba(52, 199, 89, 0.1);
  --color-warning:        #ff9500;
  --color-warning-bg:     rgba(255, 149, 0, 0.1);
  --color-error:          #ff3b30;
  --color-error-bg:       rgba(255, 59, 48, 0.1);

  --shadow-card:          0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-card-hover:    0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-float:         0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-glow-accent:   0 0 20px rgba(61, 92, 224, 0.10);
  --shadow-glow-key:      0 0 30px rgba(139, 105, 20, 0.06);
  --shadow-depth-1:       0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-depth-2:       0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-depth-3:       0 8px 24px rgba(0, 0, 0, 0.12);

  --hero-ascii-color:     #b0b0b4;
  --hero-ascii-opacity:   0.9;

  /* Key / Gold tokens */
  --color-key-primary:    #8b6914;
  --color-key-glow:       rgba(139, 105, 20, 0.06);
  --color-key-bg:         rgba(139, 105, 20, 0.04);
  --color-key-border:     rgba(139, 105, 20, 0.25);

  /* Glass surface */
  --color-surface-glass:  rgba(255, 255, 255, 0.85);
}

/* ── Dark Mode ────────────────────────────────────────────── */

[data-theme="dark"] {
  color-scheme: dark;

  --color-bg-primary:     #2c2c2e;
  --color-bg-secondary:   #3a3a3c;
  --color-bg-tertiary:    #48484a;
  --color-bg-elevated:    #3a3a3c;
  --color-bg-sunken:      #1c1c1e;
  --color-border:         #48484a;
  --color-border-hover:   #636366;
  --color-border-focus:   rgba(79, 110, 247, 0.5);

  --color-text-primary:   #f5f5f7;
  --color-text-secondary: #98989d;
  --color-text-tertiary:  #636366;
  --color-text-mono:      #e5e5ea;

  --color-accent:         #4f6ef7;
  --color-accent-hover:   #6b85f9;
  --color-accent-subtle:  rgba(79, 110, 247, 0.12);

  --color-success:        #30d158;
  --color-success-bg:     rgba(48, 209, 88, 0.15);
  --color-warning:        #ffd60a;
  --color-warning-bg:     rgba(255, 214, 10, 0.15);
  --color-error:          #ff453a;
  --color-error-bg:       rgba(255, 69, 58, 0.15);

  --shadow-card:          0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card-hover:    0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-float:         0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-glow-accent:   0 0 20px rgba(79, 110, 247, 0.12);
  --shadow-glow-key:      0 0 30px rgba(196, 155, 67, 0.08);
  --shadow-depth-1:       0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-depth-2:       0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-depth-3:       0 8px 24px rgba(0, 0, 0, 0.45);

  --hero-ascii-color:     #636366;
  --hero-ascii-opacity:   0.8;

  /* Key / Gold tokens */
  --color-key-primary:    #c49b43;
  --color-key-glow:       rgba(196, 155, 67, 0.08);
  --color-key-bg:         rgba(196, 155, 67, 0.04);
  --color-key-border:     rgba(196, 155, 67, 0.25);

  /* Glass surface */
  --color-surface-glass:  rgba(58, 58, 60, 0.80);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="black"]) {
    color-scheme: dark;
    --color-bg-primary:     #2c2c2e;
    --color-bg-secondary:   #3a3a3c;
    --color-bg-tertiary:    #48484a;
    --color-bg-elevated:    #3a3a3c;
    --color-bg-sunken:      #1c1c1e;
    --color-border:         #48484a;
    --color-border-hover:   #636366;
    --color-border-focus:   rgba(79, 110, 247, 0.5);
    --color-text-primary:   #f5f5f7;
    --color-text-secondary: #98989d;
    --color-text-tertiary:  #636366;
    --color-text-mono:      #e5e5ea;
    --color-accent:         #4f6ef7;
    --color-accent-hover:   #6b85f9;
    --color-accent-subtle:  rgba(79, 110, 247, 0.12);
    --color-success:        #30d158;
    --color-success-bg:     rgba(48, 209, 88, 0.15);
    --color-warning:        #ffd60a;
    --color-warning-bg:     rgba(255, 214, 10, 0.15);
    --color-error:          #ff453a;
    --color-error-bg:       rgba(255, 69, 58, 0.15);
    --shadow-card:          0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-card-hover:    0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-float:         0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-glow-accent:   0 0 20px rgba(79, 110, 247, 0.12);
    --shadow-glow-key:      0 0 30px rgba(196, 155, 67, 0.08);
    --shadow-depth-1:       0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-depth-2:       0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-depth-3:       0 8px 24px rgba(0, 0, 0, 0.45);

    --hero-ascii-color:     #636366;
    --hero-ascii-opacity:   0.8;

    --color-key-primary:    #c49b43;
    --color-key-glow:       rgba(196, 155, 67, 0.08);
    --color-key-bg:         rgba(196, 155, 67, 0.04);
    --color-key-border:     rgba(196, 155, 67, 0.25);
    --color-surface-glass:  rgba(58, 58, 60, 0.80);
  }
}

/* ── Base ─────────────────────────────────────────────────── */

body {
  font-family: var(--font-sans);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 13px;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
}

a { color: inherit; }

/* ── Scrollbar ───────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

/* ── Monospace ───────────────────────────────────────────── */

.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.01em;
  color: var(--color-text-mono);
  word-break: break-all;
}

/* ── Links ───────────────────────────────────────────────── */

.link {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}
.link:hover { text-decoration: underline; }

/* ── Error Text ──────────────────────────────────────────── */

.error-text {
  font-size: 12px;
  color: var(--color-error);
  margin-top: var(--space-1);
}

/* ── Badges ──────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error   { background: var(--color-error-bg);   color: var(--color-error); }

/* ── Theme Toggle ────────────────────────────────────────── */

.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 1px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition),
              box-shadow var(--transition);
}

.theme-toggle-btn:hover { color: var(--color-text-secondary); }
.theme-toggle-btn.active {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ── Wallet Pill (matches theme toggle dimensions) ─────── */

.wallet-pill {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  height: 30px;
  padding: 0 12px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition), color var(--transition),
              background-color var(--transition);
}

.wallet-pill:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.wallet-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
}

.wallet-pill-addr {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.01em;
}
