/* ============================================================
   AITOOLSTIME DESIGN SYSTEM v2.0
   Shared across all 50 pages. Load FIRST.
   ------------------------------------------------------------
   Contains:
   - CSS custom properties (color tokens, both themes)
   - Base element resets
   - Typography
   - Avatar system (user + tool)
   - Gradient variants (tt-1 through tt-8)
   ============================================================ */

/* ---------- COLOR TOKENS: LIGHT ---------- */
:root {
  /* Surfaces */
  --bg: #FFFDF9;
  --surface: #F5F1E8;
  --surface-2: #EFE9DC;

  /* Text */
  --ink: #1a1611;
  --ink-2: #524a3e;
  --ink-3: #857b6a;
  --ink-4: #b5ab97;

  /* Borders */
  --border: #e8e1d0;
  --border-2: #f0ead8;

  /* Brand */
  --accent: #2F5D3F;
  --accent-2: #E8F0EA;

  /* Nav (legacy) */
  --nav-bg: #1a1611;
  --nav-text: #d4ceb8;

  /* Semantic */
  --amber: #daac58;
  --rust: #d97757;
  --violet: #a78bdc;
  --green: #27ae60;
  --red: #c0392b;
  --blue: #2980b9;
}

/* ---------- COLOR TOKENS: DARK ---------- */
[data-theme="dark"] {
  --bg: #16130e;
  --surface: #1f1b14;
  --surface-2: #2a2419;

  --ink: #f5efdd;
  --ink-2: #c4baa3;
  --ink-3: #8a8270;
  --ink-4: #5c5646;

  --border: #33291d;
  --border-2: #241f16;

  --accent: #5cb872;
  --accent-2: rgba(92, 184, 114, 0.12);

  --nav-bg: #0d0b07;
  --nav-text: #a8a08b;
}

/* ---------- BASE RESET ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

summary {
  cursor: pointer;
}

/* ---------- TYPOGRAPHY UTILITIES ---------- */
.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.font-serif {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 600;
}

/* ---------- AVATAR SYSTEM ---------- */
.ava {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}
.ava-xs { width: 20px; height: 20px; font-size: 9px; }
.ava-sm { width: 28px; height: 28px; font-size: 11px; }
.ava-md { width: 36px; height: 36px; font-size: 13px; }
.ava-lg { width: 48px; height: 48px; font-size: 15px; }

.tool-ava {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}
.tool-ava-xs { width: 24px; height: 24px; border-radius: 5px; font-size: 10px; }
.tool-ava-sm { width: 32px; height: 32px; border-radius: 7px; font-size: 12px; }
.tool-ava-md { width: 44px; height: 44px; border-radius: 10px; font-size: 16px; }
.tool-ava-lg { width: 56px; height: 56px; border-radius: 12px; font-size: 18px; }
.tool-ava-xl { width: 72px; height: 72px; border-radius: 14px; font-size: 24px; }

/* ---------- GRADIENT VARIANTS (tt-1 to tt-8) ---------- */
/* Hash a slug or ID to [1..8] and use as class. Used for both user and tool avatars. */
.tt-1 { background: #1a1a1a; }
.tt-2 { background: linear-gradient(135deg, #2F5D3F, #1f4028); }
.tt-3 { background: linear-gradient(135deg, #ec4899, #be185d); }
.tt-4 { background: linear-gradient(135deg, #3b82f6, #1e40af); }
.tt-5 { background: linear-gradient(135deg, #f59e0b, #b45309); }
.tt-6 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.tt-7 { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.tt-8 { background: linear-gradient(135deg, #10b981, #047857); }

/* ---------- GENERIC HELPERS ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px; padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-accent { color: var(--accent); }
.text-muted { color: var(--ink-3); }
.text-rust { color: var(--rust); }
.text-amber { color: var(--amber); }
.text-green { color: var(--green); }

/* ---------- SCROLLBAR (subtle) ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
}

/* ---------- FOCUS RINGS (accessibility) ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- PRINT ---------- */
@media print {
  .left-sidebar, .topbar, .tb-cta { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- SHARED ANIMATIONS ---------- */
/* Generic pulse used by live indicators, notifications, active banners */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.15); }
}
/* Softer fade-only variant */
@keyframes fadePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
/* Slow rotation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
