@font-face {
  font-family: "Geist Variable";
  src: url("fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono Variable";
  src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font-sans: "Geist Variable", system-ui, sans-serif;
  --font-mono: "Geist Mono Variable", ui-monospace, monospace;
  --bg: #fff;
  --surface: #f4f4f5;
  --ink: #0a0a0a;
  --text: #404040;
  --muted: #666;
  --line: #eaeaea;
  --line-strong: #d4d4d4;
  --accent: #0068d6;
  --radius: 12px;
  --radius-xs: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --surface: #171717;
    --ink: #ededed;
    --text: #d4d4d4;
    --muted: #a1a1a1;
    --line: #242424;
    --line-strong: #383838;
    --accent: #3ba7ff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #171717;
  --ink: #ededed;
  --text: #d4d4d4;
  --muted: #a1a1a1;
  --line: #242424;
  --line-strong: #383838;
  --accent: #3ba7ff;
}

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

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

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 16px/1.65 var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 200ms ease,
    color 200ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  padding: 8px 14px;
  color: var(--bg);
  background: var(--ink);
  border-radius: var(--radius-xs);
}

.skip:focus {
  top: 16px;
}

main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(48px, 10vh, 96px) 16px 32px;
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.mark {
  width: 60px;
  height: 60px;
}

.mark .tile {
  fill: var(--ink);
}

.mark .letters {
  fill: var(--bg);
}

.mark .caret {
  fill: var(--accent);
}

h1 {
  margin-top: 24px;
  font-size: clamp(2.25rem, 8vw, 3rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.bio {
  max-width: 44ch;
  margin-top: 12px;
  color: var(--muted);
  text-wrap: balance;
}

.links {
  display: grid;
  gap: 12px;
  margin-top: 40px;
}

.link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.link:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.link span {
  display: grid;
  flex: 1;
  min-width: 0;
}

.link strong {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.link small {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted);
}

.link svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: color 150ms ease;
}

.link:hover svg {
  color: var(--accent);
}

footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 16px 16px 48px;
}

.social {
  display: flex;
  gap: 8px;
}

.social a,
#theme {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
  border-radius: 999px;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.social a:hover,
#theme:hover {
  color: var(--ink);
  background: var(--surface);
}

.social svg,
#theme svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.social svg.fill {
  fill: currentColor;
  stroke: none;
}

#theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  cursor: pointer;
  background: none;
  border: 0;
}

#theme .sun {
  display: none;
}

:root[data-theme="dark"] #theme .sun {
  display: block;
}

:root[data-theme="dark"] #theme .moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme .sun {
    display: block;
  }

  :root:not([data-theme="light"]) #theme .moon {
    display: none;
  }
}

.copy {
  font: 400 0.75rem/1 var(--font-mono);
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* background: dot pattern with soft glow, lit by a slow moving spotlight */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg i {
  position: absolute;
  display: block;
}

.grid,
.lit {
  inset: 0;
  background-size: 28px 28px;
  background-position: center top;
}

.grid {
  background-image: radial-gradient(circle, var(--line-strong) 1px, transparent 1.6px);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 20%, transparent 100%);
  animation: fade 1.6s ease both;
}

.lit {
  background-image: radial-gradient(circle, var(--accent) 1.2px, transparent 1.9px);
  mask-image: radial-gradient(closest-side, #000 0%, transparent 100%);
  mask-size: 70vmax 70vmax;
  mask-repeat: no-repeat;
  mask-position: 0% 10%;
  opacity: 0.7;
  animation:
    fade 2s 0.3s ease both,
    sweep 26s ease-in-out infinite alternate;
}

/* near layer: large dots out of focus, as if close to the lens */
.near {
  inset: -10%;
  background-image: radial-gradient(circle, var(--ink) 4px, transparent 5px);
  background-size: 120px 120px;
  filter: blur(4px);
  opacity: 0.05;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 35%, #000 100%);
  animation:
    fade 2s 0.2s ease both,
    near-drift 40s linear infinite;
}

.glow {
  border-radius: 50%;
  background: var(--accent);
  filter: blur(90px);
  opacity: 0.12;
  animation:
    fade 2.4s 0.2s ease both,
    float 22s ease-in-out infinite alternate;
}

.glow.one {
  width: 46vmax;
  height: 30vmax;
  left: 50%;
  top: -14vmax;
  translate: -50% 0;
}

.glow.two {
  width: 28vmax;
  height: 28vmax;
  right: -8vmax;
  bottom: -10vmax;
  opacity: 0.09;
  animation-delay: 0.5s, 0s;
  animation-duration: 2.4s, 30s;
}

@keyframes fade {
  from { opacity: 0; }
}

@keyframes sweep {
  to { mask-position: 100% 90%; }
}

@keyframes float {
  to { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); }
}

@keyframes near-drift {
  to { background-position: 120px 120px; }
}

:root[data-theme="dark"] .glow { opacity: 0.22; }
:root[data-theme="dark"] .glow.two { opacity: 0.16; }
:root[data-theme="dark"] .near { opacity: 0.07; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .glow { opacity: 0.22; }
  :root:not([data-theme="light"]) .glow.two { opacity: 0.16; }
  :root:not([data-theme="light"]) .near { opacity: 0.07; }
}

