:root {
  --night: #171a33;
  --deep: #0f1126;
  --dusk: #3a3a63;
  --mauve: #8a7c9c;
  --haze: #d9b8b0;
  --mist: #e3e5e8;
  --smoke: #f6f1ff;
  --ember: #ffe9b0;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
}

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

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

body {
  margin: 0;
  background: var(--mist);
  color: var(--night);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.5;
  /* house rule: nothing on the site is capitalised, whatever gets typed in */
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  background: var(--smoke);
  color: var(--night);
  border-radius: 999px;
}

.skip:focus {
  top: 0.75rem;
}

/* Hero: a dusk sky that thins out into mist at the bottom edge */

.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  color: var(--smoke);
  background: linear-gradient(
    180deg,
    var(--night) 0%,
    var(--dusk) 38%,
    var(--mauve) 66%,
    var(--haze) 86%,
    var(--mist) 100%
  );
}

/* grain keeps the long gradient from banding and gives the air some texture */
.hero::after,
.projects::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.nav {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.5rem var(--gutter);
}

.nav a {
  text-decoration: none;
}

.nav a:hover {
  text-decoration: underline;
}

.nav-mark {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.9375rem;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* The canvas draws the word. This heading is what screen readers get, and what
   everyone gets if the canvas never starts. */
.hero-word {
  position: absolute;
  left: 0;
  right: 0;
  top: 46%;
  transform: translateY(-50%);
  z-index: 0;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: min(40vw, 60svh);
  line-height: 1;
  letter-spacing: -0.02em;
}

.has-smoke .hero-word {
  opacity: 0;
}

.hero-line {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(1.5rem, 5svh, 3.5rem);
  z-index: 3;
  max-width: 26ch;
  color: var(--night);
  font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
  line-height: 1.35;
}

/* Dictionary entry */

.entry {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(5rem, 14vw, 11rem) var(--gutter) clamp(6rem, 16vw, 13rem);
}

.entry-head {
  position: sticky;
  top: 2rem;
  align-self: start;
}

.entry-word {
  font-family: var(--display);
  font-weight: 200;
  font-size: clamp(4.5rem, 13vw, 11rem);
  line-height: 0.85;
  letter-spacing: -0.035em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.entry-meta {
  margin-top: 1.5rem;
  color: #5b5a7e;
}

.entry-meta i {
  font-family: var(--display);
  font-size: 1.125rem;
  margin-left: 0.5rem;
}

.senses {
  padding: 0;
  list-style: none;
  counter-reset: sense;
  display: grid;
  gap: clamp(2rem, 4vw, 3.25rem);
  max-width: 30rem;
  padding-top: 0.6rem;
}

.senses li {
  counter-increment: sense;
  display: grid;
  grid-template-columns: 2rem 1fr;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.375rem, 2.3vw, 1.875rem);
  line-height: 1.28;
  letter-spacing: -0.012em;
  font-variation-settings: "SOFT" 100;
}

.senses li::before {
  content: counter(sense);
  font-family: var(--text);
  font-size: 0.875rem;
  letter-spacing: 0;
  line-height: 2.6;
  color: #5b5a7e;
}

/* Projects: the mist darkens back into night */

.projects {
  position: relative;
  color: var(--smoke);
  background: linear-gradient(
    180deg,
    var(--mist) 0,
    var(--mauve) 9rem,
    var(--dusk) 19rem,
    var(--night) 32rem,
    var(--deep) 100%
  );
}

.projects-inner {
  position: relative;
  z-index: 1;
  padding: 24rem var(--gutter) clamp(6rem, 14vw, 11rem);
}

.projects-title {
  font-family: var(--text);
  font-weight: 400;
  font-size: 0.9375rem;
  color: #b9b3d0;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.empty-head {
  font-family: var(--display);
  font-style: italic;
  font-weight: 200;
  font-size: clamp(2.75rem, 9.5vw, 8.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  max-width: 11ch;
  font-variation-settings: "SOFT" 100;
}

.empty-note {
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
  max-width: 34ch;
  color: #b9b3d0;
}

.project-rows {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgb(246 241 255 / 0.16);
}

.project-row {
  border-bottom: 1px solid rgb(246 241 255 / 0.16);
}

.project-link {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 5fr) minmax(0, 5fr) 9rem;
  align-items: baseline;
  gap: clamp(1rem, 3vw, 3rem);
  padding: clamp(1.25rem, 2.6vw, 2.25rem) 0;
  text-decoration: none;
}

/* each project is a light; it brightens when you reach for it */
.project-light {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ember);
  align-self: center;
  opacity: 0.45;
  transition: opacity 0.3s, box-shadow 0.3s;
}

.project-link:hover .project-light,
.project-link:focus-visible .project-light {
  opacity: 1;
  box-shadow: 0 0 0.9rem 0.3rem rgb(255 233 176 / 0.45);
}

.project-name {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.875rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variation-settings: "SOFT" 100;
}

a.project-link:hover .project-name {
  font-style: italic;
}

.project-blurb {
  color: #d5cfe6;
  max-width: 38ch;
}

