/* NCLI UI polish — navigation, accessibility, mobile UX */

.os-subtext {
  margin-top: 8px;
  color: #64748b;
}

:root {
  --ncli-primary: #2563eb;
  --ncli-primary-dark: #0f172a;
  --ncli-dark: #0f172a;
  --ncli-accent: #22c55e;
  --ncli-warning: #f59e0b;
  --ncli-text: #1e293b;
  --ncli-muted: #64748b;
  --ncli-border: #e2e8f0;
  --ncli-radius: 10px;
  --ncli-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 10000;
  background: var(--ncli-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
  outline: none;
  box-shadow: var(--focus-ring);
}

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

.nav-dropdown-toggle {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.nav-dropdown-toggle .fa-chevron-down {
  transition: transform 0.2s ease;
}

.nav-dropdown.is-open .nav-dropdown-toggle .fa-chevron-down,
.nav-dropdown:hover .nav-dropdown-toggle .fa-chevron-down {
  transform: rotate(180deg);
}

.nav-dropdown.is-open .dropdown-menu {
  display: block;
}

/* Focus & keyboard */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary:focus-visible,
.btn-outline:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Softer image reveal — content only */
.gallery-item img,
.hero-image img,
.product-card img,
.blog-card img {
  transition: opacity 0.35s ease;
}

img.is-loading {
  opacity: 0;
}

img.is-loaded,
img.img-error {
  opacity: 1;
}

img.img-error {
  object-fit: contain;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  min-height: 120px;
}

/* Mobile action bar */
.mobile-action-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 998;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--ncli-border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  gap: 8px;
  grid-template-columns: 1fr 1fr 1.2fr;
}

.mab-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--ncli-radius);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--ncli-border);
  color: var(--ncli-text);
  background: #fff;
}

.mab-btn.mab-wa {
  border-color: #86efac;
  color: var(--ncli-accent);
  background: #f0fdf4;
}

.mab-btn.mab-primary {
  background: var(--ncli-primary);
  border-color: var(--ncli-primary);
  color: #fff;
}

body.dark .mobile-action-bar {
  background: rgba(15, 23, 42, 0.96);
  border-top-color: #334155;
}

body.dark .mab-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

/* Chat + WA spacing on mobile */
@media (max-width: 900px) {
  .mobile-action-bar {
    display: grid;
  }

  body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .whatsapp-float {
    bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .chat-widget {
    bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .back-to-top.show {
    bottom: 175px !important;
  }

  .header-inner .btn-primary.header-cta {
    display: none !important;
  }

  .navbar {
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }

  .navbar .nav-dropdown .dropdown-menu {
    display: none !important;
    margin-top: 4px;
    padding-left: 8px;
  }

  .navbar .nav-dropdown.is-open .dropdown-menu {
    display: block !important;
  }

  .navbar .nav-dropdown:hover .dropdown-menu {
    display: none !important;
  }

  .navbar .nav-dropdown.is-open:hover .dropdown-menu {
    display: block !important;
  }
}

@media (max-width: 480px) {
  .header-inner .btn-primary.header-cta {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .page-loader {
    display: none !important;
  }

  .testimonials-track {
    animation: none !important;
  }
}

/* =========================================
   MAGIC THEME TOGGLE (DAY / NIGHT SWITCH)
========================================= */
.magic-theme-toggle {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  margin-right: 10px;
}

.mtt-track {
  width: 66px;
  height: 32px;
  border-radius: 34px;
  background: #4facfe; /* Day Sky */
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.2), 0 2px 5px rgba(0,0,0,0.1);
  overflow: hidden;
  position: relative;
  transition: background 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mtt-sky {
  width: 100%;
  height: 100%;
  position: relative;
}

/* Sun / Moon Wrapper */
.mtt-sun-moon {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fcd34d; /* Sun color */
  box-shadow: 0 0 8px #fde68a, inset -2px -2px 4px rgba(0,0,0,0.1);
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 5;
}

/* Clouds (Day Mode) */
.mtt-clouds {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease, transform 0.5s ease;
}

.mtt-cloud {
  background: #fff;
  position: absolute;
  border-radius: 50px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mtt-cloud-1 {
  width: 20px;
  height: 8px;
  top: 6px;
  right: 8px;
}
.mtt-cloud-1::before, .mtt-cloud-1::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.mtt-cloud-1::before {
  width: 10px; height: 10px; top: -4px; left: 2px;
}
.mtt-cloud-1::after {
  width: 6px; height: 6px; top: -2px; right: 2px;
}

.mtt-cloud-2 {
  width: 14px;
  height: 6px;
  top: 18px;
  right: 22px;
  opacity: 0.8;
}

/* Stars (Night Mode) */
.mtt-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.5s ease;
}

.mtt-star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 3px #fff;
  animation: mtt-twinkle 2s infinite ease-in-out alternate;
}

.mtt-star:nth-child(1) { width: 3px; height: 3px; top: 5px; left: 14px; }
.mtt-star:nth-child(2) { width: 2px; height: 2px; top: 16px; left: 8px; animation-delay: 0.5s; }
.mtt-star:nth-child(3) { width: 4px; height: 4px; top: 10px; left: 28px; animation-delay: 1s; }
.mtt-star:nth-child(4) { width: 2px; height: 2px; top: 20px; left: 22px; animation-delay: 1.5s; }

@keyframes mtt-twinkle {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

/* Moon Craters */
.mtt-craters {
  width: 100%;
  height: 100%;
  position: relative;
  opacity: 0;
  transform: rotate(-45deg);
  transition: all 0.5s ease;
}

.mtt-crater {
  position: absolute;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2);
}

.mtt-crater:nth-child(1) { width: 5px; height: 5px; top: 4px; left: 12px; }
.mtt-crater:nth-child(2) { width: 3px; height: 3px; top: 12px; left: 6px; }
.mtt-crater:nth-child(3) { width: 7px; height: 7px; top: 12px; left: 14px; }

/* =========================================
   DARK MODE ACTIVATED
========================================= */
body.dark .mtt-track {
  background: #0f172a; /* Deep space */
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5), 0 2px 5px rgba(0,0,0,0.2);
}

body.dark .mtt-sun-moon {
  transform: translateX(34px);
  background: #cbd5e1; /* Moon color */
  box-shadow: 0 0 10px rgba(255,255,255,0.4), inset -2px -2px 5px rgba(0,0,0,0.2);
}

body.dark .mtt-clouds {
  opacity: 0;
  transform: translateY(10px);
}

body.dark .mtt-stars {
  opacity: 1;
  transform: translateY(0);
}

body.dark .mtt-craters {
  opacity: 1;
  transform: rotate(0deg);
}

.magic-theme-toggle:focus-visible .mtt-track {
  outline: 2px solid var(--ncli-primary);
  outline-offset: 2px;
}

/* Responsive grid overrides for Govt Jobs on home page */
@media (max-width: 1024px) {
  .jobs-preview-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 768px) {
  .jobs-preview-grid {
    grid-template-columns: 1fr !important;
  }
}
