/* ============================================================
   Dr. Heba Sultan — Shared Stylesheet
   Used by: index.html, simulations.html, terms.html
   ============================================================ */

/* ============================================================
   THEME TOKENS
   ============================================================ */
:root,
[data-theme="light"] {
  --bg: #F8F9FB;
  --surface: #FFFFFF;
  --surface-hi: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-mid: #1E293B;
  --text-dim: #334155;
  --accent: #0F766E;
  --accent-hover: #115E59;
  --accent-soft: #CCFBF1;
  --accent-line: rgba(15, 118, 110, 0.2);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --overlay: rgba(15, 23, 42, 0.4);
}
[data-theme="dark"] {
  --bg: #0A0F14;
  --surface: #111820;
  --surface-hi: #1A222E;
  --border: #1E293B;
  --border-strong: #334155;
  --text: #F1F5F9;
  --text-mid: #CBD5E1;
  --text-dim: #94A3B8;
  --accent: #14B8A6;
  --accent-hover: #2DD4BF;
  --accent-soft: rgba(20, 184, 166, 0.12);
  --accent-line: rgba(20, 184, 166, 0.25);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  --overlay: rgba(0, 0, 0, 0.7);
}

:root {
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --display: 'Space Grotesk', var(--sans);
  --radius: 4px;
  --radius-lg: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
   --cat-motion: #3B82F6;
  --cat-thermal: #F97316;
  --cat-waves: #8B5CF6;
  --cat-electricity: #F59E0B;
  --cat-nuclear: #EF4444;
  --cat-space: #6366F1;

}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text-mid);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 250ms ease, color 250ms ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #fff; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

/* ============================================================
   LOGO SWAP
   ============================================================ */
.logo-light { display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* ============================================================
   NAVBAR
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background-color 250ms ease, border-color 250ms ease;
}
.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand-logo { height: 40px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}

.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  transition: color 180ms ease;
  position: relative;
  padding: 4px 0;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--accent); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-mid);
  transition: all 180ms ease;
  font-size: 15px;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--surface-hi);
  color: var(--text);
}

/* Hamburger MUST come after .icon-btn to win the specificity tie */
.hamburger { display: none; }

.theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: none; }
.theme-toggle .theme-icon-dark { display: block; }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 180ms ease;
}
.nav-cta:hover { background: var(--accent-hover); }

/* ============================================================
   MOBILE SIDEBAR
   ============================================================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 350ms var(--ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.08);
}
.sidebar.open { transform: translateX(0); }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.sidebar-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-mid);
  font-size: 20px;
  line-height: 1;
  transition: all 180ms ease;
}
.sidebar-close:hover { background: var(--surface-hi); color: var(--text); }

.sidebar-nav { flex: 1; padding: 16px 0; list-style: none; }
.sidebar-nav li { border-bottom: 1px solid var(--border); }
.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-mid);
  transition: all 180ms ease;
}
.sidebar-nav a:hover {
  color: var(--accent);
  background: var(--surface-hi);
  padding-left: 28px;
}
.sidebar-nav a i {
  font-size: 12px;
  color: var(--text-dim);
  transition: transform 200ms ease;
}
.sidebar-nav a:hover i { transform: translateX(4px); color: var(--accent); }

.sidebar-foot {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  transition: background 180ms ease;
}
.sidebar-cta:hover { background: var(--accent-hover); }
.sidebar-social {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text-mid);
  transition: all 180ms ease;
}
.sidebar-social a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  transition: all 180ms ease;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 15px 30px;
  border-radius: var(--radius);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.25);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  padding: 14px 28px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.btn-block { width: 100%; }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Card stagger */
.syllabus-grid.active .card,
.tools-grid .tool,
.year-grid .year-card,
.testimonials-grid .testimonial {
  opacity: 0;
  animation: cardIn 500ms var(--ease) forwards;
}
.syllabus-grid.active .card:nth-child(1) { animation-delay: 0ms; }
.syllabus-grid.active .card:nth-child(2) { animation-delay: 60ms; }
.syllabus-grid.active .card:nth-child(3) { animation-delay: 120ms; }
.syllabus-grid.active .card:nth-child(4) { animation-delay: 180ms; }
.syllabus-grid.active .card:nth-child(5) { animation-delay: 240ms; }
.syllabus-grid.active .card:nth-child(6) { animation-delay: 300ms; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.modal.open { display: flex; }
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px;
  width: 100%;
  max-width: 520px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms ease;
}
.modal-close:hover { background: var(--surface-hi); color: var(--text); }
.modal h3 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  padding-right: 40px;
  line-height: 1.2;
}
.modal-sub {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 28px;
}
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: var(--sans);
  transition: all 180ms ease;
}
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  box-shadow: var(--shadow-lg);
  font-size: 15px;
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition: opacity 300ms var(--ease),
              transform 300ms var(--ease),
              background 200ms ease,
              box-shadow 200ms ease;
}
.back-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.back-top:hover {
  background: var(--accent-hover);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 16px 40px rgba(15, 118, 110, 0.35);
}
.back-top:active {
  transform: translateY(0) scale(0.97);
  transition: transform 100ms ease;
}

/* ============================================================
   RESPONSIVE — NAV COLLAPSE
   ============================================================ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .hamburger { display: flex; }
}
@media (max-width: 768px) {
  .nav-inner { padding: 14px 20px; }
  .brand-logo { height: 34px; }
  .brand-name { font-size: 15px; }
  .brand-sub { font-size: 9.5px; }
  .modal-panel { padding: 32px 24px; }
  .modal h3 { font-size: 22px; }
  .back-top { bottom: 20px; right: 20px; width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}