/* ============================================================
   chandkitarikh.today — Main CSS Design System
   Chand Ki Tarikh Today
   ============================================================ */

/* ── Google Fonts Import ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Noto+Serif:ital,wght@0,400;0,600;1,400&display=swap');

/* ── CSS Custom Properties (Design Tokens) ───────────────── */
:root {
  /* Colors — Light Mode */
  --color-bg:           #E0E0E0;
  --color-surface:      #FFFFFF;
  --color-surface-2:    #EDEDED;
  --color-surface-3:    #D6D6D6;
  --color-border:       #C8C8C8;
  --color-border-light: #D9D9D9;
  --color-text:         #1A1A1A;
  --color-text-muted:   #5A5A5A;
  --color-text-faint:   #888888;

  /* Accent — Deep Emerald */
  --color-accent:       #1A6B47;
  --color-accent-dark:  #145938;
  --color-accent-light: #E8F5EE;
  --color-accent-mid:   #2D8C60;

  /* Gold */
  --color-gold:         #9A7213;
  --color-gold-light:   #FBF3DC;
  --color-gold-mid:     #C49A2A;

  /* Status */
  --color-error:        #C0392B;
  --color-success:      #1A6B47;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(26,25,22,0.06), 0 1px 2px rgba(26,25,22,0.04);
  --shadow-md:   0 4px 12px rgba(26,25,22,0.08), 0 2px 4px rgba(26,25,22,0.04);
  --shadow-lg:   0 8px 24px rgba(26,25,22,0.10), 0 4px 8px rgba(26,25,22,0.05);
  --shadow-xl:   0 20px 60px rgba(26,25,22,0.12);
  --shadow-card: 0 2px 8px rgba(26,25,22,0.06), 0 0 0 1px rgba(26,25,22,0.04);

  /* Typography */
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Noto Serif', Georgia, serif;
  --font-arabic:'Noto Naskh Arabic', 'Traditional Arabic', serif;

  /* Type Scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;
  --text-hero: clamp(2.75rem, 6vw, 5rem);
  --text-date: clamp(3.5rem, 9vw, 7rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-full: 9999px;

  /* Layout */
  --max-width:       1200px;
  --max-width-prose: 72ch;
  --nav-height:      68px;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
}

/* ── Dark Mode ──────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:           #111210;
  --color-surface:      #1A1916;
  --color-surface-2:    #222019;
  --color-surface-3:    #2A2824;
  --color-border:       #302E29;
  --color-border-light: #252320;
  --color-text:         #F0EDE8;
  --color-text-muted:   #9E9A93;
  --color-text-faint:   #6B6860;

  --color-accent:       #2ECC87;
  --color-accent-dark:  #27B377;
  --color-accent-light: #0F2B1F;
  --color-accent-mid:   #25A06A;

  --color-gold:         #D4A827;
  --color-gold-light:   #2A2210;
  --color-gold-mid:     #B88F1A;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.15);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.40), 0 4px 8px rgba(0,0,0,0.20);
  --shadow-xl:   0 20px 60px rgba(0,0,0,0.50);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.30), 0 0 0 1px rgba(255,255,255,0.04);
}

/* ── Base Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL support */
[dir="rtl"] { font-family: var(--font-arabic), var(--font-sans); }

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p { color: var(--color-text); max-width: var(--max-width-prose); }
p + p { margin-top: var(--space-4); }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent-dark); }
a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

strong { font-weight: 600; }
em { font-style: italic; }

.text-arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  unicode-bidi: embed;
}

/* ── Layout Utilities ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
}

.section {
  padding-block: var(--space-20);
}

.section--sm { padding-block: var(--space-12); }
.section--lg { padding-block: var(--space-24); }

.prose {
  max-width: var(--max-width-prose);
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

@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-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Flex helpers */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-8);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card--flat {
  box-shadow: none;
  border: 1px solid var(--color-border);
}

.card--accent {
  border-color: var(--color-accent);
  border-width: 2px;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff !important;
  border-color: var(--color-accent);
}
.btn--primary:hover {
  background: var(--color-accent-dark);
  color: #fff !important;
  border-color: var(--color-accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 107, 71, 0.25);
}

.btn--outline {
  background: transparent;
  color: var(--color-accent) !important;
  border-color: var(--color-accent);
}
.btn--outline:hover {
  background: var(--color-accent-light);
  color: var(--color-accent-dark) !important;
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted) !important;
  border-color: var(--color-border);
}
.btn--ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text) !important;
}

.btn--sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn--lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge--accent {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.badge--gold {
  background: var(--color-gold-light);
  color: var(--color-gold);
}

/* ── Section Headers ─────────────────────────────────────── */
.section-header { text-align: center; margin-bottom: var(--space-12); }
.section-header h2 { margin-bottom: var(--space-4); }
.section-header p { color: var(--color-text-muted); margin-inline: auto; }
.section-eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

/* ── Dividers ───────────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
  border: none;
  margin-block: var(--space-8);
}

.divider--ornament {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-faint);
  font-size: var(--text-lg);
}
.divider--ornament::before,
.divider--ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ── Accessibility ──────────────────────────────────────── */
.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-3) var(--space-6);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 500;
  z-index: 9999;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 0; }

/* ── Responsive Helpers ─────────────────────────────────── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .section { padding-block: var(--space-12); }
  h1 { font-size: clamp(2rem, 7vw, 3rem); }
  h2 { font-size: var(--text-3xl); }
}
@media (min-width: 769px) {
  .show-mobile-only { display: none !important; }
}

/* ── Print ─────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
