/* ============================================================
   نادي العلوم الاكتوارية — جامعة الملك سعود
   Design system
   ============================================================ */
:root {
  --petrol: #00292E;
  --teal: #0D4A4F;
  --green: #4CAF50;
  --mint: #B8F0C0;
  --fresh: #7CE285;
  --offwhite: #F4F4F1;
  --slate: #5E7377;
  --white: #FFFFFF;

  --font-ar: 'Tajawal', sans-serif;
  --font-en: 'Montserrat', sans-serif;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 6px 24px rgba(0, 41, 46, 0.08);
  --shadow-lg: 0 14px 40px rgba(0, 41, 46, 0.14);
  --maxw: 1140px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--font-ar);
  background: var(--offwhite);
  color: var(--petrol);
  line-height: 1.7;
  direction: rtl;
}

.en, .num { font-family: var(--font-en); }

/* ---------- Loading screen ---------- */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--petrol);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#preloader.done {
  opacity: 0;
  visibility: hidden;
}
#preloader .preloader-logo {
  width: 150px;
  height: auto;
  margin: 0 auto;
  display: block;
  animation: preloader-pulse 1.4s ease-in-out infinite;
}
@keyframes preloader-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #preloader .preloader-logo { animation: none; }
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--petrol);
  border-bottom: 1px solid rgba(184, 240, 192, 0.12);
  transition: transform 0.3s ease;
}
.navbar.nav-hidden { transform: translateY(-100%); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--white); }
.brand img { width: 42px; height: auto; }
.brand-name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.brand-sub { display: block; font-size: 0.72rem; color: var(--mint); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: rgba(244, 244, 241, 0.85);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover, .nav-links a:focus-visible { background: var(--teal); color: var(--mint); }
.nav-links a.nav-cta {
  background: var(--mint);
  color: var(--petrol);
  font-weight: 700;
  margin-inline-start: 6px;
}
.nav-links a.nav-cta:hover { background: var(--fresh); color: var(--petrol); }

/* زر الهمبرغر — مخفي على الكمبيوتر */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

/* ---------- Hero ---------- */
.hero {
  background: var(--petrol);
  color: var(--offwhite);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset-inline-start: -10%;
  bottom: -35%;
  width: 55%;
  height: 120%;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.35), rgba(124, 226, 133, 0.12));
  transform: skewX(-12deg);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  padding: 88px 0 96px;
  max-width: 720px;
}
.hero-eyebrow {
  display: inline-block;
  border: 1px solid rgba(184, 240, 192, 0.45);
  color: var(--mint);
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 0.85rem;
  margin-bottom: 20px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.25; }
.hero .hero-en {
  color: rgba(244, 244, 241, 0.65);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  margin-top: 6px;
  direction: ltr;
  text-align: right;
  overflow-wrap: break-word;
  word-break: break-word;
}
.hero-tagline {
  color: var(--mint);
  font-weight: 700;
  font-size: 1.15rem;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-tagline::before {
  content: '';
  width: 44px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green), var(--fresh));
}
.hero-actions { margin-top: 34px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 26px;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.15s, background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-mint { background: var(--mint); color: var(--petrol); }
.btn-mint:hover { background: var(--fresh); }
.btn-outline-mint { background: transparent; color: var(--mint); border: 1.5px solid var(--mint); }
.btn-outline-mint:hover { background: rgba(184, 240, 192, 0.12); }
.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover { background: #3f9443; }
.btn-ghost { background: transparent; color: var(--slate); border: 1.5px solid var(--slate); }
.btn-outline-teal { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn-outline-teal:hover { background: rgba(13, 74, 79, 0.08); }

/* ---------- Preview modal ---------- */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 41, 46, 0.6);
}
.preview-dialog {
  position: relative;
  background: var(--offwhite);
  border-radius: var(--radius);
  width: 100%;
  max-width: 820px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin: auto;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--petrol);
  color: var(--offwhite);
  padding: 14px 20px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}
