/* ==========================================================================
   Base, Reset & Liquid Glass Environment
   ========================================================================== */

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

html {
  height: 100%;
  height: 100dvh;
  width: 100%;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  background-image:
    radial-gradient(60% 55% at 14% 12%, rgba(10, 132, 255, 0.10) 0, transparent 70%),
    radial-gradient(50% 50% at 90% 8%, rgba(220, 90, 180, 0.08) 0, transparent 70%),
    radial-gradient(55% 55% at 76% 92%, rgba(0, 180, 216, 0.07) 0, transparent 70%);
  color: var(--text-primary);
  font-family: var(--font-apple);
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  transition: background-color var(--duration-normal) var(--ease-apple), color var(--duration-normal) var(--ease-apple);
  position: relative;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(60% 55% at 14% 12%, rgba(41, 151, 255, 0.14) 0, transparent 70%),
    radial-gradient(50% 50% at 90% 8%, rgba(220, 90, 180, 0.10) 0, transparent 70%),
    radial-gradient(55% 55% at 76% 92%, rgba(0, 180, 216, 0.09) 0, transparent 70%);
}

/* Lovable Micro-Noise Texture Layer */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 1;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s var(--ease-apple), background-color 0.18s var(--ease-apple), opacity 0.18s var(--ease-apple), border-color 0.18s var(--ease-apple);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.96);
}

/* Native Apple Trackless Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 148, 0.25);
  border-radius: var(--radius-pill);
  transition: background var(--duration-fast) var(--ease-apple);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 140, 148, 0.45);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 140, 148, 0.25) transparent;
}

/* Performance and Fluid Keyframe Animations */
@keyframes appleSpringIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes appleFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes liquidShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
