/**
 * Mi-Claw Design Tokens v1.0
 * Apple Design Language — Unified across all pages
 * Generated: 2026-05-09
 * 
 * Usage: <link rel="stylesheet" href="styles/design-tokens.css">
 */

/* ============================================
   1. COLOR SYSTEM
   ============================================ */

:root {
  /* --- Brand Colors (Apple Design) --- */
  --color-primary:       #0071e3;
  --color-primary-hover:  #0077ed;
  --color-primary-light:  rgba(0, 113, 227, 0.08);
  --color-primary-medium: rgba(0, 113, 227, 0.15);
  --color-gradient-start: #0071e3;
  --color-gradient-end:   #5856d6;

  /* --- Gradient Presets --- */
  --gradient-primary: linear-gradient(135deg, #0071e3, #5856d6);
  --gradient-hero:    linear-gradient(135deg, #0071e3 0%, #5856d6 100%);

  /* --- Neutral Colors (Cool gray, Apple-style) --- */
  --color-bg:           #F5F5F7;
  --color-surface:       #FFFFFF;
  --color-text:          #1D1D1F;
  --color-text-secondary: #6E6E73;
  --color-text-tertiary:  #86868B;
  --color-border:        rgba(0, 0, 0, 0.08);
  --color-divider:       rgba(0, 0, 0, 0.04);

  /* --- Functional Colors --- */
  --color-success: #34C759;
  --color-warning: #FF9500;
  --color-error:   #FF3B30;
  --color-link:     #0071e3;

  /* --- Dark Theme (for course.html etc.) --- */
  --color-bg-dark:          #000000;
  --color-surface-dark:     #1C1C1E;
  --color-text-dark:        #F5F5F7;
  --color-text-secondary-dark: #86868B;
  --color-text-tertiary-dark:  #48484A;
  --color-border-dark:      rgba(255, 255, 255, 0.08);
}


/* ============================================
   2. TYPOGRAPHY SYSTEM
   ============================================ */

:root {
  /* --- Font Stack (Apple Design + Pingfang) --- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", "Consolas",  monospace;

  /* --- Font Size Scale (Major Third: 1.25) --- */
  --text-xs:   0.75rem;  /* 12px */
  --text-sm:   0.875rem; /* 14px */
  --text-base:  1rem;     /* 16px */
  --text-lg:   1.25rem;  /* 20px */
  --text-xl:   1.5rem;   /* 24px */
  --text-2xl:  2rem;     /* 32px */
  --text-3xl:  2.5rem;  /* 40px */
  --text-4xl:  3rem;     /* 48px */

  /* --- Line Height --- */
  --leading-body:    1.6;  /* Body text (Chinese: 1.6-1.7) */
  --leading-heading: 1.2;  /* Headings (compact) */
  --leading-tight:   1.1;  /* Hero/Display text */

  /* --- Letter Spacing --- */
  --tracking-body:   0.02em; /* Chinese body text微调 */
  --tracking-heading: -0.01em; /* Headings compact */
  --tracking-tight:  -0.02em; /* Hero text */
}


/* ============================================
   3. SPACING SYSTEM (4px base)
   ============================================ */

:root {
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
}


/* ============================================
   4. BORDER RADIUS (5 tiers)
   ============================================ */

:root {
  --radius-sm:   6px;   /* Badges, small tags */
  --radius-md:   10px;   /* Buttons, inputs */
  --radius-lg:   14px;   /* Cards, panels */
  --radius-xl:   20px;   /* Large cards, modals */
  --radius-full: 980px;   /* Pill buttons */
}


/* ============================================
   5. SHADOW SYSTEM (Low-opacity, Stripe-style)
   ============================================ */

:root {
  --shadow-sm: 0 1px 2px  rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px  rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.04);
}


/* ============================================
   6. LAYOUT SYSTEM
   ============================================ */

:root {
  --container-sm: 720px;   /* Article body */
  --container-md: 980px;   /* Main content (narrow) */
  --container-lg: 1080px;  /* Main content (standard) */
  --container-xl: 1200px;  /* Max container */
}

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

.container-narrow {
  max-width: var(--container-sm);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 24px;
}


/* ============================================
   7. RESPONSIVE BREAKPOINTS (3 tiers)
   ============================================ */

/* Mobile: < 768px */
/* Tablet: 768px - 1023px */
/* Desktop: >= 1024px */


/* ============================================
   8. TRANSITION & ANIMATION
   ============================================ */

:root {
  --ease-out:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:   0.15s;
  --duration-normal: 0.3s;
  --duration-slow:   0.5s;
  --transition-base:  var(--duration-normal) var(--ease-out);
}


/* ============================================
   9. READING OPTIMIZATION
   ============================================ */

.reading-body {
  font-size: var(--text-base);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  max-width: 680px;       /* Optimal reading width: 55-75 chars */
  margin-left: auto;
  margin-right: auto;
}

.reading-body p {
  margin-bottom: 1.5em;  /* 24px @ 16px base */
}

.section {
  padding: var(--space-24) 0;  /* 96px vertical */
}


/* ============================================
   10. COMPONENT PRESETS
   ============================================ */

/* --- Card --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  padding: var(--space-6);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* --- Button: Primary --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: var(--leading-body);
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
  text-decoration: none;
  user-select: none;
}

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

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* --- Button: Secondary --- */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: var(--leading-body);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  transition: background-color var(--transition-base), box-shadow var(--transition-base);
  text-decoration: none;
  user-select: none;
}

.btn-secondary:hover {
  background: var(--color-primary-light);
}

/* --- Section Title --- */
.section-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 600;
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  text-align: center;
  margin-bottom: var(--space-2);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-16);
  line-height: var(--leading-body);
}


/* ============================================
   11. SCROLL ANIMATION (Phase 3)
   ============================================ */

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

.scroll-fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

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


/* ============================================
   12. DARK MODE SUPPORT (Phase 3 - Define only)
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:       var(--color-bg-dark);
    --color-surface:   var(--color-surface-dark);
    --color-text:      var(--color-text-dark);
    --color-text-secondary: var(--color-text-secondary-dark);
    --color-text-tertiary:  var(--color-text-tertiary-dark);
    --color-border:    var(--color-border-dark);
  }
}