.preview-x {
  background: transparent;
  border: none;
  color: var(--offwhite);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.preview-x:hover { background: rgba(244, 244, 241, 0.12); }
.preview-body { padding: 28px 26px 36px; }.btn-danger { background: transparent; color: #b3413a; border: 1.5px solid #b3413a; }
.btn-danger:hover { background: #b3413a; color: var(--white); }
.btn-sm { padding: 7px 16px; font-size: 0.88rem; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-dark { background: var(--petrol); color: var(--offwhite); }
.section-head { margin-bottom: 36px; }
.section-head h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-head h2::before {
  content: '';
  width: 34px;
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--green), var(--fresh));
  flex-shrink: 0;
}
.section-head p { color: var(--slate); margin-top: 8px; }
.section-dark .section-head p { color: rgba(244, 244, 241, 0.7); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.filter-btn {
  background: var(--white);
  border: 1.5px solid rgba(94, 115, 119, 0.35);
  color: var(--slate);
  border-radius: 999px;
  padding: 8px 22px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--green); color: var(--green); }
.filter-btn.active { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 700; }

/* ---------- Event cards ---------- */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.event-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.event-img {
  height: 170px;
  background: linear-gradient(135deg, var(--teal), var(--petrol));
  position: relative;
}
.event-img img { width: 100%; height: 100%; object-fit: cover; }
.event-img .img-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.event-img .img-fallback img { width: 64px; height: auto; object-fit: contain; opacity: 0.9; }
.event-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.event-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tag {
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 0.78rem;
  font-weight: 700;
}
.tag-upcoming { background: rgba(76, 175, 80, 0.14); color: #2e7d32; }
.tag-past { background: rgba(94, 115, 119, 0.14); color: var(--slate); }
.event-date {
  color: var(--slate);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.event-card h3 { font-size: 1.15rem; font-weight: 700; color: var(--petrol); }
.event-card p { color: var(--slate); font-size: 0.93rem; flex: 1; }
.event-loc { color: var(--teal); font-size: 0.87rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }

.empty-state {
  text-align: center;
  color: var(--slate);
  padding: 48px 0;
  grid-column: 1 / -1;
}

/* ---------- Articles ---------- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.article-card {
  background: var(--teal);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}
.article-card:hover { transform: translateY(-4px); }
.article-card .event-img { height: 150px; background: linear-gradient(135deg, var(--petrol), var(--teal)); }
.article-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.article-body h3 { color: var(--mint); font-size: 1.1rem; font-weight: 700; }
.article-body p { color: rgba(244, 244, 241, 0.75); font-size: 0.9rem; flex: 1; }
.article-body time { color: rgba(184, 240, 192, 0.7); font-size: 0.8rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
.about-text p { color: rgba(244, 244, 241, 0.85); font-size: 1.05rem; }
.about-cards { display: grid; gap: 14px; }
.about-card {
  background: var(--teal);
  border-radius: var(--radius);
  padding: 18px 22px;
  border-inline-start: 4px solid var(--fresh);
}
.about-card h4 { color: var(--mint); font-weight: 700; margin-bottom: 4px; }
.about-card p { color: rgba(244, 244, 241, 0.75); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.footer { background: var(--petrol); color: rgba(244, 244, 241, 0.75); padding: 44px 0 30px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { width: 40px; }
.footer-brand strong { color: var(--offwhite); display: block; }
.footer-brand span { font-size: 0.85rem; }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(184, 240, 192, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mint);
  transition: background 0.2s;
}
.footer-social a:hover { background: var(--teal); }
.footer-social svg { width: 18px; height: 18px; fill: currentColor; }
.footer-bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(184, 240, 192, 0.12);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- Auth / Admin ---------- */
.auth-wrap {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--petrol);
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}
.auth-card .logo { width: 64px; margin: 0 auto 18px; }
.auth-card h1 { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 4px; }
.auth-card .sub { color: var(--slate); text-align: center; font-size: 0.9rem; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1.5px solid rgba(94, 115, 119, 0.35);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--white);
  color: var(--petrol);
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--green);
}
.field input[type='email'] { direction: ltr; text-align: left; font-family: var(--font-en); }
.field textarea { resize: vertical; min-height: 100px; }

.alert {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: rgba(179, 65, 58, 0.1); color: #b3413a; }
.alert-ok { background: rgba(76, 175, 80, 0.12); color: #2e7d32; }

/* Admin layout */
.admin-bar {
  background: var(--teal);
  color: var(--offwhite);
  padding: 12px 0;
}
.admin-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-bar .who { font-size: 0.9rem; color: var(--mint); direction: ltr; font-family: var(--font-en); }
.admin-section { padding: 40px 0 72px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.admin-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 28px;
}
.admin-panel h3 { font-weight: 800; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.upload-box {
  border: 2px dashed rgba(94, 115, 119, 0.4);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  color: var(--slate);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.upload-box:hover { border-color: var(--green); color: var(--green); }
.upload-preview {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.preview-item {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(94, 115, 119, 0.25);
  background: var(--offwhite);
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(179, 65, 58, 0.92);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-remove:hover { background: #b3413a; }

.admin-list { display: grid; gap: 12px; }
.admin-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--offwhite);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  flex-wrap: wrap;
}
.admin-item .thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--teal);
  flex-shrink: 0;
}
.admin-item .meta { flex: 1; min-width: 200px; }
.admin-item .meta strong { display: block; }
.admin-item .meta span { color: var(--slate); font-size: 0.85rem; }
.admin-item .actions { display: flex; gap: 8px; }

.hidden { display: none !important; }

/* ---------- Show more ---------- */
.show-more-wrap { display: flex; justify-content: center; margin-top: 28px; }
.show-more-btn { min-width: 160px; }

/* ---------- Rich text editor (admin) ---------- */
.rich-editor {
  min-height: 220px;
  background: var(--white);
  border-radius: var(--radius-sm);
}
.ql-toolbar.ql-snow, .ql-container.ql-snow {
  border-color: rgba(94, 115, 119, 0.35);
  font-family: var(--font-ar);
}
.ql-toolbar.ql-snow { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.ql-editor { min-height: 200px; font-size: 1rem; direction: rtl; text-align: right; }
.ql-editor.ql-blank::before { right: 15px; left: auto; font-style: normal; color: var(--slate); }

/* ---------- Rich content (published articles/events) ---------- */
.rich-content { font-size: 1.08rem; line-height: 1.9; color: var(--petrol); }
.rich-content h2 { font-size: 1.5rem; font-weight: 800; margin: 28px 0 12px; color: var(--petrol); }
.rich-content h3 { font-size: 1.2rem; font-weight: 700; margin: 22px 0 10px; color: var(--teal); }
.rich-content p { margin-bottom: 16px; }
.rich-content ul, .rich-content ol { margin: 0 24px 16px 0; padding-inline-start: 20px; }
.rich-content li { margin-bottom: 6px; }
.rich-content a { color: var(--green); text-decoration: underline; }
.rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 20px 0;
  border: 1px solid rgba(94, 115, 119, 0.15);
}
.rich-content strong { font-weight: 700; }

/* ---------- Vision / Mission / Values ---------- */
.identity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 36px;
}
.identity-card {
  background: var(--petrol);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.identity-card h4 { color: var(--mint); font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.identity-card p { color: rgba(244, 244, 241, 0.85); font-size: 0.98rem; }
.identity-vision { border-inline-start: 4px solid var(--fresh); }
.identity-mission { border-inline-start: 4px solid var(--green); }

.values-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.values-label { color: var(--mint); font-weight: 700; margin-inline-end: 8px; }
.value-chip {
  background: rgba(184, 240, 192, 0.14);
  color: var(--mint);
  border: 1px solid rgba(184, 240, 192, 0.3);
  border-radius: 999px;
  padding: 6px 18px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Strategic goals ---------- */
.goals-list { display: grid; gap: 14px; }
.goal-item {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.goal-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--fresh));
  color: var(--white);
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.goal-body h4 { font-size: 1.08rem; font-weight: 700; color: var(--petrol); margin-bottom: 4px; }
.goal-body p { color: var(--slate); font-size: 0.95rem; }

/* ---------- Operational plan ---------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}
.plan-card {
  background: var(--teal);
  border-radius: var(--radius);
  padding: 22px 20px;
  border-top: 4px solid var(--fresh);
}
/* عند الوضع الداكن (داخل قسم من نحن) نخلي البطاقة أغمق للتباين */
.plan-card-alt {
  background: var(--petrol);
}
.plan-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(184, 240, 192, 0.16);
  color: var(--mint);
  font-weight: 700;
  margin-bottom: 12px;
}
.plan-card h4 { color: var(--mint); font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.plan-card p { color: rgba(244, 244, 241, 0.75); font-size: 0.9rem; }

/* ---------- Subsection header (inside a section) ---------- */
.subsection-head { margin: 48px 0 24px; }
.subsection-head h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--offwhite);
  display: flex;
  align-items: center;
  gap: 12px;
}
.subsection-head h3::before {
  content: '';
  width: 26px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green), var(--fresh));
  flex-shrink: 0;
}
.subsection-head p { color: rgba(244, 244, 241, 0.7); margin-top: 6px; }

/* عند وضع قائمة الأهداف على خلفية داكنة */
.goals-on-dark .goal-item { background: var(--petrol); box-shadow: none; }
.goals-on-dark .goal-body h4 { color: var(--offwhite); }
.goals-on-dark .goal-body p { color: rgba(244, 244, 241, 0.72); }

/* ---------- Clickable cards ---------- */
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-link:focus-visible { outline: 3px solid var(--fresh); outline-offset: 3px; border-radius: var(--radius); }

/* ---------- Detail page ---------- */
.detail { padding: 56px 0 80px; }
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 24px;
  font-size: 0.95rem;
}
.detail-back:hover { color: var(--green); }
.detail-hero-img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 28px;
  background: var(--offwhite);
  border: 1px solid rgba(94, 115, 119, 0.18);
}

