/* ============================================================
   myskillsKenya — BACKGROUND ECOSYSTEM (background.css)
   ------------------------------------------------------------
   Additive, full-viewport background layer system.

   Visual identity:  SKILLS -> GROWTH -> CONNECTION -> OPPORTUNITY

   Three fixed, pointer-events:none layers behind all content:
     1. body::before  — atmospheric depth (drifting radial auroras)
     2. body::after   — structured skill-network pattern (tiled SVG)
     3. .bg-nodes      — a few gently pulsing "living" nodes (JS-injected)

   Page variations:  bg-home is the single universal treatment.
   (Retired per-page variants alias it below so navigation can never
   swap the backdrop.)
   Theme-aware:      light mode = subtle & clean
                      dark mode  = deeper, faintly illuminated

   All motion is slow, smooth, GPU-friendly and disabled under
   prefers-reduced-motion.  Nothing here intercepts clicks.
   ============================================================ */

/* ============================================================
   1. BACKGROUND TOKENS  (light + dark)
   These extend the existing --msk-* palette for background use.
   ============================================================ */

:root {
  /* atmospheric aurora colours */
  --msk-aurora-a: rgba(59, 130, 246, 0.13);
  --msk-aurora-b: rgba(16, 185, 129, 0.09);
  --msk-aurora-c: rgba(124, 58, 237, 0.08);

  /* network pattern opacity */
  --msk-network-opacity: 0.55;

  /* living-node colour */
  --msk-lnode: rgba(59, 130, 246, 0.30);

  /* vignette depth */
  --msk-vignette: rgba(15, 23, 42, 0.03);
}

html[data-theme="dark"] {
  --msk-aurora-a: rgba(98, 165, 255, 0.18);
  --msk-aurora-b: rgba(52, 211, 153, 0.12);
  --msk-aurora-c: rgba(124, 58, 237, 0.12);

  --msk-network-opacity: 0.7;

  --msk-lnode: rgba(98, 165, 255, 0.35);

  --msk-vignette: rgba(0, 0, 0, 0.15);
}

/* ============================================================
   2. BASE — universal solid white page background
   ============================================================ */

html {
  position: relative;
  background: var(--background);
}
body {
  background: var(--background);
}

/* ============================================================
   3. LAYER 1 — ATMOSPHERIC DEPTH  (body::before)
   Large radial gradients that slowly drift, creating depth.
   ============================================================ */

/* UNIVERSAL WHITE BACKGROUND: decorative atmospheric + pattern + node
   layers are retired. Selectors are kept (display:none) so background.js
   can still inject its hooks without painting anything. */
body::before,
body::after,
.bg-nodes,
.bg-node,
body.bg-home::before,
body.bg-home::after,
body.bg-home .bg-nodes,
.bg-dashboard::before,
.bg-admin::before,
.bg-generic::before,
.bg-dashboard::after,
.bg-admin::after,
.bg-generic::after {
  display: none;
  content: none;
  background: none;
  background-image: none;
  animation: none;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
}

/* Retired keyframes kept as no-ops for any lingering references. */
@keyframes bg-drift { from { opacity: 0; } to { opacity: 0; } }
@keyframes bg-pattern-drift { from { opacity: 0; } to { opacity: 0; } }
@keyframes bg-node-pulse { from { opacity: 0; } to { opacity: 0; } }

/* Retired: original Layer 1 / Layer 2 / Layer 3 / universal / dark-mode
   gradient + pattern rules are disabled by the comment below. The page
   background is plain #FFFFFF (see BASE above). Per-role auth visuals are
   handled in professional-white.css on the same white page background. */
