/* styles/base.css */
/* Base styles, CSS variables, reset, and typography */

/* ============================== CSS Variables (Light Theme) ============================== */
:root {
  /* Colors */
  --bg: #e9eef5;
  --bg-2: #edf2f8;
  --text: #3a4252;
  --text-dim: #6b7280;
  --text-muted: #8a94a6;
  --accent: #3b82f6;

  /* Neumorphic shadows */
  --neu-light: #ffffff;
  --neu-dark: #cfd6e2;
  --neu-radius: 16px;
  --neu-inset: inset 6px 6px 12px var(--neu-dark), inset -6px -6px 12px var(--neu-light);
  --neu-out: 10px 10px 20px var(--neu-dark), -10px -10px 20px var(--neu-light);

  /* Transitions & animations */
  --t: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast: all 0.15s ease;
  --t-slow: all 0.4s ease;

  /* Layout */
  --container-pad: 2rem;
  --navbar-height: 80px;
  --border-radius: 12px;
  --border-radius-lg: 18px;

  /* Z-index scale */
  --z-background: -2;
  --z-particles: -1;
  --z-content: 1;
  --z-header: 1000;
  --z-modal: 10000;
  --z-toast: 10002;
  --z-assistant: 99999;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 
               'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 
               'Noto Color Emoji', sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, var(--bg), var(--bg-2));
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove default list styles */
ul, ol {
  list-style: none;
}

/* Remove default button styles */
button {
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
}

/* Remove default link styles */
a {
  color: inherit;
  text-decoration: none;
}

/* Remove default form element styles */
input, textarea, select {
  font: inherit;
  border: none;
  background: none;
  outline: none;
}

/* Image defaults */
img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Table defaults */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ============================== Typography ============================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5em;
  color: var(--text);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  margin-bottom: 1em;
  line-height: 1.6;
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

/* ============================== Layout Primitives ============================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ============================== Background Elements ============================== */

.background-gradient {
  position: fixed;
  inset: 0;
  z-index: var(--z-background);
  background: 
    radial-gradient(900px 600px at 20% 8%, rgba(255, 255, 255, 0.50) 0%, transparent 60%),
    linear-gradient(145deg, #f7f8fb, #eef2f8);
}

.particles {
  position: fixed;
  inset: 0;
  z-index: var(--z-particles);
  pointer-events: none;
}

/* ============================== Scroll Indicator ============================== */

.scroll-indicator {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  z-index: calc(var(--z-header) - 1);
  transition: width 0.12s ease-out;
}

/* ============================== Utility Classes ============================== */

/* Neumorphic primitives */
.neu-plate {
  background: var(--bg);
  border-radius: var(--neu-radius);
  box-shadow: var(--neu-out);
  transition: var(--t);
}

.neu-plate:hover {
  transform: translateY(-2px);
}

.neu-press {
  box-shadow: var(--neu-inset);
}

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

/* Display utilities */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }

/* Flex utilities */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Animation utilities */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .fade-in {
    transition: none;
  }
}

/* ============================== Responsive Breakpoints ============================== */

/* Mobile first approach */
/* Base styles above are for mobile */

/* Tablet and up */
@media (min-width: 640px) {
  :root {
    --container-pad: 2rem;
  }
}

/* Desktop and up */
@media (min-width: 1024px) {
  :root {
    --container-pad: 2rem;
  }
}

/* Large desktop and up */
@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* ============================== Focus & Accessibility ============================== */

/* Focus styles */
*:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 8px;
  border-radius: 4px;
  text-decoration: none;
  z-index: var(--z-modal);
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --neu-out: 0 0 0 2px var(--text);
    --neu-inset: inset 0 0 0 2px var(--text);
  }
}

/* ============================== Print Styles ============================== */

@media print {
  .background-gradient,
  .particles,
  .scroll-indicator,
  .neu-plate {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}
