:root {
  color-scheme: dark;
  background: #050505;
  color: #ededed;
  font-family: "Courier New", monospace;
  scrollbar-gutter: stable;
}

@view-transition {
  navigation: auto;
}

::view-transition-group(root),
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(root) { display: none; }
::view-transition-new(root) { mix-blend-mode: normal; }

* { box-sizing: border-box; }

body { margin: 0; }

#waves {
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  color: #737373;
  font: 12px / 15px "Courier New", monospace;
  letter-spacing: 0;
  user-select: none;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, transparent 8%, #0009 45%, #000 85%);
}

main {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
}

h1 {
  display: grid;
  min-width: 10ch;
  margin: 0;
  font-size: clamp(2rem, 7vw, 5.5rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.065em;
}

#name {
  text-align: center;
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.about-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border: 0;
  background: none;
  color: #bcbcbc;
  font: inherit;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
}

.about-button:hover {
  color: #ededed;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid #ededed;
  outline-offset: 4px;
}

.about-nav {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.about-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #aaa;
  font-size: 0.875rem;
  text-decoration: none;
}

.about-nav a:hover { color: #ededed; }

.profile { width: 100%; }

.social-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  color: #737373;
  font-size: 0.875rem;
  text-shadow: 0 1px 3px #050505, 0 0 8px #050505;
}

.social-links a, .social-links button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #bcbcbc;
  font: inherit;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.social-links a:hover, .social-links button:hover { color: #ededed; }

#contact-status {
  min-height: 1.5em;
  margin: 0.25rem 0 0;
  color: #aaa;
  font-size: 0.75rem;
  text-align: center;
}

.about-layout {
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.6fr);
  align-items: start;
  align-content: start;
  gap: clamp(2.5rem, 6vw, 5rem);
  max-width: 1140px;
  min-height: auto;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.portrait {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #282828;
  border-radius: 50%;
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait .portrait-ascii {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: portrait-ascii 12s steps(1) infinite;
}

.portrait::before, .portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/portrait.png") center / cover;
  opacity: 0;
  pointer-events: none;
  animation: portrait-glitch 12s steps(1) infinite;
}

.portrait::before {
  clip-path: polygon(0 18%, 100% 18%, 100% 30%, 0 30%, 0 55%, 100% 55%, 100% 62%, 0 62%);
  filter: hue-rotate(160deg) saturate(1.5);
}

.portrait::after {
  clip-path: polygon(0 35%, 100% 35%, 100% 44%, 0 44%, 0 72%, 100% 72%, 100% 80%, 0 80%);
  filter: hue-rotate(-80deg) saturate(1.5);
  animation-direction: reverse;
}

@keyframes portrait-ascii {
  0%, 75%, 100% { opacity: 0; }
  25% { opacity: 1; }
}

@keyframes portrait-glitch {
  0%, 26%, 76%, 100% { opacity: 0; transform: translateX(0); }
  24%, 74% { opacity: 0.9; transform: translateX(9px); }
  24.6%, 74.6% { opacity: 0.75; transform: translateX(-7px); }
  25.2%, 75.2% { opacity: 0.9; transform: translateX(5px); }
  25.7%, 75.7% { opacity: 0; transform: translateX(0); }
}

.about-copy {
  min-width: 0;
  color: #aaa;
  font-size: 1rem;
  line-height: 1.8;
  text-shadow: 0 1px 3px #050505, 0 0 8px #050505;
}

.about-copy h1 {
  display: block;
  min-width: 0;
  margin-bottom: 2rem;
  color: #ededed;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
}