/* ---------- Slider gallery ---------- */
.gallery {
  position: relative;
  margin-bottom: 28px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--offwhite);
  border: 1px solid rgba(94, 115, 119, 0.18);
}
.gallery-track {
  display: flex;
  transition: transform 0.35s ease;
}
.gallery-slide {
  min-width: 100%;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--offwhite);
}
.gallery-slide img { width: 100%; height: 100%; object-fit: contain; }
.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 41, 46, 0.78);
  color: var(--offwhite);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 2;
}
.gallery-btn:hover { background: var(--petrol); }
.gallery-btn.prev { right: 14px; }
.gallery-btn.next { left: 14px; }
.gallery-dots {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}
.gallery-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(244, 244, 241, 0.55);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s;
}
.gallery-dot.active { background: var(--fresh); }
.gallery-counter {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 41, 46, 0.78);
  color: var(--offwhite);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.82rem;
  font-family: var(--font-en);
  z-index: 2;
}
@media (max-width: 640px) {
  .gallery-slide { height: 300px; }
  .gallery-btn { width: 38px; height: 38px; font-size: 1.2rem; }
}
.detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.detail h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.3; margin-bottom: 12px; }
.detail-sub { color: var(--slate); font-size: 0.95rem; display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.detail-sub span { display: inline-flex; align-items: center; gap: 6px; }
.detail-content {
  font-size: 1.08rem;
  line-height: 1.9;
  color: var(--petrol);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.detail-loading { text-align: center; color: var(--slate); padding: 60px 0; }

.loader { text-align: center; color: var(--slate); padding: 32px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero-inner { padding: 64px 0 72px; }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }

  /* Navbar: brand centered on top (bigger logo), hamburger opens drawer */
  .navbar { z-index: 1002; }
  .nav-inner { flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; min-height: 0; position: relative; }
  .brand { flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px; }
  .brand img { width: 56px; }
  .brand-name { font-size: 0.95rem; line-height: 1.3; }
  .brand-sub { font-size: 0.66rem; }

  /* زر الهمبرغر أعلى اليمين */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    position: absolute;
    top: 14px;
    right: 4px;
    left: auto;
    width: 42px;
    height: 42px;
    padding: 9px;
    background: transparent;
    border: none;
    border-radius: 10px;
    z-index: 60;
  }
  .nav-toggle span {
    display: block;
    height: 2.5px;
    width: 100%;
    background: var(--offwhite);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.2s;
  }
  .nav-toggle.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .nav-toggle.active span:nth-child(2) { opacity: 0; }
  .nav-toggle.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

  /* الروابط تصير قائمة منزلقة من اليمين */
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    height: 100vh;
    width: 76%;
    max-width: 300px;
    background: var(--petrol);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 80px 20px 24px;
    transform: translateX(105%);
    transition: transform 0.3s ease;
    z-index: 1002;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    flex-wrap: nowrap;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a {
    padding: 16px 16px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--offwhite);
    border-radius: var(--radius-sm);
    text-align: right;
    border-bottom: 1px solid rgba(184, 240, 192, 0.12);
    display: block;
    width: 100%;
  }
  .nav-links a:active { background: var(--teal); }

  /* زر الهمبرغر فوق الكل */
  .nav-toggle { z-index: 1003; }

  /* خلفية معتمة خلف القائمة */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 41, 46, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1001;
  }
  .nav-backdrop.show { opacity: 1; visibility: visible; }

  /* Hero: clean right-aligned block, no skew, comfortable spacing */
  .hero::after { display: none; }
  .hero {
    background: linear-gradient(160deg, var(--petrol) 60%, #0f3d34 100%);
  }
  .hero-inner {
    padding: 40px 20px 48px;
    max-width: 100%;
    text-align: right;
  }
  .hero-eyebrow { font-size: 0.78rem; margin-bottom: 16px; }
  .hero h1 {
    font-size: clamp(1.35rem, 7.2vw, 1.85rem);
    line-height: 1.35;
    white-space: nowrap;
  }
  .hero .hero-en {
    font-size: clamp(0.68rem, 3.4vw, 0.85rem);
    line-height: 1.5;
    margin-top: 8px;
    text-align: right;
    direction: rtl;
    white-space: nowrap;
  }
  .hero-tagline {
    font-size: 1.02rem;
    margin-top: 20px;
    justify-content: flex-start;
  }
  .hero-tagline::before { width: 28px; }

  /* Buttons: full width, stacked */
  .hero-actions { margin-top: 28px; flex-direction: column; gap: 10px; }
  .hero-actions .btn { width: 100%; text-align: center; }

  /* Sections tighter */
  .section { padding: 44px 0; }
  .section-head h2 { font-size: 1.4rem; }
  .section-head p { font-size: 0.95rem; }

  /* Cards single column */
  .events-grid, .articles-grid { grid-template-columns: 1fr; }
  .identity-grid { grid-template-columns: 1fr; }

  /* Footer stacked and centered */
  .footer-inner { flex-direction: column; text-align: center; align-items: center; gap: 20px; }
  .footer-brand { flex-direction: column; text-align: center; gap: 8px; }

  /* Filters */
  .filters { gap: 8px; }
  .filter-btn { padding: 8px 18px; font-size: 0.92rem; }

  /* Auth card fits */
  .auth-card { padding: 32px 24px; }
}

@media (max-width: 380px) {
  .brand img { width: 50px; }
  .brand-name { font-size: 0.88rem; }
  .nav-links a { padding: 13px 14px; font-size: 1rem; }
}
