/* polr labs. Token names and values follow the polr labs design system. */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/geist-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light dark;

  --background: #ffffff;
  --background-subtle: #fafafa;
  --ink: #171717;
  --ink-secondary: #666666;
  --ink-hover: #383838;
  --on-ink: #ffffff;
  --hairline: #eaeaea;

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: 24px;
  --frame-width: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --background-subtle: #1a1a1a;
    --ink: #ededed;
    --ink-secondary: #a0a0a0;
    --ink-hover: #cccccc;
    --on-ink: #0a0a0a;
    --hairline: #2e2e2e;
  }
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5rem;
  font-feature-settings: "liga" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--ink);
  color: var(--on-ink);
}

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

a {
  color: var(--ink-secondary);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {
  a:hover {
    color: var(--ink);
  }
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* The sticky nav is 65px tall. A linked section lands flush under it, so the rule above the section stays hidden. */
section[id] {
  scroll-margin-top: 64px;
}

/* A link that takes keyboard focus is scrolled clear of the nav, with room for its focus ring. */
main,
main a,
.footer a {
  scroll-margin-top: 80px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 2;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.875rem;
}

.skip:focus {
  top: 16px;
  color: var(--on-ink);
}

.frame {
  max-width: var(--frame-width);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  border-left: 1px solid var(--hairline);
  border-right: 1px solid var(--hairline);
}

/* On a screen taller than the page, the hero takes the spare height and the footer sits at the bottom. */
main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Nav */

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--hairline);
  background: var(--background);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 0.225em;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.06em;
}

.wordmark-polr {
  display: flex;
  align-items: baseline;
  font-weight: 600;
}

.wordmark-o {
  flex-shrink: 0;
  width: 0.558em;
  height: 0.558em;
  margin: 0 -0.021em -0.012em 0.039em;
}

.wordmark-labs {
  font-weight: 400;
  color: var(--ink-secondary);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  border-radius: 128px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  white-space: nowrap;
}

.button-secondary {
  border-color: var(--hairline);
  background: var(--background);
  color: var(--ink);
}

@media (hover: hover) {
  .button:hover {
    border-color: var(--ink-hover);
    background: var(--ink-hover);
    color: var(--on-ink);
  }

  .button-secondary:hover {
    border-color: var(--hairline);
    background: var(--background-subtle);
    color: var(--ink);
  }
}

.button-small {
  height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Hero */

.hero {
  position: relative;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}

.hero-rings {
  position: absolute;
  left: 50%;
  top: 50%;
  /* 1200px across in the full 1078px frame, and in proportion to the frame below that. */
  width: calc(100% * 1200 / 1078);
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
  stroke: var(--hairline);
  stroke-width: 1;
}

.hero-rings circle {
  vector-effect: non-scaling-stroke;
}

.hero-point {
  fill: var(--ink);
  stroke: none;
}

.hero-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 120px var(--gutter);
  text-align: center;
}

h1 {
  max-width: min(47.5rem, 760px);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 1.143;
  letter-spacing: -0.06em;
  font-weight: 600;
  text-wrap: balance;
}

.lede {
  max-width: min(32.5rem, 520px);
  font-size: 1.125rem;
  line-height: 1.75rem;
  color: var(--ink-secondary);
  text-wrap: balance;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding-top: 8px;
}

/* Research */

.section-head {
  padding: 64px var(--gutter) 32px;
}

h2 {
  font-size: 2rem;
  line-height: 2.5rem;
  letter-spacing: -0.04em;
  font-weight: 600;
  text-wrap: balance;
}

.areas {
  display: flex;
  gap: 1px;
  background: var(--hairline);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

/* The dividers are the background showing through the gaps, which forced colours would remove. */
@media (forced-colors: active) {
  .areas {
    background: CanvasText;
  }
}

.area {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 32px var(--gutter) 48px;
  background: var(--background);
}

.area h3 {
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.area p {
  color: var(--ink-secondary);
  text-wrap: pretty;
}

.index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--ink-secondary);
}

/* Contact */

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 80px var(--gutter);
  border-bottom: 1px solid var(--hairline);
}

.contact h2 {
  max-width: 35rem;
}

/* Footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px var(--gutter);
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: var(--ink-secondary);
}

/* The width steps are in em, so they follow the reader's font size as the type does.
   At the 16px default they are 767px, 600px and 420px. */

/* Below tablet width */

@media (max-width: 47.9375em) {
  .hero-rings {
    display: none;
  }

  .areas {
    flex-direction: column;
  }

  .area {
    flex: none;
  }
}

/* Small screens */

@media (max-width: 37.5em) {
  :root {
    --gutter: 16px;
  }

  .frame {
    border-left: 0;
    border-right: 0;
  }

  .nav {
    column-gap: 16px;
  }

  .nav-links {
    gap: 4px 16px;
  }

  .hero-content {
    padding-top: 80px;
    padding-bottom: 80px;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.75rem;
    line-height: 2.25rem;
  }

  .contact {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .contact h2 br {
    display: none;
  }
}

/* Phones: the hero buttons stack at full width */

@media (max-width: 26.25em) {
  .actions {
    flex-direction: column;
    align-self: stretch;
  }

  /* A label may run to two lines when the reader's font size is large. */
  .actions .button {
    height: auto;
    min-height: 48px;
    padding-top: 11px;
    padding-bottom: 11px;
    white-space: normal;
    text-align: center;
  }
}

/* Short viewports, and screens too narrow for a one-row nav: the nav scrolls away with the page */

@media (max-height: 480px), (max-width: 19.9em) {
  .nav {
    position: static;
  }

  main,
  section[id] {
    scroll-margin-top: 0;
  }

  main a,
  .footer a {
    scroll-margin-top: 16px;
  }
}
