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

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

:root {
  --mono: "Geist Mono", ui-monospace, monospace;
  --bg: #060914;
  --tile: rgba(17, 25, 48, 0.62);
  --tile-hover: rgba(22, 33, 64, 0.72);
  --line: rgba(140, 165, 255, 0.13);
  --line-strong: rgba(140, 175, 255, 0.38);
  --text: #eef2ff;
  --muted: #9aa8cc;
  --faint: #6b7aa3;
  --blue: #4f7cff;
  --cyan: #3fd0f0;
  --violet: #a17bff;
  --gradient: linear-gradient(100deg, #7aa2ff 0%, var(--cyan) 50%, var(--violet) 100%);
  --radius: 1.5rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(40rem 30rem at 8% -5%, rgba(79, 124, 255, 0.28), transparent 70%),
    radial-gradient(36rem 28rem at 95% 10%, rgba(161, 123, 255, 0.2), transparent 70%),
    radial-gradient(44rem 30rem at 50% 110%, rgba(63, 208, 240, 0.12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Geist", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

a {
  color: var(--text);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
  color: var(--cyan);
  text-decoration-color: var(--cyan);
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

p {
  margin: 0 0 0.75rem;
}

p:last-child {
  margin-bottom: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Grid */

.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 1rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem) 1rem 7rem;
}

.tile {
  position: relative;
  grid-column: span 2;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  overflow: hidden;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  animation: rise 0.7s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.3s var(--ease), border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.tile:is(:hover, :focus-within) {
  transform: translateY(-3px);
  background: var(--tile-hover);
  border-color: var(--line-strong);
  box-shadow: 0 24px 48px -28px rgba(79, 124, 255, 0.6);
}

.tile h2 {
  font-family: var(--mono);
  margin: 0 0 1rem;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tile-hero {
  grid-column: span 3;
}

.tile-contact {
  grid-column: span 1;
}

.tile-in-numbers {
  grid-column: span 4;
}

.tile-experience {
  grid-row: span 3;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* Hero */

.tile-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.tile-hero::after {
  content: "";
  position: absolute;
  inset: auto -6rem -8rem auto;
  width: 22rem;
  height: 22rem;
  background: radial-gradient(circle, rgba(79, 124, 255, 0.35), transparent 65%);
  pointer-events: none;
}

.eyebrow {
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.3rem 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.eyebrow::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--cyan);
}

.tile-hero h1 {
  margin: 0;
  font-size: clamp(2.75rem, 7vw, 5.25rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.tagline {
  margin: 0;
  max-width: 28ch;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.profile {
  max-width: 62ch;
  color: var(--muted);
}

.cta,
.chat-launcher,
.chat-form button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(100deg, var(--blue), #6a5cff);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.cta {
  position: relative;
  z-index: 1;
  margin-top: 0.5rem;
  padding: 0.85rem 1.5rem;
  box-shadow: 0 10px 30px -10px rgba(79, 124, 255, 0.8);
}

.cta::after {
  content: " \2192";
}

.cta:hover,
.chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -10px rgba(106, 92, 255, 0.9);
}

/* Contact */

.tile-contact {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.monogram {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: conic-gradient(from 200deg, var(--blue), var(--cyan), var(--violet), var(--blue));
  border-radius: 1.25rem;
  box-shadow: 0 12px 30px -12px rgba(63, 208, 240, 0.7);
}

.contact-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.contact-list {
  display: grid;
  gap: 0.75rem;
  font-size: 0.92rem;
}

.contact-list li {
  display: grid;
  min-width: 0;
}

.contact-list a,
.contact-list span {
  overflow-wrap: anywhere;
}

.contact-label {
  font-family: var(--mono);
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* In numbers */

.tile-in-numbers ul {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

.tile-in-numbers li {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.tile-in-numbers strong {
  display: block;
  margin-bottom: 0.35rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

/* Experience and education: timeline */

.tile-experience ul,
.tile-education ul {
  display: grid;
  gap: 1.25rem;
}

.tile-experience li {
  position: relative;
  padding-left: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
}

.tile-experience li::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  left: 0;
  width: 0.6rem;
  height: 0.6rem;
  border: 2px solid var(--cyan);
  border-radius: 50%;
}

.tile-experience li:first-child::before {
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.tile-experience li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.2rem;
  bottom: -1.1rem;
  left: 0.29rem;
  width: 1px;
  background: var(--line-strong);
}

.tile-experience strong,
.tile-education strong {
  font-family: var(--mono);
  display: block;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.tile-experience em,
.tile-education em {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: normal;
  font-weight: 400;
}

.tile-education li {
  font-weight: 600;
  line-height: 1.4;
}

/* Open source */

.tile-open-source p:first-of-type strong {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tile-open-source p {
  color: var(--muted);
}

.tile-open-source p:first-of-type strong,
.tile-open-source a {
  color: var(--text);
}

.tile-open-source a {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: border-color 0.2s, color 0.2s;
}

.tile-open-source a::after {
  content: " \2197";
}

.tile-open-source a:hover {
  border-color: var(--cyan);
}

/* Toolbox */

.tile-toolbox ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tile-toolbox li {
  padding: 0.35rem 0.85rem;
  font-size: 0.88rem;
  background: rgba(140, 165, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.2s, background 0.2s;
}

.tile-toolbox li:hover {
  background: rgba(79, 124, 255, 0.18);
  border-color: var(--line-strong);
}

/* Chat widget */

.chat-launcher {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.35rem;
  box-shadow: 0 12px 34px -8px rgba(79, 124, 255, 0.85);
}

.pulse {
  position: relative;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--cyan);
  border-radius: 50%;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  to {
    opacity: 0;
    transform: scale(3);
  }
}

.chat {
  inset: auto 1.25rem 5.5rem auto;
  width: min(26rem, calc(100vw - 2rem));
  height: min(40rem, calc(100dvh - 7.5rem));
  margin: 0;
  padding: 0;
  color: var(--text);
  background: rgba(12, 18, 36, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(18px);
}

.chat:popover-open {
  display: flex;
  flex-direction: column;
  animation: rise 0.35s var(--ease);
}

.chat::backdrop {
  background: transparent;
}

.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.chat-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.chat-close {
  flex: none;
  width: 2rem;
  height: 2rem;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.chat-close:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.msg {
  max-width: 88%;
  padding: 0.65rem 0.95rem;
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  border-radius: 1.1rem;
  animation: rise 0.3s var(--ease);
}

.msg-twin {
  align-self: flex-start;
  background: rgba(140, 165, 255, 0.08);
  border: 1px solid var(--line);
  border-bottom-left-radius: 0.35rem;
}

.msg-visitor {
  align-self: flex-end;
  white-space: pre-wrap;
  background: linear-gradient(100deg, var(--blue), #6a5cff);
  border-bottom-right-radius: 0.35rem;
}

.msg-error {
  color: #ffc4cc;
  background: rgba(255, 90, 120, 0.1);
  border-color: rgba(255, 90, 120, 0.35);
}

.msg p,
.msg ul,
.msg ol {
  margin: 0 0 0.6rem;
}

.msg > :last-child {
  margin-bottom: 0;
}

.msg ul,
.msg ol {
  padding-left: 1.2rem;
}

.msg ul {
  list-style: disc;
}

.msg li + li {
  margin-top: 0.3rem;
}

.msg a {
  color: var(--cyan);
}

.msg code {
  padding: 0.05rem 0.3rem;
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(140, 165, 255, 0.12);
  border-radius: 0.3rem;
}

.typing {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.25rem 0;
}

.typing i {
  width: 0.4rem;
  height: 0.4rem;
  background: var(--muted);
  border-radius: 50%;
  animation: blink 1.2s infinite both;
}

.typing i:nth-child(2) {
  animation-delay: 0.2s;
}

.typing i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.chat-starters {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.chat-starters button {
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.chat-starters button:hover {
  background: rgba(79, 124, 255, 0.18);
  border-color: var(--cyan);
}

.chat-privacy {
  margin: 0;
  padding: 0.75rem 1.25rem 0;
  color: var(--faint);
  font-size: 0.75rem;
  line-height: 1.4;
  border-top: 1px solid var(--line);
}

.chat-privacy + .chat-form {
  border-top: 0;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.chat-form textarea {
  flex: 1;
  min-width: 0;
  max-height: 8rem;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(140, 165, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  resize: none;
  field-sizing: content;
}

.chat-form textarea::placeholder {
  color: var(--faint);
}

.chat-form button {
  padding: 0.7rem 1.1rem;
}

.chat-form :disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Responsive */

@media (max-width: 64rem) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile,
  .tile-hero,
  .tile-contact,
  .tile-in-numbers {
    grid-column: span 2;
  }

  .tile-experience {
    grid-row: auto;
  }

  .tile-open-source,
  .tile-education {
    grid-column: span 1;
  }

  .tile-contact .contact-list {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  }

  .tile-in-numbers ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 40rem) {
  .bento {
    grid-template-columns: minmax(0, 1fr);
  }

  .tile,
  .tile-open-source,
  .tile-education {
    grid-column: 1 / -1;
  }

  .chat {
    inset: auto 1rem 5rem 1rem;
    width: auto;
  }
}

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