/* ==========================================================================
   Wadantech HMS — Design System
   Tokens, base styles, layout primitives
   ========================================================================== */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

/* --- Design tokens --- */
:root {
  /* Brand colors */
  --ink-900: #0A1F3D;          /* Deep navy — primary brand */
  --ink-800: #112B52;
  --ink-700: #1B3A6B;
  --ink-600: #2C4F87;

  --cyan-700: #00677a;
  --cyan-600: #0090a8;          /* Premium medical cyan */
  --cyan-500: #0cc0d8;
  --cyan-400: #22D3EE;
  --cyan-100: #CFFAFE;
  --cyan-50:  #ECFEFF;

  --teal-600: #0D9488;
  --green-500: #10B981;
  --amber-500: #F59E0B;
  --red-500:   #EF4444;
  --rose-500:  #F43F5E;
  --violet-500: #8B5CF6;

  /* Neutrals (warm) */
  --bg:           #FAFAF9;
  --surface:      #FFFFFF;
  --surface-2:    #F4F4F2;
  --surface-3:    #E7E7E3;
  --border:       #E5E7EB;
  --border-strong:#D1D5DB;
  --muted:        #6B7280;
  --text:         #111827;
  --text-soft:    #374151;

  /* Semantic */
  --primary:      var(--ink-900);
  /* Teal aligned pixel-exact with the admin redesign (Phase 12) so brand
     colour is identical across the public site and the admin portal. */
  --accent:       #0090a8;
  --accent-hover: #007a8f;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-2xl: 32px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 0 6px rgba(0, 144, 168, 0.12);

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;

  /* Type */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-arabic: 'Noto Naskh Arabic', 'Plus Jakarta Sans', sans-serif;
  --font-persian: 'Vazirmatn', 'Plus Jakarta Sans', sans-serif;

  /* Layout */
  --container: 1240px;
  --header-h: 76px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 150ms;
  --dur-2: 240ms;
  --dur-3: 400ms;
}

/* Dark mode */
[data-theme="dark"] {
  --bg:           #08152B;
  --surface:      #0E1F3E;
  --surface-2:    #142A51;
  --surface-3:    #1B3865;
  --border:       #1F3866;
  --border-strong:#2A4A82;
  --muted:        #94A3B8;
  --text:         #F1F5F9;
  --text-soft:    #CBD5E1;

  --primary:      var(--cyan-400);
  --accent:       var(--cyan-400);
  --accent-hover: var(--cyan-300, #67E8F9);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.6);
}

/* --- Reset / Base --- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[lang="fa"] body, [lang="ps"] body { font-family: var(--font-persian); }
[lang="ar"] body { font-family: var(--font-arabic); }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

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

h1, h2, h3, h4, h5 {
  font-family: var(--font-sans);
  color: var(--text);
  margin: 0 0 var(--s-3);
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-weight: 700;
  text-wrap: balance;
}
[lang="fa"] h1, [lang="fa"] h2, [lang="fa"] h3, [lang="fa"] h4, [lang="fa"] h5,
[lang="ps"] h1, [lang="ps"] h2, [lang="ps"] h3, [lang="ps"] h4, [lang="ps"] h5 { font-family: var(--font-persian); letter-spacing: 0; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3, [lang="ar"] h4, [lang="ar"] h5 { font-family: var(--font-arabic); letter-spacing: 0; }

h1 { font-size: clamp(2.25rem, 4vw + 1rem, 3.75rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 2.5vw + 0.5rem, 2.5rem); }
h3 { font-size: clamp(1.25rem, 1vw + 1rem, 1.5rem); }
h4 { font-size: 1.125rem; }

p { margin: 0 0 var(--s-4); color: var(--text-soft); text-wrap: pretty; }

/* --- Layout primitives --- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

section { padding-block: clamp(60px, 8vw, 110px); }

.eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan-600);
  margin-bottom: var(--s-3);
}

.section-head { max-width: 720px; margin: 0 auto var(--s-12); text-align: center; }
.section-head h2 { color: var(--ink-900); margin-bottom: var(--s-3); }
[data-theme="dark"] .section-head h2 { color: var(--text); }
.section-head p { color: var(--muted); font-size: 1.0625rem; }

.grid { display: grid; gap: var(--s-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Note: .row also exists in Bootstrap (still loaded for legacy pages like appointment
   booking wizard). We add `flex-wrap` + `gap` so the class works whether or not
   Bootstrap is loaded, and so legacy `.row > .col-lg-4` markup wraps to multiple lines. */
.row { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.col { display: flex; flex-direction: column; gap: var(--s-4); }

.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* --- Reveal animations (intersection-observer driven via .reveal-in) --- */
/* default visible (no-JS fallback). JS adds .js-reveal-ready to html which switches them to hidden until is-in. */
.reveal { opacity: 1; transform: none; transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.js-reveal-ready .reveal { opacity: 0; transform: translateY(24px); }
.js-reveal-ready .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* Utility text */
.text-center { text-align: center; }
.text-gradient {
  background: linear-gradient(120deg, var(--ink-900) 0%, var(--cyan-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-theme="dark"] .text-gradient {
  background: linear-gradient(120deg, #E0F2FE 0%, var(--cyan-400) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