/* __MSK_WHITE_BG_RETIRED__ START
   (everything until __MSK_WHITE_BG_RETIRED__ END is retired)
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 18% 22%, var(--msk-aurora-a) 0%, transparent 60%),
    radial-gradient(ellipse 55% 45% at 82% 30%, var(--msk-aurora-b) 0%, transparent 58%),
    radial-gradient(ellipse 50% 60% at 60% 85%, var(--msk-aurora-c) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 50%, transparent 40%, var(--msk-vignette) 100%);
  background-size: 200% 200%, 200% 200%, 200% 200%, 100% 100%;
  background-position: 0% 0%, 100% 0%, 50% 100%, 50% 50%;
  animation: bg-drift 45s ease-in-out infinite alternate;
}

/* ============================================================
   4. LAYER 2 — SKILL NETWORK PATTERN  (body::after)
   A structured, tileable SVG mesh: a 3x3 grid of nodes joined
   by connection lines, with diagonal "pathway" links and a
   central hub.  Deliberate and ordered — never random dots.
   ============================================================ */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: var(--msk-network-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Cg fill='none' stroke='%233b82f6' stroke-width='0.7' stroke-opacity='0.14'%3E%3Cpath d='M30 75 H210'/%3E%3Cpath d='M30 150 H210'/%3E%3Cpath d='M30 225 H210'/%3E%3Cpath d='M75 30 V270'/%3E%3Cpath d='M150 30 V270'/%3E%3Cpath d='M225 30 V270'/%3E%3Cpath d='M75 75 L150 150 L75 225'/%3E%3Cpath d='M225 75 L150 150 L225 225'/%3E%3Cpath d='M30 75 L75 150 L30 225'/%3E%3Cpath d='M270 75 L225 150 L270 225'/%3E%3C/g%3E%3Cg fill='%233b82f6' fill-opacity='0.18'%3E%3Ccircle cx='75' cy='75' r='2.5'/%3E%3Ccircle cx='150' cy='75' r='3'/%3E%3Ccircle cx='225' cy='75' r='2.5'/%3E%3Ccircle cx='75' cy='150' r='3'/%3E%3Ccircle cx='150' cy='150' r='4.5'/%3E%3Ccircle cx='225' cy='150' r='3'/%3E%3Ccircle cx='75' cy='225' r='2.5'/%3E%3Ccircle cx='150' cy='225' r='3'/%3E%3Ccircle cx='225' cy='225' r='2.5'/%3E%3Ccircle cx='30' cy='75' r='2'/%3E%3Ccircle cx='30' cy='150' r='2'/%3E%3Ccircle cx='30' cy='225' r='2'/%3E%3Ccircle cx='270' cy='75' r='2'/%3E%3Ccircle cx='270' cy='150' r='2'/%3E%3Ccircle cx='270' cy='225' r='2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 300px 300px;
  background-repeat: repeat;
  animation: bg-pattern-drift 60s linear infinite;
}

/* ============================================================
   5. LAYER 3 — LIVING NODES  (.bg-nodes)
   A handful of softly pulsing dots injected by background.js.
   Each node is a fixed, pointer-events:none span.
   ============================================================ */

.bg-nodes {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-node {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--msk-lnode);
  box-shadow: 0 0 8px 1px var(--msk-lnode);
  opacity: 0.5;
  animation: bg-node-pulse 6s ease-in-out infinite;
}

/* ============================================================
   6. UNIVERSAL TREATMENT (single implementation)
   Every page uses bg-home (the landing treatment). The retired
   per-page variant classes below alias it exactly, so even if one
   is ever added, the backdrop cannot change between pages.
   ============================================================ */

/* --- Homepage = universal: strongest, most alive --- */
.bg-home::before {
  background-position: 0% 0%, 100% 0%, 50% 100%, 50% 50%;
}
.bg-home::after {
  --msk-network-opacity: 0.7;
}

/* --- Retired variants: alias bg-home exactly (universal background) --- */
.bg-dashboard::before,
.bg-admin::before,
.bg-generic::before {
  background-position: 0% 0%, 100% 0%, 50% 100%, 50% 50%;
}
.bg-dashboard::after,
.bg-admin::after,
.bg-generic::after {
  --msk-network-opacity: 0.7;
}

/* ============================================================
   7. DARK MODE — illuminated network + deeper aurora
   ============================================================ */

html[data-theme="dark"] body::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Cg fill='none' stroke='%2362a5ff' stroke-width='0.6' stroke-opacity='0.10'%3E%3Cpath d='M30 75 H210'/%3E%3Cpath d='M30 150 H210'/%3E%3Cpath d='M30 225 H210'/%3E%3Cpath d='M75 30 V270'/%3E%3Cpath d='M150 30 V270'/%3E%3Cpath d='M225 30 V270'/%3E%3Cpath d='M75 75 L150 150 L75 225'/%3E%3Cpath d='M225 75 L150 150 L225 225'/%3E%3Cpath d='M30 75 L75 150 L30 225'/%3E%3Cpath d='M270 75 L225 150 L270 225'/%3E%3C/g%3E%3Cg fill='%2362a5ff' fill-opacity='0.12'%3E%3Ccircle cx='75' cy='75' r='2.5'/%3E%3Ccircle cx='150' cy='75' r='3'/%3E%3Ccircle cx='225' cy='75' r='2.5'/%3E%3Ccircle cx='75' cy='150' r='3'/%3E%3Ccircle cx='150' cy='150' r='4.5'/%3E%3Ccircle cx='225' cy='150' r='3'/%3E%3Ccircle cx='75' cy='225' r='2.5'/%3E%3Ccircle cx='150' cy='225' r='3'/%3E%3Ccircle cx='225' cy='225' r='2.5'/%3E%3Ccircle cx='30' cy='75' r='2'/%3E%3Ccircle cx='30' cy='150' r='2'/%3E%3Ccircle cx='30' cy='225' r='2'/%3E%3Ccircle cx='270' cy='75' r='2'/%3E%3Ccircle cx='270' cy='150' r='2'/%3E%3Ccircle cx='270' cy='225' r='2'/%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================================
   8. ANIMATION KEYFRAMES
   All motion is slow, smooth and low-CPU.
   ============================================================ */

