/* ============================================
   APPLE-INSPIRED DESIGN SYSTEM
   Built with purpose, crafted with care
   ============================================ */

:root {
  /* Apple Color Palette - Light Mode */
  --color-primary: #0071e3;
  --color-primary-dark: #0077ED;
  --color-primary-light: #2997FF;
  
  --color-bg: #ffffff;
  --color-bg-secondary: #fbfbfd;
  --color-bg-tertiary: #f5f5f7;
  --color-bg-elevated: rgba(255, 255, 255, 0.72);
  
  --color-text: #1d1d1f;
  --color-text-secondary: #86868b;
  --color-text-tertiary: #86868b;
  
  --color-border: rgba(0, 0, 0, 0.1);
  --color-border-hover: rgba(0, 0, 0, 0.15);
  
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-shadow-elevated: rgba(0, 0, 0, 0.12);
  
  /* Typography - San Francisco Inspired */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  
  /* Refined Type Scale */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1.0625rem;  /* 17px - Apple's body text */
  --font-size-lg: 1.1875rem;    /* 19px */
  --font-size-xl: 1.3125rem;    /* 21px */
  --font-size-2xl: 1.75rem;     /* 28px */
  --font-size-3xl: 2.5rem;      /* 40px */
  --font-size-4xl: 3.5rem;      /* 56px */
  --font-size-5xl: 4.5rem;      /* 72px */
  --font-size-6xl: 6rem;        /* 96px */
  
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.0833333;
  --line-height-snug: 1.1428571;
  --line-height-normal: 1.4705882;
  --line-height-relaxed: 1.5;
  
  /* Apple's Precise Spacing System */
  --space-2: 0.125rem;    /* 2px */
  --space-4: 0.25rem;     /* 4px */
  --space-6: 0.375rem;    /* 6px */
  --space-8: 0.5rem;      /* 8px */
  --space-12: 0.75rem;    /* 12px */
  --space-14: 0.875rem;   /* 14px */
  --space-16: 1rem;       /* 16px */
  --space-18: 1.125rem;   /* 18px */
  --space-20: 1.25rem;    /* 20px */
  --space-24: 1.5rem;     /* 24px */
  --space-32: 2rem;       /* 32px */
  --space-40: 2.5rem;     /* 40px */
  --space-48: 3rem;       /* 48px */
  --space-64: 4rem;       /* 64px */
  --space-80: 5rem;       /* 80px */
  --space-96: 6rem;       /* 96px */
  --space-128: 8rem;      /* 128px */
  
  /* Layout */
  --max-width-content: 980px;
  --max-width-narrow: 692px;
  --max-width-wide: 1440px;
  
  --header-height: 48px;
  
  /* Border Radius - Apple's Precision */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows - Layered Depth */
  --shadow-sm: 
    0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 
    0 2px 8px 0 rgba(0, 0, 0, 0.08),
    0 1px 4px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 
    0 12px 32px 0 rgba(0, 0, 0, 0.1),
    0 2px 12px 0 rgba(0, 0, 0, 0.08);
  --shadow-xl: 
    0 24px 64px 0 rgba(0, 0, 0, 0.12),
    0 8px 24px 0 rgba(0, 0, 0, 0.08);
  
  /* Apple's Signature Easing Curves */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Transitions */
  --transition-fast: 0.2s var(--ease-out);
  --transition-base: 0.3s var(--ease-out);
  --transition-slow: 0.4s var(--ease-out);
  
  /* Blur Effects */
  --blur-sm: 12px;
  --blur-md: 20px;
  --blur-lg: 40px;
  
  /* Z-index layers */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
}

/* Dark Mode - True Apple Black */
[data-theme="dark"] {
  --color-primary: #2997FF;
  --color-primary-dark: #0A84FF;
  --color-primary-light: #5EB3FF;
  
  --color-bg: #000000;
  --color-bg-secondary: #1c1c1e;
  --color-bg-tertiary: #2c2c2e;
  --color-bg-elevated: rgba(28, 28, 30, 0.72);
  
  --color-text: #f5f5f7;
  --color-text-secondary: #a1a1a6;
  --color-text-tertiary: #86868b;
  
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-hover: rgba(255, 255, 255, 0.15);
  
  --color-shadow: rgba(0, 0, 0, 0.3);
  --color-shadow-elevated: rgba(0, 0, 0, 0.5);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding-top: var(--header-height);
}

/* Typography - Apple's Approach */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.02em; /* Tight tracking for large text */
}

h1 { 
  font-size: var(--font-size-6xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.03em;
}

h2 { 
  font-size: var(--font-size-5xl);
  letter-spacing: -0.025em;
}

h3 { 
  font-size: var(--font-size-4xl);
  letter-spacing: -0.02em;
}

h4 { 
  font-size: var(--font-size-3xl);
}

h5 { 
  font-size: var(--font-size-2xl);
}

h6 { 
  font-size: var(--font-size-xl);
}

p {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
}

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

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

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   GLASSMORPHIC NAVIGATION
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--color-bg-elevated);
  backdrop-filter: saturate(180%) blur(var(--blur-md));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur-md));
  border-bottom: 1px solid var(--color-border);
  z-index: var(--z-fixed);
  transition: all 0.5s var(--ease-out);
}

.nav {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-24);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  text-decoration: none;
  transition: opacity var(--transition-fast);
  letter-spacing: -0.01em;
}

.nav__brand:hover {
  opacity: 0.7;
  color: var(--color-text);
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-32);
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-32);
}

.nav__link {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  transition: color var(--transition-fast);
  position: relative;
  padding: var(--space-4) 0;
}

