/* ===== Theme tokens ===== */
:root,
[data-bs-theme="light"] {
  --nec-primary: #0b6aa2;
  --nec-primary-dark: #08537f;
  --nec-primary-rgb: 11, 106, 162;
  --nec-accent: #f59e0b;
  --nec-bg: #f5f9fc;
  --nec-surface: #ffffff;
  --nec-surface-2: #eef5fb;
  --nec-text: #0c1b2e;
  --nec-muted: #5b6b75;
  --nec-border: rgba(12, 27, 46, 0.09);
  --nec-shadow: 0 10px 30px rgba(12, 27, 46, 0.08);
  --nec-shadow-lg: 0 24px 60px rgba(11, 106, 162, 0.16);
  --nec-header-bg: rgba(255, 255, 255, 0.85);
}

[data-bs-theme="dark"] {
  --nec-primary: #45c8ee;
  --nec-primary-dark: #2bb0da;
  --nec-primary-rgb: 69, 200, 238;
  --nec-accent: #fbbf24;
  --nec-bg: #070f1c;
  --nec-surface: #0d1829;
  --nec-surface-2: #122136;
  --nec-text: #e6f1f3;
  --nec-muted: #93a7b0;
  --nec-border: rgba(230, 241, 243, 0.09);
  --nec-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --nec-shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
  --nec-header-bg: rgba(7, 15, 28, 0.82);
  --bs-body-bg: var(--nec-bg);
  --bs-body-color: var(--nec-text);
}

/* ===== Base ===== */
html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Inter for comfortable reading; Plus Jakarta Sans for headings and numbers.
   overflow-x: clip is a safety net against sideways scrolling on phones (unlike hidden, it keeps the sticky header working). */
body {
  overflow-x: clip;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  background: var(--nec-bg);
  color: var(--nec-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5,
.brand-text,
.footer-brand,
.stat-number,
.btn {
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

a {
  color: var(--nec-primary);
}

.btn:focus-visible, .btn-link.nav-link:focus-visible, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--nec-surface), 0 0 0 0.25rem rgba(var(--nec-primary-rgb), 0.6);
}

/* ===== Buttons ===== */
.btn-nec {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--nec-primary);
  --bs-btn-border-color: var(--nec-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--nec-primary-dark);
  --bs-btn-hover-border-color: var(--nec-primary-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--nec-primary-dark);
  --bs-btn-active-border-color: var(--nec-primary-dark);
  font-weight: 600;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

[data-bs-theme="dark"] .btn-nec {
  --bs-btn-color: #02203a;
  --bs-btn-hover-color: #02203a;
  --bs-btn-active-color: #02203a;
}

/* Light sweep on hover */
.btn-nec::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.btn-nec:hover::after {
  transform: translateX(120%);
}

.btn-nec-outline {
  --bs-btn-color: var(--nec-text);
  --bs-btn-border-color: var(--nec-border);
  --bs-btn-hover-color: var(--nec-primary);
  --bs-btn-hover-bg: var(--nec-surface);
  --bs-btn-hover-border-color: var(--nec-primary);
  --bs-btn-active-bg: var(--nec-surface);
  font-weight: 600;
  border-radius: 999px;
  border-width: 1.5px;
  background: var(--nec-surface);
}

/* ===== Header / navbar ===== */
.site-header {
  background: var(--nec-header-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--nec-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

.site-header .navbar {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  transition: padding 0.3s ease;
}

.site-header.is-scrolled .navbar {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

/* ===== NEC logo mark (inline SVG, see _LogoMark.cshtml) ===== */
.logo-mark {
  --logo-hand: #8a7340;
  --logo-line: #0a2a5c;
  --logo-ring: #0a2a5c;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

[data-bs-theme="dark"] .logo-mark,
.site-footer .logo-mark {
  --logo-hand: #ffffff;
  --logo-line: #e2f0fc;
  --logo-ring: #5fd6f2;
}

.logo-hand { stroke: var(--logo-hand); }
.logo-line { stroke: var(--logo-line); }
.logo-ring { stroke: var(--logo-ring); }
.logo-lid { fill: var(--logo-line); }

.brand-logo {
  display: inline-block;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  transition: width 0.3s ease, height 0.3s ease;
}

.site-header.is-scrolled .brand-logo {
  width: 50px;
  height: 50px;
}

/* Hands gently close in on hover.
   The resting transforms repeat the SVG attributes so CSS can animate from them. */
.brand-logo use {
  transform-origin: 100px 100px;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo use:first-of-type {
  transform: translate(0, -15px);
}

.brand-logo use:last-of-type {
  transform: rotate(180deg) translate(0, -15px);
}

.navbar-brand:hover .brand-logo use:first-of-type,
.footer-brand:hover .brand-logo use:first-of-type {
  transform: translate(0, -11px);
}

.navbar-brand:hover .brand-logo use:last-of-type,
.footer-brand:hover .brand-logo use:last-of-type {
  transform: rotate(180deg) translate(0, -11px);
}

/* The logo's eye blinks every few seconds */
.brand-logo .logo-eye {
  transform-origin: 102px 100px;
  animation: logo-blink 7s ease-in-out infinite;
}

@keyframes logo-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  94.5% { transform: scaleY(0.08); }
  97% { transform: scaleY(1); }
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 800;
  font-size: 1.12rem;
  line-height: 1.1;
  color: var(--nec-text);
  letter-spacing: 0;
}

.brand-text small {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nec-primary);
  margin-top: 0.2rem;
}

.site-header .nav-link {
  position: relative;
  color: var(--nec-text);
  font-weight: 500;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
  color: var(--nec-primary);
}

@media (min-width: 992px) {
  .site-header .nav-link::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.1rem;
    height: 2px;
    border-radius: 2px;
    background: var(--nec-primary);
    transform: scaleX(0);
    transition: transform 0.25s ease;
  }

  .site-header .nav-link:hover::after,
  .site-header .nav-link.active::after {
    transform: scaleX(1);
  }
}

/* iPad landscape and small laptops: the full menu only fits the 960px container with tighter spacing,
   otherwise "Book Appointment" is pushed off screen and the whole page scrolls sideways */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .site-header .nav-link {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    font-size: 0.95rem;
  }

  .site-header .nav-link::after {
    left: 0.5rem;
    right: 0.5rem;
  }

  .brand-text {
    font-size: 1rem;
  }

  .site-header .btn.px-4 {
    padding-left: 0.9rem !important;
    padding-right: 0.9rem !important;
    white-space: nowrap;
  }
}

/* ===== Theme toggle ===== */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--nec-border);
  background: var(--nec-surface);
  color: var(--nec-text);
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--nec-primary);
  border-color: var(--nec-primary);
  transform: rotate(-12deg);
}

