@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');
@import "tailwindcss";

@custom-variant dark (&:where(.dark, .dark *));

/* ============================================================
   9Router palette — adopted from 9remote_private/web
   Brand orange (dark) / soft coral (light), neutral warm bases
   ============================================================ */
:root {
  /* Brand scale (light) - centered on #E56A4A */
  --color-brand-50: #fdf1ed;
  --color-brand-100: #fadccf;
  --color-brand-200: #f4b59c;
  --color-brand-300: #ee8d6a;
  --color-brand-400: #ea7855;
  --color-brand-500: #E56A4A;
  --color-brand-600: #cc5236;
  --color-brand-700: #a64027;
  --color-brand-800: #7a2f1d;
  --color-brand-900: #4d1e12;

  /* Primary (legacy alias for backward compat with existing components) */
  --color-primary: var(--color-brand-500);
  --color-primary-hover: var(--color-brand-600);

  /* Surfaces & backgrounds (light) */
  --color-bg: #FDFAF6;
  --color-bg-alt: #F7F3EE;
  --color-surface: #ffffff;
  --color-surface-2: #f4f4f5;
  --color-surface-3: #e7e7e9;
  --color-sidebar: rgba(244, 241, 236, 0.85);

  /* Borders */
  --color-border: #e5e7eb;
  --color-border-subtle: #f1f1f3;

  /* Text */
  --color-text: #0a0a0a;
  --color-text-main: #0a0a0a;
  --color-text-muted: #6B7280;
  --color-text-subtle: #9CA3AF;

  /* Status */
  --color-danger: #cf222e;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;

  /* Radius */
  --radius-brand: 10px;
  --radius-brand-lg: 14px;

  /* Shadows */
  --shadow-soft: 0 1px 2px 0 rgba(0,0,0,0.04);
  --shadow-warm: 0 2px 12px -2px rgba(229, 106, 74, 0.18);
  --shadow-elevated: 0 12px 28px -4px rgba(60, 50, 45, 0.06);
  --shadow-elev:
    inset 0 1px 0 0 rgba(255,255,255,0.8),
    0 1px 2px rgba(15,23,42,0.04),
    0 12px 36px -8px rgba(15,23,42,0.10);
  --shadow-focus: 0 0 0 3px rgba(229,106,74,0.18);

  color-scheme: light;
}

.dark {
  /* Brand scale (dark) - centered on #E56A4A, same as light for consistency */
  --color-brand-50: #fdf1ed;
  --color-brand-100: #fadccf;
  --color-brand-200: #f4b59c;
  --color-brand-300: #ee8d6a;
  --color-brand-400: #ea7855;
  --color-brand-500: #E56A4A;
  --color-brand-600: #cc5236;
  --color-brand-700: #a64027;
  --color-brand-800: #7a2f1d;
  --color-brand-900: #4d1e12;

  --color-primary: #E56A4A;
  --color-primary-hover: #cc5236;

  /* Surfaces (dark - Claude-like neutral warm) */
  --color-bg: #1a1a1a;
  --color-bg-alt: #1F1F1E;
  --color-surface: #262626;
  --color-surface-2: #303030;
  --color-surface-3: #3a3a3a;
  --color-sidebar: rgba(30, 30, 30, 0.85);

  --color-border: #333333;
  --color-border-subtle: #2a2a2a;

  --color-text: #ededed;
  --color-text-main: #ededed;
  --color-text-muted: #9ca3af;
  --color-text-subtle: #6b7280;

  --color-danger: #ef4444;
  --color-success: #22c55e;
  --color-warning: #fbbf24;
  --color-info: #60a5fa;

  --shadow-soft: 0 1px 2px 0 rgba(0,0,0,0.3);
  --shadow-warm: 0 2px 12px -2px rgba(229, 106, 74, 0.25);
  --shadow-elevated: 0 12px 28px -4px rgba(0, 0, 0, 0.45);
  --shadow-elev:
    inset 0 1px 0 0 rgba(255,255,255,0.06),
    0 1px 2px rgba(0,0,0,0.4),
    0 16px 48px -8px rgba(0,0,0,0.55);
  --shadow-focus: 0 0 0 3px rgba(229, 106, 74, 0.18);

  color-scheme: dark;
}

