/* Tokens: swap fonts or colours here and the whole site follows. */
:root {
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Newsreader", ui-serif, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --background: #ffffff;
  --foreground: #09090b;
  --text: #3f3f46;
  --muted: #71717a;
  --button-bg: #e0e0e0;
  --button-border: #919191;
  --button-fg: #000000;

  --width: 27rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #09090b;
    --foreground: #fafafa;
    --text: #d4d4d8;
    --muted: #a1a1aa;
    --button-bg: #27272a;
    --button-border: #52525b;
    --button-fg: #fafafa;
    color-scheme: dark;
  }
}

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

body {
  min-height: 100svh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  padding: 24px;
}

@media (min-width: 768px) {
  main {
    padding-block: 96px;
  }
}

.page {
  display: flex;
  flex-direction: column;
  gap: 48px;
  max-width: var(--width);
  margin-inline: auto;
  text-align: center;
}

a {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}

a:hover {
  color: var(--foreground);
}

/* Site title + nav */
.header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 36px;
  letter-spacing: -0.02em;
}

/* Top nav: name / link / link */
.nav {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Intro lines */
.intro p {
  line-height: 28px;
}

/* Sections */
.section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

h2 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.01em;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section p {
  color: var(--text);
  line-height: 22px;
}

/* Heading + tagline, held closer than the section gap */
hgroup {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section .tagline {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 18px;
  text-wrap: balance;
}

/* A whole section that links somewhere */
a.section {
  color: inherit;
  font-weight: 400;
  text-decoration: none;
}

a.section:hover h2 {
  text-decoration-thickness: 2px;
}

/* Plain, square, slightly retro button */
.button {
  display: inline-flex;
  align-items: center;
  align-self: center;
  height: 28px;
  margin-top: 4px;
  padding-inline: 8px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-fg);
  font: inherit;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  color: var(--button-fg);
  filter: brightness(0.96);
}

/* Email address + copy button under the contact button */
.email {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* One click selects the whole address, for copying by hand */
.address {
  user-select: all;
}

/* Copy icon: swaps to a tick for a moment after copying */
.copy {
  padding: 2px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.copy:hover {
  color: var(--foreground);
}

.copy svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy .icon-done,
.copy[data-state="copied"] .icon-copy {
  display: none;
}

.copy[data-state="copied"] .icon-done {
  display: block;
}

/* Snake: a small game board to break up the page */
.snake-board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 13;
  margin-top: 4px;
  border: 1px solid var(--button-border);
  cursor: pointer;
}

/* Mid-game, swipes on the board steer the snake instead of scrolling the page */
.snake[data-state="running"] .snake-board {
  cursor: default;
  touch-action: none;
}

.snake-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.snake-bar .button {
  margin-top: 0;
}

.snake-score {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Read by screen readers, not shown */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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