/* =============================================================================
   MEDIRAAH GLOBAL — Design System
   global.css
   Contains: CSS tokens, reset, base styles, typography, layout utilities,
             spacing utilities, animation keyframes
   ============================================================================= */

/* ─────────────────────────────────────────────────────────────────────────────
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* Premium Brand Color Palette — inspired by Maven Clinic's editorial warmth */
  --color-primary:         #0C2B3B;   /* Deep Forest Navy */
  --color-primary-light:   #163E55;   /* Interactive Navy Hover */
  --color-secondary:       #2E7D6B;   /* Jewel Teal/Emerald */
  --color-secondary-light: #4FA090;   /* Soft Teal */
  --color-accent:          #C4845A;   /* Warm Terra Cotta */
  --color-accent-light:    #F5EDE4;   /* Soft Peach/Cream */
  --color-surface:         #FAFAF7;   /* Warm Off-White */
  --color-surface-alt:     #F2EFE9;   /* Warm Cream */
  --color-surface-warm:    #EDE8DF;   /* Deeper Cream */
  --color-surface-dark:    #0C2B3B;   /* Deep Forest Section */
  --color-text:            #0C2B3B;   /* Deep Navy for High Contrast */
  --color-text-muted:      #5A6B75;   /* Muted Neutral */
  --color-text-light:      #D6E4EC;   /* Light Text for Dark Sections */
  --color-border:          #DDD8CF;   /* Warm Cream Border */
  --color-border-light:    #EDE8DF;   /* Very Light Warm Border */
  --color-white:           #FFFFFF;   /* Pure White */

  /* Typography — Lora (Display Serif) + Inter (Body) — editorial pairing */
  --font-heading:  'Lora', Georgia, 'Times New Roman', serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display:  'Lora', Georgia, 'Times New Roman', serif;
  --font-ui:       'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Typography — Font Scale */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */
  --text-6xl:  3.75rem;    /* 60px */
  --text-7xl:  4.5rem;     /* 72px */

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

  /* Border Radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-pill: 50px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(11, 61, 94, 0.06), 0 1px 2px rgba(11, 61, 94, 0.04);
  --shadow-md:  0 4px 16px rgba(11, 61, 94, 0.08), 0 2px 6px rgba(11, 61, 94, 0.04);
  --shadow-lg:  0 10px 40px rgba(11, 61, 94, 0.10), 0 4px 12px rgba(11, 61, 94, 0.06);
  --shadow-xl:  0 20px 60px rgba(11, 61, 94, 0.14), 0 8px 24px rgba(11, 61, 94, 0.08);

  /* Transitions */
  --transition-fast:   150ms ease-out;
  --transition-base:   220ms ease-out;
  --transition-slow:   380ms cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Layout */
  --container-max:     1280px;
  --container-narrow:  900px;
  --nav-height:        76px;
  --section-padding:   108px 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. MODERN CSS RESET
   ───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-surface);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

input, button, textarea, select {
  font: inherit;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.7;
}

/* ─────────────────────────────────────────────────────────────────────────────
   3. BASE ELEMENT STYLES
   ───────────────────────────────────────────────────────────────────────────── */
::selection {
  background-color: rgba(91, 155, 138, 0.25);
  color: var(--color-text);
}

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

hr {
  border: none;
  border-top: 1px solid var(--color-border);
}

/* ─────────────────────────────────────────────────────────────────────────────
   4. TYPOGRAPHY CLASSES
   ───────────────────────────────────────────────────────────────────────────── */

/* Display — large hero headings */
.text-display {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 7vw, 7rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  font-weight: 400;
}

/* Section headings */
.text-section-heading {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-3xl), 3.5vw, var(--text-5xl));
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.text-section-sub {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.75;
  max-width: 600px;
  font-weight: 400;
}

/* Utility size classes */
.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); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }
.text-4xl  { font-size: var(--text-4xl); }
.text-5xl  { font-size: var(--text-5xl); }
.text-6xl  { font-size: var(--text-6xl); }
.text-7xl  { font-size: var(--text-7xl); }