.theme-toggle i {
  grid-area: 1 / 1;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

/* Light mode shows the moon (switch to dark), dark mode shows the sun */
.theme-icon-light {
  transform: translateY(150%) rotate(90deg);
  opacity: 0;
}

[data-bs-theme="dark"] .theme-icon-dark {
  transform: translateY(-150%) rotate(-90deg);
  opacity: 0;
}

[data-bs-theme="dark"] .theme-icon-light {
  transform: none;
  opacity: 1;
  color: var(--nec-accent);
}

/* ===== Inner pages ===== */
.page-title {
  font-weight: 700;
  color: var(--nec-text);
}

.page-title + .lead {
  color: var(--nec-muted);
}

/* ===== Footer (deep navy in both themes) ===== */
.site-footer {
  position: relative;
  overflow: hidden;
  padding-top: 4rem;
  background: linear-gradient(180deg, #001a3d 0%, #00122b 100%);
  color: rgba(226, 240, 252, 0.72);
  font-size: 0.95rem;
}

.footer-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  right: -200px;
  top: -300px;
  background: radial-gradient(circle, rgba(69, 200, 238, 0.18), transparent 65%);
  pointer-events: none;
}

.site-footer a {
  color: rgba(226, 240, 252, 0.8);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: #45c8ee;
}

/* Keep Bootstrap's button colours instead of the footer link colour */
.site-footer a.btn {
  color: var(--bs-btn-color);
}

.site-footer a.btn:hover {
  color: var(--bs-btn-hover-color);
}

.footer-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 2.25rem;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-cta h2 {
  color: #fff;
  font-weight: 800;
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.footer-cta p {
  margin: 0;
}

.footer-cta p a {
  color: #45c8ee;
  font-weight: 700;
}

.site-footer .btn-nec {
  --bs-btn-bg: #45c8ee;
  --bs-btn-border-color: #45c8ee;
  --bs-btn-hover-bg: #2bb0da;
  --bs-btn-hover-border-color: #2bb0da;
  --bs-btn-color: #001a3d;
  --bs-btn-hover-color: #001a3d;
}

.footer-main {
  padding: 3.5rem 0 2.5rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  color: #fff !important;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.15;
}

.footer-brand small {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8a165;
}

.brand-logo-lg {
  width: 76px;
  height: 76px;
}

.footer-about {
  margin: 1.25rem 0 1.5rem;
  max-width: 360px;
}

.footer-social {
  display: flex;
  gap: 0.6rem;
}

.footer-social a {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.footer-social a:hover {
  background: #45c8ee;
  color: #001a3d;
  transform: translateY(-3px);
}

.footer-heading {
  position: relative;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.4rem;
  padding-bottom: 0.75rem;
}

/* Bronze accent from the hands in the NEC logo */
.footer-heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: #c8a165;
}

.footer-links,
.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li + li {
  margin-top: 0.65rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-links a::before {
  content: "";
  width: 0;
  height: 2px;
  background: #45c8ee;
  transition: width 0.25s ease;
}

.footer-links a:hover::before {
  width: 10px;
}

.footer-contact li {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.footer-contact i {
  color: #45c8ee;
  line-height: 1.5;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.75rem 0 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.footer-bottom-links a + a {
  position: relative;
}

/* Small dot separator between the bottom links */
.footer-bottom-links a + a::before {
  content: "";
  position: absolute;
  left: -0.95rem;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: rgba(226, 240, 252, 0.35);
}

/* ===== Floating buttons ===== */
.fab-whatsapp,
.back-to-top {
  position: fixed;
  right: 1.25rem;
  z-index: 1030;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.fab-whatsapp {
  bottom: 1.25rem;
  width: 56px;
  height: 56px;
  font-size: 1.6rem;
  color: #fff;
  background: #25d366;
  animation: fab-ring 2.4s infinite;
}

.fab-whatsapp:hover {
  color: #fff;
  transform: scale(1.08);
}

@keyframes fab-ring {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55), 0 10px 25px rgba(0, 0, 0, 0.25); }
  70% { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0), 0 10px 25px rgba(0, 0, 0, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 10px 25px rgba(0, 0, 0, 0.25); }
}

.back-to-top {
  bottom: 5.5rem;
  width: 44px;
  height: 44px;
  color: #fff;
  background: var(--nec-primary);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

[data-bs-theme="dark"] .back-to-top {
  color: #001a3d;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* Phones: keep logo, theme toggle and menu button on one line */
@media (max-width: 575.98px) {
  .site-header .navbar-brand {
    flex: 1 1 0;
    min-width: 0;
    margin-right: 0.5rem;
    white-space: normal;
  }

  .site-header .navbar-brand + div {
    flex-shrink: 0;
  }

  .brand-logo,
  .site-header.is-scrolled .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand-text {
    font-size: 0.95rem;
  }

  .brand-text small {
    font-size: 0.56rem;
    letter-spacing: 0.1em;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .navbar-toggler {
    padding: 0.3rem 0.55rem;
  }
}

@media (max-width: 991.98px) {
  /* Bootstrap's g-5 gutter (3rem) is wider than the container padding and pushes rows off-screen on phones */
  .row.g-5 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 2.5rem;
  }
}

/* Page-to-page transition: the new page opens from the centre like a dilating pupil.
   Chrome/Edge only (cross-document view transitions); other browsers just load the page. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: none;
}

::view-transition-new(root) {
  animation: pupil-open 0.55s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-new(root) {
    animation: none;
  }
}

/* 71% of the reference length reaches the corners, so the circle ends covering the whole page */
@keyframes pupil-open {
  from { clip-path: circle(0% at 50% 50%); }
  to { clip-path: circle(72% at 50% 50%); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* "Skip to main content": hidden until a keyboard user tabs to it */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2000;
  padding: 0.65rem 1.1rem;
  border-radius: 0.6rem;
  font-weight: 700;
  color: #fff;
  background: var(--nec-primary);
  box-shadow: 0 8px 24px rgba(12, 27, 46, 0.25);
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  color: #fff;
  transform: none;
}

/* Side-sliding reveal animations start up to 40px outside the content; clipping here (not on body, which phones
   ignore when deciding how far to zoom out) keeps the page exactly screen-wide. clip, unlike hidden, keeps sticky working. */
main {
  overflow-x: clip;
}

main:focus {
  outline: none;
}
