/* =========================================================
   SCIRIDGE TECHNOLOGIES — MASTER NAVIGATION STYLESHEET
   PREMIUM WARM IVORY NAVIGATION
   Refactored for High Contrast, Clean Typography & Readability
========================================================= */

/* =========================================================
   01. COLOR FOUNDATION
========================================================= */

:root {
  --nav-bg: #F5F3EE;
  --nav-bg-soft: #FBFAF7;
  --nav-bg-hover: #EAE6DE;

  --nav-text: #191A1C;
  --nav-text-secondary: #424743;
  --nav-text-muted: #5E645F;

  --nav-border: #D5D0C6;
  --nav-border-soft: rgba(25, 26, 28, 0.12);

  --nav-accent: #C85A4A;
  --nav-accent-dark: #A9473A;

  --nav-shadow: rgba(25, 26, 28, 0.12);
}

/* =========================================================
   02. DESKTOP NAVIGATION BAR
========================================================= */

.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header, 1000);
  height: var(--nav-height, 82px);
  background: rgba(245, 243, 238, 0.96);
  border-bottom: 1px solid rgba(25, 26, 28, 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: navFadeIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: height 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.35s ease,
              border-color 0.35s ease,
              box-shadow 0.35s ease;
}

.main-nav.scrolled,
.main-nav.is-scrolled {
  height: 70px;
  background: rgba(245, 243, 238, 0.98);
  border-bottom-color: rgba(25, 26, 28, 0.14);
  box-shadow: 0 12px 35px rgba(25, 26, 28, 0.08);
}

@keyframes navFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   03. NAVIGATION CONTAINER
========================================================= */

.nav-container {
  width: min(calc(100% - 48px), var(--container-wide, 1340px));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 35px;
}

/* =========================================================
   04. LOGO
========================================================= */

.site-logo {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  color: var(--nav-text);
  font-family: var(--font-display, var(--font-primary, sans-serif));
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.site-logo:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.site-logo-image {
  display: block;
  width: 145px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
}

.logo-sci {
  color: var(--nav-text);
  font-weight: 800;
}

.logo-ridge {
  color: var(--nav-accent);
  font-weight: 700;
}

/* =========================================================
   05. DESKTOP NAVIGATION LINKS
========================================================= */

.nav-links {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  position: relative;
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--nav-text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 20px;
  height: 2px;
  background: var(--nav-accent);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-link:hover,
.nav-link.active,
.nav-link[aria-current="page"] {
  color: var(--nav-text);
}

.nav-link:hover::after,
.nav-link.active::after,
.nav-link[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* =========================================================
   06. SERVICES DROPDOWN
========================================================= */

.nav-dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-dropdown-toggle {
  cursor: pointer;
}

.dropdown-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--nav-text-secondary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: color 0.2s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-dropdown:hover .dropdown-arrow,
.nav-dropdown:focus-within .dropdown-arrow {
  color: var(--nav-accent);
  transform: rotate(180deg);
}

/* =========================================================
   07. DESKTOP DROPDOWN PANEL
========================================================= */

.dropdown-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  width: 440px;
  padding: 10px;
  transform: translate(-50%, 14px);
  background: rgba(251, 250, 247, 0.99);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 24px 60px rgba(25, 26, 28, 0.16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: opacity 0.22s ease,
              transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.22s ease;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  width: 48px;
  height: 2px;
  background: var(--nav-accent);
}

.dropdown-menu > a {
  position: relative;
  width: 100%;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 12px 18px;
  background: transparent;
  border-bottom: 1px solid rgba(25, 26, 28, 0.08);
  border-radius: 4px;
  text-decoration: none;
  overflow: hidden;
  transition: background 0.2s ease, padding-left 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.dropdown-menu > a:first-child {
  padding-top: 14px;
}

.dropdown-menu > a:last-child {
  border-bottom: 0;
  padding-bottom: 14px;
}

.dropdown-menu > a:hover {
  background: var(--nav-bg-hover);
  padding-left: 24px;
}

.dropdown-menu > a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--nav-accent);
  transform: scaleY(0);
  transform-origin: center bottom;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.dropdown-menu > a:hover::before,
.dropdown-menu > a:focus-visible::before {
  transform: scaleY(1);
}

.dropdown-title {
  display: block;
  width: 100%;
  margin: 0;
  color: var(--nav-text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.dropdown-description {
  display: block;
  width: 100%;
  margin: 0;
  color: var(--nav-text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.5;
}

.dropdown-menu > a:hover .dropdown-title {
  color: var(--nav-accent);
}

.dropdown-menu > a:hover .dropdown-description {
  color: var(--nav-text);
}

.dropdown-menu > a:focus-visible {
  outline: 2px solid var(--nav-accent);
  background: var(--nav-bg-hover);
}

/* =========================================================
   08. CONTACT BUTTON
========================================================= */

.nav-contact {
  margin-left: 12px;
  height: 44px;
  padding: 0 22px;
  background: var(--nav-accent);
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--nav-accent);
  border-radius: var(--radius-sm, 4px);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(200, 90, 74, 0.25);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-contact::after {
  display: none !important;
}

.nav-contact:hover {
  background: var(--nav-accent-dark);
  border-color: var(--nav-accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(200, 90, 74, 0.35);
}

/* =========================================================
   09. MOBILE MENU TOGGLE
========================================================= */

.mobile-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5.5px;
  background: var(--nav-bg-soft);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: var(--nav-bg-hover);
  border-color: #C0BBB0;
  box-shadow: 0 6px 16px rgba(25, 26, 28, 0.08);
}

.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--nav-text);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s ease,
              width 0.2s ease;
}

/* Hamburger → X */
.mobile-menu-toggle.active span:nth-child(1),
.mobile-menu-toggle.is-active span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2),
.mobile-menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
  width: 0;
}

.mobile-menu-toggle.active span:nth-child(3),
.mobile-menu-toggle.is-active span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* =========================================================
   10. MOBILE CLOSE BUTTON
========================================================= */

.mobile-menu-close {
  position: absolute;
  top: calc(var(--nav-mobile-height, 68px) + 18px);
  right: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--nav-bg-soft);
  border: 1px solid var(--nav-border);
  border-radius: 4px;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(25, 26, 28, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-menu-close:hover {
  background: var(--nav-accent);
  border-color: var(--nav-accent);
  transform: rotate(90deg);
}

.mobile-menu-close span {
  position: absolute;
  width: 18px;
  height: 2px;
  background: var(--nav-text);
}

.mobile-menu-close:hover span {
  background: #ffffff;
}

.mobile-menu-close span:first-child { transform: rotate(45deg); }
.mobile-menu-close span:last-child { transform: rotate(-45deg); }

.mobile-menu-close:focus-visible {
  outline: 2px solid var(--nav-accent);
  outline-offset: 3px;
}

/* =========================================================
   11. MOBILE FULLSCREEN DRAWER
========================================================= */

.mobile-navigation {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-mobile-menu, 1100) - 1);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 92% 15%, rgba(200, 90, 74, 0.08), transparent 25%),
    radial-gradient(circle at 8% 82%, rgba(104, 112, 106, 0.04), transparent 28%),
    linear-gradient(145deg, #F5F3EE 0%, #FBFAF7 52%, #EDEAE3 100%);
  color: var(--nav-text);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(25, 26, 28, 0.2) transparent;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-navigation.active,
.mobile-navigation.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* Decorative Orbits */
.mobile-navigation::before,
.mobile-navigation::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.mobile-navigation::before {
  width: 480px;
  height: 480px;
  top: 70px;
  right: -285px;
  border: 1px solid rgba(200, 90, 74, 0.12);
}

.mobile-navigation::after {
  width: 305px;
  height: 305px;
  top: 160px;
  right: -180px;
  border: 1px solid rgba(25, 26, 28, 0.06);
}

/* =========================================================
   12. MOBILE NAVIGATION INNER
========================================================= */

.mobile-navigation-inner {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 44px), 640px);
  margin-inline: auto;
  padding-top: calc(var(--nav-mobile-height, 68px) + 24px);
  padding-bottom: 38px;
  display: flex;
  flex-direction: column;
}