/* Color utilities */
.text-primary  { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent   { color: var(--color-accent); }
.text-muted    { color: var(--color-text-muted); }
.text-light    { color: var(--color-text-light); }
.text-white    { color: var(--color-white); }

/* Weight utilities */
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

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

/* Font family utilities */
.font-heading { font-family: var(--font-heading); }
.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }

/* ─────────────────────────────────────────────────────────────────────────────
   5. LAYOUT UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

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

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-10);
  }
}

@media (min-width: 1200px) {
  .container {
    padding-inline: var(--space-16);
  }
}

/* Flex utilities */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.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-end     { justify-content: flex-end; }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }

/* Grid utilities */
.grid            { display: grid; }
.grid-cols-1     { grid-template-columns: 1fr; }
.grid-cols-2     { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3     { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4     { grid-template-columns: repeat(4, 1fr); }
.col-span-2      { grid-column: span 2; }

/* Responsive grid helpers */
.grid-auto-fit-sm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid-auto-fit-md {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ─────────────────────────────────────────────────────────────────────────────
   6. SPACING UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */
.section {
  padding: var(--section-padding);
}

.section--lg {
  padding: 120px 0;
}

.section--sm {
  padding: 64px 0;
}

/* Margin utilities */
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }

.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }

.mx-auto { margin-inline: auto; }

/* Padding utilities */
.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.p-10 { padding: var(--space-10); }
.px-4 { padding-inline: var(--space-4); }
.px-6 { padding-inline: var(--space-6); }
.py-4 { padding-block: var(--space-4); }
.py-6 { padding-block: var(--space-6); }

/* Width/height */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.w-auto  { width: auto; }

/* Display */
.block        { display: block; }
.inline-block { display: inline-block; }
.hidden       { display: none; }
.relative     { position: relative; }
.overflow-hidden { overflow: hidden; }

/* ─────────────────────────────────────────────────────────────────────────────
   7. ANIMATION KEYFRAMES
   ───────────────────────────────────────────────────────────────────────────── */

/* Scroll entrance animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Marquee scroll */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Scroll indicator bounce */
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%       { transform: translateY(8px); opacity: 1; }
}

/* Pulse for blobs */
@keyframes blobPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  33%       { transform: scale(1.05) rotate(2deg); }
  66%       { transform: scale(0.97) rotate(-2deg); }
}

/* Number count-up shimmer */
@keyframes shimmer {
  from { opacity: 0.4; }
  to   { opacity: 1; }
}

/* Fade in simple */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SCROLL ANIMATION CLASSES
   Elements start hidden; JS adds .is-visible to trigger the animation
   ───────────────────────────────────────────────────────────────────────────── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for children */
.stagger-children .animate-on-scroll:nth-child(1)  { transition-delay: 0ms; }
.stagger-children .animate-on-scroll:nth-child(2)  { transition-delay: 60ms; }
.stagger-children .animate-on-scroll:nth-child(3)  { transition-delay: 120ms; }
.stagger-children .animate-on-scroll:nth-child(4)  { transition-delay: 180ms; }
.stagger-children .animate-on-scroll:nth-child(5)  { transition-delay: 240ms; }
.stagger-children .animate-on-scroll:nth-child(6)  { transition-delay: 300ms; }
.stagger-children .animate-on-scroll:nth-child(7)  { transition-delay: 360ms; }
.stagger-children .animate-on-scroll:nth-child(8)  { transition-delay: 420ms; }

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SECTION LABEL BADGE
   ───────────────────────────────────────────────────────────────────────────── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-4);
}

.section-label::before {
  content: '';
  display: block;
  width: 20px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BACKGROUND UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */
.bg-surface      { background-color: var(--color-surface); }
.bg-surface-alt  { background-color: var(--color-surface-alt); }
.bg-surface-warm { background-color: var(--color-surface-warm); }
.bg-surface-dark { background-color: var(--color-surface-dark); }
.bg-primary      { background-color: var(--color-primary); }
.bg-white        { background-color: var(--color-white); }
