/* ==========================================
   1. المتغيرات والأساسيات (Root & Base Styles)
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --green: #176b4d;
  --green-dark: #0b3d2e;
  --lime: #c6e86b;
  --ink: #172923;
  --muted: #63756e;
  --paper: #f7faf6;
  --line: #e1e9e2;
  --white: #fff;
  --shadow: 0 18px 50px rgba(21, 67, 48, 0.09);
  --gold: #e7bd52;
  --deep: #082f24;
  --glass: rgba(255, 255, 255, 0.82);
  --glow: #d7f18c;
}

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  font-family: 'Cairo', Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.9;
  overflow-x: hidden;
  animation: pageEnter 0.65s ease both;
}

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

::selection {
  background: var(--lime);
  color: var(--green-dark);
}

:focus-visible {
  outline: 3px solid #d6a900;
  outline-offset: 3px;
}

/* ==========================================
   2. شريط القائمة العلوي (Site Header & Nav)
   ========================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(16px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  background: var(--lime);
  color: var(--green-dark);
  border-radius: 14px;
  font-size: 27px;
}

.brand small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle, .menu-toggle {
  min-height: 42px;
  min-width: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.25s, background 0.25s;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
  font: 700 12px 'Cairo', sans-serif;
  padding: 9px 12px;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  background: var(--lime);
}

.menu-toggle {
  display: none;
  border: 0;
  background: #edf5e9;
  font-size: 20px;
  color: var(--green);
}

.nav {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.nav a {
  font-size: 12px;
  font-weight: 700;
  color: #53665d;
  padding: 8px 10px;
  border-radius: 10px;
  position: relative;
  transition: transform 0.22s ease, background-color 0.22s ease, color 0.22s ease;
}

.nav a:hover, .nav a.active {
  background: #eaf4e8;
  color: var(--green);
  transform: translateY(-1px);
}

.nav a.active:after {
  content: "";
  position: absolute;
  bottom: 3px;
  right: 12px;
  left: 12px;
  height: 2px;
  background: var(--green);
  border-radius: 2px;
}

/* ==========================================
   3. القسم الرئيسي (Hero Section)
   ========================================== */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 65px clamp(20px, 7vw, 100px) 75px;
  background: radial-gradient(circle at 90% 10%, #e6f2d4, transparent 30%), linear-gradient(120deg, #f7faf6, #eef6e9);
  overflow: hidden;
  position: relative;
}

.hero:before {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border: 1px solid #176b4d12;
  border-radius: 50%;
  top: -170px;
  right: 28%;
  box-shadow: 0 0 0 28px #176b4d05, 0 0 0 56px #176b4d04;
  pointer-events: none;
}

.hero-copy {
  max-width: 600px;
  animation: rise-in 0.75s both;
}

.eyebrow {
  display: inline-block;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  animation: fade-in 0.7s 0.1s both;
}

.hero h1 {
  font-size: clamp(34px, 4.5vw, 62px);
  line-height: 1.35;
  letter-spacing: -1.5px;
  margin: 12px 0 18px;
  color: var(--green-dark);
}

.hero h1 em {
  font-style: normal;
  color: var(--green);
}

.hero p, .page-hero p {
  color: var(--muted);
  font-size: 16px;
  max-width: 610px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 27px;
  animation: rise-in 0.7s 0.25s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(11, 61, 46, 0.2);
}

.btn.primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  box-shadow: 0 8px 20px #176b4d24;
  position: relative;
  overflow: hidden;
}

.btn.primary:after {
  content: "";
  position: absolute;
  top: -40%;
  left: -70%;
  width: 45%;
  height: 180%;
  transform: rotate(25deg);
  background: linear-gradient(90deg, transparent, #ffffff35, transparent);
  transition: left 0.55s;
}

.btn.primary:hover:after {
  left: 130%;
}

.btn.secondary {
  border-color: #cbdacf;
  background: white;
  color: var(--green);
}

/* Hero Visual & Campus Photo */
.hero-visual {
  min-height: 340px;
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(#d9efef 0%, #f3f6d9 70%, #c3d6a3 70%);
  box-shadow: var(--shadow);
  isolation: isolate;
  animation: floatIn 0.9s cubic-bezier(.2, .8, .2, 1) both;
}

.school-photo-wrap {
  min-height: 410px;
  border: 1px solid #ffffffaa;
  background: #dbe8d6;
}

.school-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
  z-index: -2;
}

.school-photo-wrap:hover .school-photo {
  transform: scale(1.045);
}

.photo-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 38, 26, .04) 25%, rgba(5, 38, 26, .7) 100%);
  z-index: -1;
}

