:root {
  color-scheme: dark;
  --paper: #0d0f14;
  --ink: #f2f0e9;
  --copy: #c5c7ce;
  --muted: #9ba1ab;
  --line: rgba(242, 240, 233, 0.16);
  --acid: #d9ff56;
  --decode-spectrum: linear-gradient(
    90deg,
    #ff5b78 0%,
    #ff9d57 7.14%,
    #e8c95b 14.28%,
    #46c98f 21.42%,
    #45bad7 28.56%,
    #7595ff 35.7%,
    #bc7df0 42.84%,
    #ff5b78 50%,
    #ff9d57 57.14%,
    #e8c95b 64.28%,
    #46c98f 71.42%,
    #45bad7 78.56%,
    #7595ff 85.7%,
    #bc7df0 92.84%,
    #ff5b78 100%
  );
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  isolation: isolate;
  background: linear-gradient(145deg, #13151c 0%, var(--paper) 56%, #090a0e 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  width: 52rem;
  aspect-ratio: 1;
  position: fixed;
  top: -22rem;
  right: -13rem;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 62%,
    rgba(217, 47, 73, 0.22),
    transparent 31%
  ), radial-gradient(
    circle at 68% 42%,
    rgba(54, 95, 196, 0.3),
    transparent 34%
  ), radial-gradient(
    circle at 48% 24%,
    rgba(22, 131, 93, 0.24),
    transparent 31%
  ), radial-gradient(
    circle at 54% 56%,
    rgba(116, 67, 170, 0.2),
    transparent 62%
  );
  pointer-events: none;
  transform: translate3d(var(--glow-x, 0), var(--glow-y, 0), 0);
  will-change: transform;
}

a {
  color: inherit;
}

.site-shell {
  width: min(100%, 1440px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding: clamp(1.1rem, 3vh, 2.25rem) clamp(1.25rem, 4vw, 4.5rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(0.85rem, 2.25vh, 1.8rem);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(1.5rem, 4vw, 4.5rem);
}

.intro-copy {
  min-width: 0;
  max-width: 58rem;
}

.eyebrow {
  color: var(--muted);
  font-size: clamp(0.65rem, 0.82vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0.08em 0 0.06em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 7.2vh, 5.4rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.95;
}

.about {
  max-width: 47rem;
  color: var(--copy);
  font-size: clamp(0.8rem, 1.15vw, 1.05rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.work {
  min-height: 0;
  padding-top: clamp(0.8rem, 2vh, 1.4rem);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.scramble-word {
  display: inline-block;
  position: relative;
}

.scramble-word.is-decoding-word {
  color: transparent;
}

.scramble-word.is-decoding-word::after {
  content: attr(data-glyphs);
  position: absolute;
  inset: 0;
  color: transparent;
  background-image: var(--decode-spectrum);
  background-position: 0 50%;
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: decode-rainbow 700ms linear infinite;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes decode-rainbow {
  to {
    background-position: -100% 50%;
  }
}

.repo-list {
  min-height: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  column-gap: clamp(1.5rem, 3vw, 3.5rem);
}

.repo-list li {
  min-width: 0;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.repo-list li:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.repo-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.45rem, 1.25vh, 0.9rem) 0.35rem;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 2rem;
  align-items: center;
  gap: clamp(0.55rem, 1.2vw, 0.9rem);
  position: relative;
  text-decoration: none;
  overflow: hidden;
  transition: background-color 180ms ease, opacity 220ms ease, padding 180ms ease;
}

.repo-card::before {
  content: "";
  width: 3px;
  position: absolute;
  top: 0.55rem;
  bottom: 0.55rem;
  left: 0;
  z-index: 2;
  border-radius: 99px;
  background: var(--ink);
  transform: scaleY(0);
  transition: transform 160ms ease;
}

.repo-card:hover,
.repo-card:focus-visible {
  padding-right: 0.7rem;
  padding-left: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
}

.repo-card:hover::before,
.repo-card:focus-visible::before {
  transform: scaleY(1);
}

.repo-index {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: clamp(0.57rem, 0.7vw, 0.67rem);
  letter-spacing: 0.08em;
  transition: color 180ms ease, transform 180ms ease;
}

.repo-copy {
  min-width: 0;
  display: grid;
  gap: clamp(0.18rem, 0.55vh, 0.35rem);
}

.repo-heading {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
}

.repo-title {
  min-width: 0;
  font-size: clamp(0.9rem, 1.3vw, 1.16rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
  transition: letter-spacing 180ms ease, transform 180ms ease;
}

.repo-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: clamp(0.52rem, 0.65vw, 0.63rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 180ms ease;
}

.repo-description {
  max-width: 42rem;
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(0.65rem, 0.78vw, 0.76rem);
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.repo-arrow {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  transition: background-color 180ms ease, border-color 180ms ease,
    transform 220ms ease;
}

.repo-card:hover .repo-index,
.repo-card:focus-visible .repo-index,
.repo-card:hover .repo-meta,
.repo-card:focus-visible .repo-meta {
  color: var(--ink);
}

.repo-card:hover .repo-index,
.repo-card:focus-visible .repo-index {
  transform: translateX(0.12rem);
}

.repo-card:hover .repo-title,
.repo-card:focus-visible .repo-title {
  letter-spacing: -0.045em;
  transform: translateX(0.12rem);
}

.repo-card:hover .repo-arrow,
.repo-card:focus-visible .repo-arrow {
  border-color: var(--ink);
  background: var(--acid);
  color: var(--paper);
  transform: translate(0.08rem, -0.08rem) rotate(8deg);
}

@media (hover: hover) and (pointer: fine) {
  .repo-list:has(.repo-card:hover) .repo-card:not(:hover) {
    opacity: 0.68;
  }
}

.contact {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-bottom: 0.08rem;
  white-space: nowrap;
}

.contact a {
  position: relative;
  font-size: clamp(0.72rem, 0.9vw, 0.85rem);
  font-weight: 700;
  text-decoration: none;
}

.contact a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -0.2rem;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.contact a:hover::after,
.contact a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

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

@media (max-width: 700px) {
  body::before {
    width: 34rem;
    top: -15rem;
    right: -15rem;
  }

  .site-shell {
    gap: clamp(0.7rem, 1.8vh, 1rem);
    padding: clamp(0.8rem, 2.5vh, 1.35rem) 1rem;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  h1 {
    font-size: clamp(2rem, 8.8vw, 3rem);
  }

  .about {
    max-width: 32rem;
    font-size: clamp(0.7rem, 2.7vw, 0.9rem);
    line-height: 1.35;
  }

  .repo-list {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(8, minmax(0, 1fr));
  }

  .repo-list li:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .repo-card {
    grid-template-columns: 1.6rem minmax(0, 1fr) 1.7rem;
  }

  .repo-description {
    -webkit-line-clamp: 1;
  }

  .repo-arrow {
    width: 1.6rem;
    height: 1.6rem;
  }

  .contact {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    padding-bottom: 0;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .eyebrow {
    font-size: 0.56rem;
  }

  .repo-heading {
    gap: 0.4rem;
  }

  .repo-meta {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-height: 680px) {
  .site-shell {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    gap: 0.55rem;
  }

  h1 {
    font-size: clamp(2rem, 6.5vh, 3.25rem);
  }

  .about {
    font-size: 0.72rem;
  }

  .work {
    padding-top: 0.5rem;
    gap: 0.35rem;
  }

  .repo-card {
    padding-top: 0.22rem;
    padding-bottom: 0.22rem;
  }

  .repo-description {
    display: none;
  }

  .repo-arrow {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.68rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  body::before {
    transform: none;
    will-change: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
