/*
 * HASIBUL PLATFORM - DESIGN SYSTEM FOUNDATION
 * 
 * Aesthetic: Light Theme, Premium SaaS (Apple, Stripe, Linear)
 * Architecture:
 * 1. CSS Reset & Base
 * 2. Root Tokens (Typography, Spacing, Sizing)
 * 3. Theme Tokens (Colors, Shadows, Surfaces)
 * 4. Layout System (Grid, Container)
 * 5. Utility Classes
 */

/* ==========================================================================
   1. CSS RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--h-font-sans);
  background-color: var(--h-color-bg);
  color: var(--h-color-text);
  line-height: var(--h-line-height-base);
  font-size: var(--h-text-base);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

/* ==========================================================================
   2. ROOT TOKENS
   ========================================================================== */
:root {
  /* Typography System */
  --h-font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --h-font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  
  /* Font Scale (Fluid base) */
  --h-text-xs: 0.75rem;     /* 12px */
  --h-text-sm: 0.875rem;    /* 14px */
  --h-text-base: 1rem;      /* 16px */
  --h-text-md: 1.125rem;    /* 18px */
  --h-text-lg: 1.25rem;     /* 20px */
  --h-text-xl: 1.5rem;      /* 24px */
  --h-text-2xl: 1.875rem;   /* 30px */
  --h-text-3xl: 2.25rem;    /* 36px */
  --h-text-4xl: 3rem;       /* 48px */
  --h-text-5xl: 3.75rem;    /* 60px */
  
  /* Font Weights */
  --h-weight-normal: 400;
  --h-weight-medium: 500;
  --h-weight-semibold: 600;
  --h-weight-bold: 700;

  /* Line Heights */
  --h-line-height-none: 1;
  --h-line-height-tight: 1.25;
  --h-line-height-snug: 1.375;
  --h-line-height-base: 1.5;
  --h-line-height-relaxed: 1.625;

  /* Spacing System (Base 4px/8px) */
  --h-space-0: 0px;
  --h-space-1: 0.25rem;  /* 4px */
  --h-space-2: 0.5rem;   /* 8px */
  --h-space-3: 0.75rem;  /* 12px */
  --h-space-4: 1rem;     /* 16px */
  --h-space-5: 1.25rem;  /* 20px */
  --h-space-6: 1.5rem;   /* 24px */
  --h-space-8: 2rem;     /* 32px */
  --h-space-10: 2.5rem;  /* 40px */
  --h-space-12: 3rem;    /* 48px */
  --h-space-16: 4rem;    /* 64px */
  --h-space-20: 5rem;    /* 80px */
  --h-space-24: 6rem;    /* 96px */
  --h-space-32: 8rem;    /* 128px */

  /* Sizing Constraints */
  --h-header-height: 64px;
  --h-max-w-sm: 640px;
  --h-max-w-md: 768px;
  --h-max-w-lg: 1024px;
  --h-max-w-xl: 1280px;
  --h-max-w-content: 800px; /* Optimal reading width */

  /* Border Radius */
  --h-radius-none: 0;
  --h-radius-sm: 4px;
  --h-radius-md: 8px;
  --h-radius-lg: 12px;
  --h-radius-xl: 16px;
  --h-radius-full: 9999px;

  /* Z-index System */
  --h-z-hide: -1;
  --h-z-base: 0;
  --h-z-dropdown: 1000;
  --h-z-sticky: 1020;
  --h-z-fixed: 1030;
  --h-z-modal: 1050;

  /* Animation Tokens */
  --h-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --h-transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   3. THEME TOKENS (Light Mode Primary)
   ========================================================================== */
:root {
  /* Soft Light Backgrounds */
  --h-color-bg: #FAFBFD;
  --h-color-bg-subtle: #ffffff;
  --h-color-bg-surface: #ffffff;
  --h-color-surface: #ffffff;
  
  /* High Contrast Typography */
  --h-color-text: #0f172a;        /* Dark navy */
  --h-color-text-muted: #64748b;  /* Slate 500 */
  --h-color-text-secondary: #475569; /* Slate 600 */
  --h-color-text-inverse: #ffffff;
  
  /* Subtle Borders */
  --h-color-border: #e2e8f0;      /* Slate 200 */
  --h-color-border-subtle: #f1f5f9; /* Slate 100 */

  /* Brand / Primary */
  --h-color-primary: #156FF7;     /* Brand Blue */
  --h-color-primary-hover: #0E5AD0;
  
  /* Semantic Colors */
  --h-color-success: #10b981;
  --h-color-error: #ef4444;
  --h-color-warning: #f59e0b;
  --h-color-info: #3b82f6;

  /* Shadows (Soft, Apple-like elevation) */
  --h-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --h-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --h-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --h-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  
  /* Focus States */
  --h-color-focus-ring: rgba(24, 24, 27, 0.3); /* Subtle primary focus ring */
}

/* ==========================================================================
   4. LAYOUT SYSTEM
   ========================================================================== */
.hp-container {
  width: 100%;
  max-width: var(--h-max-w-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--h-space-4);
  padding-right: var(--h-space-4);
}

@media (min-width: 768px) {
  .hp-container {
    padding-left: var(--h-space-8);
    padding-right: var(--h-space-8);
  }
}

.h-container-content {
  max-width: var(--h-max-w-content);
}

.h-grid {
  display: grid;
  gap: var(--h-space-6);
}

.h-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .h-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .h-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .h-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.h-section {
  padding-top: var(--h-space-16);
  padding-bottom: var(--h-space-16);
}

@media (min-width: 768px) {
  .h-section {
    padding-top: var(--h-space-24);
    padding-bottom: var(--h-space-24);
  }
}

/* ==========================================================================
   5. UTILITY CLASSES
   ========================================================================== */

/* Typography Utilities */
.h-text-center { text-align: center; }
.h-text-left { text-align: left; }
.h-text-right { text-align: right; }

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

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

/* Spacing Utilities */
.h-mb-2 { margin-bottom: var(--h-space-2); }
.h-mb-4 { margin-bottom: var(--h-space-4); }
.h-mb-6 { margin-bottom: var(--h-space-6); }
.h-mb-8 { margin-bottom: var(--h-space-8); }
.h-mt-4 { margin-top: var(--h-space-4); }
.h-mt-8 { margin-top: var(--h-space-8); }

/* Accessibility */
.h-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

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

@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;
  }
}

/* ==========================================================================
   6. COMPONENTS (Buttons)
   ========================================================================== */
.hp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--h-transition-fast);
  cursor: pointer;
  border: none;
}

.hp-btn--primary {
  background-color: var(--h-color-primary);
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.hp-btn--primary:hover {
  filter: brightness(0.9);
  color: #ffffff;
  transform: translateY(-1px);
}

.hp-btn--primary:active {
  transform: translateY(1px);
}

.hp-btn--lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 10px;
}

.hp-btn--sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 6px;
}