.photo-top-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #ffffffed;
  color: var(--green-dark);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 24px #092d201c;
}

.photo-caption {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
}

.caption-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--lime);
  color: var(--green-dark);
  font-size: 27px;
}

.photo-caption strong {
  display: block;
  font-size: 19px;
  line-height: 1.4;
}

.photo-caption small {
  display: block;
  color: #e0eee4;
  font-size: 11px;
}

.floating-chip {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fffffff0;
  border: 1px solid #ffffff80;
  border-radius: 15px;
  padding: 10px 13px;
  box-shadow: 0 12px 30px #092d2020;
  animation: gentleFloat 4s ease-in-out infinite;
  max-width: calc(100% - 24px);
}

.floating-chip > span {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 11px;
  background: #e8f4d9;
  color: var(--green);
  font-size: 20px;
}

.floating-chip strong {
  display: block;
  color: var(--green-dark);
  font-size: 11px;
  line-height: 1.4;
}

.floating-chip small {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.chip-solar { top: 28%; left: 16%; }
.chip-charge { bottom: 25%; left: 8%; animation-delay: 1.2s; }

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #77a83b;
  border-radius: 50%;
  margin-left: 5px;
  animation: pulse-ring 1.8s infinite;
}

/* ==========================================
   4. الأقسام والمكونات والبطاقات (Sections & Cards)
   ========================================== */