@theme inline {
  /* Brand scale */
  --color-brand-50: var(--color-brand-50);
  --color-brand-100: var(--color-brand-100);
  --color-brand-200: var(--color-brand-200);
  --color-brand-300: var(--color-brand-300);
  --color-brand-400: var(--color-brand-400);
  --color-brand-500: var(--color-brand-500);
  --color-brand-600: var(--color-brand-600);
  --color-brand-700: var(--color-brand-700);
  --color-brand-800: var(--color-brand-800);
  --color-brand-900: var(--color-brand-900);

  /* Primary aliases */
  --color-primary: var(--color-primary);
  --color-primary-hover: var(--color-primary-hover);

  /* Semantic */
  --color-bg: var(--color-bg);
  --color-bg-alt: var(--color-bg-alt);
  --color-surface: var(--color-surface);
  --color-surface-2: var(--color-surface-2);
  --color-surface-3: var(--color-surface-3);
  --color-sidebar: var(--color-sidebar);
  --color-border: var(--color-border);
  --color-border-subtle: var(--color-border-subtle);
  --color-text: var(--color-text);
  --color-text-main: var(--color-text-main);
  --color-text-muted: var(--color-text-muted);
  --color-text-subtle: var(--color-text-subtle);
  --color-accent: var(--color-brand-500);
  --color-danger: var(--color-danger);
  --color-success: var(--color-success);
  --color-warning: var(--color-warning);
  --color-info: var(--color-info);

  /* Static fallbacks (explicit per-mode usage if needed) */
  --color-bg-light: #FCFBF9;
  --color-bg-dark: #1a1a1a;
  --color-surface-light: #ffffff;
  --color-surface-dark: #262626;
  --color-sidebar-light: #F4F1EC;
  --color-sidebar-dark: #1F1F1E;
  --color-border-light: #e5e7eb;
  --color-border-dark: #333333;
  --color-text-main-light: #0a0a0a;
  --color-text-main-dark: #ededed;
  --color-text-muted-light: #6B7280;
  --color-text-muted-dark: #9ca3af;

  /* Radius */
  --radius-brand: var(--radius-brand);
  --radius-brand-lg: var(--radius-brand-lg);

  /* Shadows */
  --shadow-soft: var(--shadow-soft);
  --shadow-warm: var(--shadow-warm);
  --shadow-elevated: var(--shadow-elevated);
  --shadow-elev: var(--shadow-elev);
  --shadow-focus: var(--shadow-focus);

  /* Font - Inter primary, Apple system fallback */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', system-ui, sans-serif;
}

/* Base */
body {
  background-color: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Selection - brand-tinted */
::selection {
  background-color: rgba(229, 106, 74, 0.25);
  color: var(--color-primary);
}
.dark ::selection {
  background-color: rgba(229, 106, 74, 0.3);
  color: var(--color-brand-300);
}

/* iOS keyboard accent */
input, textarea {
  accent-color: var(--color-primary);
}

/* Scrollbar (custom-scrollbar utility kept for compat) */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.3);
  border-radius: 20px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-primary);
}

/* Thin horizontal scrollbar - brand colored */
.scroll-thin-x {
  scrollbar-width: thin;
  scrollbar-color: rgba(229, 106, 74, 0.55) transparent;
}
.dark .scroll-thin-x {
  scrollbar-color: rgba(229, 106, 74, 0.55) transparent;
}
.scroll-thin-x::-webkit-scrollbar { height: 3px; }
.scroll-thin-x::-webkit-scrollbar-track { background: transparent; }
.scroll-thin-x::-webkit-scrollbar-thumb {
  background: rgba(229, 106, 74, 0.55);
  border-radius: 3px;
}
.dark .scroll-thin-x::-webkit-scrollbar-thumb {
  background: rgba(229, 106, 74, 0.55);
}

