@font-face {
  font-family: "iA Writer Quattro S";
  src: url("../fonts/iAWriterQuattroS-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "iA Writer Quattro S";
  src: url("../fonts/iAWriterQuattroS-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "iA Writer Mono S";
  src: url("../fonts/iAWriterMonoS-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Zinc, and the Aurora gradient: PSST's own stops on the dark canvas,
   the same hues deepened to hold on the light one. */
:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #18181b;
  --muted: #52525b;
  --faint: #a1a1aa;
  --line: rgb(24 24 27 / 0.1);
  --edge: rgb(24 24 27 / 0.2);
  --surface: #fff;
  --tint: rgb(24 24 27 / 0.06);
  --teal: #0d9488;
  --blue: #2563eb;
  --violet: #7c3aed;
  --pink: #db2777;
  --live: #16a34a;
  --paused: #d97706;
  --shadow: rgb(24 24 27 / 0.16);
  --pastel: 13%;
  --text: "iA Writer Quattro S", ui-sans-serif, system-ui, sans-serif;
  --mono: "iA Writer Mono S", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --fg: #fafafa;
    --muted: #a1a1aa;
    --faint: #71717a;
    --line: rgb(250 250 250 / 0.12);
    --edge: rgb(250 250 250 / 0.24);
    --surface: #18181b;
    --tint: rgb(250 250 250 / 0.09);
    --teal: #5eead4;
    --blue: #60a5fa;
    --violet: #a78bfa;
    --pink: #f472b6;
    --live: #4ade80;
    --paused: #fbbf24;
    --shadow: rgb(0 0 0 / 0.6);
    --pastel: 22%;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.65 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* About 65 characters of the body face, and a gutter either side. */
main,
footer {
  width: min(100% - 2.5rem, 42.5rem);
  margin-inline: auto;
}

p {
  margin: 0 0 1.1rem;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--edge);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.15s;
}

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

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

::selection {
  background: color-mix(in srgb, var(--violet) 28%, transparent);
}

/* The bar */

.bar {
  position: fixed;
  top: 0.875rem;
  left: 50%;
  z-index: 1;
  display: flex;
  gap: 2px;
  padding: 4px;
  translate: -50% 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: 0 10px 28px -16px var(--shadow);
  font-size: 0.875rem;
  line-height: 1.3;
  white-space: nowrap;
}

.bar a {
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.bar a:hover {
  background-color: var(--tint);
  color: var(--fg);
}

.bar .home {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.bar .home,
.wordmark {
  background-image: linear-gradient(
    90deg,
    var(--teal),
    var(--blue),
    var(--violet),
    var(--pink),
    var(--violet),
    var(--blue),
    var(--teal)
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bar .home:hover {
  background-color: transparent;
  color: transparent;
}

/* The hero */

.hero {
  padding-block: 9.5rem 5.5rem;
  text-align: center;
  text-wrap: balance;
}

.tag {
  display: inline-block;
  margin: 0;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 0.78rem/1.5 var(--mono);
}

/* The gradient runs there and back in 2 seconds, then rests for 2, as
   it does in the terminal. */
.wordmark {
  display: block;
  width: fit-content;
  margin: 1.25rem auto 0.25rem;
  font-size: clamp(5.5rem, 26vw, 10.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.02em;
  animation: drift 4s linear infinite;
}

@keyframes drift {
  50%,
  100% {
    background-position-x: 200%;
  }
}

.tagline {
  margin-bottom: 1.75rem;
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 700;
  line-height: 1.25;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 2.25rem 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1.35rem;
  border: 1px solid var(--edge);
  border-radius: 0.85rem;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: translate 0.12s, box-shadow 0.12s;
}

@supports (corner-shape: squircle) {
  .button {
    border-radius: 1.5rem;
    corner-shape: squircle;
  }
}

.button.primary {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.button:hover {
  translate: 0 -1px;
  box-shadow: 0 8px 18px -10px var(--shadow);
}

.button:active {
  translate: 0 1px;
  box-shadow: none;
}

/* Sections */

/* A rule, the section's number under it, and room for the bar above
   both when a link lands here. */
section {
  padding-block: 1rem 5.5rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 5rem;
}

.num {
  margin-bottom: 2.75rem;
  color: var(--muted);
  font: 0.8rem/1.5 var(--mono);
}

h2 {
  margin: 0 0 1.4rem;
  font-size: clamp(1.5rem, 5.6vw, 1.95rem);
  line-height: 1.2;
  text-wrap: balance;
}

/* Quattro's space is a typewriter's: full width. Display sizes want less. */
h2,
.tagline {
  word-spacing: -0.14em;
}

section > :last-child {
  margin-bottom: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

p code {
  padding: 0.1em 0.28em;
  border-radius: 0.4em;
  background: var(--tint);
  overflow-wrap: anywhere;
}

pre {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
  font: 0.8rem/1.8 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre code {
  font-size: inherit;
}

/* A click on a command selects the whole of it, ready to copy. A long
   one wraps under itself, clear of the prompt. */
.cmd code {
  display: block;
  padding-left: 2ch;
  text-indent: -2ch;
  -webkit-user-select: all;
  user-select: all;
}

.cmd code::before {
  content: "$ ";
  color: var(--faint);
}

.out {
  color: var(--muted);
}

/* Pills and dots */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.pills li {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
  line-height: 1.5;
}

.pastel li {
  border-color: transparent;
  background: color-mix(in srgb, var(--hue) var(--pastel), transparent);
}

.pastel li:nth-child(4n + 1) {
  --hue: var(--teal);
}

.pastel li:nth-child(4n + 2) {
  --hue: var(--blue);
}

.pastel li:nth-child(4n + 3) {
  --hue: var(--violet);
}

.pastel li:nth-child(4n) {
  --hue: var(--pink);
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--state);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--state) 22%, transparent);
}

.live {
  --state: var(--live);
}

.paused {
  --state: var(--paused);
}

.note {
  margin-top: 2.5rem;
  color: var(--muted);
  font: 0.8rem/1.5 var(--mono);
}

.note + .pills {
  margin-top: 0.9rem;
}

/* The Space key. Hold it. */

.hold {
  width: min(100%, 20rem);
  margin: 2rem 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hold svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.hold .ink {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.hold .side {
  opacity: 0.4;
  stroke-width: 1.25;
}

.hold .cap {
  transition: translate 0.08s ease-out;
}

.hold:active .cap {
  translate: 0 4px;
}

.hold .wave {
  stroke-width: 2;
  stroke-linecap: round;
}

.hold .wave line {
  transform-origin: 0 36px;
}

.hold:active .wave line {
  animation: listen 0.42s ease-in-out infinite alternate;
}

.hold:active .wave line:nth-child(3n) {
  animation-duration: 0.31s;
}

.hold:active .wave line:nth-child(3n + 1) {
  animation-duration: 0.53s;
  animation-delay: -0.2s;
}

@keyframes listen {
  from {
    transform: scaleY(0.2);
  }
  to {
    transform: scaleY(1.15);
  }
}

/* The foot */

footer {
  padding-block: 1.5rem 5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin-bottom: 0.5rem;
}

@media (max-width: 26rem) {
  .bar a {
    padding-inline: 0.7rem;
  }

  .hero {
    padding-block: 7.5rem 4.5rem;
  }

  .button {
    padding-inline: 1.1rem;
  }

  section {
    padding-bottom: 4.5rem;
  }

  .num {
    margin-bottom: 2.25rem;
  }
}

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

  .wordmark,
  .hold:active .wave line {
    animation: none;
  }

  .button,
  .hold .cap {
    transition: none;
  }
}
