/* ============================================
   SMITHDIGITAL — Global Styles
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colours */
  --navy:        #0e2460;
  --navy-dark:   #091840;
  --blue:        #1a4db5;
  --blue-light:  #3b6fd4;
  --blue-pale:   #e8eef8;
  --white:       #ffffff;
  --off-white:   #f4f6fb;
  --text:        #1a1f36;
  --text-muted:  #6b7280;
  --border:      #e2e8f0;

  /* Typography */
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-black:   900;

  /* Spacing */
  --container: 1200px;
  --section-pad: 100px;

  /* Motion */
  --ease:     cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 0.25s;

  /* Nav */
  --nav-h: 72px;
}

html {
  scroll-behavior: smooth;
  /* Dark fallback so site-bg shows before CSS loads */
  background: var(--navy-dark);
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: transparent; /* site-bg div provides the dark base */
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a  { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ── SITE BACKGROUND ──
   Fixed dark grid. Shared across all pages.
   Sections scroll over it — always behind everything. */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, #1a3a8a 100%);
  pointer-events: none;
}
.site-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Page enter animation ── */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
main { animation: page-enter 0.4s var(--ease) both; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: var(--fw-semi);
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}
.btn--primary {
  background: var(--blue);
  color: var(--white);
}
.btn--primary:hover {
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,77,181,0.35);
}
.btn--ghost {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.5);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--white);
  transform: translateY(-2px);
}
.btn--outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn--outline:hover {
  background: var(--blue);
  color: var(--white);
  transform: translateY(-2px);
}

/* ── NAV ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  /* No background on nav itself — sliding panel handles it */
}

/* ── NAV BACKGROUND PANEL ──
   Scales in from the top edge (scaleY 0 → 1, transform-origin: top).
   No backdrop-filter — avoids compositing/paint issues on off-screen elements.
   JS adds/removes .is-visible. */
.nav-bg {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 99;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 1px 0 var(--border);
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform 0.9s var(--ease);
  pointer-events: none;
  /* Force nav-bg onto its own GPU compositor layer so it always
     paints above sticky/animated sections regardless of compositing order */
  will-change: transform;
}
.nav-bg.is-visible {
  transform: scaleY(1);
}

.nav__inner {
  position: relative;
  z-index: 1; /* always above the sliding panel */
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__logo {
  font-size: 1.35rem;
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  backdrop-filter: blur(6px);
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.nav--scrolled .nav__logo {
  background: var(--blue-pale);
  border-color: rgba(26,77,181,0.15);
}
.nav__logo-smith  { color: var(--white); transition: color var(--duration) var(--ease); }
.nav__logo-digital{ color: rgba(168,199,255,0.9); transition: color var(--duration) var(--ease); }
.nav--scrolled .nav__logo-smith  { color: var(--navy); }
.nav--scrolled .nav__logo-digital{ color: var(--blue); }

.nav__links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav__link {
  font-size: 0.9rem;
  font-weight: var(--fw-medium);
  color: rgba(255,255,255,0.85);
  transition: color var(--duration);
  position: relative;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  display: inline-block;
  will-change: transform;
}
/* Glow box */
.nav__link::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.0);
  box-shadow: 0 0 0 1px rgba(255,255,255,0);
  transition: background 0.2s, box-shadow 0.2s;
  pointer-events: none;
}
.nav__link:hover { color: var(--white); }
.nav__link:hover::before {
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 14px rgba(168,199,255,0.35), 0 0 0 1px rgba(255,255,255,0.14);
}
.nav--scrolled .nav__link { color: var(--text-muted); }
.nav--scrolled .nav__link:hover { color: var(--navy); }
.nav--scrolled .nav__link:hover::before {
  background: rgba(26,77,181,0.07);
  box-shadow: 0 0 14px rgba(26,77,181,0.18), 0 0 0 1px rgba(26,77,181,0.12);
}

.nav__cta {
  font-size: 0.875rem;
  padding: 0.55rem 1.25rem;
  /* Inherits btn--primary styles — no overrides needed */
}

/* Mobile hamburger */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all var(--duration) var(--ease);
}
.nav--scrolled .nav__toggle span { background: var(--navy); }

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }

  /* ── Mobile menu open state ──
     Slides down from under the nav bar, full-width dark panel. */
  .nav__links--open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    z-index: 98;
    padding: 0.25rem 1.5rem 1.5rem;
    background: rgba(9, 24, 64, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    gap: 0;
    animation: menu-slide-down 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @keyframes menu-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .nav__links--open .nav__link {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem 0.25rem;
    font-size: 1rem;
    font-weight: var(--fw-medium);
    display: block;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0;
    will-change: auto;
  }
  .nav__links--open .nav__link:hover { color: var(--white); background: none; }
  .nav__links--open .nav__link::before { display: none; }

  .nav__links--open .nav__cta {
    display: flex;
    margin-top: 1.1rem;
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
  }
}

/* ── Hamburger → X morphing animation ── */
.nav__toggle span {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              opacity   0.18s ease,
              background 0.25s ease;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── FOOTER ── */
.footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.7);
  padding: 60px 0 32px;
}
.footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 3rem;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
}
.footer__brand {}
.footer__logo {
  display: flex;
  align-items: baseline;
  font-size: 1.4rem;
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}
.footer__logo .nav__logo-smith  { color: var(--white); }
.footer__logo .nav__logo-digital{ color: #7eb8ff; }
.footer__tagline {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.5);
  max-width: 220px;
  line-height: 1.5;
}
.footer__links {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
}
.footer__col-title {
  font-size: 0.8rem;
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 1rem;
}
.footer__col a {
  display: block;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.65);
  margin-bottom: 0.6rem;
  transition: color var(--duration);
}
.footer__col a:hover { color: var(--white); }
.footer__email {
  display: block;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.75) !important;
  margin-bottom: 0.75rem;
  transition: color var(--duration);
}
.footer__email:hover { color: var(--white) !important; }
.footer__contact-note {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.footer__contact-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: var(--fw-semi);
  color: #7eb8ff !important;
  transition: gap var(--duration), color var(--duration);
}
.footer__contact-cta:hover {
  color: var(--white) !important;
  gap: 0.55rem;
}

.footer__bottom {
  padding-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer__copy {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
}
.footer__social {
  display: flex;
  gap: 1rem;
}
.footer__social a {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  transition: all var(--duration);
  font-size: 0.8rem;
}
.footer__social a:hover {
  border-color: rgba(255,255,255,0.4);
  color: var(--white);
  background: rgba(255,255,255,0.07);
}

/* ══════════════════════════════════════
   GLOBAL MOBILE SCALING
   ══════════════════════════════════════ */

/* Tighter container padding on small phones */
@media (max-width: 480px) {
  .container { padding: 0 1.25rem; }
}

/* Nav — prevent overflow on very small screens */
@media (max-width: 360px) {
  .nav__logo {
    font-size: 1.1rem;
    padding: 0.25rem 0.55rem;
  }
}

/* Footer — stack on mobile */
@media (max-width: 600px) {
  .footer__top {
    flex-direction: column;
    gap: 2rem;
  }
  .footer__links {
    gap: 2rem;
  }
  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
