/* =========================================================
   Halaqa Canonical Design System — v1.0 (2026-06-29)
   ========================================================= */

/* ── Brand Tokens ── */
:root {
  --brand:       #f9795b;
  --brand-hover: #e86848;
  --brand-light: #fb8a6f;
  --primary:     #0d9488;
  --primary-dark:#0f766e;
  --primary-light:#0fdfd2;
  --wa-green:    #25D366;
  --text:        #1a1a2e;
  --text-2:      #64748b;
  --text-3:      #94a3b8;
  --text-4:      #475569;
  --text-5:      #334155;
  --text-6:      #1e293b;
  --text-7:      #0f172a;
  --border:      #e2e8f0;
  --border-2:    #f1f5f9;
  --light:       #f8fafc;
  --light-2:     #f0fdf4;
  --light-3:     #f0fdfa;
  --light-4:     #fef3ee;
  --light-5:     #fdf2f8;
  --light-6:     #fef2f2;
  --white:       #ffffff;
  --error:       #991b1b;
  --error-2:     #7f1d1d;
  --error-bg:    #fee2e2;
  --error-bg-2:  #fef2f2;
  --error-bg-3:  #fecaca;
  --success:     #166534;
  --success-2:   #065F46;
  --success-bg:  #dcfce7;
  --success-bg-2:#bbf7d0;
  --success-bg-3:#D1FAE5;
  --warn:        #92400e;
  --warn-bg:     #fef3c7;
  --warn-bg-2:   #fef9c3;
  --warn-bg-3:   #fcd34d;
  --warn-dark:   #b45309;
  --pink:        #db2777;
  --pink-bg:     #fdf2f8;
  --red:         #dc2626;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.65;
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
[dir=rtl] body { font-family: 'Cairo', -apple-system, sans-serif; }

/* ── Header ── */
.header {
  position: sticky; top: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  z-index: 200;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
}
.logo {
  font-size: 20px; font-weight: 700; color: var(--text);
  text-decoration: none; letter-spacing: -0.5px;
}
.logo span { color: var(--brand); }

/* ── Hamburger toggle ── */
.hamburger {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 6px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: transparent; cursor: pointer;
  transition: background .15s;
}
.hamburger:hover { background: var(--light); }
.hamburger span {
  display: block; width: 100%; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Side overlay ── */
.side-overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,46,.55);
  backdrop-filter: blur(3px);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.side-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Side panel ── */
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(340px, 92vw);
  background: var(--white);
  z-index: 400;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -4px 0 40px rgba(0,0,0,.15);
  overflow-y: auto;
}
.side-panel::-webkit-scrollbar { width: 4px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.side-panel.open { transform: translateX(0); }
[dir=rtl] .side-panel { right: auto; left: 0; transform: translateX(-100%); }
[dir=rtl] .side-panel.open { transform: translateX(0); }

/* ── Side panel internals ── */
.side-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.side-header .logo { font-size: 18px; font-weight: 700; }
.side-header .logo span { color: var(--brand); }
.side-close {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-2);
  transition: background .15s;
}
.side-close:hover { background: var(--light); color: var(--text); }
.side-section { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.side-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-2); margin-bottom: 10px;
}
.side-links { list-style: none; }
.side-links li { margin-bottom: 2px; }
.side-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  text-decoration: none; color: var(--text);
  transition: background .12s;
}
.side-links a:hover { background: var(--light); }
.side-links .icon { font-size: 16px; flex-shrink: 0; }
.side-links .arrow { margin-left: auto; color: var(--text-3); font-size: 14px; }
.side-links .tag {
  margin-left: auto; background: var(--brand); color: white;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.side-cta { padding: 18px 22px; }
.side-cta a {
  display: block; background: var(--brand); color: white;
  text-align: center; padding: 13px; border-radius: 10px;
  text-decoration: none; font-weight: 700; font-size: 15px;
  transition: background .15s;
}
.side-cta a:hover { background: var(--brand-hover); }

/* ── Language toggle ── */
.lang-toggle {
  display: flex; border: 1.5px solid var(--border); border-radius: 6px; overflow: hidden;
}
.lang-toggle button {
  border: none; background: transparent; padding: 5px 12px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background .12s;
}
.lang-toggle button.active { background: var(--brand); color: white; }
.lang-toggle button:hover:not(.active) { background: var(--light); }

/* ── Container ── */
.container { max-width: 840px; margin: 0 auto; padding: 0 28px; }

/* ── Buttons ── */
.btn {
  display: inline-block; padding: 14px 28px;
  background: var(--brand); color: white;
  border: none; border-radius: 10px;
  font-size: 16px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--brand-hover); }
.btn-teal {
  background: var(--primary); color: white;
}
.btn-teal:hover { background: var(--primary-dark); }

/* ── Links ── */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Footer ── */
.footer {
  text-align: center; padding: 40px 20px;
  color: var(--text-2); font-size: 14px;
  border-top: 1px solid var(--border); margin-top: 60px;
}
.footer a { color: var(--primary); }

/* ── Utility ── */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }

/* ── A11y: visible focus ring for keyboard users ── */
*:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── A11y: skip-to-main link (hidden until focused) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--white);
  font-weight: 700;
  border-radius: 6px;
  z-index: 9999;
}
.skip-link:focus { left: 8px; }

/* ── WCAG AA: high-contrast link variant for normal-weight links ── */
.link-high-contrast {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── WCAG AA: text-on-brand accessible variant (for orange button labels) ── */
.btn-text-on-brand {
  color: var(--white);
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

/* ── Accessibility Fixes (v2) ─────────────────────────────── */
:root {
  /* Accessible brand — #c14800 passes 4.5:1 on white */
  --brand: #c14800;
  --brand-raw: #f9795b;  /* original for decorative use */
}
.brand-raw { color: var(--brand-raw) !important; }

/* Fix .tag elements (was 10px brand-colored text on white — fails) */
.side-links .tag {
  background: var(--brand-raw); /* background — contrast fine */
  color: white; /* text is white — fine */
}
.tag {
  background: var(--brand-raw);
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* Skip link style */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand);
  color: white;
  padding: 8px 16px;
  z-index: 1000;
  transition: top .2s;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--primary);
}

/* Ensure main landmark has visible focus */
main:target {
  scroll-margin-top: 80px;
}

/* Focus ring for interactive elements */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* Large text (18pt+) can still use brand-raw (3:1 passes) */
h1, h2, h3, .brand-accent {
  color: var(--brand-raw);
}