.mobile-navigation-inner::before {
  content: "Navigation";
  display: block;
  margin-bottom: 12px;
  color: var(--nav-accent);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* =========================================================
   13. MOBILE PRIMARY MENU
========================================================= */

.mobile-nav-link,
.mobile-services-toggle {
  position: relative;
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(25, 26, 28, 0.12);
  color: var(--nav-text);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, padding-left 0.25s ease;
}

.mobile-nav-link::before,
.mobile-services-toggle::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 2px;
  background: var(--nav-accent);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-nav-link:hover,
.mobile-nav-link:focus-visible,
.mobile-services-toggle:hover,
.mobile-services-toggle:focus-visible {
  color: var(--nav-accent);
  outline: none;
}

.mobile-nav-link:hover::before,
.mobile-nav-link:focus-visible::before,
.mobile-services-toggle:hover::before,
.mobile-services-toggle:focus-visible::before {
  width: 100%;
}

/* =========================================================
   14. MOBILE SERVICES ACCORDION
========================================================= */

.mobile-services {
  width: 100%;
}

.mobile-services-toggle {
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}

.mobile-arrow {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--nav-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--nav-accent);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              color 0.2s ease;
}

.mobile-services-toggle[aria-expanded="true"] {
  color: var(--nav-text);
  border-bottom-color: rgba(200, 90, 74, 0.35);
}

.mobile-services-toggle[aria-expanded="true"] .mobile-arrow {
  transform: rotate(45deg);
  background: var(--nav-accent);
  border-color: var(--nav-accent);
  color: #ffffff;
}

/* =========================================================
   15. MOBILE SERVICES SUBMENU
========================================================= */

.mobile-services-menu {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.25s ease,
              visibility 0.25s ease;
}

.mobile-services-menu.active,
.mobile-services-menu.is-open {
  max-height: 340px;
  opacity: 1;
  visibility: visible;
}