.nav__link:hover {
  color: var(--color-text);
}

.nav__link.active {
  color: var(--color-text);
}

.nav__link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--color-text);
}

/* Theme Toggle - Minimal Icon Style */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
}

.theme-toggle:hover {
  color: var(--color-text);
  background-color: var(--color-bg-tertiary);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Mobile Menu Toggle */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-8);
  color: var(--color-text);
  font-size: var(--font-size-2xl);
  transition: opacity var(--transition-fast);
}

.nav__toggle:hover {
  opacity: 0.7;
}

.nav__toggle:active {
  opacity: 0.5;
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .nav {
    padding: 0 var(--space-16);
  }
  
  .nav__toggle {
    display: block;
    /* Ensure 44px tap target */
    min-width: 44px;
    min-height: 44px;
  }
  
  .nav__menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-bg-elevated);
    backdrop-filter: saturate(180%) blur(var(--blur-md));
    -webkit-backdrop-filter: saturate(180%) blur(var(--blur-md));
    flex-direction: column;
    gap: 0;
    padding: var(--space-32) var(--space-24);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.5s var(--ease-out), opacity 0.5s var(--ease-out), visibility 0.5s;
  }
  
  .nav__menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav__list {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }
  
  .nav__link {
    width: 100%;
    /* Ensure 44px tap target */
    padding: var(--space-24) 0;
    min-height: 44px;
    text-align: center;
    font-size: var(--font-size-xl);
    border-bottom: 1px solid var(--color-border);
    /* Add touch feedback */
    -webkit-tap-highlight-color: rgba(0, 113, 227, 0.1);
  }
  
  .nav__link:active {
    background-color: rgba(0, 113, 227, 0.05);
  }
  
  .nav__link:hover {
    background-color: transparent;
  }
  
  .nav__link.active::after {
    display: none;
  }
  
  .theme-toggle {
    margin-top: var(--space-32);
    /* Ensure 44px tap target */
    min-width: 44px;
    min-height: 44px;
  }
}

/* ============================================
   FOOTER STYLES
   ============================================ */

.footer {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: var(--space-80) var(--space-24);
  margin-top: var(--space-128);
  transition: all 0.5s var(--ease-out);
}

.footer__content {
  max-width: var(--max-width-content);
  margin: 0 auto;
  text-align: center;
}

.footer__text {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  margin: 0;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.container {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--space-24);
}

.container-narrow {
  max-width: var(--max-width-narrow);
}

.container-wide {
  max-width: var(--max-width-wide);
}

.section {
  padding: var(--space-48) 0 var(--space-64) 0;
}

.section-sm {
  padding: var(--space-32) 0 var(--space-48) 0;
}

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

/* ============================================
   SKIP TO CONTENT LINK (Accessibility)
   ============================================ */

.skip-to-content {
  position: absolute;
  top: -100px;
  left: var(--space-16);
  z-index: 9999;
  background-color: var(--color-primary);
  color: white;
  padding: var(--space-12) var(--space-24);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: var(--space-16);
}

/* ============================================
   KEYBOARD FOCUS STATES
   ============================================ */

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

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Better focus for buttons */
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Better focus for links */
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Scroll Animations - Apple Style (Faster) */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

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

/* Stagger animation delay for sequential reveals */
.fade-in:nth-child(1) { transition-delay: 0.03s; }
.fade-in:nth-child(2) { transition-delay: 0.06s; }
.fade-in:nth-child(3) { transition-delay: 0.09s; }
.fade-in:nth-child(4) { transition-delay: 0.12s; }
.fade-in:nth-child(5) { transition-delay: 0.15s; }

/* ============================================
   SCROLL MORE INDICATOR (Right Side)
   ============================================ */

.scroll-more-indicator {
  position: fixed;
  right: var(--space-32);
  bottom: var(--space-64);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  z-index: 99;
}

.scroll-more-indicator.visible {
  opacity: 1;
}

.scroll-more-indicator__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: var(--font-size-2xl);
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-md);
  animation: bounceVertical 2s ease-in-out infinite;
}

@keyframes bounceVertical {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(8px);
  }
  60% {
    transform: translateY(4px);
  }
}

/* Hide on mobile */
@media (max-width: 768px) {
  .scroll-more-indicator {
    display: none;
  }
}

/* ============================================
   PAGE LOAD ANIMATION
   ============================================ */

body {
  opacity: 0;
  animation: pageLoad 0.4s var(--ease-out) forwards;
}

@keyframes pageLoad {
  to {
    opacity: 1;
  }
}

/* Prevent animation on subsequent navigations */
body.loaded {
  animation: none;
  opacity: 1;
}

/* ============================================
   RESPONSIVE TYPOGRAPHY
   ============================================ */

@media (max-width: 1068px) {
  :root {
    --font-size-6xl: 4.5rem;   /* 72px */
    --font-size-5xl: 3.5rem;   /* 56px */
    --font-size-4xl: 2.75rem;  /* 44px */
    --font-size-3xl: 2rem;     /* 32px */
  }
}

@media (max-width: 734px) {
  :root {
    --font-size-6xl: 3rem;     /* 48px */
    --font-size-5xl: 2.5rem;   /* 40px */
    --font-size-4xl: 2rem;     /* 32px */
    --font-size-3xl: 1.75rem;  /* 28px */
    
    --space-128: 4rem;         /* 64px */
    --space-96: 3rem;          /* 48px */
    --space-80: 2.5rem;        /* 40px */
  }
  
  .section {
    padding: var(--space-48) 0;
  }
  
  .section-sm {
    padding: var(--space-32) 0;
  }
}
