/* ========================================
   PRODUCTION-READY CSS - APPLE-INSPIRED DESIGN
   ========================================
   This CSS file embodies Apple's design philosophy: clean, minimalist aesthetics
   with subtle gradients, rounded corners, smooth animations, and a harmonious
   color palette. Optimized for performance, accessibility, and responsiveness.
   ======================================== */

/* ========================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ========================================
   Defines the color palette, typography, spacing, and other design tokens.
   ======================================== */
:root {
  /* Color Palette - Harmonious whites, grays, and blues */
  --color-primary: #007AFF; /* Apple blue */
  --color-primary-hover: #0056CC;
  --color-secondary: #5AC8FA; /* Light blue */
  --color-accent: #FF9500; /* Orange accent */
  --color-text-primary: #1D1D1F; /* Dark gray */
  --color-text-secondary: #86868B; /* Medium gray */
  --color-text-muted: #A1A1A6; /* Light gray */
  --color-background: #FFFFFF; /* Pure white */
  --color-surface: #F5F5F7; /* Light gray surface */
  --color-border: #D1D1D6; /* Subtle border */
  --color-shadow: rgba(0, 0, 0, 0.1); /* Soft shadow */

  /* Typography */
  --font-family-primary: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  --font-size-xs: 0.75rem; /* 12px */
  --font-size-sm: 0.875rem; /* 14px */
  --font-size-base: 1rem; /* 16px */
  --font-size-lg: 1.125rem; /* 18px */
  --font-size-xl: 1.25rem; /* 20px */
  --font-size-2xl: 1.5rem; /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem; /* 36px */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Spacing */
  --spacing-xs: 0.25rem; /* 4px */
  --spacing-sm: 0.5rem; /* 8px */
  --spacing-md: 1rem; /* 16px */
  --spacing-lg: 1.5rem; /* 24px */
  --spacing-xl: 2rem; /* 32px */
  --spacing-2xl: 3rem; /* 48px */
  --spacing-3xl: 4rem; /* 64px */

  /* Border Radius */
  --border-radius-sm: 0.25rem; /* 4px */
  --border-radius-md: 0.5rem; /* 8px */
  --border-radius-lg: 0.75rem; /* 12px */
  --border-radius-xl: 1rem; /* 16px */
  --border-radius-full: 9999px; /* Fully rounded */

  /* Shadows */
  --shadow-sm: 0 1px 2px var(--color-shadow);
  --shadow-md: 0 4px 6px var(--color-shadow);
  --shadow-lg: 0 10px 15px var(--color-shadow);
  --shadow-xl: 0 20px 25px var(--color-shadow);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;

  /* Breakpoints */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
}

/* ========================================
   RESET AND BASE STYLES
   ========================================
   Minimal CSS reset and base styles for consistency across browsers.
   ======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--color-background);
}

/* ========================================
   TYPOGRAPHY
   ========================================
   Custom typography using San Francisco equivalents.
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-text-primary);
}

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

p {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-primary-hover);
}

/* ========================================
   LAYOUT UTILITIES
   ========================================
   Reusable classes for layout and spacing.
   ======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.space-x-sm > * + * { margin-left: var(--spacing-sm); }
.space-x-md > * + * { margin-left: var(--spacing-md); }
.space-x-lg > * + * { margin-left: var(--spacing-lg); }

.space-y-sm > * + * { margin-top: var(--spacing-sm); }
.space-y-md > * + * { margin-top: var(--spacing-md); }
.space-y-lg > * + * { margin-top: var(--spacing-lg); }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ========================================
   RESPONSIVE DESIGN
   ========================================
   Breakpoints for mobile-first responsive design.
   ======================================== */
@media (min-width: 640px) {
  .container { padding: 0 var(--spacing-lg); }
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
}

@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:flex-col { flex-direction: column; }
  .md\:hidden { display: none; }
}

@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
}

@media (min-width: 1280px) {
  .xl\:flex { display: flex; }
  .xl\:hidden { display: none; }
}

/* ========================================
   COMPONENT: BUTTONS
   ========================================
   Reusable button classes with variants.
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  background-color: var(--color-primary);
  color: white;
}

.btn:hover,
.btn:focus {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--color-border);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-ghost:hover,
.btn-ghost:focus {
  background-color: var(--color-primary);
  color: white;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ========================================
   COMPONENT: CARDS
   ========================================
   Clean card components with subtle shadows.
   ======================================== */
.card {
  background-color: var(--color-background);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-lg);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: var(--spacing-md);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.card-content {
  color: var(--color-text-secondary);
}

.card-footer {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

/* ========================================
   COMPONENT: NAVIGATION
   ========================================
   Minimalist navigation bar.
   ======================================== */
.nav {
  background-color: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  padding: var(--spacing-md) 0;
  margin-top: var(--spacing-lg);
}

.nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--spacing-lg);
}

.nav-link {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
  color: var(--color-primary);
}

/* ========================================
   COMPONENT: FORMS
   ========================================
   Accessible form elements with clean styling.
   ======================================== */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xs);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  color: #FF3B30; /* Apple red */
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-xs);
}

/* ========================================
   ANIMATIONS AND TRANSITIONS
   ========================================
   Smooth animations for enhanced user experience.
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* ========================================
   ACCESSIBILITY
   ========================================
   Focus states, contrast ratios, and semantic enhancements.
   ======================================== */
.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;
}

.focus-visible:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --color-text-secondary: #000000;
  }
}

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

/* ========================================
   HTMX INTEGRATION
   ========================================
   Existing HTMX styles preserved and enhanced.
   ======================================== */
.htmx-indicator {
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

.htmx-request.htmx-indicator {
  opacity: 1;
}

.contact.htmx-swapping {
  opacity: 0;
  transition: opacity var(--transition-slow);
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================
   Efficient selectors and minimal redundancy.
   ======================================== */
/* Use CSS containment for better performance */
.card {
  contain: layout style paint;
}

/* Optimize transforms for GPU acceleration */
.btn,
.card {
  will-change: transform;
}

/* ========================================
   UTILITY CLASSES
   ========================================
   Additional utility classes for common use cases.
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-surface { background-color: var(--color-surface); }

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

.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-md { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: var(--border-radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.m-0 { margin: 0; }
.p-0 { padding: 0; }
.m-sm { margin: var(--spacing-sm); }
.p-sm { padding: var(--spacing-sm); }
.m-md { margin: var(--spacing-md); }
.p-md { padding: var(--spacing-md); }
.m-lg { margin: var(--spacing-lg); }
.p-lg { padding: var(--spacing-lg); }

/* ========================================
   COMPONENT: HERO SECTION
   ========================================
   Styling for the hero section.
   ======================================== */
.hero-section {
  padding: var(--spacing-3xl) 0;
  margin-top: var(--spacing-lg);
}

/* ========================================
   DARK MODE SUPPORT (OPTIONAL)
   ========================================
   Uncomment and customize for dark mode implementation.
   ======================================== */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #1D1D1F;
    --color-surface: #2D2D2F;
    --color-text-primary: #F5F5F7;
    --color-text-secondary: #86868B;
    --color-border: #424245;
  }
}
*/
