:root {
  --bg: #08080a;
  --fg: #ffffff;
  --muted: #9a9aa3;
  --grid: rgba(255, 255, 255, 0.05);
  --pad: clamp(1.25rem, 5vw, 4.5rem);
}

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

html { scroll-behavior: smooth; scrollbar-gutter: stable; }
html.intro-running { overflow: hidden; }
html.hello-intro .dynamic-island,
html.hello-intro .soot-trail { visibility: hidden; }

body {
  position: relative;
  font-family: "Space Grotesk", system-ui, sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  color: var(--fg);
  line-height: 1.6;
}

.page-accent-layer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  overflow: visible;
  pointer-events: none;
  transform: translate3d(0, var(--accent-parallax-y, 0px), 0);
}
.page-accent {
  position: absolute;
  display: block;
  left: 0;
  top: 0;
  transform: translate(calc(-50% + var(--accent-jitter-x, 0px)), -50%) rotate(var(--accent-rotation, 0deg));
}
.page-accent--circle {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 92, 130, 0.7);
  border-radius: 50%;
}
.page-accent--square {
  width: 64px;
  height: 64px;
  border: 1px solid rgba(139, 120, 255, 0.7);
}
.page-accent--triangle {
  width: 0;
  height: 0;
  border-right: 38px solid transparent;
  border-bottom: 66px solid rgba(100, 217, 154, 0.7);
  border-left: 38px solid transparent;
}
.page-accent--cross::before,
.page-accent--cross::after {
  position: absolute;
  top: 50%;
  left: 0;
  width: 72px;
  height: 1px;
  background: rgba(105, 166, 255, 0.75);
  content: "";
}
.page-accent--cross {
  width: 72px;
  height: 72px;
}
.page-accent--cross::before { transform: translateY(-50%) rotate(45deg); }
.page-accent--cross::after { transform: translateY(-50%) rotate(-45deg); }

.triangle-background {
  position: fixed;
  inset: -18vh 0;
  z-index: 0;
  width: 100%;
  height: 136vh;
  opacity: 0.62;
  pointer-events: none;
  transform: translate3d(0, var(--triangle-parallax-y, 0px), 0);
  will-change: transform;
}

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: #000;
  pointer-events: none;
}
.soot-trail {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}
.soot-trail.is-active {
  opacity: 1;
}
.soot-ball, .soot-particle {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}
.soot-ball {
  width: 0.9rem;
  height: 1.125rem;
  overflow: visible;
  filter: drop-shadow(0 0.15rem 0.22rem rgba(0, 0, 0, 0.55));
  will-change: transform;
}
.soot-particle {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: #242228;
  box-shadow: 0 0 0.35rem rgba(0, 0, 0, 0.35);
  transition: opacity 360ms ease;
  will-change: transform;
}
.dynamic-island {
  position: fixed;
  top: 1.25rem;
  right: var(--pad);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(15, 15, 18, 0.88);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.3);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.island-brand, .island-widgets {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.island-indicator {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #8b78ff;
  box-shadow: 0 0 0.7rem rgba(139, 120, 255, 0.8);
}
.island-divider { height: 1rem; border-left: 1px solid rgba(255, 255, 255, 0.22); }
.island-detail { color: var(--muted); font-size: 0.78rem; }
.island-widgets { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.island-widget-divider { height: 0.8rem; border-left: 1px solid rgba(255, 255, 255, 0.18); }
.island-status { display: inline-flex; align-items: center; gap: 0.35rem; }
.island-status-indicator {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #64d99a;
  box-shadow: 0 0 0.55rem rgba(100, 217, 154, 0.65);
}
.dynamic-island:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }
main { position: relative; z-index: 2; }

@media (max-width: 520px) {
  .dynamic-island {
    top: 0.75rem;
    right: 0.75rem;
    max-width: calc(100vw - 1.5rem);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.65rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.8rem;
  }
  .dynamic-island .island-brand,
  .dynamic-island .island-widgets { gap: 0.45rem; }
  .dynamic-island .island-widgets { font-size: 0.7rem; }
}

section { padding: 0 var(--pad); }

.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.hello {
  display: inline-block;
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 500;
  line-height: 1.2;
}
.hello-character { display: inline-block; }
.hello-im { display: none; }
.hero-title {
  font-size: clamp(1.75rem, 10.5vw, 9rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  white-space: nowrap;
  perspective: 900px;
}
.metric-outline {
  position: relative;
  display: inline-block;
}
.metric-outline::before {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  content: "";
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms ease;
}
.metric-outline:hover::before {
  transform: scaleX(1);
}
.metric-outline::after {
  position: absolute;
  top: 0;
  right: 0;
  transform: translateY(calc(-100% + 4px));
  padding: 0.3rem 0.45rem;
  background: #08080a;
  color: #fff;
  content: attr(data-metrics);
  font: 600 0.75rem/1.2 Consolas, monospace;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  white-space: nowrap;
  z-index: 1;
  transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 140ms;
}
.metric-outline:hover::after {
  transform: translateY(calc(-100% - 2px));
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
.name-character { display: inline-block; }
.name-cursor {
  display: inline-block;
  height: 0.8em;
  margin-left: 0.06em;
  border-left: 0.08em solid currentColor;
  vertical-align: -0.02em;
  visibility: hidden;
  animation: cursor-blink 0.8s steps(2, start) infinite;
}
@keyframes cursor-blink {
  to { opacity: 0; }
}
.title-character {
  display: inline-block;
  transform-origin: bottom center;
  will-change: transform, opacity;
}
.heading-character { display: inline-block; }
.role { margin-top: 1.5rem; color: var(--muted); font-size: clamp(0.9rem, 1.3vw, 1.1rem); line-height: 1.3; }

.about {
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 28vh;
  padding-bottom: 2vh;
  gap: 0.75rem;
  max-width: 60rem;
}
.about h2, .skills h2, .contact h2, .projects-title { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 700; letter-spacing: -0.02em; }
.about p { font-size: clamp(1.1rem, 2vw, 1.6rem); max-width: 40ch; }

.skills {
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2vh;
  padding-bottom: 3vh;
  gap: 0.75rem;
  max-width: 60rem;
}
.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}
.skill-list li {
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(8, 8, 10, 0.75);
  color: var(--muted);
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}
.skill-list li:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.55);
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}