.mobile-services-menu a {
  position: relative;
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid rgba(25, 26, 28, 0.08);
  color: var(--nav-text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: color 0.2s ease,
              background 0.2s ease,
              padding-left 0.25s ease,
              opacity 0.3s ease,
              transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-services-menu.active a,
.mobile-services-menu.is-open a {
  opacity: 1;
  transform: translateY(0);
}

.mobile-services-menu.active a:nth-child(1) { transition-delay: 0.03s; }
.mobile-services-menu.active a:nth-child(2) { transition-delay: 0.06s; }
.mobile-services-menu.active a:nth-child(3) { transition-delay: 0.09s; }
.mobile-services-menu.active a:nth-child(4) { transition-delay: 0.12s; }
.mobile-services-menu.active a:nth-child(5) { transition-delay: 0.15s; }

.mobile-services-menu a::before {
  content: "";
  position: absolute;
  left: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nav-accent);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mobile-services-menu a:hover,
.mobile-services-menu a:focus-visible {
  padding-left: 28px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--nav-text);
  outline: none;
}

.mobile-services-menu a:hover::before,
.mobile-services-menu a:focus-visible::before {
  opacity: 1;
  transform: scale(1);
}

.mobile-services-menu a:first-child {
  color: var(--nav-accent);
  font-weight: 700;
}

/* =========================================================
   16. MOBILE CTA BUTTON
========================================================= */

.mobile-navigation-inner > .mobile-nav-link:last-child {
  margin-top: 24px;
  min-height: 56px;
  justify-content: center;
  padding: 0 16px;
  border: 1.5px solid rgba(200, 90, 74, 0.45);
  border-radius: 4px;
  background: rgba(200, 90, 74, 0.08);
  color: var(--nav-text);
  font-size: 1.05rem;
  font-weight: 700;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mobile-navigation-inner > .mobile-nav-link:last-child::before,
.mobile-navigation-inner > .mobile-nav-link:last-child::after {
  display: none !important;
  content: none !important;
}

.mobile-navigation-inner > .mobile-nav-link:last-child:hover,
.mobile-navigation-inner > .mobile-nav-link:last-child:focus-visible {
  background: var(--nav-accent);
  border-color: var(--nav-accent);
  color: #ffffff;
  transform: translateY(-2px);
}

/* =========================================================
   17. MOBILE MENU FOOTER
========================================================= */

.mobile-menu-footer {
  margin-top: 32px;
  padding-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-top: 1px solid rgba(25, 26, 28, 0.12);
}

.mobile-menu-footer-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-menu-footer-item > span:first-child {
  color: var(--nav-text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.mobile-menu-footer-item > span:last-child,
.mobile-menu-footer-item a {
  color: var(--nav-text);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
}

.mobile-menu-footer-item a:hover {
  color: var(--nav-accent);
}

/* =========================================================
   18. RESPONSIVE BREAKPOINTS
========================================================= */

@media (min-width: 769px) {
  .mobile-navigation {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .nav-container {
    width: min(calc(100% - 40px), var(--container-width, 1240px));
    gap: 20px;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-link {
    padding: 0 12px;
    font-size: 0.875rem;
  }

  .nav-contact {
    margin-left: 6px;
    padding: 0 16px;
  }

  .dropdown-menu {
    width: 400px;
  }
}

@media (max-width: 768px) {
  .main-nav {
    height: var(--nav-mobile-height, 68px);
    background: rgba(245, 243, 238, 0.98);
  }

  .main-nav.scrolled,
  .main-nav.is-scrolled {
    height: 64px;
    box-shadow: 0 8px 25px rgba(25, 26, 28, 0.08);
  }

  .nav-container {
    width: calc(100% - 36px);
  }

  .site-logo {
    font-size: 24px;
  }

  .site-logo-image {
    width: 125px;
    max-height: 42px;
  }

  .nav-links,
  .dropdown-menu {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-navigation-inner {
    padding-top: calc(var(--nav-mobile-height, 68px) + 20px);
  }
}

@media (max-width: 480px) {
  .nav-container {
    width: calc(100% - 28px);
  }

  .mobile-navigation-inner {
    width: calc(100% - 32px);
    padding-bottom: 28px;
  }

  .mobile-nav-link,
  .mobile-services-toggle {
    min-height: 62px;
    font-size: 1.15rem;
    font-weight: 700;
  }

  .mobile-services-menu a {
    min-height: 48px;
    font-size: 0.875rem;
  }

  .mobile-arrow {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    font-size: 1.1rem;
  }

  .mobile-menu-footer {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* =========================================================
   19. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  .main-nav,
  .dropdown-menu,
  .dropdown-menu > a,
  .mobile-navigation,
  .mobile-nav-link,
  .mobile-services-toggle,
  .mobile-services-menu,
  .mobile-services-menu a,
  .mobile-arrow,
  .nav-link,
  .site-logo,
  .mobile-menu-toggle,
  .mobile-menu-toggle span,
  .mobile-menu-close {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}