/* entry: elements rack into focus one after another */
.mark,
h1,
.bio,
.links li,
footer > * {
  animation: rack 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mark { animation-delay: 0.1s; }
h1 { animation-delay: 0.2s; }
.bio { animation-delay: 0.3s; }
.links li:nth-child(1) { animation-delay: 0.42s; }
.links li:nth-child(2) { animation-delay: 0.5s; }
.links li:nth-child(3) { animation-delay: 0.58s; }
.links li:nth-child(4) { animation-delay: 0.66s; }
footer > :nth-child(1) { animation-delay: 0.8s; }
footer > :nth-child(2) { animation-delay: 0.88s; }
#theme { animation: rack 0.9s 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes rack {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg i,
  .mark,
  h1,
  .bio,
  .links li,
  footer > *,
  #theme {
    animation: none !important;
  }
}

/* floating contact button */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--bg);
  background: var(--ink);
  border-radius: 50%;
  box-shadow: 0 8px 24px -8px rgb(0 0 0 / 0.35);
  transition:
    transform 250ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 250ms ease;
  animation: pop 0.8s 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -10px rgb(0 0 0 / 0.4);
}

.fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: ring 3.6s 2.4s ease-out infinite;
}

.fab svg,
.close svg,
.done svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fab svg {
  width: 22px;
  height: 22px;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.6);
  }
}

@keyframes ring {
  0% { opacity: 0.6; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.7); }
}

/* contact dialog */
.modal {
  position: fixed;
  inset: auto 24px 92px auto;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100dvh - 116px);
  margin: 0;
  padding: 0;
  overflow: auto;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 24px 64px -24px rgb(0 0 0 / 0.4);
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(20px) scale(0.92);
  filter: blur(8px);
  transition:
    opacity 300ms ease,
    transform 450ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 300ms ease,
    overlay 450ms allow-discrete,
    display 450ms allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: none;
  filter: none;
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(20px) scale(0.92);
    filter: blur(8px);
  }
}

.modal::backdrop {
  background: rgb(0 0 0 / 0);
  backdrop-filter: blur(0);
  transition:
    background-color 350ms ease,
    backdrop-filter 350ms ease,
    overlay 350ms allow-discrete,
    display 350ms allow-discrete;
}

.modal[open]::backdrop {
  background: rgb(0 0 0 / 0.25);
  backdrop-filter: blur(6px);
}

@starting-style {
  .modal[open]::backdrop {
    background: rgb(0 0 0 / 0);
    backdrop-filter: blur(0);
  }
}

.panel {
  padding: 20px;
}

.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: -8px;
  color: var(--muted);
  border-radius: 50%;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.close:hover {
  color: var(--ink);
  background: var(--surface);
}

.close svg {
  width: 18px;
  height: 18px;
}

#contact-form {
  display: grid;
  gap: 14px;
}

#contact-form label {
  display: grid;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

#contact-form input,
#contact-form textarea {
  width: 100%;
  padding: 10px 12px;
  font: 400 1rem/1.5 var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  resize: vertical;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

#contact-form input::placeholder,
#contact-form textarea::placeholder {
  color: var(--muted);
}

#contact-form input:focus-visible,
#contact-form textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.trap {
  position: absolute;
  left: -9999px;
}

.submit {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--bg);
  background: var(--ink);
  border-radius: 8px;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.submit:hover:not(:disabled) {
  opacity: 0.88;
}

.submit:active:not(:disabled) {
  transform: scale(0.98);
}

.submit:disabled {
  cursor: progress;
  opacity: 0.6;
}

.status:empty {
  display: none;
}

.status {
  font-size: 0.875rem;
  color: var(--muted);
}

.status a {
  color: var(--accent);
  text-decoration: underline;
}

/* fields rise in one after another when the dialog opens */
.modal[open] .panel header,
.modal[open] #contact-form > * {
  animation: rack 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal[open] #contact-form > :nth-child(1) { animation-delay: 0.08s; }
.modal[open] #contact-form > :nth-child(2) { animation-delay: 0.14s; }
.modal[open] #contact-form > :nth-child(3) { animation-delay: 0.2s; }
.modal[open] #contact-form > :nth-child(6) { animation-delay: 0.26s; }

.done {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px 0 12px;
  text-align: center;
}

.done[hidden],
#contact-form[hidden] {
  display: none;
}

.done svg {
  width: 56px;
  height: 56px;
  color: var(--accent);
  stroke-width: 1.5;
}

.done circle {
  stroke-dasharray: 63;
  animation: draw 0.7s ease both;
}

.done path {
  stroke-dasharray: 16;
  animation: draw 0.5s 0.5s ease both;
}

.done h3 {
  font-size: 1.125rem;
  color: var(--ink);
}

@keyframes draw {
  from { stroke-dashoffset: 63; }
}

@media (prefers-reduced-motion: reduce) {
  .fab,
  .fab::after,
  .modal,
  .modal::backdrop,
  .modal[open] .panel header,
  .modal[open] #contact-form > *,
  .done circle,
  .done path {
    animation: none !important;
    transition: none !important;
  }
}