.project-meta {
  color: #b9b3d0;
  font-size: 0.9375rem;
  text-align: right;
  white-space: nowrap;
}

/* the grain fades out before the footer so the two meet without an edge */
.projects::after {
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 12rem), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 12rem), transparent);
}

/* Other pages open with the same sky, but it closes back into night
   instead of thinning into mist, because the footer comes straight after. */

.hero-sub {
  background: linear-gradient(
    180deg,
    var(--night) 0%,
    var(--dusk) 40%,
    #6c6488 66%,
    var(--dusk) 86%,
    var(--night) 100%
  );
}

/* let the grain thin out so there's no edge where the sky meets the next section */
.hero-sub::after {
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
  mask-image: linear-gradient(180deg, #000 60%, transparent);
}

.hero-short {
  min-height: 66svh;
}

.hero-sub .hero-word {
  font-size: min(26vw, 46svh);
}

.hero-sub .hero-line {
  color: var(--smoke);
  max-width: 34ch;
}

.hero-line a {
  white-space: nowrap;
}

/* Patch notes: one heading per day, with that day's releases hung beside it */

.notes {
  color: var(--smoke);
  background: linear-gradient(180deg, var(--night), var(--deep));
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(5rem, 12vw, 9rem);
}

.note-day {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(1.5rem, 5vw, 5rem);
}

.note-date {
  position: sticky;
  top: 2rem;
  align-self: start;
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

/* the releases hang off one thread, each marked by a small light */
.note-list {
  border-left: 1px solid rgb(246 241 255 / 0.16);
  padding-left: clamp(1.5rem, 3vw, 2.75rem);
  display: grid;
  gap: clamp(3rem, 6vw, 4.5rem);
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
  max-width: 40rem;
}

.note {
  position: relative;
}

.note::before {
  content: "";
  position: absolute;
  left: calc(clamp(1.5rem, 3vw, 2.75rem) * -1 - 0.25rem - 0.5px);
  top: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0.8rem 0.2rem rgb(255 233 176 / 0.3);
}

.note-version {
  color: var(--ember);
  font-size: 0.9375rem;
}

.note-title {
  margin: 0.5rem 0 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variation-settings: "SOFT" 100;
}

.note-summary {
  margin-top: 1rem;
  color: #d5cfe6;
  max-width: 38ch;
}

.note-changes {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.note-changes li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
}

.note-kind {
  color: #b9b3d0;
  font-size: 0.9375rem;
}

/* Footer: the brand's name, burning off into the air. The letters and the
   smoke are drawn by site.js on the canvas; the text underneath is what
   screen readers get, and what shows if the simulation can't run. */

.foot {
  position: relative;
  /* overlap the section above by a pixel so no pale seam shows between them */
  margin-top: -1px;
  isolation: isolate;
  overflow: hidden;
  min-height: 96svh;
  display: flex;
  flex-direction: column;
  color: var(--smoke);
  background:
    radial-gradient(ellipse 75% 60% at 50% 100%, rgb(255 214 176 / 0.3), rgb(217 184 176 / 0.1) 45%, transparent 76%),
    linear-gradient(180deg, var(--deep) 0%, #171940 55%, #2e2b58 100%);
}

.foot-smoke {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.foot-links {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 4rem);
  padding: clamp(4rem, 9vw, 7rem) var(--gutter) 0;
}

.foot-links a {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  text-decoration: none;
}

.foot-path {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.625rem, 2.8vw, 2.375rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-decoration: underline transparent 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.25s, color 0.25s;
}

.foot-links a:hover .foot-path,
.foot-links a:focus-visible .foot-path {
  color: var(--ember);
  text-decoration-color: currentColor;
}

.foot-what {
  color: #b9b3d0;
  font-size: 0.9375rem;
}

.foot-sign {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 4rem var(--gutter) 0;
  text-align: center;
}

.foot-big {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-weight: 200;
  font-size: clamp(5rem, 25vw, 25rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: transparent;
  background: linear-gradient(180deg, var(--smoke) 35%, #ffd9b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* once the canvas is drawing the word, this copy only holds its place */
.foot.has-smoke .foot-big {
  opacity: 0;
}

.foot-base {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--gutter);
  font-size: 0.9375rem;
  color: #b9b3d0;
}

/* Cursor smoke sits over everything and never takes a click */

.trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

@media (max-width: 760px) {
  .entry {
    grid-template-columns: 1fr;
  }

  .entry-head {
    position: static;
  }

  .hero-word {
    font-size: min(46vw, 46svh);
  }

  .project-link {
    grid-template-columns: 1.25rem 1fr auto;
  }

  .project-blurb {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .projects-inner {
    padding-top: 20rem;
  }
}

@media (max-width: 760px) {
  .note-day {
    grid-template-columns: 1fr;
  }

  .note-date {
    position: static;
  }

  .note-changes li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .foot-links {
    grid-template-columns: 1fr;
  }
}

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

  .foot-path {
    transition: none;
  }

  .project-light {
    transition: none;
  }
}
