@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-latin-opsz-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #fff;
  --ink: #1c1c1c;
  --soft: #6e6e6e;
  --tile: #f1f1f1;
  --tile-hover: #e6e6e6;
  --selection: #fbd3b4;
  --gutter: clamp(1.25rem, 2.8vw, 2.5rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light dark;
}

/* Dark: what the toggle chose (theme.js), or the visitor's system where scripts do not run. The
   artwork stays as it is. */
:root[data-theme="dark"] {
  --bg: #111111;
  --ink: #ececec;
  --soft: #9b9b9b;
  --tile: #2b2b2b;
  --tile-hover: #3a3a3a;
  --selection: #7a3c17;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111111;
    --ink: #ececec;
    --soft: #9b9b9b;
    --tile: #2b2b2b;
    --tile-hover: #3a3a3a;
    --selection: #7a3c17;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.4 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

/* Top bar */

/* Where the ring of the logo passes over the disc it is cut out in the page's own colour. */
.brand__cut {
  stroke: var(--bg);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand svg {
  width: 1.5rem;
  height: 1.5rem;
}

.nav {
  display: flex;
  gap: clamp(1.25rem, 2.2vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  color: var(--soft);
  transition: color 0.2s;
}

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

.nav a[aria-current] {
  font-weight: 500;
}

.nav a[aria-current]::before {
  content: "";
  display: inline-block;
  width: 0.3rem;
  height: 0.3rem;
  margin-right: 0.6rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.18em;
}

.bar__end {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.75rem);
}

/* The light/dark toggle, a tile like the GitHub button: a moon in the light theme, a sun in the dark one. */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: -0.375rem 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--tile);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.25s;
}

.theme-toggle:hover {
  background: var(--tile-hover);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 1.125rem;
  height: 1.125rem;
}

.theme-toggle__sun,
:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

/* Hero */

.hero {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* The artwork with the headline on it. Its colours are the picture's, the same in both themes. */
.stage {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: clamp(26rem, 46vw, 44rem);
  margin: 0 var(--gutter);
  overflow: hidden;
  border-radius: 16px;
}

.stage .stage__art {
  position: absolute;
  inset: 0;
  min-height: 0;
  max-height: none;
  margin: 0;
  border-radius: 0;
}

/* Darker in the middle, where the words are. */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgb(0 0 0 / 0.55), rgb(0 0 0 / 0.15) 70%);
  pointer-events: none;
}

.stage__text {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  padding: 2.5rem var(--gutter);
  color: #fff;
  text-align: center;
}

.stage__lede {
  margin: -0.5rem 0 0;
  color: rgb(255 255 255 / 0.9);
  font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero__title {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 5rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero__title span {
  display: block;
}

.hero__title-soft {
  color: rgb(255 255 255 / 0.72);
}

.cta {
  display: inline-flex;
  flex: none;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.cta__download,
.cta__github {
  display: grid;
  place-items: center;
  height: 3.375rem;
  border-radius: 4px;
  transition: background-color 0.25s;
}

/* On the artwork the buttons are light whatever the theme. */
.cta__download {
  padding: 0 1.6rem;
  background: #fff;
  color: #111;
}

.cta__github {
  width: 3.375rem;
  overflow: hidden;
  background: rgb(255 255 255 / 0.18);
  color: #fff;
  backdrop-filter: blur(6px);
}

.cta__github svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Two icons share the tile: the GitHub mark, and above the tile, out of sight, the sign of a link
   that opens a new page. Pointed at, the mark drops out through the bottom as the other drops in
   from the top. */
.cta__icon {
  grid-area: 1 / 1;
}

.cta__icon--go {
  transform: translateY(-2.5rem);
}

.cta__github:hover .cta__icon:not(.cta__icon--go),
.cta__github:focus-visible .cta__icon:not(.cta__icon--go) {
  transform: translateY(2.5rem);
}

.cta__github:hover .cta__icon--go,
.cta__github:focus-visible .cta__icon--go {
  transform: none;
}

.cta__download:hover {
  background: #ececec;
}

.cta__github:hover {
  background: rgb(255 255 255 / 0.28);
}

.cta :focus-visible {
  outline-offset: 2px;
  border-radius: 4px;
}

/* Under the buttons: the version, and what the button downloads. */
.cta__note {
  margin: -0.75rem 0 0;
  color: rgb(255 255 255 / 0.78);
  font-size: 0.875rem;
  letter-spacing: 0;
}


.hero__art {
  position: relative;
  flex: 1 1 auto;
  min-height: clamp(15rem, 30vw, 34rem);
  max-height: 125vw;
  margin: 0 0.625rem;
  overflow: hidden;
  border-radius: 4px;
  /* Stand-in while the artwork loads. */
  background: linear-gradient(100deg, #f1e3e3, #f5d5c1 28%, #f3b082 42%, #e5631f 55%, #c14219 76%, #6c3d30);
}

.hero__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 45%;
}

/* The other hero designs. Each sets its stand-in colour and which part of the picture to keep. */

.hero__art[data-hero="halo"] {
  background: linear-gradient(#7893b4, #e1d5cd 58%, #f0b08a 90%);
}

.hero__art[data-hero="halo"] img {
  object-position: 60% 75%;
}

.hero__art[data-hero="dawn"] {
  background: #05070d;
}

.hero__art[data-hero="dawn"] img {
  object-position: 69% 85%;
}

.hero__art[data-hero="bloom"] {
  background: #f7f2e8;
}

.hero__art[data-hero="bloom"] img {
  object-position: 50% 50%;
}

.hero__art[data-hero="fringe"] {
  background: #f1e7ea;
}

.hero__art[data-hero="fringe"] img {
  object-position: 66% 50%;
}

.hero__art[data-hero="eclipse"] {
  background: #0c0c0d;
}

/* The eclipse is drawn dot by dot, so it takes no picture. */
.hero__art[data-hero="eclipse"] picture {
  display: none;
}

.hero__canvas {
  position: absolute;
  top: 0;
  left: 0;
  image-rendering: pixelated;
}

/* Three figures under the artwork. */
.facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem clamp(2rem, 6vw, 6rem);
  margin: 0;
  padding: clamp(2rem, 3.5vw, 3rem) var(--gutter) clamp(2.25rem, 4vw, 3.5rem);
  list-style: none;
  text-align: center;
}

.facts li {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
}

.facts strong {
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}

.facts span {
  color: var(--soft);
  font-size: 0.875rem;
}

/* Smaller screens */

@media (max-width: 640px) {
  /* Room for the two page links. The logo leads home, and the GitHub button or the footer to GitHub. */
  .bar {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .nav {
    gap: 1rem;
    font-size: 0.9375rem;
  }

  .nav li:first-child,
  .nav li:last-child,
  .nav a[aria-current]::before {
    display: none;
  }

  .stage {
    min-height: 34rem;
  }

  .facts {
    gap: 1.25rem 2rem;
  }
}

/* Motion */

@media (prefers-reduced-motion: no-preference) {
  .hero__title span,
  .stage__lede,
  .cta,
  .cta__note,
  .facts li {
    animation: rise 0.8s var(--ease) both;
  }

  .hero__title span:last-child {
    animation-delay: 0.08s;
  }

  .stage__lede {
    animation-delay: 0.12s;
  }

  .cta {
    animation-delay: 0.16s;
  }

  .cta__note {
    animation-delay: 0.2s;
  }

  .facts li {
    animation-delay: 0.3s;
  }

  .hero__art img {
    animation: settle 1.4s var(--ease) both;
  }

  .cta__icon {
    transition: transform 0.4s var(--ease);
  }
}

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

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