/* ── CSS Custom Properties ──────────────────────────────── */
:root {
  --navy:          #1a2e3b;
  --navy-mid:      #2c4a5a;
  --cream:         #f7f5f0;
  --cream-dark:    #eceae3;
  --border:        #dddad3;
  --border-light:  #ebe9e2;
  --text:          #1a1a1a;
  --text-mid:      #3a3a3a;
  --text-muted:    #696766;
  --teal:          #2e8b7a;
  --amber:         #b5651d;
  --amber-bg:      #fdf6ec;
  --amber-border:  #ddb88a;
  --white:         #ffffff;
  --max-width:     780px;
  --page-padding:  40px;
}

/* ── Reset + RTL defaults ───────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
}

html, body {
  font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  text-align: right;
}

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

/* ── Skip link (keyboard a11y) ──────────────────────────── */
.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  inset-block-start: 8px;
  background: var(--navy);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  text-decoration: none;
}

.skip-link:focus {
  inset-inline-start: 8px;
}

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

/* Search input has its own box-shadow focus style */
.search-input:focus-visible {
  outline: none;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  background: var(--navy);
  padding: 0 var(--page-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.brand-dot {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, .92);
  letter-spacing: .01em;
}

.topbar-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.topbar-nav a {
  color: rgba(255, 255, 255, .65);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 5px;
  transition: color .15s, background .15s;
}

.topbar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

/* Active nav state — controlled by data-page on <body> and data-nav on <a> */
body[data-page="home"]      [data-nav="home"],
body[data-page="sources"]   [data-nav="sources"],
body[data-page="skills"]    [data-nav="skills"],
body[data-page="templates"] [data-nav="templates"],
body[data-page="start"]     [data-nav="start"] {
  color: rgba(255, 255, 255, .92);
}

.nav-cta {
  color: var(--teal) !important;
  border: 1px solid rgba(46, 139, 122, .4);
  font-size: 12px !important;
}

.nav-cta:hover {
  background: rgba(46, 139, 122, .12) !important;
  color: var(--teal) !important;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  padding: 64px var(--page-padding) 52px;
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid rgba(46, 139, 122, .3);
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 22px;
  background: rgba(46, 139, 122, .04);
}

.hero-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.35;
  margin-bottom: 14px;
  letter-spacing: -.01em;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.75;
}

/* ── Search ─────────────────────────────────────────────── */
.search-wrap {
  max-width: 520px;
  margin: 0 auto 12px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 13px 52px 13px 20px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  direction: rtl;
  text-align: right;
}

.search-input:focus {
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(44, 74, 90, .08);
}

.search-input::placeholder { color: #b0ada6; }

.search-icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9a9890;
  font-size: 16px;
  pointer-events: none;
  line-height: 1;
}

.search-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 7px;
  text-align: center;
  margin-bottom: 36px;
}

/* ── Search dropdown ────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(26, 46, 59, .10);
  z-index: 100;
  overflow: hidden;
  display: none;
}

.search-dropdown.visible { display: block; }

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--border-light);
  text-align: right;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--cream); }

.result-type {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: .06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.result-type-skill   { background: #eef7f4; color: var(--teal); }
.result-type-source  { background: #eef3f7; color: var(--navy); }
.result-type-prompt  { background: #fdf6ec; color: var(--amber); }

.result-text { flex: 1; min-width: 0; }

.result-title-ar {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.result-title-en {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Segoe UI', sans-serif;
  direction: ltr;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-result {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.search-no-result a { color: var(--teal); text-decoration: underline; }

/* ── Section divider ────────────────────────────────────── */
.section-divider {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  border: none;
  border-bottom: 1px solid var(--border-light);
}

/* ── Nav cards ──────────────────────────────────────────── */
.cards-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px var(--page-padding) 48px;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.nav-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s, box-shadow .2s, transform .15s;
}

.nav-card:hover {
  border-color: var(--navy-mid);
  box-shadow: 0 4px 16px rgba(26, 46, 59, .08);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.card-arrow {
  font-size: 16px;
  color: var(--border);
  margin-top: 2px;
  transition: color .15s;
  font-family: 'Segoe UI', sans-serif;
}

.nav-card:hover .card-arrow { color: var(--navy-mid); }

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 3px;
}

.card-title-en {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
  font-family: 'Segoe UI', sans-serif;
  direction: ltr;
  text-align: left;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .04em;
}

/* ── Disclaimer ─────────────────────────────────────────── */
.disclaimer-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding) 56px;
}

.disclaimer-box {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-inline-start: 4px solid var(--amber);
  border-radius: 8px;
  padding: 18px 22px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.disc-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

.disc-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 6px;
}

.disc-body-ar {
  font-size: 12px;
  color: #6b4c2a;
  line-height: 1.7;
  margin-bottom: 6px;
}

