:root {
  --green-deep: #0A3D2C;
  --green-saudi: #006C35;
  --green-mid: #1D8B5C;
  --green-light: #E8F3EE;
  --gold: #C9A961;
  --gold-light: #F5EDD8;
  --gold-deep: #8B6F1F;
  --cream: #FAF7F0;
  --cream-dark: #F2EDE0;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --ink-muted: #8A8A8A;
  --line: rgba(10, 61, 44, 0.12);
  --line-strong: rgba(10, 61, 44, 0.25);
  --shadow-soft: 0 1px 3px rgba(10, 61, 44, 0.06), 0 1px 2px rgba(10, 61, 44, 0.04);
  --shadow-card: 0 4px 24px rgba(10, 61, 44, 0.08);
  --radius: 4px;
  --radius-lg: 12px;
}

body.dark-theme {
  --green-deep: #F5EDD8; /* Swapped for contrast, green deep becomes a light gold/cream for text */
  --green-saudi: #00A651; /* Brighter green for dark mode visibility */
  --green-light: #1A2E26; /* Dark background for elements */
  --gold: #D4AF37;
  --gold-light: #3A301A;
  --gold-deep: #FCE8B2;
  --cream: #121212; /* Dark background */
  --cream-dark: #1E1E1E; /* Slightly lighter dark background */
  --ink: #FFFFFF;
  --ink-soft: #E0E0E0;
  --ink-muted: #A0A0A0;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

body.dark-theme .topbar { background: #000; color: #D4AF37; }
body.dark-theme header { background: rgba(18, 18, 18, 0.95); }
body.dark-theme .logo-name { color: #FFF; }
body.dark-theme .calc-wrapper, body.dark-theme .control, body.dark-theme .result-card, body.dark-theme .faq-item { background: #1E1E1E; border-color: var(--line); }
body.dark-theme .calc-header { background: #0A1C14; }
body.dark-theme .hero { background: linear-gradient(180deg, #121212 0%, #1A2E26 100%); }
body.dark-theme footer { background: #000; }

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.75;
  font-size: 17px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.serif { font-family: 'Cairo', sans-serif; }

/* ============== TOP BAR ============== */
.topbar {
  background: var(--green-deep);
  color: var(--cream);
  padding: 8px 0;
  font-size: 13px;
  text-align: center;
  letter-spacing: 0.5px;
}
.topbar span { color: var(--gold); margin: 0 4px; }

/* ============== HEADER ============== */
header {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(250, 247, 240, 0.95);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  width: 44px;
  height: 44px;
  background: var(--green-saudi);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 20px;
  border-radius: 6px;
  letter-spacing: -1px;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-size: 22px; font-weight: 700; color: var(--green-deep); }
.logo-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

nav ul { list-style: none; display: flex; gap: 2rem; }
nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: color 0.2s;
  position: relative;
}
nav a:hover { color: var(--green-saudi); }

/* ============== HERO ============== */
.hero {
  padding: 4rem 0 3rem;
  background: linear-gradient(180deg, var(--cream) 0%, var(--green-light) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 90% 10%, rgba(201, 169, 97, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(0, 108, 53, 0.05) 0%, transparent 40%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  background: var(--gold-light);
  color: var(--gold-deep);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(201, 169, 97, 0.3);
}

h1 {
  font-family: 'Cairo', sans-serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}

h1 .accent {
  color: var(--gold-deep);
  position: relative;
  display: inline-block;
}

h1 .accent::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 0;
  left: 0;
  height: 8px;
  background: var(--gold);
  opacity: 0.25;
  z-index: -1;
}

.hero-sub {
  font-size: 19px;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.stat {
  text-align: center;
}
.stat-num {
  font-family: 'Cairo', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--green-saudi);
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 6px;
}

/* ============== CALCULATOR SECTION ============== */
.calc-section {
  padding: 4rem 0;
  background: var(--cream);
}

.calc-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  border: 1px solid var(--line);
}

.calc-header {
  background: var(--green-deep);
  color: var(--cream);
  padding: 1.75rem 2rem;
  position: relative;
  overflow: hidden;
}

.calc-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 60%);
  opacity: 0.15;
}

.calc-header h2 {
  font-family: 'Cairo', sans-serif;
  font-size: 28px;
  margin-bottom: 6px;
  position: relative;
  font-weight: 700;
}

.calc-header p {
  font-size: 14px;
  opacity: 0.85;
  position: relative;
}

.calc-body {
  padding: 2rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.control {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.control:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.08);
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.control-label {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}

.control-value {
  font-family: 'Cairo', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--green-deep);
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--line-strong);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--green-saudi);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 108, 53, 0.3);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--green-saudi);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 108, 53, 0.3);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-card {
  background: linear-gradient(135deg, var(--green-light) 0%, var(--cream) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-card.featured {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: var(--cream);
}

.result-card.featured .result-label { color: var(--gold); }
.result-card.featured .result-value { color: var(--cream); }
.result-card.featured .result-unit { color: rgba(245, 237, 216, 0.7); }

.result-label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.result-value {
  font-family: 'Cairo', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--green-deep);
  line-height: 1;
}

.result-unit {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 6px;
}

.chart-container {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-canvas {
  position: relative;
  height: 280px;
}

.message-box {
  background: var(--gold-light);
  border-right: 4px solid var(--gold);
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--gold-deep);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.message-box::before {
  content: '◆';
  color: var(--gold);
  font-size: 12px;
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  background: white;
  color: var(--green-deep);
  border: 1px solid var(--line-strong);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: var(--green-deep);
  color: var(--gold);
  border-color: var(--green-deep);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--green-saudi);
  color: white;
  border-color: var(--green-saudi);
}
.btn-primary:hover {
  background: var(--green-deep);
  color: var(--gold);
}

/* ============== CONTENT SECTIONS ============== */
.section {
  padding: 4rem 0;
}

.section-light {
  background: var(--cream-dark);
}

.section-dark {
  background: var(--green-deep);
  color: var(--cream);
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.section-eyebrow {
  font-size: 13px;
  color: var(--gold-deep);
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.section-dark .section-eyebrow { color: var(--gold); }

h2 {
  font-family: 'Cairo', sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--green-deep);
  margin-bottom: 1rem;
}

.section-dark h2 { color: var(--cream); }

.section-sub {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.section-dark .section-sub { color: rgba(245, 237, 216, 0.85); }

/* ============== EDUCATIONAL CONTENT ============== */
.article {
  max-width: 760px;
  margin: 0 auto;
}

.article h3 {
  font-family: 'Cairo', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--green-deep);
  margin: 2.5rem 0 1rem;
  position: relative;
  padding-right: 1rem;
}

.article h3::before {
  content: '';
  position: absolute;
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--gold);
}

.article p {
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
  font-size: 17px;
}

.article strong {
  color: var(--green-deep);
  font-weight: 700;
}

.callout {
  background: white;
  border: 1px solid var(--line);
  border-right: 4px solid var(--green-saudi);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.callout-label {
  font-size: 12px;
  color: var(--green-saudi);
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.callout p {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

/* ============== EXAMPLE TABLE ============== */
.example-table {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin: 2rem 0;
  border: 1px solid var(--line);
}

.example-table table {
  width: 100%;
  border-collapse: collapse;
}

.example-table thead {
  background: var(--green-deep);
  color: var(--cream);
}

.example-table th, .example-table td {
  padding: 14px 16px;
  text-align: right;
  font-size: 15px;
  border-bottom: 1px solid var(--line);
}

.example-table th {
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.5px;
  border-bottom: none;
}

.example-table tbody tr:hover {
  background: var(--cream);
}

.example-table .highlight {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  color: var(--green-saudi);
  font-size: 17px;
}

/* ============== FAQ ============== */
.faq-grid {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.faq-item:hover { border-color: var(--gold); }

.faq-item[open] {
  box-shadow: var(--shadow-card);
  border-color: var(--gold);
}

.faq-item summary {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--green-deep);
  font-size: 17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-family: 'Cairo', sans-serif;
  font-size: 28px;
  color: var(--gold);
  font-weight: 400;
  transition: transform 0.3s;
  line-height: 0.8;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-content {
  padding: 0 1.5rem 1.5rem;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
}

/* ============== TIPS GRID ============== */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.tip-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(245, 237, 216, 0.15);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.3s;
}

.tip-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.tip-num {
  font-family: 'Cairo', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 1rem;
}

.tip-title {
  font-family: 'Cairo', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 8px;
}

.tip-desc {
  font-size: 15px;
  color: rgba(245, 237, 216, 0.75);
  line-height: 1.7;
}

/* ============== FOOTER ============== */
footer {
  background: var(--green-deep);
  color: var(--cream);
  padding: 3rem 0 1.5rem;
  border-top: 4px solid var(--gold);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-about p {
  font-size: 14px;
  color: rgba(245, 237, 216, 0.75);
  line-height: 1.8;
  margin-top: 1rem;
}

.footer-col h4 {
  font-family: 'Cairo', sans-serif;
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 1rem;
  font-weight: 700;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: rgba(245, 237, 216, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid rgba(245, 237, 216, 0.15);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 13px;
  color: rgba(245, 237, 216, 0.5);
}

.disclaimer {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 12px;
  color: rgba(245, 237, 216, 0.65);
  line-height: 1.7;
  margin-top: 1.5rem;
  border-right: 2px solid var(--gold);
}

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
  .controls-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  nav ul { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-stats { gap: 2rem; }
  .container { padding: 0 1rem; }
  .calc-body { padding: 1.5rem 1rem; }
  body { font-size: 16px; }
}

/* ============== ANIMATIONS ============== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-content > * {
  animation: fadeInUp 0.8s ease-out backwards;
}
.hero-content > *:nth-child(1) { animation-delay: 0.1s; }
.hero-content > *:nth-child(2) { animation-delay: 0.2s; }
.hero-content > *:nth-child(3) { animation-delay: 0.3s; }
.hero-content > *:nth-child(4) { animation-delay: 0.4s; }

