:root {
  --paper:      #f7f6f1;
  --ink:        #1b1a18;
  --muted:      #8c8884;
  --pill:       #e7e5df;
  --pill-ink:   #2a2825;

  --font: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- layout ---------------------------------------------------------- */

.stage {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 10vh 16px;
}

.block {
  /* The one true ink-to-ink distance between name, bio and buttons. */
  --gap: clamp(2rem, 3.4vw, 3rem);

  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding-inline: clamp(0px, 2vw, 24px);

  /* A flex column never collapses margins, so the trims below add up exactly
     as written instead of swallowing each other. */
  display: flex;
  flex-direction: column;
}

/* ---- type ------------------------------------------------------------ */

/* Even spacing needs uneven margins. Line-height leaves invisible slack above
   and below every line, while a pill button has none, so each block cancels
   its own slack and --gap becomes the distance the eye actually sees.
   main.js measures --slack-top / --slack-bottom from the real font metrics and
   the real line wrap, and re-measures on resize, so the gaps stay even when the
   copy is rewritten. The numbers below are only the no-JS fallback. */

.headline {
  margin: 0 0 calc(var(--slack-bottom, 0.194) * -1em);
  font-weight: 600;
  font-size: clamp(2.125rem, 5.6vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
}

.tagline {
  margin: calc(var(--gap) - var(--slack-top, 0.374) * 1em) 0
          calc(var(--slack-bottom, 0.163) * -1em);
  color: var(--muted);
  font-weight: 400;
  font-size: clamp(1.0625rem, 2.1vw, 1.375rem);
  line-height: 1.5;
  letter-spacing: -0.003em;
  text-wrap: pretty;
}

/* Typing: a hidden ghost holds the final size so nothing reflows while the
   live copy fills in on top of it. Without JS, the live copy simply shows. */
.typed { position: relative; }

.typed__ghost { visibility: hidden; }

/* The not-yet-typed remainder stays in the DOM, invisible but still taking up
   space, so the text wraps exactly as it will when finished. Without this a
   half-typed word sits at the end of one line and jumps to the next as it
   grows past the edge. */
.typed__rest { visibility: hidden; }

.typed__live {
  position: absolute;
  inset: 0;
}

/* An empty inline box: zero width, and it creates no break opportunity, so
   parking it mid-word cannot shift the wrap. The bar is painted by ::after,
   which is out of flow and costs the layout nothing. */
.caret {
  position: relative;
}

.caret::after {
  content: "";
  position: absolute;
  /* Offset rather than a margin: this shifts only the painted bar, so the gap
     costs the line no width and cannot move the wrap. */
  left: 0.16em;
  top: 0.18em;
  width: max(1px, 0.055em);
  height: 0.9em;
  background: currentColor;
  opacity: 0.85;
}

.caret--blink::after { animation: blink 1.06s steps(1, end) infinite; }

@keyframes blink { 0%, 50% { opacity: 0.85; } 50.01%, 100% { opacity: 0; } }

/* ---- socials --------------------------------------------------------- */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: var(--gap);
}

.pill {
  --lift: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.375rem;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-ink);
  font-size: clamp(0.875rem, 1.35vw, 0.9375rem);
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pill:hover,
.pill:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
}

.pill:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Pills stay out of the way until the typing lands, then rise in. */
.js .links .pill {
  opacity: 0;
  transform: translateY(var(--lift));
}

.js .links.is-in .pill {
  animation: rise 0.55s cubic-bezier(0.22, 0.68, 0.32, 1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ---- reduced motion -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .js .links .pill { opacity: 1; transform: none; animation: none; }
  .caret { display: none; }
  .pill { transition: none; }
  .pill:hover { transform: none; }
}