@keyframes bg-drift {
  0% { background-position: 0% 0%, 100% 0%, 50% 100%; }
  50% { background-position: 8% 6%, 94% 4%, 55% 94%; }
  100% { background-position: 4% 10%, 97% 8%, 48% 90%; }
}

@keyframes bg-pattern-drift {
  0% { background-position: 0px 0px; }
  100% { background-position: 300px 300px; }
}

@keyframes bg-node-pulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.4); }
}

/* ============================================================
   9. RESPONSIVE — simplify on small screens
   ============================================================ */

@media (max-width: 740px) {
  .bg-nodes {
    display: none;
  }

  body::after {
    --msk-network-opacity: 0.3;
    background-size: 200px 200px;
  }

  .bg-home::after {
    --msk-network-opacity: 0.4;
  }
}

/* ============================================================
   10. ACCESSIBILITY — respect prefers-reduced-motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .bg-node {
    animation: none;
  }

  .bg-node {
    opacity: 0.3;
  }
}

/* ============================================================
   11. HOME — "SKILLS & OPPORTUNITIES ECOSYSTEM" BACKGROUND
   Replaces the generic aurora-drift + mesh + particle system on
   the landing page with a calm, professional environment:
   a daylight-studio tonal field whose soft lights follow the
   page's story stages (learn -> skills -> opportunities ->
   career), a horizon glow above the footer, and a fine
   structured dot grid for atmosphere. Dark mode re-composes the
   same scene over the deep navy base (never a flat black).
   ============================================================ */

