:root{
  --bg: #0f1724; 
  --panel: #0b1220;
  --muted: #9aa6b2;
  --text: #e6eef6;
  --accent: #48b5ff;
  --accent-2: #7ef3c5;
  --danger: #ff6b6b;
  --glass: rgba(255,255,255,0.04);
  --radius: 12px;
  --fw-regular: 400;
  --fw-medium: 600;
  --fw-bold: 700;
  --max-width: 1200px;
  --container-gap: 1.25rem;
  --shadow-1: 0 6px 20px rgba(2,6,23,0.6);
  --shadow-2: 0 8px 30px rgba(2,6,23,0.75);
  --glass-border: rgba(255,255,255,0.04);
  --gutter: 1.25rem;
  --section-gap: 1.25rem;
  --panel-alpha: 0.04;

  --bg-start: #071021;
  --bg-end:   #0f1724;
  --overlay-accent: rgba(72,181,255,0.035); 
  --overlay-accent-2: rgba(126,243,197,0.018); 
}

/* Reset & base */
*,
*::before,
*::after { box-sizing: border-box; }

html,body { height: 100%; }

body{
  margin: 0;
  min-height: 100vh;      /* ensure body at least full viewport */
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  /* fallback single color kept for fast paint */
  background: var(--bg-end);
  overflow-x: hidden;
}

/* decorative gradient overlay now in a fixed pseudo element that can be shifted smoothly.
   background-size is taller than viewport (200%) so moving background-position creates a
   continuous vertical shift over the whole document (avoids a visible horizontal "stop" line). */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0; /* keep behind content */
  /* main linear gradient layer (movable) + subtle decorative blobs */
  background-image:
    linear-gradient(180deg, var(--bg-start), var(--bg-end)),
    radial-gradient(600px 300px at 8% 12%, var(--overlay-accent), transparent 12%),
    radial-gradient(500px 250px at 92% 88%, var(--overlay-accent-2), transparent 12%);
  /* make the linear gradient taller than the viewport to allow smooth vertical panning */
  background-size: 100% 200%, cover, cover;
  /* vertical position of the large gradient is controlled by CSS variable --bg-pos (0% .. 100%) */
  background-position: 0 var(--bg-pos, 0%), center center, center center;
  transition: opacity .4s linear, background .4s linear;
}

/* ensure content layers above the pseudo background */
header, main, footer, .container, .hero, .section-card { position: relative; z-index: 2; }

/* Typography */
h1,h2,h3,h4{
  margin: 0 0 .5rem 0;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.15;
  font-weight: var(--fw-bold);
}

