/* ==============================================================
   Noon Sakinah & Tanween — Egypt Institute
   Brand: deep navy (#0b2239) + gold, matching the main site.
   System font stacks only — no external font/script imports,
   so this page is unaffected by strict CSP script-src/style-src.
   ============================================================== */

:root {
  --navy: #0b2239;
  --navy-deep: #071626;
  --navy-mid: #14304c;
  --paper: #FAF8F3;
  --ink: #1B2430;
  --ink-soft: #566072;
  --gold: #C9A227;
  --gold-soft: #E6C868;
  --line: #E4E0D4;
  --card: #FFFFFF;

  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* "Arial" was removed from this stack: on iOS/iPadOS it does not shape
     Arabic letters into their joined (cursive) forms, which made words
     appear as disconnected, isolated letters. Ending on the generic
     "sans-serif" instead lets each platform fall back to its own proper
     Arabic system font (e.g. Geeza Pro on iOS/macOS) with correct joining. */
  --font-arabic: "Geeza Pro", "Damascus", "Al Nile", "Traditional Arabic", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.arabic, .hero-ar, .letter-pill, .ikhfa-poem-ar, .learn-card-letters.arabic,
.arabic-big, .example-block-header h3, .noon-tanween, .next-letter,
.learn-card-letters, .example-block-header h4, .ikhfa-card-header h4 {
  font-family: var(--font-arabic);
}

/* Arabic text is set noticeably larger than the Latin body copy so the
   letters and diacritics stay crisp and easy to read at a glance. */
.arabic { font-size: 1.25em; line-height: 1.9; }
.hero-ar { font-size: 2rem; }
.letter-pill { font-size: 1.15rem; }
.ikhfa-poem-ar { font-size: 1.7rem; line-height: 2; }
.learn-card-letters { font-size: 1.15rem; }
.learn-card-letters.small { font-size: 0.95rem; letter-spacing: 0.03em; }
.example-block-header h3 { font-size: 1.35rem; }
.example-block-header h4, .ikhfa-card-header h4 { font-size: 1.15rem; }

/* ---------------- Header ---------------- */

.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
}

.header-left-flex, .header-right-flex {
  display: flex;
  align-items: center;
  gap: 22px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-circle img { display: block; width: 44px; height: 44px; border-radius: 50%; }

.logo-title { color: #FBF6E7; font-weight: 700; font-size: 0.92rem; letter-spacing: 0.03em; }
.logo-sub { color: var(--gold-soft); font-size: 0.62rem; letter-spacing: 0.08em; }

.nav-desktop { display: flex; gap: 18px; }
.nav-link {
  color: #C9D2DC;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; border-bottom-color: var(--gold); }

.nav-mobile { display: none; }

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.whatsapp-btn:hover { background: var(--gold-soft); }
.whatsapp-label { display: none; }

@media (min-width: 560px) {
  .whatsapp-label { display: inline; }
}

@media (max-width: 760px) {
  .nav-desktop { display: none; }
  .nav-mobile { display: flex; gap: 12px; font-size: 0.78rem; }
  .nav-link-mobile { text-decoration: none; }
  .nav-link-mobile.dim { color: #93A0AF; }
  .nav-link-mobile.light { color: #fff; }
  .header-right-flex { gap: 12px; }
}

/* ---------------- Main / Hero ---------------- */

.main { padding: 36px 20px 70px; }

.hero { text-align: center; margin-bottom: 30px; }
.hero h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hero-ar { font-size: 1.5rem; color: var(--gold); font-weight: 400; }

.card-shadow { box-shadow: 0 10px 30px rgba(11, 34, 57, 0.08); }

/* ---------------- Learn section ---------------- */

.learn-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  margin-bottom: 28px;
  scroll-margin-top: 84px;
}

.learn-title { margin: 0 0 16px; font-family: var(--font-serif); font-size: 1.2rem; color: var(--navy); }

.learn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 760px) { .learn-grid { grid-template-columns: repeat(2, 1fr); } }

.learn-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  font-family: inherit;
}
.learn-card:hover { border-color: var(--gold); }
.learn-card.active { border-color: var(--gold); background: #FBF6E7; }

.learn-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-soft);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.learn-card-title { font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.learn-card-desc { font-size: 0.78rem; color: var(--ink-soft); margin: 2px 0 4px; }
.learn-card-letters { font-size: 0.9rem; color: var(--gold); }
.learn-card-letters.small { font-size: 0.72rem; letter-spacing: 0.02em; }

/* ---------------- Content cards ---------------- */

.content-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 24px;
}
.scroll-mt { scroll-margin-top: 84px; }

.content-card > h2 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--navy);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.two-col h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--navy); }
.two-col p, .rule-desc { color: var(--ink-soft); margin: 0 0 12px; }

