/* Northern Vector Systems: palette from the logo (navy, slate, glacier blue, sky) on snow white.
   One family, Archivo: the expanded width (125) for headlines echoes the wordmark. */
:root {
  --night: #061a2e;
  --ink: #102a43;
  --muted: #536a80;
  --canvas: #f6f9fc;
  --tint: #eaf1f7;
  --line: #d3e0ea;
  --accent: #1f6ea6;
  --sky: #5bc0eb;
  --on-night: #eef5fb;
  --on-night-muted: #a8bfd3;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 76rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --section: clamp(4.5rem, 10vw, 8rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--on-night);
  color: var(--night);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 1rem;
}

/* Display type: wide, heavy, tight. */
h1,
h2 {
  font-stretch: 125%;
  font-weight: 760;
  letter-spacing: -0.02em;
  line-height: 1.04;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.875rem, 4vw, 3rem);
}

h3 {
  font-stretch: 112%;
  font-weight: 650;
  font-size: 1.3125rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

/* Buttons and links: the only things that react to hover. */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--on-night);
  color: var(--night);
  font-weight: 650;
  font-stretch: 108%;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.2s var(--ease);
}

.button:hover {
  background: var(--sky);
}

.button:active {
  transform: translateY(1px);
}

.button-small {
  min-height: 2.5rem;
  padding: 0 1.125rem;
  font-size: 0.9375rem;
}

.text-link {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.2s, color 0.2s;
}

.text-link:hover {
  text-decoration-thickness: 2px;
}

/* Hero */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: min(100svh, 60rem);
  overflow: hidden;
  background: var(--night);
  color: var(--on-night);
  /* The mesh is 1440x400: track that ratio so the peaks are never cropped at the top. */
  --ridge: clamp(11rem, 27.78vw, 40rem);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-block: 1.5rem;
}

.brand img {
  width: auto;
  height: 2.25rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  font-size: 0.9375rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--on-night-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--on-night);
}

.topbar .button {
  margin-left: auto;
}

.nav-links + .button {
  margin-left: 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  padding-top: clamp(3rem, 9vh, 7rem);
  padding-bottom: calc(var(--ridge) * 0.76 + 2rem);
  margin-block: auto;
}

.hero h1 span {
  display: block;
}

.hero h1 {
  max-width: 13ch;
  font-size: clamp(2.75rem, 7.4vw, 6rem);
  line-height: 0.98;
}

.lede {
  max-width: 36rem;
  margin-top: 1.75rem;
  color: var(--on-night-muted);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: 2.5rem;
}

.ridge {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: var(--ridge);
}

/* Hero mountain (bin/mountain.py): translucent facets, fine edges, small nodes, lit summits. */
.ridge-faces polygon {
  fill: var(--sky);
}

.ridge-lines line {
  stroke: #9ad3f2;
  stroke-opacity: 0.42;
  stroke-width: 1.1;
}

.ridge-nodes circle {
  fill: #b5e2f8;
}

.ridge-nodes .lit {
  fill: var(--night);
  stroke: #fff;
  stroke-width: 1.75;
  vector-effect: non-scaling-stroke;
}

.ridge-pulses circle {
  fill: none;
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  opacity: 0;
}

/* Phones draw the range at under half size: thicker lines and bigger nodes keep it legible. */
@media (max-width: 47.99rem) {
  .ridge-lines line {
    stroke-width: 2.2;
  }

  .ridge-nodes circle {
    r: 3.6px;
  }

  .ridge-nodes .lit {
    r: 6.5px;
  }
}

/* Page load: the nav and headline arrive, then the range builds outward from the main summit
   (nodes, then the edges between them, then the facets), and the lit summits pulse once. */
@media (prefers-reduced-motion: no-preference) {
  .topbar {
    animation: fade 0.8s var(--ease) both;
  }

  .hero h1 span,
  .hero-copy .lede,
  .hero-copy .actions {
    animation: rise 0.9s var(--ease) both;
  }

  .hero h1 span:nth-child(2) {
    animation-delay: 0.12s;
  }

  .hero h1 span:nth-child(3) {
    animation-delay: 0.24s;
  }

  .hero-copy .lede {
    animation-delay: 0.42s;
  }

  .hero-copy .actions {
    animation-delay: 0.54s;
  }

  .ridge-nodes circle {
    transform-box: fill-box;
    transform-origin: center;
    animation: pop 0.5s var(--ease) both;
    animation-delay: calc(var(--d) * 1.3s + 0.3s);
  }

  /* The dash exists only while a line draws (fill-mode backwards), so finished edges meet their nodes. */
  .ridge-lines line {
    animation: draw 0.7s var(--ease) backwards;
    animation-delay: calc(var(--d) * 1.3s + 0.4s);
  }

  .ridge-faces polygon {
    animation: fade 1.1s var(--ease) both;
    animation-delay: calc(var(--d) * 1.3s + 0.8s);
  }

  .ridge-pulses circle {
    transform-box: fill-box;
    transform-origin: center;
    animation: pulse 1.8s var(--ease) both;
    animation-delay: calc(var(--d) * 1.3s + 0.75s);
  }
}

