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

:root {
  --surface: #fff;
  --ink: #111;
  --muted: color-mix(in srgb, var(--ink) 70%, var(--surface));
  --rule: color-mix(in srgb, var(--ink) 22%, var(--surface));
  --page-margin: clamp(1rem, 4vw, 3rem);
  --serif: "Valley Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --sans: var(--serif);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #111;
    --ink: #fafafa;
    color-scheme: dark;
  }
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background-color 0.6s ease,
    color 0.6s ease;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: 76rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem var(--page-margin);
}

.site-header svg {
  display: block;
  width: 96px;
  height: auto;
}

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.875rem;
  font-weight: 500;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

/* Document */

.doc {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 76rem;
  width: 100%;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) var(--page-margin) clamp(3rem, 8vw, 6rem);
}

.doc-meta {
  margin-top: 0;
  margin-bottom: 2.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
  line-height: 1.4;
}

.doc-meta dt {
  color: var(--muted);
}

.doc-meta dd {
  margin: 0.15rem 0 1rem;
  font-weight: 500;
}

.doc-title {
  margin: 0 0 clamp(2.5rem, 5vw, 4rem);
  padding-top: 0.6rem;
  border-top: 1px solid var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.doc-body {
  min-width: 0;
}

@media (min-width: 60rem) {
  .doc {
    grid-template-columns: 1fr minmax(0, 43rem) 1fr;
    column-gap: 3rem;
  }
  .doc-meta {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    position: sticky;
    top: 2rem;
    max-width: 15rem;
  }
  .doc-title,
  .doc-body {
    grid-column: 2;
  }
}

/* Prose */

.prose {
  font-size: 1.0625rem;
  line-height: 1.7;
}

.prose p {
  margin: 0 0 1.1em;
}

.prose h2 {
  margin: 2.75em 0 1em;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin: 2em 0 0.6em;
  font-size: 1rem;
  font-weight: 600;
}

.prose ul {
  margin: 0 0 1.1em;
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.5em;
}

.prose li::marker {
  color: var(--muted);
}

.prose strong {
  font-weight: 600;
}

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.lede {
  margin: 0 0 2rem;
  font-size: 1.125rem;
  line-height: 1.6;
}

.embed {
  width: 100%;
  min-height: 520px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--rule);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.5rem var(--page-margin) 2rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

/* Home */

.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(2.5rem, 6vw, 4.5rem);
  max-width: 76rem;
  width: 100%;
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 7rem) var(--page-margin);
}

.home-title {
  margin: 0;
  max-width: 18ch;
  position: relative;
  padding-top: 0.75rem;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 7vw, 5.25rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.platforms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.5rem 3rem;
  margin: 0;
}

.platforms div {
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.platforms dt {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
}

.platforms dd {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  text-decoration: none;
}

.social a:hover {
  color: var(--ink);
}

/* Color shuffle */

.swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.swatch .chip {
  width: 0.75rem;
  height: 0.75rem;
  border: 1px solid currentColor;
}

.swatch .chip + .chip {
  margin-left: calc(-0.6rem - 1px);
}

.swatch .roll {
  flex: none;
  display: inline-block;
  transition: transform 0.5s ease;
}

.swatch:hover .roll,
.swatch:focus-visible .roll {
  transform: rotate(180deg);
}

.swatch:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  body,
  .swatch .roll {
    transition: none;
  }
}

.rotate {
  display: inline-block;
  font-style: italic;
  transition:
    transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.35s ease,
    filter 0.35s ease;
}

.rotate.out {
  transform: translateY(-0.35em);
  opacity: 0;
  filter: blur(8px);
}

.rotate.below {
  transform: translateY(0.35em);
  opacity: 0;
  filter: blur(8px);
  transition: none;
}

/* Home motion */

.home-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: draw 1.1s cubic-bezier(0.65, 0, 0.35, 1) both;
}

.rise {
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: var(--d, 0s);
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
}

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

.platforms div {
  position: relative;
}

.platforms div::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.platforms div:hover::before {
  transform: scaleX(1);
}

.platforms dt {
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.platforms div:hover dt {
  transform: translateX(0.35rem);
}

.swatch.pop .chip {
  animation: pop 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes pop {
  50% {
    transform: scale(1.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-title::before,
  .rise,
  .swatch.pop .chip {
    animation: none;
  }
  .platforms div::before,
  .platforms dt {
    transition: none;
  }
}
