/* ============================================================
   base.css — Design Tokens, Resets, Typography, Animations
   ============================================================ */

/* ----- Custom Properties (Design Tokens) ----- */
:root {
  /* Typography */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, "Cascadia Code", monospace;
  --font-size-xs: 10px;
  --font-size-sm: 11px;
  --font-size-base: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 28px;

  /* macOS System Colors */
  --macos-menubar-bg: rgba(236, 236, 236, 0.72);
  --macos-menubar-text: #1d1d1f;
  --macos-menubar-border: rgba(0, 0, 0, 0.12);
  --macos-desktop-bg: #1e1e2e;
  --macos-window-bg: #ffffff;
  --macos-window-titlebar: linear-gradient(180deg, #e8e8e8 0%, #d6d6d6 100%);
  --macos-window-titlebar-inactive: #f6f6f6;
  --macos-window-border: rgba(0, 0, 0, 0.15);
  --macos-window-shadow: 0 22px 70px 4px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0,0,0,0.12);
  --macos-window-radius: 10px;
  --macos-sidebar-bg: rgba(244, 244, 244, 0.92);
  --macos-sidebar-text: #1d1d1f;
  --macos-sidebar-hover: rgba(0, 0, 0, 0.05);
  --macos-dock-bg: rgba(244, 244, 244, 0.45);
  --macos-dock-border: rgba(255, 255, 255, 0.35);
  --macos-dock-shadow: 0 0 0 0.5px rgba(0,0,0,0.12), 0 10px 40px rgba(0,0,0,0.2);
  --macos-finder-content-bg: #ffffff;

  /* Traffic Lights */
  --traffic-close: #ff5f57;
  --traffic-minimize: #febc2e;
  --traffic-maximize: #28c840;
  --traffic-inactive: #ddd;

  /* Terminal */
  --terminal-bg: rgba(30, 30, 30, 0.92);
  --terminal-text: #33ff33;
  --terminal-prompt: #00d4aa;
  --terminal-cursor: #33ff33;

  /* iOS Colors */
  --ios-statusbar-text: #ffffff;
  --ios-bg: #000000;
  --ios-dock-bg: rgba(30, 30, 30, 0.65);
  --ios-folder-bg: rgba(200, 200, 200, 0.25);
  --ios-folder-popup-bg: rgba(40, 40, 40, 0.85);
  --ios-icon-radius: 22.37%;
  --ios-icon-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Z-Index Scale */
  --z-desktop: 1;
  --z-desktop-icons: 10;
  --z-windows: 100;
  --z-dock: 500;
  --z-menubar: 600;
  --z-dropdown: 700;
  --z-modal: 800;
  --z-ios-statusbar: 600;
  --z-ios-folder-popup: 700;

  /* Animation */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

html, body {
  width: 100%;
  height: 100%;
  min-width: 320px;
  overflow: hidden;
  font-family: var(--font-system);
  font-size: var(--font-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: var(--macos-desktop-bg);
  color: var(--macos-menubar-text);
  position: relative;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
  color: inherit;
}

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

ul, ol {
  list-style: none;
}

/* ----- Utilities ----- */
.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;
}

.glass {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.35);
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

/* ----- Scrollbar (macOS style) ----- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}

/* ----- Keyframes ----- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.92); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes windowOpen {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes windowClose {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.85) translateY(30px);
  }
}

@keyframes windowMinimize {
  to {
    opacity: 0;
    transform: scale(0.3) translateY(100vh);
  }
}

@keyframes dockBounce {
  0%, 100% { transform: translateY(0); }
  30%  { transform: translateY(-28px); }
  50%  { transform: translateY(-14px); }
  70%  { transform: translateY(-20px); }
  85%  { transform: translateY(-8px); }
}

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

@keyframes iosIconPop {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes iosFolderOpen {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40, 200, 64, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(40, 200, 64, 0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