body.bg-home::before {
  animation: none;
  background:
    /* daylight behind the hero */
    radial-gradient(ellipse 64% 34% at 50% -6%, rgba(59, 130, 246, 0.11) 0%, transparent 64%),
    /* learning-stage field (left) */
    radial-gradient(ellipse 44% 24% at 8% 26%, rgba(16, 185, 129, 0.08) 0%, transparent 62%),
    /* opportunities-stage field (right) */
    radial-gradient(ellipse 48% 26% at 94% 56%, rgba(59, 130, 246, 0.09) 0%, transparent 64%),
    /* career-stage field (left, lower) */
    radial-gradient(ellipse 42% 22% at 6% 78%, rgba(16, 185, 129, 0.06) 0%, transparent 60%),
    /* horizon glow separating content from footer */
    radial-gradient(ellipse 85% 20% at 50% 90%, rgba(255, 255, 255, 0.26) 0%, transparent 72%),
    /* base page tint */
    linear-gradient(180deg, #f8fbff 0%, #eef4fc 46%, #f7fafd 78%, #eff4fb 100%);
}

/* Atmospheric field for the landing page: a fine, engineered dot
   matrix only.  The previous version pinned six oversized clip-art
   silhouettes (book / laptop / certificate / briefcase / graduation
   cap / growth chart) to the viewport margins; they were sliced by
   the viewport edge and sat behind the copy, so they read as
   accidental art rather than an environment.  The stage lighting
   (::before) now carries the story; this layer supplies texture,
   fading in from the top and out towards the footer. */
body.bg-home::after {
  animation: none;
  opacity: 0.72;
  background-image:
    radial-gradient(circle, rgba(59, 130, 246, 0.13) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(15, 23, 42, 0.045) 0.7px, transparent 1.1px);
  background-repeat: repeat, repeat;
  background-size: 32px 32px, 16px 16px;
  background-position: 16px 16px, 8px 8px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 9%, #000 90%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 9%, #000 90%, transparent 100%);
}

/* no floating particles on the landing page */
body.bg-home .bg-nodes {
  display: none !important;
}

/* --- dark mode: the same composition over the deep navy studio --- */

html[data-theme="dark"] body.bg-home::before {
  background:
    radial-gradient(ellipse 64% 34% at 50% -6%, rgba(98, 165, 255, 0.15) 0%, transparent 64%),
    radial-gradient(ellipse 44% 24% at 8% 26%, rgba(52, 211, 153, 0.08) 0%, transparent 62%),
    radial-gradient(ellipse 48% 26% at 94% 56%, rgba(98, 165, 255, 0.11) 0%, transparent 64%),
    radial-gradient(ellipse 42% 22% at 6% 78%, rgba(52, 211, 153, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 85% 20% at 50% 90%, rgba(98, 165, 255, 0.07) 0%, transparent 72%),
    linear-gradient(180deg, #0e1729 0%, #0a101d 52%, #0d1424 100%);
}

html[data-theme="dark"] body.bg-home::after {
  opacity: 0.66;
  background-image:
    radial-gradient(circle, rgba(148, 163, 184, 0.13) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(98, 165, 255, 0.09) 0.7px, transparent 1.1px);
}

@media (max-width: 740px) {
  body.bg-home::after {
    background-size: 44px 44px;
    opacity: 0.5;
  }
}
/* PART 1+2+5: premium hero layer + role-aware auth backgrounds (additive, CSS-only). */
.msk-hero-shell{position:relative;isolation:isolate;overflow:clip;}
.msk-hero-shell::before{content:"";position:absolute;inset:-10% -5% auto;height:480px;z-index:-1;pointer-events:none;background:radial-gradient(ellipse 42% 55% at 22% 40%,rgba(59,130,246,.13),transparent 65%),radial-gradient(ellipse 34% 48% at 78% 30%,rgba(16,185,129,.10),transparent 65%),radial-gradient(ellipse 30% 40% at 62% 70%,rgba(124,58,237,.08),transparent 65%);animation:msk-hero-drift 26s ease-in-out infinite alternate;}
html[data-theme="dark"] .msk-hero-shell::before{background:radial-gradient(ellipse 44% 55% at 22% 40%,rgba(98,165,255,.16),transparent 65%),radial-gradient(ellipse 36% 48% at 78% 30%,rgba(52,211,153,.11),transparent 65%),radial-gradient(ellipse 32% 42% at 62% 70%,rgba(124,58,237,.12),transparent 65%);}
@keyframes msk-hero-drift{from{transform:translate3d(-1.5%,0,0) scale(1);}to{transform:translate3d(1.5%,-1.5%,0) scale(1.03);}}
.msk-hero-shell .hero-copy h1{text-wrap:balance;color:var(--text);text-shadow:0 1px 0 rgba(255,255,255,.35),0 18px 40px rgba(15,23,42,.12);}
html[data-theme="dark"] .msk-hero-shell .hero-copy h1{text-shadow:0 1px 0 rgba(0,0,0,.45),0 0 28px rgba(98,165,255,.18);}
.msk-hero-shell .hero-copy h1 .hero-hl{color:var(--primary-dark);}
html[data-theme="dark"] .msk-hero-shell .hero-copy h1 .hero-hl{color:#9cc2ff;}
/* Login/register `.auth-page` role-gradient blobs REMOVED — obsolete.
   The login page now uses a clean white page background plus the light
   split-panel treatment defined in professional-white.css (loaded last),
   which also drives body[data-auth-role="..."] learner/employer/admin. */
@media (prefers-reduced-motion:reduce){.msk-hero-shell::before{animation:none;}}
/* Landing industry strip: fills lower hero whitespace intentionally. */
.msk-industry-strip{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 0;}
.msk-industry-chip{font-size:.72rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);background:rgba(255,255,255,.55);padding:8px 12px;border-radius:999px;backdrop-filter:blur(8px);}
html[data-theme="dark"] .msk-industry-chip{background:rgba(255,255,255,.04);color:var(--muted);}
/* Role-aware login links: auth architecture untouched, visual only. */
.auth-role-links{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 4px;}
.auth-role-links a{font-size:.78rem;font-weight:800;padding:8px 12px;border-radius:999px;border:1px solid var(--border);color:var(--text);background:var(--surface-secondary);}
.auth-role-links a[aria-current="true"]{background:var(--primary-dark);box-shadow:0 0 0 1px var(--border);color:#FFFFFF;}
.auth-role-note{font-size:.8rem;opacity:.82;margin:8px 0 0;color:var(--text-muted);}
/* __MSK_WHITE_BG_RETIRED__ END */

/* UNIVERSAL WHITE BACKGROUND — footer + hero-shell cleanup (authoritative).
   Old decorative hero glow is retired; footer chip stays readable on white. */
.msk-hero-shell::before{display:none;background:none;animation:none;}
.site-footer, footer.site-footer{background:var(--background);color:var(--text);border-top:1px solid var(--border);}
.site-footer a{color:#1d4ed8;}