/* Palette, type and spacing follow the MolaBoard website (molaboard-web DESIGN.md). */
:root {
  --font-sans: 'Geist', 'Segoe UI Variable Text', 'SF Pro Display', 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', 'SFMono-Regular', 'SF Mono', Consolas, monospace;

  --background: #111111;
  --foreground: #cccccc;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-750: #353535;
  --neutral-800: #2b2b2b;
  --neutral-850: #242424;
  --neutral-900: #1b1b1b;
  --neutral-925: #161616;
  --primary-blue: #2563eb;
  --status-live: #22c55e;

  --surface: #1b1b1b;
  --line: rgba(255, 255, 255, 0.08);
  --focus: rgba(37, 99, 235, 0.6);
  --radius: 0.625rem;

  --grid-max: 1080px;
  --shell-pad: clamp(1.25rem, 5vw, 3rem);
  --section-gap: clamp(4.5rem, 10vw, 9rem);
  --header-height: 4rem;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1,
h2,
h3 {
  margin: 0;
  color: var(--neutral-100);
  font-weight: 500;
  letter-spacing: -0.035em;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--primary-blue);
  color: #fff;
  font-size: 0.875rem;
}

.skip-link:focus {
  top: 1rem;
}

.shell {
  width: 100%;
  max-width: calc(var(--grid-max) + 2 * var(--shell-pad));
  margin: 0 auto;
  padding: 0 var(--shell-pad);
}

/* Type */

.display {
  font-size: clamp(2.5rem, 6.4vw, 4.5rem);
  line-height: 1.02;
  font-weight: 500;
}

.section-title {
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.08;
  max-width: 22ch;
}

.lede {
  max-width: 36rem;
  color: var(--neutral-400);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.5;
}

.eyebrow {
  margin-bottom: 1.5rem;
  color: var(--neutral-400);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    transform 160ms var(--ease-out),
    filter 160ms var(--ease-out),
    color 160ms ease;
}

.button-sm {
  min-height: 2.5rem;
  padding: 0 1rem;
  font-size: 0.875rem;
}

.button-primary {
  background: var(--primary-blue);
  color: #fff;
}

.button-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.button-primary:active {
  transform: translateY(0);
}

.button-quiet {
  padding: 0;
  min-height: 2.75rem;
  color: var(--neutral-200);
}

.button-quiet:hover {
  color: #fff;
}

.arrow {
  display: inline-block;
  transition: transform 200ms var(--ease-out);
}

a:hover > .arrow {
  transform: translateX(4px);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  transition:
    background-color 240ms ease,
    box-shadow 240ms ease;
}

.site-header.is-scrolled {
  background: rgba(17, 17, 17, 0.94);
  box-shadow: 0 1px 0 var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--neutral-100);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 2rem;
  height: 2rem;
  transition: transform 400ms var(--ease-out);
}

.brand:hover .brand-icon {
  animation: wiggle 700ms var(--ease-out);
}

.site-nav {
  margin-left: auto;
}

.nav-list {
  display: flex;
  gap: 1.75rem;
}

/* The header button covers contact until it hides on narrow phones. */
.nav-contact {
  display: none;
}

.nav-list a {
  position: relative;
  color: var(--neutral-400);
  font-size: 0.9375rem;
  transition: color 160ms ease;
}

.nav-list a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.3rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 240ms var(--ease-out);
}

.nav-list a:hover {
  color: var(--neutral-100);
}

.nav-list a:hover::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.menu-toggle {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--neutral-100);
  cursor: pointer;
}

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 1.125rem;
  height: 1.5px;
  margin: 0 auto;
  background: currentColor;
  border-radius: 2px;
  transition: transform 240ms var(--ease-out), opacity 160ms ease;
}

.menu-bars {
  position: relative;
}

.menu-bars::before,
.menu-bars::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-bars::before {
  transform: translateY(-5px);
}

.menu-bars::after {
  transform: translateY(5px);
}

.menu-toggle[aria-expanded='true'] .menu-bars {
  background: transparent;
}

.menu-toggle[aria-expanded='true'] .menu-bars::before {
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded='true'] .menu-bars::after {
  transform: rotate(-45deg);
}

/* Hero */

/* The section after the hero shares its background and brings its own top gap. */
.hero {
  padding-top: clamp(3rem, 8vw, 6.5rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
  align-items: center;
  gap: 2rem;
}

.hero-copy .display {
  max-width: 13ch;
}

.hero-lede {
  margin-top: 1.5rem;
}

.hero-actions {
  margin-top: 2.25rem;
}

.word {
  display: inline-block;
}

.hero-mola img {
  width: 100%;
  max-width: 18rem;
  margin-left: auto;
}

.hero-mola:hover {
  animation: wiggle 900ms var(--ease-out);
}

/* The lifecycle path */

.path {
  margin: 2.25rem 0 0;
}

.path-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  --dot: 0.875rem;
}

