/*
 * AISTHETIC OS — Base Styles
 * ─────────────────────────────────────────────────────────────────────────────
 * Reset, body defaults, grain texture, violet radial backdrop, scrollbar
 * styling, shared animations, and common utility classes.
 *
 * Import order (in each page HTML):
 *   1. shared/css/tokens.css   ← design tokens / variables
 *   2. shared/css/base.css     ← this file
 *   3. page.css                ← page-specific styles
 * ─────────────────────────────────────────────────────────────────────────────
 */

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

a           { color: inherit; text-decoration: none; }
button      { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
ul, ol      { list-style: none; }
img         { display: block; max-width: 100%; }
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
*::-webkit-scrollbar         { width: 8px; height: 8px; }
*::-webkit-scrollbar-track   { background: transparent; }
*::-webkit-scrollbar-thumb   { background: var(--border); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ── Body ────────────────────────────────────────────────────────────────── */
html, body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s, color 0.3s;
}

::selection { background: var(--violet-1); color: #fff; }

/* ── Grain texture overlay ───────────────────────────────────────────────── */
/* A very low-opacity fractal noise layer that adds tactility to flat surfaces. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' /><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.03 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
  opacity: 0.5;
}
body.theme-light::before,
body.light-mode::before { opacity: 0.08; mix-blend-mode: multiply; }

/* ── Violet radial backdrop ──────────────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  top: -30%; left: 30%;
  transform: translateX(-50%);
  width: 1200px; height: 1200px;
  background: radial-gradient(circle at center, rgba(124, 58, 237, 0.07) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
body.light-mode::after {
  opacity: 0.45;
  background: radial-gradient(circle at center, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
}

/* ── Shared animations ───────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0   rgba(132, 204, 22, 0.55); }
  100% { box-shadow: 0 0 0 8px rgba(132, 204, 22, 0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

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

/* ── Utility: loading spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--violet-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