.section { padding: 64px clamp(20px, 7vw, 100px); }
.tinted { background: #edf5e9; }

.section-heading {
  text-align: center;
  margin: 0 auto 28px;
  max-width: 720px;
}

.section-heading h2, .closing h2 {
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.4;
  color: var(--green-dark);
  margin: 7px 0;
  letter-spacing: -.4px;
}

.section-heading p { color: var(--muted); margin: 0; }

.text-panel {
  max-width: 900px;
  margin: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(22px, 4vw, 42px);
  box-shadow: var(--shadow);
  animation: soft-appear 0.7s both;
}

.text-panel p { margin: 0 0 17px; }
.text-panel p:last-child { margin-bottom: 0; }

.cards { display: grid; gap: 18px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.two { grid-template-columns: repeat(2, 1fr); }

.card, .stat-card, .flow-step, .timeline article, .calculator, .closing-card {
  animation: soft-appear 0.7s both;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 25px;
  box-shadow: 0 7px 24px #174c3010;
}

.card:hover, .stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 38px #174c3019;
  border-color: #bdd7b9;
}

.card h3 { margin: 8px 0; font-size: 19px; color: var(--green-dark); }
.card p, .card li { color: var(--muted); font-size: 14px; }
.card a { font-size: 12px; font-weight: 800; color: var(--green); }

.card-icon {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  background: #eaf4e4;
  color: var(--green);
  border-radius: 15px;
  font-size: 25px;
}

/* Stats Section */
.stats-section { background: linear-gradient(180deg, #f7faf6, #f0f6e9); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 1100px; margin: auto; }

.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 7px 24px #174c3009;
}

.stat-icon {
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #eaf4e4;
  color: var(--green);
  font-size: 25px;
}

.stat-card strong { font-size: 17px; color: var(--green-dark); }
.stat-card p { font-size: 13px; color: var(--muted); margin-bottom: 0; }

/* Image Note */
.image-note-section { padding-top: 0; padding-bottom: 40px; }
.image-note {
  max-width: 1050px;
  margin: auto;
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid #dbe8d4;
  background: #f0f7e9;
}

.note-symbol {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #dcefc9;
  color: var(--green);
  font-size: 24px;
}

.image-note strong { color: var(--green-dark); }
.image-note p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

/* ==========================================
   5. صفحات فرعية وعناصر تفاعلية (Subpages & UI)
   ========================================== */
.page-hero {
  padding: 58px clamp(20px, 7vw, 100px);
  background: linear-gradient(110deg, #e9f4e4, #f8fbf5);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.page-hero:after {
  content: "☀";
  position: absolute;
  left: 8%;
  top: -35px;
  font-size: 160px;
  color: #176b4d0a;
  pointer-events: none;
  animation: slow-spin 32s linear infinite;
}

.page-hero h1 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.4;
  color: var(--green-dark);
  margin: 8px 0;
}

.check-list {
  max-width: 900px;
  margin: auto;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.check-list li {
  background: white;
  border: 1px solid var(--line);
  padding: 13px 18px;
  border-radius: 12px;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.check-list li:hover {
  transform: translateX(-5px);
  background-color: rgba(11, 61, 46, 0.05);
}

.check-list li:before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  background: #e8f4df;
  color: var(--green);
  width: 25px;
  height: 25px;
  border-radius: 50%;
  font-weight: 800;
  margin-left: 10px;
}

.notice {
  max-width: 900px;
  margin: 28px auto 0;
  padding: 18px 20px;
  background: #fff8df;
  border-right: 4px solid #e0b43e;
  border-radius: 12px;
  color: #695626;
  font-size: 13px;
  transition: transform 0.25s ease;
}

.notice:hover { transform: scale(1.01); }

.top-space { margin-top: 48px; }

/* Flow Steps & Timeline */
.flow-steps { display: flex; align-items: stretch; gap: 10px; }
.flow-step { flex: 1; background: white; border: 1px solid var(--line); padding: 20px; border-radius: 16px; }

.flow-step > span, .timeline article > span {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 11px;
  background: var(--lime);
  color: var(--green-dark);
  font-weight: 800;
}

.flow-step h3 { font-size: 16px; color: var(--green-dark); }
.flow-step p { font-size: 13px; color: var(--muted); }
.flow-arrow { align-self: center; color: var(--green); font-size: 23px; }

.timeline { max-width: 850px; margin: auto; display: grid; gap: 16px; }

.timeline article {
  display: flex;
  gap: 18px;
  background: white;
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline article:hover {
  transform: translateX(-4px);
  box-shadow: 0 10px 28px #174c3010;
}

.timeline article > span { flex-shrink: 0; }
.timeline h3 { margin: 0 0 5px; color: var(--green-dark); }
.timeline p { margin: 0; color: var(--muted); font-size: 14px; }

/* Calculator */
.calculator { max-width: 650px; margin: auto; display: grid; gap: 10px; }
.calculator label { font-size: 13px; font-weight: 800; }
.calculator input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccdacf;
  border-radius: 10px;
  font: inherit;
  background: #fbfdf9;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.calculator input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 61, 46, 0.15);
  outline: none;
}

.calc-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 15px;
  background: #edf5e9;
  padding: 18px;
  border-radius: 13px;
  margin-top: 8px;
}

.calc-result span { font-size: 12px; color: var(--muted); }
.calc-result strong { font-size: 19px; color: var(--green-dark); }
.small-note { font-size: 11px; color: var(--muted); }

/* Closing & Footer */
.closing { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.closing > div { max-width: 720px; }
.closing p { color: var(--muted); }

.closing-card {
  margin: 30px auto 0;
  max-width: 900px;
  background: var(--green-dark);
  color: white;
  border-radius: 24px;
  padding: clamp(25px, 5vw, 50px);
}

.closing-card .eyebrow { color: var(--lime); }
.closing-card h2 { font-size: 32px; margin: 8px 0; color: white; }
.closing-card p { color: #d3e5d9; }
.closing-card .slogan {
  font-size: 20px;
  font-weight: 800;
  color: var(--lime);
  margin: 22px 0;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  display: inline-block;
  border-right: 4px solid var(--lime);
}
.closing-card .btn { background: var(--lime); color: var(--green-dark); }

footer {
  background: var(--green-dark);
  color: #d5e6d9;
  padding: 28px clamp(20px, 7vw, 100px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 12px;
  border-top: 3px solid var(--lime);
}

footer p { margin: 0; color: #a9c6b5; }
footer a { font-weight: 800; color: var(--lime); }
.footer-brand { font-weight: 800; color: white; }

/* Progress Bar & Back to Top */
.reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  z-index: 100;
  background: transparent;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--gold));
  box-shadow: 0 0 12px #c6e86b80;
  transition: width .08s linear;
}

.back-to-top {
  position: fixed;
  z-index: 30;
  bottom: 22px;
  inset-inline-end: 22px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 15px;
  background: var(--green-dark);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 10px 28px #092d2033;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: .25s;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ==========================================
   6. الوضع الليلي (Dark Mode)
   ========================================== */
body.dark-mode {
  --ink: #e7f0e9;
  --muted: #b2c2b7;
  --paper: #101b17;
  --line: #2b4035;
  --white: #172820;
  background: var(--paper);
  color: var(--ink);
}

.dark-mode .site-header,
.dark-mode .theme-toggle,
.dark-mode .btn.secondary,
.dark-mode .text-panel,
.dark-mode .card,
.dark-mode .stat-card,
.dark-mode .flow-step,
.dark-mode .timeline article {
  background: #172820;
  color: var(--ink);
  border-color: #2b4035;
}

.dark-mode .hero {
  background: radial-gradient(circle at 90% 10%, #25432c, transparent 34%), linear-gradient(120deg, #101b17, #172820);
}

.dark-mode .hero h1,
.dark-mode .hero h1 em,
.dark-mode h2,
.dark-mode h3 {
  color: #d7efc5;
}

.dark-mode .nav a { color: #c3d4c9; }
.dark-mode .nav a:hover, .dark-mode .nav a.active {
  background: #25432c;
  color: #e4f7d2;
}

.dark-mode input, .dark-mode select, .dark-mode textarea {
  background: #101b17;
  color: #e7f0e9;
  border-color: #405548;
}

/* ==========================================
   7. الرسوم المتحركة (Keyframe Animations)
   ========================================== */
@keyframes pageEnter { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes gentleFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 #77a83b70; }
  70% { box-shadow: 0 0 0 9px #77a83b00; }
  100% { box-shadow: 0 0 0 0 #77a83b00; }
}
@keyframes slow-spin { to { transform: rotate(360deg); } }
@keyframes soft-appear { from { opacity: .65; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================
   8. التجاوب مع الشاشات (Responsive Media Queries)
   ========================================== */
@media(max-width: 1000px) {
  .site-header { flex-wrap: wrap; }
  .menu-toggle { display: block; order: 3; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; order: 4; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
  .hero { grid-template-columns: 1fr; padding-top: 45px; }
  .hero-visual { min-height: 300px; }
  .cards.three { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .flow-steps { flex-wrap: wrap; }
  .flow-step { min-width: 40%; }
  .flow-arrow { display: none; }
  .school-photo-wrap { min-height: 360px; }
  .chip-solar { left: 5%; }
}

@media(max-width: 700px) {
  .site-header { padding: 12px 16px; gap: 10px; }
  .brand { min-width: 0; flex: 1; line-height: 1.4; }
  .brand small { font-size: 10px; }
  .hero { padding: 34px 18px; gap: 24px; }
  .hero h1 { font-size: clamp(29px, 8vw, 42px); }
  .hero-visual, .school-photo-wrap { min-height: 270px; }
  .floating-chip { padding: 8px 10px; gap: 7px; }
  .chip-solar { top: 18%; left: 5%; }
  .chip-charge { bottom: 23%; left: 4%; }
  .photo-caption { right: 14px; bottom: 14px; }
  .section { padding: 38px 18px; }
  .page-hero { padding: 34px 18px; }
  .cards.three, .cards.two, .stats-grid { grid-template-columns: 1fr; }
  .closing { flex-direction: column; align-items: stretch; }
  .closing .btn { align-self: flex-start; }
  .flow-steps { display: grid; grid-template-columns: 1fr; }
  .flow-step { min-width: 0; }
  .timeline article { padding: 15px; gap: 12px; }
  .calc-result { grid-template-columns: 1fr; }
  footer { padding: 24px 18px; align-items: flex-start; flex-direction: column; }
  .back-to-top { inset-inline-start: 14px; bottom: 14px; left: 14px; }
}

@media(max-width: 380px) {
  .brand { font-size: 12px; }
  .brand small { font-size: 9px; }
  .hero-visual, .school-photo-wrap { min-height: 230px; }
  .floating-chip small { display: none; }
  .floating-chip strong { font-size: 10px; }
}

@media(prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}