/* ============================================
   Lilmoon-AI · Linear-style Design Tokens
   Dark + Violet · Glow · Hairlines · Noise
   ============================================ */

:root {
  /* — Surfaces — */
  --bg-0: #08080c;            /* deepest space */
  --bg-1: #0b0b12;            /* page bg */
  --bg-2: #101019;            /* card bg */
  --bg-3: #16161f;            /* elevated card */
  --bg-4: #1b1b27;            /* hover */
  --bg-overlay: rgba(8, 8, 12, 0.72);

  /* — Hairlines — */
  --line-1: rgba(255, 255, 255, 0.06);   /* default border */
  --line-2: rgba(255, 255, 255, 0.10);   /* hover border */
  --line-3: rgba(255, 255, 255, 0.16);   /* focus border */
  --line-inset: rgba(255, 255, 255, 0.04);

  /* — Text — */
  --text-1: #f4f4f8;           /* primary */
  --text-2: #c8c8d4;           /* secondary */
  --text-3: #8a8a9a;           /* tertiary */
  --text-4: #5b5b6e;           /* muted */
  --text-5: #3d3d4d;           /* disabled */

  /* — Brand: Violet — */
  --violet-50: #f4f0ff;
  --violet-100: #e6dcff;
  --violet-200: #c9b6ff;
  --violet-300: #a78bfa;
  --violet-400: #8b6cff;
  --violet-500: #7c5cff;       /* primary */
  --violet-600: #6a48f0;
  --violet-700: #5635d4;
  --violet-800: #3d22a3;
  --violet-900: #241366;
  --violet-glow: rgba(124, 92, 255, 0.45);
  --violet-glow-soft: rgba(124, 92, 255, 0.18);

  /* — Status — */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --success-glow: rgba(52, 211, 153, 0.35);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --warning-glow: rgba(251, 191, 36, 0.35);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --danger-glow: rgba(248, 113, 113, 0.35);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);
  --info-glow: rgba(96, 165, 250, 0.35);

  /* — Spacing — */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;

  /* — Radii — */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 8px;
  --r-4: 10px;
  --r-5: 12px;
  --r-6: 16px;
  --r-7: 20px;
  --r-full: 9999px;

  /* — Type — */
  --font-sans: "Inter Tight", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  --t-display: 56px;
  --t-h1: 32px;
  --t-h2: 24px;
  --t-h3: 18px;
  --t-body: 14px;
  --t-small: 13px;
  --t-tiny: 11px;

  /* — Shadows / Elevation — */
  --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.05) inset, 0 4px 16px rgba(0,0,0,0.45);
  --shadow-3: 0 1px 0 rgba(255,255,255,0.06) inset, 0 12px 40px rgba(0,0,0,0.55);
  --shadow-violet: 0 0 0 1px rgba(124,92,255,0.4), 0 8px 32px rgba(124,92,255,0.25);

  /* — Motion — */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 520ms;
  --dur-5: 800ms;
}

/* ============================================
   Reset / Base
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-1);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Global ambient backdrop — soft radial violet glow + grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 50% at 12% -10%, rgba(124,92,255,0.18), transparent 60%),
    radial-gradient(50% 40% at 92% 0%, rgba(96,165,250,0.10), transparent 60%),
    radial-gradient(80% 60% at 50% 110%, rgba(124,92,255,0.10), transparent 60%);
}

/* Noise overlay (very subtle) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#app { position: relative; z-index: 2; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--violet-glow); color: var(--text-1); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); border: 2px solid transparent; background-clip: padding-box; }

/* ============================================
   Utility primitives
   ============================================ */

/* Hairline frame — Linear's signature 1px border with inner highlight */
.hairline {
  border: 1px solid var(--line-1);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}
.hairline-strong {
  border: 1px solid var(--line-2);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 1px 2px rgba(0,0,0,0.4);
}

/* Surface presets */
.surface-1 { background: var(--bg-2); }
.surface-2 { background: var(--bg-3); }

/* Glow on hover (set parent class .glow-hover) */
.glow-hover { transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-3) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.glow-hover:hover {
  border-color: var(--line-3);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 8px 32px rgba(124,92,255,0.10), 0 0 0 1px rgba(124,92,255,0.18);
}

/* Conic flowing border — Linear's most iconic flourish */
.flow-border {
  position: relative;
  isolation: isolate;
}
.flow-border::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--angle, 0deg),
    transparent 0deg,
    rgba(124,92,255,0.0) 60deg,
    rgba(124,92,255,0.85) 90deg,
    rgba(167,139,250,0.95) 120deg,
    rgba(124,92,255,0.0) 150deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: flow-rotate 4s linear infinite;
  pointer-events: none;
  z-index: 1;
}
@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes flow-rotate { to { --angle: 360deg; } }

/* Shimmer — moving sheen */
.shimmer {
  position: relative;
  overflow: hidden;
}
.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg,
    transparent 30%,
    rgba(255,255,255,0.06) 50%,
    transparent 70%);
  transform: translateX(-100%);
  animation: shimmer-sweep 2.4s var(--ease-in-out) infinite;
  pointer-events: none;
}
@keyframes shimmer-sweep {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* Entrance animations */
.enter-up { animation: enter-up 600ms var(--ease-out) both; }
@keyframes enter-up {
  from { opacity: 0; transform: translateY(12px); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.enter-fade { animation: enter-fade 500ms var(--ease-out) both; }
@keyframes enter-fade { from { opacity: 0; } to { opacity: 1; } }

.stagger > * { animation: enter-up 600ms var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 360ms; }
.stagger > *:nth-child(8) { animation-delay: 420ms; }
.stagger > *:nth-child(9) { animation-delay: 480ms; }
.stagger > *:nth-child(10) { animation-delay: 540ms; }

/* Layout helpers */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--violet-400);
  outline-offset: 2px;
  border-radius: var(--r-2);
}
