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

html { line-height: 1.5; }

html { background-color: black; }

body {
  margin: 0;
  min-height: 100vh;
  color: white;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Background lives on its own fixed layer (iOS ignores background-attachment: fixed) */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
    radial-gradient(circle at 80% 20%, rgba(25, 25, 255, 1) 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 25% 56%, rgba(13, 145, 26, 1) 1%, rgba(0, 0, 0, 1) 29%, rgba(0, 0, 0, 1) 74%, rgba(238, 130, 238, 1) 100%);
}

/* Film grain */
body::after {
  z-index: -1;
  opacity: 0.35;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, p { margin: 0; font-size: inherit; font-weight: normal; }

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

/* Page layout: content on the left, nav on the right */
.page {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 72px 24px 24px;
}

.content { flex: 1; }

.site-title { font-size: 24px; }

/* Blinking terminal cursor after the title */
.site-title::after {
  content: "▍";
  margin-left: 0.1em;
  animation: blink 1.1s steps(1) infinite;
}

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

.site-title.typing::after { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .site-title::after { animation: none; }
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5ch 2ch;
  margin-top: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.links a:hover { color: white; text-decoration: underline; }

.links-stacked { flex-direction: column; align-items: flex-start; gap: 0.25rem; }

/* Projects */
.projects-heading {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 1.5rem;
}

.projects-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: darkred;
}

.projects {
  max-width: 44rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project {
  display: grid;
  grid-template-columns: 3ch 1fr;
  gap: 1.5ch;
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.project:first-child { border-top: none; padding-top: 0; }

.project-index { color: rgba(255, 255, 255, 0.45); }

.project-title a:hover { text-decoration: underline; }

.project-description {
  margin-top: 0.25rem;
  color: rgba(255, 255, 255, 0.75);
}

.project-tags {
  margin-top: 0.5rem;
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.45);
}

/* Nav: full-screen overlay on mobile, sidebar on desktop */
.menu-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  padding: 1rem;
  border: none;
  background: none;
  color: white;
  cursor: pointer;
}

.menu-toggle svg { display: block; width: 1.5rem; height: 1.5rem; }

.nav {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.9);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}

.nav.open { transform: translateX(0); }

.nav a { padding: 0.5rem 0.75rem; }
.nav a:hover { background-color: rgb(55 65 81); }

@media (min-width: 768px) {
  .menu-toggle { display: none; }

  .page { padding: 50px; }

  .nav {
    position: static;
    align-items: flex-start;
    background: none;
    transform: none;
    transition: none;
  }

  .nav a { padding: 0; }
  .nav a:hover { background: none; }

  /* Dot marks the current page; spacer keeps the others aligned */
  .nav a::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    vertical-align: middle;
    transition: background-color 0.2s;
  }

  .nav a:hover::before { background-color: rgba(255, 255, 255, 0.5); }
  .nav a.active::before { background-color: white; }

  .site-title { font-size: 40px; }
}