/* As the reader scrolls past the hero, the range sinks a little (browsers with scroll timelines). */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .ridge {
      animation: sink linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes draw {
  from {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
  }
  to {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0);
  }
}

@keyframes pulse {
  0% {
    opacity: 0;
    transform: scale(1);
  }
  12% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: scale(5);
  }
}

@keyframes sink {
  to {
    transform: translateY(10%);
  }
}

/* Sections */
.section {
  padding-block: var(--section);
}

.section-tint {
  background: var(--tint);
}

.split {
  display: grid;
  gap: 2.5rem;
}

.split-head p {
  max-width: 30rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.row {
  position: relative;
  display: grid;
  gap: 0.5rem;
  padding-block: 1.75rem;
}

.row::before,
.work::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--line);
  transform-origin: left;
}

.row p,
.work-body p {
  max-width: 38rem;
  color: var(--muted);
}

.row p {
  max-width: 34rem;
}

.work {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-block: 2.5rem;
}

#work-title {
  margin-bottom: 2.5rem;
}

.work::before {
  background: var(--ink);
  opacity: 0.18;
}

.work h3 {
  font-size: clamp(1.625rem, 3vw, 2.25rem);
  font-stretch: 125%;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.work-kind {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.work-body {
  display: grid;
  gap: 1rem;
  justify-items: start;
}

.work-body p:first-child {
  color: var(--ink);
  font-size: 1.125rem;
}

.stack {
  font-size: 0.9375rem;
}

.work-body .text-link {
  color: var(--accent);
}

.standards {
  display: grid;
  gap: 3rem;
  margin-top: 3.5rem;
}

.standard h3 {
  font-size: clamp(1.75rem, 2.6vw, 2.75rem);
  font-stretch: 125%;
  font-weight: 760;
  letter-spacing: -0.02em;
  line-height: 1;
}

.standard-claim {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
  font-size: 1.125rem;
  font-weight: 650;
}

.standard-claim + p {
  max-width: 34rem;
  margin-top: 0.5rem;
  color: var(--muted);
}

/* Contact */
.contact {
  padding-block: var(--section);
  background: var(--night);
  color: var(--on-night);
}

.contact h2 {
  max-width: 16ch;
  font-size: clamp(2.25rem, 5.6vw, 4.5rem);
}

.contact p {
  max-width: 34rem;
  margin-top: 1.5rem;
  color: var(--on-night-muted);
  font-size: 1.125rem;
}

.contact-email {
  display: inline-block;
  margin-top: 2.5rem;
  color: var(--sky);
  font-size: clamp(1.125rem, 3.2vw, 2rem);
  font-stretch: 112%;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
  transition: color 0.2s;
}

.contact-email:hover {
  color: var(--on-night);
}

.footer {
  background: var(--night);
  color: var(--on-night-muted);
  border-top: 1px solid rgb(255 255 255 / 0.1);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 2rem;
  font-size: 0.875rem;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.cookie-settings {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.cookie-settings:hover {
  color: var(--on-night);
}

/* The analytics consent banner (analytics.js), fixed to the bottom of the screen. */
.consent {
  position: fixed;
  inset: auto var(--gutter) 1rem;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9375rem;
  box-shadow: 0 12px 32px rgb(6 26 46 / 0.18);
}

.consent p {
  flex: 1 1 16rem;
}

.consent-actions {
  display: flex;
  gap: 0.5rem;
}

.consent button {
  min-height: 2.5rem;
  padding: 0 1.125rem;
  border: 1px solid var(--night);
  border-radius: 999px;
  background: none;
  color: var(--night);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.consent .consent-allow {
  background: var(--night);
  color: #fff;
}

.consent button:hover {
  background: var(--tint);
  color: var(--night);
}

.consent .consent-allow:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

[hidden] {
  display: none !important;
}

/* 404 */
.not-found {
  display: grid;
  align-content: center;
  min-height: 100svh;
  background: var(--night);
  color: var(--on-night);
}

.not-found h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
}

.not-found p {
  max-width: 30rem;
  margin: 1.25rem 0 2.25rem;
  color: var(--on-night-muted);
  font-size: 1.125rem;
}

.not-found .brand img {
  height: 2.25rem;
  width: auto;
  margin-bottom: 3rem;
}

.footer img {
  width: auto;
  height: 1.75rem;
}

/* Scroll reveals, only once main.js has run (content stays visible without JS). */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(1.5rem);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    transition-delay: calc(var(--i, 0) * 90ms);
  }

  .js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }

  .js .row::before,
  .js .work::before {
    transform: scaleX(0);
    transition: transform 1.1s var(--ease);
  }

  .js .row.is-visible::before,
  .js .work.is-visible::before {
    transform: scaleX(1);
  }
}

@media (min-width: 48rem) {
  .row {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    gap: 2rem;
  }

  .work {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 2rem;
    padding-block: 3rem;
  }

}

@media (min-width: 64rem) {
  .standards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
  }

  .split {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 4rem;
  }

  .split-head {
    position: sticky;
    top: 2.5rem;
    align-self: start;
  }

  .row {
    grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  }
}

@media (max-width: 47.99rem) {
  .nav-links {
    display: none;
  }

  .brand img {
    height: 1.75rem;
  }

  .topbar {
    padding-block: 1.125rem;
  }
}