.projects { padding-top: 3vh; padding-bottom: 3vh; overflow: hidden; }
.projects-title { margin-bottom: 1rem; text-align: center; }
.track { display: flex; flex-direction: row; gap: 1.5rem; width: max-content; }
.card {
  flex: 0 0 min(26rem, 84vw);
  min-height: 21rem;
  background: rgba(8, 8, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.card:hover, .card:focus-within {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.28);
}
.project-preview {
  position: relative;
  width: calc(100% + 2.5rem);
  aspect-ratio: 16 / 8;
  margin: -1.25rem -1.25rem 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 75% 15%, rgba(128, 104, 255, 0.25), transparent 45%),
    linear-gradient(135deg, #17171d, #0d0d10);
}
.project-preview::before { transition: transform 300ms ease; }
.card:hover .project-preview::before, .card:focus-within .project-preview::before { transform: scale(1.06); }
.project-preview::before {
  content: "";
  position: absolute;
  inset: 18% 12%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.4rem;
  background:
    linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)) 12% 22% / 34% 3px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)) 12% 36% / 62% 2px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12)) 12% 44% / 52% 2px no-repeat,
    linear-gradient(rgba(139, 120, 255, 0.7), rgba(139, 120, 255, 0.7)) 12% 66% / 20% 12% no-repeat,
    rgba(8, 8, 10, 0.72);
}
.project-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wide-banner-preview { aspect-ratio: 4 / 1; background: #111; }
.wide-banner-preview::before { content: none; }
.wide-banner-preview img { object-fit: contain; }
.card p { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { color: var(--muted); font-size: 0.85rem; }
.card a { margin-top: auto; width: fit-content; text-underline-offset: 4px; transition: color 180ms ease, text-underline-offset 180ms ease; }
.card a:hover { color: #c4b8ff; text-underline-offset: 7px; }

@media (min-width: 800px) {
  .card { height: 21rem; }
}

@media (prefers-reduced-motion: reduce) {
  .projects { overflow: visible; }
  .track {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scroll-snap-type: x mandatory;
  }
  .card { scroll-snap-align: start; }
}

.contact {
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 2vh;
  padding-bottom: 5vh;
  gap: 0.35rem;
}
.mail { font-size: clamp(1.4rem, 4vw, 3rem); font-weight: 500; width: fit-content; text-underline-offset: 6px; }
.contact .mail { font-size: 0.9em; font-weight: inherit; width: auto; text-underline-offset: 3px; }
.mail { transition: color 180ms ease, text-underline-offset 180ms ease; }
.mail:hover { color: #c4b8ff; text-underline-offset: 6px; }
.discord-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.social-link {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 180ms ease, transform 180ms ease;
}
.social-link svg { width: 1.35rem; height: 1.35rem; fill: currentColor; }
.social-link:hover { color: var(--fg); transform: translateY(-2px); }
.social-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.discord-contact .social-link { margin-right: 0; }
.contact p a { margin-right: 1.5rem; color: var(--muted); }
.contact p a:hover { color: var(--fg); }

.typed::after { content: ""; display: inline-block; width: 0.08em; height: 1em; margin-right: -0.08em; vertical-align: -0.12em; background: currentColor; }
.rest { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .intro-overlay { display: none; }
  .name-cursor { visibility: visible; animation: none; }
  .hello-im { display: inline; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
