:root {
  --bg: #f5f4f0;
  --ink: #1d1d1b;
  --muted: #9b9891;
  --serif: "Baskerville", "Baskerville Old Face", "Hoefler Text", "Palatino", Georgia, "Times New Roman", serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Wordmark ---------- */

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

body.info-open #stage {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

#wordmark {
  position: relative;
  font-weight: 400;
  font-size: clamp(2.5rem, 9vw, 7rem);
  letter-spacing: -0.005em;
  line-height: 1.1;
}

#wordmark .sizer {
  visibility: hidden;
  white-space: pre;
}

#wordmark .typed {
  position: absolute;
  top: 0;
  left: 0;
  white-space: pre;
}

.caret {
  display: inline-block;
  width: 0.032em;
  height: 1.02em;
  margin-left: 0.045em;
  vertical-align: -0.09em;
  background: var(--ink);
  opacity: 0;
}

.caret.on {
  opacity: 1;
}

.caret.blinking {
  animation: blink 1.1s step-end infinite;
}

.caret.gone {
  animation: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

@keyframes blink {
  0%   { opacity: 1; }
  50%  { opacity: 0; }
  100% { opacity: 1; }
}

/* ---------- Info button ---------- */

#info-button {
  position: fixed;
  top: 18px;
  right: 26px;
  z-index: 20;
  width: 52px;
  height: 52px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.35s ease;
}

#info-button:hover,
#info-button:focus-visible {
  color: var(--ink);
}

#info-button:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 2px;
  border-radius: 50%;
}

#info-button .glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#info-button .glyph-i {
  font-style: italic;
  font-size: 27px;
}

#info-button .glyph-x {
  font-size: 25px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

body.info-open #info-button .glyph-i {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

body.info-open #info-button .glyph-x {
  opacity: 1;
  transform: none;
}

/* ---------- Info panel ---------- */

#info-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.5s;
}

body.info-open #info-panel {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.info {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.62;
}

.info + .info {
  margin-top: 1.1em;
}

.info .line {
  display: block;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  transition-delay: 0s;
}

body.info-open .info .line {
  opacity: 1;
  transform: none;
  transition-duration: 0.5s, 0.5s;
  transition-timing-function: ease, cubic-bezier(0.2, 0.7, 0.3, 1);
  transition-delay: calc(0.12s + var(--i, 0) * 0.065s);
}

/* ---------- Tennis ball ---------- */

#ball {
  position: fixed;
  left: 0;
  bottom: 9vh;
  z-index: 5;
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
}

#ball svg {
  display: block;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  #stage,
  #info-button .glyph,
  .info .line {
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }

  .info .line {
    transform: none;
  }

  .caret.blinking {
    animation: none;
  }

  #ball {
    display: none;
  }
}
