/* ==========================================================================
   Design tokens, base styles, and the chrome shared by every page
   (font face, nav bar, footer, scroll-reveal animation, section headers).
   ========================================================================== */

:root {
  --dark-navy: #020c1b;
  --navy: #0a192f;
  --light-navy: #112240;
  --lightest-navy: #233554;
  --navy-shadow: rgba(2, 12, 27, 0.7);
  --slate: #8892b0;
  --light-slate: #a8b2d1;
  --lightest-slate: #ccd6f6;
  --white: #e6f1ff;
  --green-bright: #64ffda;
  --green-tint: rgba(100, 255, 218, 0.1);

  --nav-height: 62px;
  --content-pad: 70px;

  /* One easing curve for the whole site keeps motion feeling of a piece. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --lift: cubic-bezier(0.34, 1.3, 0.64, 1);
}

@font-face {
  font-family: "NTR";
  /* Subset to latin + punctuation: 7 KB instead of the 374 KB original,
     and no Google Fonts request on the critical path. */
  src: url("/fonts/ntr-latin.woff2") format("woff2"),
       url("/fonts/NTR-Regular.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  /* Anchored sections must clear the fixed nav bar. */
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--navy);
  color: var(--slate);
  font-family: "NTR", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--lightest-navy);
  color: var(--white);
}

a {
  color: var(--green-bright);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

img {
  max-width: 100%;
  height: auto;
}

/* Visible only to keyboard users, never on mouse click. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link ------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--light-navy);
  color: var(--green-bright);
  border: 1px solid var(--green-bright);
  border-radius: 6px;
  font-size: 16px;
  transition: top 0.25s var(--ease-out);
}

.skip-link:focus-visible {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Button ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: bold;
  padding: 12px 32px;
  border: 1px solid var(--green-bright);
  border-radius: 4px;
  cursor: pointer;
  background-image: linear-gradient(var(--green-tint), var(--green-tint));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size 0.4s var(--ease-out), transform 0.25s var(--lift),
    box-shadow 0.3s var(--ease-out);
}

.btn:hover {
  background-size: 100% 100%;
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -14px var(--green-bright);
}

/* Nav bar --------------------------------------------------------------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background-color: rgba(10, 25, 47, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out), transform 0.35s var(--ease-out);
}

/* Set by js/main.js once the page is scrolled past the hero. */
.nav.is-stuck {
  border-bottom-color: var(--lightest-navy);
  box-shadow: 0 10px 30px -10px var(--navy-shadow);
}

/* Nav hides on scroll down, returns on scroll up. */
.nav.is-hidden {
  transform: translateY(-100%);
}

.nav__inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__brand {
  color: var(--lightest-slate);
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav__brand:hover {
  color: var(--green-bright);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.6vw, 22px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  color: var(--lightest-slate);
  font-size: 17px;
  font-weight: bold;
  border-radius: 6px;
}

.nav__link:hover,
.nav__link[aria-current="page"] {
  color: var(--green-bright);
}

/* Underline grows out from the centre on hover. */
.nav__link--text::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 1.5px;
  background: var(--green-bright);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.28s var(--ease-out);
}

.nav__link--text:hover::after,
.nav__link--text[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav__link svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
  display: block;
  transition: transform 0.25s var(--lift);
}

.nav__link--icon:hover svg {
  transform: translateY(-3px);
}

.nav__social {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 6px;
  margin-left: 2px;
  border-left: 1px solid var(--lightest-navy);
}

/* Section headers ------------------------------------------------------- */

.section-header {
  display: flex;
  align-items: center;
  padding-bottom: 42px;
}

.section-title {
  color: var(--lightest-slate);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: bold;
  line-height: 1.1;
  margin: 0;
  white-space: nowrap;
}

/* The rule that trails off after the heading. Animates out with the section. */
.section-header::after {
  content: "";
  display: block;
  flex: 1;
  max-width: 300px;
  height: 1px;
  margin-left: 20px;
  background-color: var(--lightest-navy);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s var(--ease-out) 0.2s;
}

.reveal.is-visible .section-header::after,
.section-header.is-visible::after {
  transform: scaleX(1);
}

/* Scroll reveal --------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s var(--ease-out), transform 0.75s var(--ease-out);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Footer ---------------------------------------------------------------- */

.footer {
  padding: 90px 0 44px;
  text-align: center;
  color: var(--slate);
  font-size: 16px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  margin-bottom: 12px;
}

.footer__links a:hover {
  color: var(--white);
}

.footer__meta {
  color: var(--slate);
  opacity: 0.85;
}

/* Reduced motion -------------------------------------------------------- */

@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;
    scroll-behavior: auto !important;
  }

  /* Anything that reveals on scroll must still end up visible. */
  .reveal {
    opacity: 1;
    transform: none;
  }

  .section-header::after {
    transform: scaleX(1);
  }
}

@media only screen and (max-width: 780px) {
  .nav__link--text {
    font-size: 15px;
  }
}

/* Below this width the section links and four social icons stop fitting
   side by side, so the section links give way (they duplicate the page's
   own scroll order anyway). */
@media only screen and (max-width: 640px) {
  :root {
    --content-pad: 24px;
  }

  .nav__brand {
    font-size: 18px;
  }

  .nav__link {
    padding: 8px 7px;
  }

  .nav__link--text {
    display: none;
  }

  .nav__social {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
  }
}