/* Track behind the dots, from the first dot's centre to the last. */
.path-steps::before,
.path-steps::after {
  content: '';
  position: absolute;
  top: calc(var(--dot) / 2 - 1px);
  left: calc(var(--dot) / 2);
  right: calc(20% - var(--dot) / 2);
  height: 2px;
  border-radius: 2px;
}

.path-steps::before {
  background: var(--neutral-750);
}

.path-steps::after {
  background: var(--primary-blue);
  transform-origin: left;
}

.path-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-right: 1rem;
}

.path-dot {
  position: relative;
  z-index: 1;
  width: var(--dot);
  height: var(--dot);
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--neutral-750);
  box-shadow: 0 0 0 4px var(--path-bg, var(--background));
}

.path-dot-live::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--status-live);
  opacity: 0;
}

.path-name {
  color: var(--neutral-100);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.path-verb {
  color: var(--neutral-500);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* Sections */

.section {
  padding: var(--section-gap) 0;
}

.section-tone {
  background: var(--neutral-925);
}

/* Follows a section with the same background, so one gap is enough. */
.section-flush {
  padding-top: 0;
}

.section-head {
  display: grid;
  gap: 1.25rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: end;
}

.about-copy {
  display: grid;
  gap: 1.25rem;
}

.about-copy .section-title {
  margin-bottom: 0.5rem;
}

.about-copy p {
  max-width: 38rem;
  font-size: 1.0625rem;
}

.facts {
  margin: 0;
  display: grid;
}

.fact {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--line);
}

.fact:last-child {
  border-bottom: 1px solid var(--line);
}

.fact dt {
  color: var(--neutral-500);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.9;
}

.fact dd {
  margin: 0;
  color: var(--neutral-100);
}

/* Products */

.products-title {
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

/* The whole card links to the product through the heading link's overlay. */
.product {
  --path-bg: var(--surface);
  position: relative;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  transition: transform 300ms var(--ease-out);
}

.product:hover {
  transform: translateY(-2px);
}

.product:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.product-link:focus-visible {
  outline: none;
}

.product-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.product-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
}

.product-icon {
  width: 3rem;
  height: 3rem;
}

.product h3 {
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.product-copy p {
  margin-top: 0.375rem;
  max-width: 36rem;
  color: var(--neutral-400);
  font-size: 0.9688rem;
}

.product-cta {
  color: var(--neutral-200);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 160ms ease;
}

.product:hover .product-cta {
  color: #fff;
}

.product:hover .product-cta .arrow {
  transform: translateX(4px);
}

/* Team */

.person h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.people {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  max-width: 48rem;
}

.person {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.person p {
  margin-top: 0.25rem;
  color: var(--neutral-400);
  font-size: 0.9688rem;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--neutral-800);
  color: var(--neutral-200);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  transition:
    transform 300ms var(--ease-out),
    background-color 300ms ease;
}

.person-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2rem;
  margin-top: 0.25rem;
  color: var(--neutral-200);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 160ms ease;
}

.person-link:hover {
  color: #fff;
}

/* The ↗ glyph renders large in Geist, so it is set smaller than the label. */
.person-link .arrow {
  font-size: 0.6875rem;
  line-height: 1;
}

.person-link:hover > .arrow {
  transform: translate(2px, -2px);
}

img.avatar {
  object-fit: cover;
}

.person:hover .avatar {
  transform: translateY(-3px) rotate(-4deg);
  background: var(--primary-blue);
  color: #fff;
}

/* Contact */

.contact .section-title {
  max-width: 18ch;
}

.contact .lede {
  margin-top: 1.25rem;
}

.contact-mail {
  display: inline-flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 2.5rem;
  color: var(--neutral-100);
  font-size: clamp(1.5rem, 4.4vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.contact-mail span:first-child {
  background-image: linear-gradient(var(--primary-blue), var(--primary-blue));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 400ms var(--ease-out);
}

.contact-mail:hover span:first-child {
  background-size: 100% 2px;
}

/* Footer */

.site-footer {
  padding: 3.5rem 0 2.5rem;
  background: var(--neutral-925);
  color: var(--neutral-500);
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem 3rem;
}

.footer-brand p {
  margin-top: 0.75rem;
}

.footer-links {
  display: grid;
  gap: 0.5rem;
  justify-items: end;
  align-content: start;
}

.footer-links a {
  color: var(--neutral-300);
  transition: color 160ms ease;
}

.footer-links a:hover {
  color: #fff;
}

.footer-legal {
  max-width: 34rem;
  font-style: normal;
  line-height: 1.6;
}

.footer-copy {
  align-self: end;
  justify-self: end;
}

/* Motion. Everything below only runs when JavaScript is on and the visitor
   has not asked for reduced motion, so the page reads the same without it. */

@media (prefers-reduced-motion: no-preference) {
  .js .word {
    opacity: 0;
    transform: translateY(0.45em);
    animation: rise 700ms var(--ease-out) forwards;
    animation-delay: calc(120ms + var(--i) * 70ms);
  }

  .js .hero-lede,
  .js .hero-actions,
  .js .eyebrow {
    opacity: 0;
    animation: rise 700ms var(--ease-out) forwards;
  }

  .js .eyebrow {
    animation-delay: 60ms;
  }

  .js .hero-lede {
    animation-delay: 700ms;
  }

  .js .hero-actions {
    animation-delay: 820ms;
  }

  .js .hero-mola img {
    opacity: 0;
    animation:
      swim-in 1400ms var(--ease-out) 300ms forwards,
      drift 8s ease-in-out 1700ms 3;
  }

  .js .path-steps::after {
    transform: scaleX(0);
  }

  .js .path.is-playing .path-steps::after {
    animation: draw 2200ms var(--ease-out) 200ms forwards;
  }

  .js .path-name,
  .js .path-verb {
    opacity: 0.35;
    transition: opacity 400ms ease;
  }

  .js .path.is-playing .path-dot {
    animation: light 500ms var(--ease-out) forwards;
    animation-delay: calc(200ms + var(--n) * 480ms);
  }

  .js .path.is-playing .path-name,
  .js .path.is-playing .path-verb {
    opacity: 1;
    transition-delay: calc(200ms + var(--n) * 480ms);
  }

  .js .path.is-playing .path-dot-live {
    animation-name: light-live;
  }

  .js .path.is-playing .path-dot-live::after {
    animation: live 1600ms ease-out calc(200ms + 4 * 480ms + 300ms) 3;
  }

  .js [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity 800ms var(--ease-out),
      transform 800ms var(--ease-out);
    transition-delay: calc(var(--d, 0) * 90ms);
  }

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

/* With motion reduced, the path shows its finished state. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .path-dot {
    background: var(--primary-blue);
  }

  .path-dot-live {
    background: var(--status-live);
  }

  .brand:hover .brand-icon,
  .hero-mola:hover {
    animation: none;
  }

  .button-primary:hover,
  .person:hover .avatar,
  .product:hover {
    transform: none;
  }
}

html:not(.js) .path-dot {
  background: var(--primary-blue);
}

html:not(.js) .path-dot-live {
  background: var(--status-live);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes swim-in {
  0% {
    opacity: 0;
    transform: translate(-80px, 16px) rotate(-10deg);
  }
  60% {
    opacity: 1;
    transform: translate(6px, -4px) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes drift {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: translate(6px, -10px) rotate(2deg);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: rotate(-8deg);
  }
  55% {
    transform: rotate(6deg);
  }
  80% {
    transform: rotate(-2deg);
  }
}

@keyframes draw {
  to {
    transform: scaleX(1);
  }
}

@keyframes light {
  0% {
    background: var(--neutral-750);
    transform: scale(1);
  }
  50% {
    transform: scale(1.35);
  }
  100% {
    background: var(--primary-blue);
    transform: scale(1);
  }
}

@keyframes light-live {
  0% {
    background: var(--neutral-750);
    transform: scale(1);
  }
  50% {
    transform: scale(1.35);
  }
  100% {
    background: var(--status-live);
    transform: scale(1);
  }
}

@keyframes live {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(2.6);
  }
}

/* Responsive */

@media (max-width: 960px) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .facts {
    max-width: 30rem;
  }
}

@media (max-width: 760px) {
  .menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  .site-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    margin: 0;
  }

  .nav-list {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem var(--shell-pad) 1rem;
    background: var(--background);
    box-shadow: 0 1px 0 var(--line), 0 24px 40px -24px rgba(0, 0, 0, 0.8);
  }

  .nav-list.is-open {
    display: flex;
  }

  .nav-list a {
    display: block;
    padding: 0.75rem 0;
    font-size: 1.0625rem;
  }

  .nav-list a::after {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

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

  .hero-mola {
    order: -1;
  }

  .hero-mola img {
    max-width: 6rem;
    margin-left: 0;
  }

  /* The path turns vertical on narrow screens. */
  .path-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .path-steps::before,
  .path-steps::after {
    top: calc(var(--dot) / 2);
    bottom: 2.5rem;
    left: calc(var(--dot) / 2 - 1px);
    right: auto;
    width: 2px;
    height: auto;
  }

  .path-steps::after {
    transform-origin: top;
  }

  .path-step {
    display: grid;
    grid-template-columns: var(--dot) minmax(0, 1fr);
    column-gap: 1.25rem;
    row-gap: 0;
    padding: 0;
  }

  .path-dot {
    grid-row: 1 / span 2;
    margin: 0.4rem 0 0;
  }

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

  .product-head {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .product-cta {
    grid-column: 1 / -1;
  }

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

  .footer-links,
  .footer-copy {
    justify-items: start;
    justify-self: start;
  }
}

@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  .js .path-steps::after {
    transform: scaleY(0);
  }

  .js .path.is-playing .path-steps::after {
    animation-name: draw-down;
  }
}

@keyframes draw-down {
  to {
    transform: scaleY(1);
  }
}

@media (max-width: 520px) {
  .header-actions .button {
    display: none;
  }

  .nav-contact {
    display: list-item;
  }

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