/* Reusable elevated card */
.card-soft {
  background-color: var(--color-surface);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-brand-lg);
}
.card-elev {
  background-color: var(--color-surface);
  box-shadow: var(--shadow-elev);
  border-radius: var(--radius-brand-lg);
}

/* Hero gradient (compat) */
.bg-hero-gradient {
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
}

/* macOS Vibrancy */
.bg-vibrancy {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.72);
}
.dark .bg-vibrancy {
  background: rgba(38, 38, 38, 0.72);
}

/* macOS Traffic Lights */
.traffic-lights {
  display: flex;
  gap: 8px;
}
.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.traffic-light.red { background: #FF5F56; }
.traffic-light.yellow { background: #FFBD2E; }
.traffic-light.green { background: #27C93F; }

/* Material Symbols */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.fill-1 {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Disable text selection on buttons */
button {
  -webkit-user-select: none;
  user-select: none;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

@keyframes border-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(229, 106, 74, 0.3), 0 0 10px rgba(229, 106, 74, 0.2);
    border-color: rgba(229, 106, 74, 0.5);
  }
  50% {
    box-shadow: 0 0 10px rgba(229, 106, 74, 0.5), 0 0 20px rgba(229, 106, 74, 0.3);
    border-color: rgba(229, 106, 74, 0.8);
  }
}
.animate-border-glow { animation: border-glow 2s ease-in-out infinite; }

@keyframes slideInFromRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInFromTop {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.slide-in-right { animation: slideInFromRight 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fade-in { animation: fadeIn 0.2s ease-out forwards; }
.slide-in-top { animation: slideInFromTop 0.18s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
.animate-pulse-glow { animation: pulseGlow 3s ease-in-out infinite; }

/* CTA shimmer + glow pulse */
@keyframes ctaShimmer {
  0% { transform: translateX(-120%) skewX(-20deg); }
  100% { transform: translateX(220%) skewX(-20deg); }
}
@keyframes ctaGlowPulse {
  0%, 100% { box-shadow: 0 8px 24px -8px rgba(229, 106, 74, 0.45), 0 0 0 0 rgba(229, 106, 74, 0.5); }
  50% { box-shadow: 0 12px 32px -8px rgba(229, 106, 74, 0.6), 0 0 0 8px rgba(229, 106, 74, 0); }
}
.btn-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  animation: ctaGlowPulse 2.4s ease-in-out infinite;
}
.btn-cta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: ctaShimmer 2.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.btn-cta > * { position: relative; z-index: 2; }

/* Dot Grid Background Pattern */
.dot-grid-bg {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 15% 20%, rgba(229, 106, 74, 0.10) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(229, 106, 74, 0.06) 0%, transparent 40%);
}
.dark .dot-grid-bg {
  background-image:
    radial-gradient(circle at 15% 20%, rgba(229, 106, 74, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(229, 106, 74, 0.10) 0%, transparent 40%);
}

/* Landing-style faint grid overlay (use absolute pos inside relative parent) */
.landing-grid {
  background-image:
    linear-gradient(to right, var(--color-accent) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-accent) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.08;
}
.dark .landing-grid {
  opacity: 0.04;
}

/* Changelog markdown body */
.changelog-body h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}
.changelog-body h1:first-child { margin-top: 0; }
.changelog-body h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--color-primary);
}
.changelog-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0.75rem 0 0.4rem;
}
.changelog-body ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
.changelog-body li { margin: 0.25rem 0; line-height: 1.6; }
.changelog-body p { margin: 0.5rem 0; line-height: 1.6; }
.changelog-body code {
  background: var(--color-bg-alt);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: ui-monospace, monospace;
}
.changelog-body a {
  color: var(--color-primary);
  text-decoration: underline;
}
.changelog-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}