h1{ font-size: clamp(1.6rem, 3.6vw, 2.4rem); }
h2{ font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
h3{ font-size: 1.05rem; }

p{ margin: 0 0 1rem 0; color: var(--muted); font-weight: var(--fw-regular); }

/* Links & buttons */
a{
  color: var(--accent);
  text-decoration: none;
  transition: color .15s ease, transform .08s ease;
}
a:hover,a:focus{ color: var(--accent-2); transform: translateY(-1px); outline: none; }

button,
button[type="button"],
.btn{
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .9rem;
  background: linear-gradient(180deg, var(--accent) 0%, #2b9fe8 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
button.secondary,
.btn.secondary{
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: none;
}
button:active{ transform: translateY(1px) scale(.995); }
button:disabled{ opacity: .6; cursor: not-allowed; }

/* Header / nav */
.header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius: 14px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.02);
  margin-bottom: .9rem;
  width: 100%;
}
.brand{
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}
.brand .logo{
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #6bd5ff);
  box-shadow: var(--shadow-1);
  display:flex; align-items:center; justify-content:center;
}

/* Nav links improved */
.nav{
  display: flex;
  gap: .5rem;
  align-items: center;
}
.nav a{
  display:inline-block;
  padding:.45rem .65rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: var(--fw-medium);
  transition: background .12s ease, color .12s ease, transform .08s ease;
}
.nav a:hover, .nav a:focus{
  color: var(--text);
  background: rgba(255,255,255,0.02);
  transform: translateY(-1px);
}

.nav-toggle{
  display: none;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: .35rem;
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle:focus{ outline: none; box-shadow: 0 6px 20px rgba(72,181,255,0.08); color: var(--accent); }


.hero{
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 2rem;
  margin-top: 1.25rem;
  position: relative;
  z-index: 2; 
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  box-shadow: var(--shadow-2);
  border: 1px solid var(--glass-border);
  align-items: center;
}

.hero-visual{
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(2,6,23,0.45);
  min-height: 220px;
  display: block;
}

.hero-visual .visual-illustration{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  transform-origin: center;
  animation: visual-slow-zoom 14s linear infinite;
}

.hero-visual .visual-overlay{
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: .75rem;
}

.hero-visual .avatars{
  display:flex;
  gap: .5rem;
}
.hero-visual .avatar{
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: var(--fw-medium);
  box-shadow: 0 8px 18px rgba(2,6,23,0.35);
  transform: translateY(0);
  animation: float .9s ease-in-out infinite alternate;
}

.hero-visual .avatar:nth-child(2){ animation-delay: .12s; transform-origin:center; }
.hero-visual .avatar:nth-child(3){ animation-delay: .24s; transform-origin:center; }

.hero-visual .chat-bubble{
  display:inline-block;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  padding: .5rem .75rem;
  border-radius: 10px;
  color: var(--text);
  font-size: .9rem;
  box-shadow: 0 10px 30px rgba(2,6,23,0.45);
  border: 1px solid rgba(255,255,255,0.02);
  max-width: 70%;
  animation: bubble-pop 6s ease-in-out infinite;
}

.hero-visual .stats{
  display:flex;
  gap: .6rem;
  margin-top: .2rem;
}
.hero-visual .stat{
  background: rgba(255,255,255,0.02);
  padding: .45rem .6rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: .85rem;
  display:flex;
  gap:.4rem;
  align-items:baseline;
  border:1px solid rgba(255,255,255,0.02);
}
.hero-visual .stat .num{ color: var(--accent-2); font-weight: var(--fw-medium); }

@keyframes float{
  from{ transform: translateY(0); }
  to{ transform: translateY(-6px); }
}
@keyframes bubble-pop{
  0%{ transform: translateY(0); opacity: 1; }
  50%{ transform: translateY(-4px); opacity: .95; }
  100%{ transform: translateY(0); opacity: 1; }
}
@keyframes visual-slow-zoom{
  0%{ transform: scale(1); }
  50%{ transform: scale(1.03); }
  100%{ transform: scale(1); }
}

@media (min-width: 880px){
  .hero{ grid-template-columns: 1fr 420px; align-items: center; }
}

@media (max-width: 879px){
  nav#primary-nav{
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    position: absolute;
    right: 1rem;
    top: calc(100% + 0.5rem); 
    background: linear-gradient(180deg, var(--bg-end), var(--bg-start));
    padding: .75rem;
    border-radius:10px;
    box-shadow: var(--shadow-2);
    border:1px solid var(--glass-border);
    z-index: 60;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
  }
  
  nav#primary-nav.open{
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  
  nav#primary-nav .nav{
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-width: 160px;
  }
  .nav-toggle{ display: inline-flex; align-items:center; }
  .header{ position: relative; width: 100%; }
}


.reveal{
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease;
  will-change: opacity, transform;
}
.reveal.visible{
  opacity: 1;
  transform: none;
}