.about-copy p { margin: 0 0 1.5rem; }
.about-copy strong { color: #ededed; }
.age { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.age-digit {
  display: inline-block;
  position: relative;
  width: 1ch;
  height: 1.2em;
  overflow: hidden;
  line-height: 1.2;
  vertical-align: -0.3em;
}

.age-in, .age-out {
  position: absolute;
  inset: 0;
  animation-duration: 320ms;
  animation-timing-function: cubic-bezier(0.22, 0.7, 0.3, 1);
  animation-fill-mode: both;
}

.age-in { animation-name: digit-in; }
.age-out { animation-name: digit-out; }

@keyframes digit-in {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes digit-out {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

.about-copy ul { padding-left: 1.25rem; }
.about-copy li { margin-bottom: 0.75rem; }

.about-copy blockquote {
  margin: 2.5rem 0 0;
  padding-left: 1.25rem;
  border-left: 1px solid #444;
  color: #ccc;
}

.about-copy blockquote p { margin: 0; }

.projects-layout {
  display: block;
  max-width: 1140px;
  min-height: auto;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.projects-layout h1 { margin-bottom: 1rem; }
.projects-intro { color: #aaa; }
.project-list { margin-top: 3rem; }

.project {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.5fr) auto;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid #303030;
}

.project h2 {
  margin: 0.25rem 0 0;
  color: #ededed;
  font-size: 1.25rem;
  font-weight: 400;
}

.project p { margin: 0; }
.project-content p { margin-top: 0.75rem; }

.project-media {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #303030;
  border-radius: 2px;
}

.project-banner, .project-ascii {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-ascii { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.project-media.is-loading .project-banner { opacity: 0; }
.project-media.is-loading .project-ascii { opacity: 1; }
.project-media.is-loaded .project-ascii { animation: banner-ascii 650ms steps(1) forwards; }
.project-banner.is-loaded { animation: banner-load 350ms steps(1) 200ms forwards; }

@keyframes banner-ascii {
  0%, 35% { opacity: 1; transform: none; }
  45% { opacity: 0.7; transform: translateX(-5px); }
  52% { opacity: 1; transform: translateX(4px); }
  62% { opacity: 0.35; transform: translateX(-2px); }
  75%, 100% { opacity: 0; transform: none; }
}

@keyframes banner-load {
  0%, 18% { transform: translateX(-5px); clip-path: inset(8% 0 16%); filter: hue-rotate(80deg); }
  9%, 35% { transform: translateX(6px); clip-path: inset(22% 0 4%); filter: hue-rotate(-60deg); }
  27%, 54% { transform: translateX(-3px); clip-path: inset(0 0 30%); filter: contrast(1.3); }
  45%, 72%, 100% { transform: none; clip-path: inset(0); filter: none; }
  63% { transform: translateX(3px); clip-path: inset(14% 0 0); filter: hue-rotate(35deg); }
}

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

.nyx-preview {
  display: grid;
  place-items: center;
  container-type: inline-size;
  min-width: 0;
  padding: 1rem;
  background: repeating-linear-gradient(0deg, #080808 0 3px, #151515 3px 4px);
}

.nyx-preview span {
  position: relative;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  color: #ccc;
  font-size: clamp(0.625rem, 10cqw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.nyx-preview span::before, .nyx-preview span::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: #ededed;
  clip-path: inset(18% 0 57%);
  pointer-events: none;
  opacity: 0;
  animation: nyx-slice 2.2s steps(1) infinite;
}

.nyx-preview span::after {
  color: #777;
  clip-path: inset(60% 0 15%);
  animation-duration: 3.1s;
  animation-direction: reverse;
}

@keyframes nyx-slice {
  0%, 14%, 45%, 74%, 100% { opacity: 0; transform: none; }
  8%, 41% { opacity: 1; transform: translateX(-6px); }
  10%, 43% { opacity: 1; transform: translateX(5px); }
  68% { opacity: 1; transform: translateX(-4px) skewX(8deg); }
  71% { opacity: 1; transform: translateX(3px); }
}

.project-status, .project-link, .project-soon { color: #999; font-size: 0.875rem; }

.project-link, .project-soon {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  text-underline-offset: 0.3em;
}

.project-link:hover { color: #ededed; text-decoration: underline; }

@media (max-width: 760px) {
  .about-layout {
    grid-template-columns: 1fr;
    padding-top: 1rem;
  }

  .profile { max-width: 220px; }
  .projects-layout { padding-top: 1rem; }
  .project { grid-template-columns: 1fr; gap: 1rem; }
}

#name::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.85em;
  margin-left: 0.12em;
  background: currentColor;
  vertical-align: -0.04em;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #name::after { animation: none; }
  .age-in, .age-out { animation-duration: 0s; }
  .portrait .portrait-ascii { animation: none; }
  .portrait::before, .portrait::after { animation: none; }
  .project-banner.is-loaded { animation: none; }
  .project-media .project-ascii { display: none; }
  .project-media.is-loading .project-banner { opacity: 1; }
  .nyx-preview span::before, .nyx-preview span::after { animation: none; }
}
