@font-face {
  font-family: "Share Tech Mono";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("fonts/share-tech-mono-latin-400.woff2") format("woff2");
}

:root {
  color-scheme: light dark;

  --font-display: "Share Tech Mono", ui-monospace, "SF Mono", monospace;
  --background: light-dark(#ffffff, #0a0a0a);
  --foreground: light-dark(#171716, #f4f1e8);
  --muted: light-dark(#696660, #85827a);
  --code-background: light-dark(rgba(23, 23, 22, 0.035), rgba(244, 241, 232, 0.035));
  --code-border: light-dark(rgba(23, 23, 22, 0.12), rgba(244, 241, 232, 0.1));
  --code-pattern: light-dark(rgba(23, 23, 22, 0.07), rgba(244, 241, 232, 0.055));
  --portrait-color: light-dark(rgb(23, 23, 22), rgb(244, 241, 232));
  --syntax-comment: light-dark(#4f5960, #7c8f8f);
  --syntax-function: light-dark(#005f9f, #5fd7ff);
  --syntax-keyword: light-dark(#9f6500, #ffd75f);
  --syntax-meta: light-dark(#8f3fbf, #d787ff);
  --syntax-number: light-dark(#bf5f00, #ffaf5f);
  --syntax-string: light-dark(#008f5f, #87d787);
  --trail: light-dark(#4f4c47, #cfc9bc);
  --trail-shadow: light-dark(rgba(23, 23, 22, 0.12), rgba(244, 241, 232, 0.18));
  --theme-transition: 520ms ease;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background-color: var(--background);
  transition: background-color var(--theme-transition);
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--foreground);
  background-color: var(--background);
  font-family:
    ui-monospace,
    "SFMono-Regular",
    "SF Mono",
    Consolas,
    "Liberation Mono",
    monospace;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  transition:
    background-color var(--theme-transition),
    color var(--theme-transition);
}

.theme-toggle {
  justify-self: center;
  margin-top: -0.35rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font: inherit;
  font-size: clamp(0.875rem, 2vw, 1rem);
  line-height: 1.4;
  text-decoration: none;
  text-underline-offset: 0.35em;
  cursor: pointer;
  transition: color var(--theme-transition);
}

.theme-toggle:focus-visible {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  outline: 1px solid currentColor;
  outline-offset: 0.5rem;
}

.theme-toggle:active {
  transform: translateY(1px);
}

.theme-toggle-arrow {
  color: color-mix(in srgb, var(--muted), transparent 45%);
  transition: color var(--theme-transition);
}

.screen {
  position: relative;
  z-index: 2;
  display: grid;
  height: 100svh;
  min-height: 100%;
  place-content: center;
  gap: clamp(1rem, 3vw, 1.5rem);
  padding: 2rem;
  overflow: hidden;
  text-align: center;
}

.intro {
  display: grid;
  gap: 0.55rem;
}

.name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.8rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: 0;
}

.name-line {
  display: block;
}

.role {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 3.9vw, 1.15rem);
  line-height: 1.3;
  white-space: nowrap;
  transition: color var(--theme-transition);
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
}

.link {
  color: var(--muted);
  font-size: clamp(0.875rem, 2vw, 1rem);
  line-height: 1.4;
  text-decoration: none;
  text-underline-offset: 0.35em;
  transition: color var(--theme-transition);
}

.email-copy {
  position: relative;
  display: inline-flex;
}

.copy-badge {
  position: absolute;
  bottom: 100%;
  left: 50%;
  z-index: 3;
  padding: 0.26rem 0.38rem;
  color: var(--background);
  background: var(--foreground);
  border: 0;
  border-radius: 0.25rem;
  font: inherit;
  font-size: 0.72em;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transform: translate(-50%, 0.25rem);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background-color var(--theme-transition),
    color var(--theme-transition);
  white-space: nowrap;
}

.separator {
  color: color-mix(in srgb, var(--muted), transparent 45%);
  transition: color var(--theme-transition);
}

.link:focus-visible {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  outline: 1px solid currentColor;
  outline-offset: 0.5rem;
}

@media (hover: hover) {
  .theme-toggle:hover,
  .link:hover {
    color: var(--foreground);
    text-decoration: underline;
    text-decoration-thickness: 1px;
  }

  .email-copy:hover .copy-badge,
  .email-copy:focus-within .copy-badge {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }
}

.code-snippet {
  --code-font-size: clamp(0.78rem, 2vw, 0.95rem);

  position: relative;
  display: block;
  width: min(34rem, calc(100vw - 3rem));
  height: 9.75rem;
  margin: 0 auto;
  padding: 1.1rem 1.2rem;
  overflow: hidden;
  color: var(--syntax-comment);
  background: var(--code-background);
  border: 1px solid var(--code-border);
  border-radius: 0.5rem;
  font: inherit;
  font-size: var(--code-font-size);
  line-height: 1.55;
  text-align: left;
  transition:
    background-color var(--theme-transition),
    border-color var(--theme-transition),
    color var(--theme-transition);
}

.code-snippet::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(
    circle,
    var(--code-pattern) 1px,
    transparent 1px
  );
  background-position: 0.35rem 0.35rem;
  background-size: 0.9rem 0.9rem;
  content: "";
  pointer-events: none;
}

.code-snippet.is-glitching {
  animation: snippet-glitch 620ms steps(2, end);
}

.code-scroll {
  position: relative;
  z-index: 1;
  display: block;
  height: 100%;
  overflow-y: auto;
  font-size: 0;
  scrollbar-width: none;
}

.code-scroll::-webkit-scrollbar {
  display: none;
}

.code-scroll code {
  font: inherit;
  font-size: var(--code-font-size);
  white-space: pre-wrap;
}

.syntax-token {
  transition: color var(--theme-transition);
}

.syntax-comment {
  color: var(--syntax-comment);
}

.syntax-function {
  color: var(--syntax-function);
}

.syntax-keyword {
  color: var(--syntax-keyword);
}

.syntax-meta {
  color: var(--syntax-meta);
}

.syntax-number {
  color: var(--syntax-number);
}

.syntax-string {
  color: var(--syntax-string);
}

.code-cursor {
  display: inline-block;
  width: 0.6em;
  color: var(--foreground);
  font-size: var(--code-font-size);
  animation: cursor-blink 1s steps(2, start) infinite;
  transition: color var(--theme-transition);
}

.portrait-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  color: var(--portrait-color);
  pointer-events: none;
}

.trail-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.trail-glyph {
  position: fixed;
  top: 0;
  left: 0;
  color: var(--trail);
  font-size: var(--size);
  line-height: 1;
  opacity: 0;
  text-shadow: 0 0 1.5rem var(--trail-shadow);
  transform: translate3d(var(--x), var(--y), 0) translate(-50%, -50%);
  animation: glyph-life var(--life) cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes cursor-blink {
  0%,
  45.01% {
    opacity: 1;
  }

  45%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .screen {
    gap: 0.75rem;
    padding: 1rem 1.25rem;
  }

  .intro {
    gap: 0.35rem;
  }

  .code-snippet {
    --code-font-size: 0.78rem;

    width: min(100%, calc(100vw - 2.5rem));
    height: 8.25rem;
    padding: 0.95rem 1rem;
  }

  .theme-toggle {
    margin-top: -0.15rem;
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --theme-transition: 1ms linear;
  }
}

@keyframes snippet-glitch {
  0%,
  100% {
    border-color: var(--code-border);
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  18% {
    border-color: color-mix(in srgb, var(--foreground), transparent 68%);
    opacity: 0.84;
    transform: translate3d(-1px, 1px, 0);
  }

  32% {
    border-color: color-mix(in srgb, var(--foreground), transparent 94%);
    opacity: 0.72;
    transform: translate3d(2px, -1px, 0);
  }

  48% {
    border-color: color-mix(in srgb, var(--foreground), transparent 74%);
    opacity: 0.9;
    transform: translate3d(-2px, 0, 0);
  }

  64% {
    border-color: color-mix(in srgb, var(--foreground), transparent 88%);
    opacity: 0.78;
    transform: translate3d(1px, 1px, 0);
  }
}

@keyframes glyph-life {
  0% {
    opacity: 0;
    transform:
      translate3d(var(--x), var(--y), 0)
      translate(-50%, -50%)
      rotate(var(--rotation))
      scale(0.82);
  }

  12% {
    opacity: 0.7;
  }

  100% {
    opacity: 0;
    transform:
      translate3d(
        calc(var(--x) + var(--drift-x)),
        calc(var(--y) + var(--drift-y)),
        0
      )
      translate(-50%, -50%)
      rotate(calc(var(--rotation) + var(--spin)))
      scale(1.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .code-snippet.is-glitching,
  .code-cursor,
  .trail-glyph {
    animation: none;
  }
}