.disc-body-en {
  font-size: 12px;
  color: #6b4c2a;
  line-height: 1.7;
  direction: ltr;
  text-align: left;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--navy);
  padding: 24px var(--page-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-size: 12px;
  color: rgba(255, 255, 255, .75);
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a {
  font-size: 12px;
  color: rgba(255, 255, 255, .75);
  transition: color .15s;
}

.footer-links a:hover { color: #fff; }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cards-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px var(--page-padding) 36px; }
}

@media (max-width: 600px) {
  :root { --page-padding: 20px; }

  /* Hide all nav links except the GitHub CTA on mobile */
  .topbar-nav a:not(.nav-cta) { display: none; }

  .hero-title    { font-size: 22px; }
  .hero-subtitle { font-size: 14px; }
  .cards-section { padding-top: 28px; }
  .nav-card      { padding: 16px; }
  .card-title    { font-size: 14px; }

  .disclaimer-box { flex-direction: column; gap: 8px; }

  .footer        { flex-direction: column; gap: 12px; text-align: center; }
  .footer-links  { justify-content: center; }
}

/* ── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .nav-card { transition: none; }
}

/* ═══════════════════════════════════════════════════════════
   NEW SECTIONS — site-improvements
   ═══════════════════════════════════════════════════════════ */

/* ── Stats bar ──────────────────────────────────────────── */
.stats-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px var(--page-padding);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 32px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--teal);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── How-to section ─────────────────────────────────────── */
.how-to-section {
  background: var(--cream-dark);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 48px var(--page-padding);
}

.how-to-inner,
.comparison-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 28px;
  text-align: center;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.step-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-icon {
  font-size: 26px;
  line-height: 1;
}

.step-number {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--teal);
}

.step-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.step-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
}

.step-btn {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  border: 1px solid rgba(46, 139, 122, .35);
  border-radius: 6px;
  padding: 6px 12px;
  transition: background .15s;
  align-self: flex-start;
}

.step-btn:hover {
  background: rgba(46, 139, 122, .06);
}

/* ── Before/After comparison ────────────────────────────── */
.comparison-section {
  padding: 48px var(--page-padding) 32px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.comparison-box {
  border-radius: 10px;
  padding: 20px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comparison-without {
  background: #fff5f5;
  border-color: #fca5a5;
}

.comparison-with {
  background: #f0fdf4;
  border-color: #86efac;
}

.comparison-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.comparison-icon { font-size: 16px; }

.comparison-q {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.comparison-a {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
  background: rgba(255, 255, 255, .7);
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, .06);
}

.comparison-note {
  font-size: 11px;
  color: #9b1c1c;
  background: rgba(252, 165, 165, .2);
  border-radius: 4px;
  padding: 4px 8px;
}

.comparison-note-ok {
  color: #166534;
  background: rgba(134, 239, 172, .25);
}

/* ── Templates note ─────────────────────────────────────── */
.templates-note {
  background: rgba(46, 139, 122, .08);
  border: 1px solid rgba(46, 139, 122, .25);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--teal);
  margin-bottom: 20px;
  text-align: center;
}

/* ── Floating suggestion button ─────────────────────────── */
.suggest-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--amber);
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(181, 101, 29, .35);
  z-index: 150;
  transition: background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
  text-decoration: none;
}

.suggest-btn:hover {
  background: #9a4f18;
  box-shadow: 0 6px 20px rgba(181, 101, 29, .45);
  transform: translateY(-1px);
}

/* ── Visitor counter ────────────────────────────────────── */
.footer-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.visitor-label {
  font-size: 10px;
  color: rgba(255, 255, 255, .5);
  letter-spacing: .06em;
}

.visitor-badge {
  height: 20px;
  opacity: .85;
}

/* ── Start page steps ───────────────────────────────────── */
.start-steps {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px var(--page-padding) 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  list-style: none;
}

.start-step {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.step-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.start-step-body { flex: 1; }

.start-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.start-step-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.start-step-desc a { color: var(--teal); text-decoration: underline; }

kbd {
  display: inline-block;
  font-size: 12px;
  font-family: 'Segoe UI', monospace;
  background: var(--cream-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text-mid);
}

.copy-example {
  margin-top: 10px;
  background: var(--navy);
  color: rgba(255, 255, 255, .88);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  user-select: all;
  cursor: text;
}

/* ── Responsive additions ───────────────────────────────── */
@media (max-width: 768px) {
  .steps-grid      { grid-template-columns: 1fr; }
  .comparison-grid { grid-template-columns: 1fr; }
  .stat-divider    { display: none; }
  .stat-item       { padding: 0 16px; }
}

@media (max-width: 600px) {
  .suggest-btn       { font-size: 12px; padding: 9px 14px; bottom: 16px; left: 16px; }
  .how-to-section    { padding: 32px var(--page-padding); }
  .comparison-section { padding: 32px var(--page-padding) 24px; }
  .stats-bar         { padding: 20px var(--page-padding); flex-wrap: wrap; gap: 12px; }
  .section-heading   { font-size: 17px; }
}