.example-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.sep { color: var(--gold); }

.arabic-big { font-size: 1.9rem; line-height: 2.1; }
.noon-tanween { color: #7A1414; font-weight: 700; }
.next-letter { color: var(--navy); font-weight: 700; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }

/* ---------------- Section header / badges ---------------- */

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.section-header h2 { margin: 0; font-family: var(--font-serif); font-size: 1.35rem; color: var(--navy); }

.badge-dark, .badge-light {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge-dark { background: var(--navy); color: var(--gold-soft); }
.badge-light { background: var(--paper); color: var(--navy); border: 1px solid var(--line); }

.subsection-title {
  margin: 22px 0 6px;
  font-size: 1.02rem;
  color: var(--navy);
  padding-top: 10px;
}
.subsection-title.dark-border { border-top: 1px solid var(--line); }
.subsection-desc { margin: 0 0 12px; color: var(--ink-soft); font-size: 0.88rem; }

.letters-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.letter-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.88rem;
  color: var(--navy);
}

/* ---------------- Example blocks ---------------- */

.example-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
}
.example-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
}
.example-block-header h3 { margin: 0; font-size: 1.1rem; color: #fff; }
.example-block-header span { font-size: 0.68rem; letter-spacing: 0.08em; color: var(--gold-soft); }

.example-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}
@media (max-width: 700px) { .example-grid { grid-template-columns: 1fr; } }

.example-cell {
  background: var(--card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.example-cell.muted { background: var(--paper); }
.example-label { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.ex-line + .ex-line { margin-top: 4px; }
.mt-8 { margin-top: 8px; }

/* ---------------- Ikhfa ---------------- */

.ikhfa-poem {
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  text-align: center;
}
.ikhfa-poem-ar { margin: 0 0 6px; font-size: 1.3rem; color: var(--gold-soft); }
.ikhfa-poem-en { margin: 0; font-size: 0.78rem; color: #C9D2DC; }

.ikhfa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 760px) { .ikhfa-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .ikhfa-grid { grid-template-columns: 1fr; } }

.ikhfa-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.ikhfa-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.ikhfa-card-header h4 { margin: 0; font-size: 0.95rem; color: var(--navy); }
.ikhfa-card-grid { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ikhfa-card-grid .muted { color: var(--ink-soft); }

/* ---------------- Reference table ---------------- */

.reference-section {
  background: var(--navy);
  color: #fff;
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 24px;
}
.reference-section h2 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 1.3rem; }
.reference-sub { margin: 0 0 18px; font-size: 0.85rem; color: #B8C2CE; font-weight: 400; }

.table-scroll { overflow-x: auto; }
.ref-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.ref-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--gold-soft);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}
.ref-table td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.9rem; }
.ref-table td.white { color: #fff; }
.ref-table td.bold { font-weight: 700; }
.ref-table td.dim { color: #C9D2DC; }
.ref-table td.muted { color: #8996A5; }
.ref-table td.accent { color: var(--gold-soft); font-weight: 600; }

/* ---------------- Footer ---------------- */

.footer { background: var(--navy-deep); color: #fff; padding: 30px 0 18px; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.footer-title { font-family: var(--font-serif); font-size: 1.1rem; color: var(--gold-soft); margin-bottom: 6px; }
.footer-desc { color: #B8C2CE; font-size: 0.88rem; max-width: 46ch; }
.footer-actions { display: flex; gap: 10px; }
.footer-btn { padding: 9px 16px; border-radius: 999px; text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.footer-btn.dark { background: rgba(255,255,255,0.08); color: #fff; }
.footer-btn.light { background: var(--gold); color: var(--navy-deep); }
.copy {
  text-align: center;
  font-size: 0.78rem;
  color: #7C8896;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
}

@media (max-width: 600px) {
  .footer-inner { flex-direction: column; text-align: center; }
}