.toast{
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.visible{
  opacity: 1;
  transform: none;
}

.sr-only{
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* Cards & grid */
.grid{
  display: grid;
  gap: 1.25rem;
}
.grid.cols-2{ grid-template-columns: repeat(2, 1fr); }
.grid.cols-3{ grid-template-columns: repeat(3, 1fr); }
@media (max-width: 880px){ .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(2,6,23,0.5);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover{ transform: translateY(-6px); box-shadow: 0 20px 40px rgba(2,6,23,0.6); }
.card .meta{ font-size: .85rem; color: var(--muted); }

.section-card{
  min-height: 160px;
  padding: 1.15rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Form controls */
.input,
textarea,
select{
  width: 100%;
  padding: .6rem .75rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  outline: none;
  transition: box-shadow .12s ease, border-color .12s ease;
  font-size: .95rem;
}
.input:focus,
textarea:focus,
select:focus{
  border-color: rgba(72,181,255,0.95);
  box-shadow: 0 6px 20px rgba(72,181,255,0.08);
}

/* Table */
.table{
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  color: var(--text);
}
.table th, .table td{
  padding: .65rem .8rem;
  border-bottom: 1px dashed rgba(255,255,255,0.03);
  text-align: left;
}
.table thead th{
  color: var(--muted);
  font-weight: var(--fw-medium);
}

/* Small utilities */
.kicker{
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Footer */
.footer{
  margin-top: 2.5rem;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

/* Images */
img{
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* Accessibility & motion */
:focus{ outline: 3px solid rgba(72,181,255,0.14); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}

/* Tiny helpers */
.muted{ color: var(--muted); }
.mt-1{ margin-top: .5rem; }
.mt-2{ margin-top: 1rem; }
.mb-1{ margin-bottom: .5rem; }
.p-1{ padding: .5rem; }

/* Notifications / badges */
.toast{
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
  color: var(--text);
  padding: .75rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--glass-border);
  z-index: 999;
}
.badge{
  display:inline-block;
  padding:.2rem .5rem;
  border-radius:999px;
  background: rgba(78,204,163,0.12);
  color: var(--accent-2);
  font-weight: var(--fw-medium);
  font-size:.8rem;
}

/* Danger variant */
.btn-danger{
  background: linear-gradient(180deg, #ff6b6b, #ff4b4b);
  box-shadow: 0 8px 24px rgba(255,107,107,0.18);
}

/* Sections grid: now a vertical stack (طائفة) that becomes flexible rows on large screens */
.sections-grid{
  display: flex;
  flex-direction: column; /* طائفة عمودية افتراضياً */
  gap: 1.25rem;
  margin-top: 1.6rem;
  align-items: stretch;
}

/* each section-item is a separate box (مربع خاص) */
.section-item{
  background: linear-gradient(180deg, rgba(255,255,255,0.012), rgba(255,255,255,0.008));
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: .85rem;
  box-shadow: 0 10px 28px rgba(2,6,23,0.35);
  transition: transform .18s ease, box-shadow .18s ease, border-color .12s ease;
}

/* the internal article had its own card styles; to avoid double visuals, make it neutral */
.section-item .section-card{
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* keep section-card spacing and ensure content flows */
.section-item .section-card h3{ margin-bottom:.4rem; }
.section-item .section-card p{ margin-bottom:.6rem; }

/* on larger screens show items in a row with wrapping */
@media (min-width: 880px){
  .sections-grid{
    flex-direction: row;
    flex-wrap: wrap;
  }
  .section-item{
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 260px;
  }
}

/* hover lift for the item box */
.section-item:hover{
  transform: translateY(-6px);
  box-shadow: 0 26px 48px rgba(2,6,23,0.48);
  border-color: rgba(255,255,255,0.05);
}

/* small-screen tweak: ensure full-width stack with separated boxes */
@media (max-width: 640px){
  .sections-grid{ gap: .9rem; }
  .section-item{ padding: .85rem; }
}

/* Skip link: visually hidden until focused (accessibility) */
.skip-link{
  position: fixed; /* changed from absolute to fixed */
  left: 12px;
  top: 12px;
  background: rgba(0,0,0,0.65);
  color: var(--text);
  padding: .45rem .7rem;
  border-radius: 8px;
  transform: translateY(-140%);
  opacity: 0;
  transition: transform .18s ease, opacity .12s ease;
  z-index: 9999; /* place above everything when shown */
  text-decoration: none;
  font-weight: var(--fw-medium);
}
.skip-link:focus,
.skip-link:focus-visible{
  transform: translateY(0);
  opacity: 1;
  outline: 2px solid rgba(72,181,255,0.16);
  outline-offset: 3px;
}

/* Sections panel: ensure it doesn't get visually overlapped and clears previous content */
.sections-panel{
  clear: both;       /* ensure it begins below floats */
  z-index: 2;        /* align with main/header stacking */
  overflow: visible; /* ensure child shadows are shown */
  box-sizing: border-box;
  margin-top: var(--section-gap);
}

/* make sure containers use border-box sizing (defensive) */
.container{ 
  box-sizing: border-box; 
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* defensive: ensure hero visual doesn't produce unexpected overflow */
.hero-visual{ max-width: 100%; overflow: hidden; }

/* Active nav link state (set by JS via aria-current or .active) */
.nav a[aria-current="true"],
.nav a.active{
  color: var(--accent-2);
  background: rgba(255,255,255,0.02);
  box-shadow: 0 8px 20px rgba(72,181,255,0.04);
}

/* Improve focus-visible for interactive elements */
:focus-visible{
  outline: 3px solid rgba(72,181,255,0.18);
  outline-offset: 3px;
}

.feature-list{
  /* ensure list text uses the page text color */
  color: var(--text);
  list-style: none;
  padding: 0;
  margin: 0 0 .6rem 0;
  display: grid;
  gap: .65rem;
}
.feature-list li{
  padding-left: 1.25rem;
  position: relative;
  /* keep this for compatibility */
  color: var(--text);
}
.feature-list li::before{
  content: "";
  position: absolute;
  left: 0;
  top: .6rem;
  width: 8px;
  height: 8px;
  border-radius:50%;
  background: var(--accent-2);
  box-shadow: 0 4px 10px rgba(126,243,197,0.06);
}
/* explicitly style the headline part so <strong> isn't rendered in default black */
.feature-list li strong{
  color: var(--text);
  font-weight: var(--fw-medium);
}
/* keep the descriptive span muted */
.feature-list li .muted{
  color: var(--muted);
  font-weight: var(--fw-regular);
}
