:root {
  --background: #fdfcfb;
  --foreground: #171717;
  --accent: #8b5cf6;
  --accent-soft: rgb(from var(--accent) r g b / 0.1);
  --accent-2: #facc15;
  --bg-tint-1: rgb(from var(--accent) r g b / 0.26);
  --bg-tint-2: rgb(from var(--accent-2) r g b / 0.2);
  --font-sans: "Inter", sans-serif;
  --font-serif: "Fraunces", serif;
}

html.dark {
  --background: #14121c;
  --foreground: #ededed;
  --accent: #a78bfa;
  --accent-2: #fde047;
  --bg-tint-1: rgb(from var(--accent) r g b / 0.24);
  --bg-tint-2: rgb(from var(--accent-2) r g b / 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: rgb(from var(--foreground) r g b / 0.2) transparent;
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: hidden;
  background-color: var(--background);
  /* both rows show two dots then skip one, second row shifted half a period for the stagger */
  /* diagonal tint sits behind the dots, violet top-left fading to yellow bottom-right */
  background-image:
    radial-gradient(circle, rgb(from var(--foreground) r g b / 0.16) 1.5px, transparent 1.7px),
    radial-gradient(circle, rgb(from var(--foreground) r g b / 0.16) 1.5px, transparent 1.7px),
    radial-gradient(circle, rgb(from var(--foreground) r g b / 0.16) 1.5px, transparent 1.7px),
    radial-gradient(circle, rgb(from var(--foreground) r g b / 0.16) 1.5px, transparent 1.7px),
    linear-gradient(160deg, var(--bg-tint-1) 0%, transparent 45%, transparent 60%, var(--bg-tint-2) 100%);
  background-size: 108px 72px, 108px 72px, 108px 72px, 108px 72px, 100% 100%;
  background-position: 0 0, 36px 0, 54px 36px, 90px 36px, 0 0;
  background-attachment: fixed;
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

::-webkit-scrollbar {
  width: 0.6rem;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgb(from var(--foreground) r g b / 0.2);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

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

/* nav */

#nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgb(from var(--foreground) r g b / 0.1);
  background: rgb(from var(--background) r g b / 0.8);
  backdrop-filter: blur(8px);
}

.nav-inner {
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 500;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.875rem;
}

.nav-links a {
  color: rgb(from var(--foreground) r g b / 0.6);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.toggles {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgb(from var(--foreground) r g b / 0.15);
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border: none;
  background: none;
  color: rgb(from var(--foreground) r g b / 0.6);
  cursor: pointer;
  transition: color 0.2s ease;
}

.icon-btn:hover {
  color: var(--accent);
}

.icon-btn svg {
  height: 1.1rem;
  width: 1.1rem;
}

.lang-btn {
  height: 2rem;
  border: none;
  background: none;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  color: rgb(from var(--foreground) r g b / 0.6);
  cursor: pointer;
  transition: color 0.2s ease;
}

.lang-btn:hover {
  color: var(--accent);
}

/* sections */

main > section {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  scroll-margin-top: 6rem;
}

#projects {
  max-width: 99rem;
}

main > section > h2 {
  font-size: 1.875rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* hero */

.hero {
  min-height: calc(100svh - 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-size: 3rem;
}

@media (min-width: 640px) {
  .hero h1 {
    font-size: 4.5rem;
  }
}

.hero-title {
  margin-top: 1.25rem;
  font-size: 1.25rem;
  color: rgb(from var(--foreground) r g b / 0.7);
}

.hero-tagline {
  margin-top: 0.5rem;
  max-width: 28rem;
  color: rgb(from var(--foreground) r g b / 0.6);
}

.hero-in {
  opacity: 0;
  animation: hero-in 0.5s ease-out forwards;
}

.hero-title.hero-in {
  animation-delay: 0.12s;
}

.hero-tagline.hero-in {
  animation-delay: 0.24s;
}

.links.hero-in {
  animation-delay: 0.36s;
}

@keyframes hero-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.links {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.icon-link {
  font-size: 1.5rem;
  color: rgb(from var(--foreground) r g b / 0.6);
  transition: color 0.2s ease;
}

.icon-link:hover {
  color: var(--accent);
}

.icon-link svg {
  height: 1.2em;
  width: 1.2em;
  display: block;
}

.resume-btn {
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgb(from var(--foreground) r g b / 0.2);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.875rem;
  color: rgb(from var(--foreground) r g b / 0.7);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.resume-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.resume-btn svg {
  height: 0.9em;
  width: 0.9em;
}

/* about */

.about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

@media (min-width: 640px) {
  .about-content {
    flex-direction: row;
    align-items: flex-start;
  }
}

.about-photo {
  flex-shrink: 0;
  width: 12rem;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 0.75rem;
  color: rgb(255 255 255 / 0.85);
}

.about-photo svg {
  height: 30%;
  width: 30%;
}

.about-text {
  min-width: 0;
}

.intro {
  color: rgb(from var(--foreground) r g b / 0.7);
}

.bullets {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bullets li {
  display: flex;
  gap: 0.75rem;
  color: rgb(from var(--foreground) r g b / 0.7);
}

.bullets .dot {
  margin-top: 0.5rem;
  height: 0.375rem;
  width: 0.375rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgb(from var(--foreground) r g b / 0.4);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem 1.5rem;
}

@media (min-width: 640px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .skills-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.skills-grid h3 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgb(from var(--foreground) r g b / 0.5);
  margin-bottom: 1rem;
}

.skills-grid ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skills-grid li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgb(from var(--foreground) r g b / 0.8);
}

.skills-grid li svg {
  flex-shrink: 0;
  height: 1.5rem;
  width: 1.5rem;
  color: rgb(from var(--foreground) r g b / 0.6);
}

.experience-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.experience-list li {
  background: rgb(from var(--background) r g b / 0.5);
  backdrop-filter: blur(1px);
  border: 1px solid rgb(from var(--foreground) r g b / 0.15);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

/* the li tag bumps specificity above .reveal.visible so the lift wins once cards are revealed */
.experience-list li:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.exp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.exp-company,
.project-type {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.exp-head h3 {
  margin-top: 0.35rem;
  font-size: 1.25rem;
}

.period {
  font-size: 0.875rem;
  color: rgb(from var(--foreground) r g b / 0.5);
}

.experience-list p {
  margin-top: 0.5rem;
  color: rgb(from var(--foreground) r g b / 0.7);
}

/* projects */

.projects-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.project-card {
  width: 100%;
  max-width: 18rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgb(from var(--background) r g b / 0.5);
  backdrop-filter: blur(1px);
  border: 1px solid rgb(from var(--foreground) r g b / 0.15);
  border-radius: 0.75rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

/* article tag bumps specificity above .reveal.visible so the lift wins once cards are revealed */
article.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.project-image {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  font-family: var(--font-serif);
  font-size: 2.5rem;
  color: rgb(255 255 255 / 0.85);
}

img.project-image {
  width: 100%;
  display: block;
  object-fit: cover;
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.5rem;
}

.project-card h3 {
  margin-top: 0.5rem;
  font-size: 1.25rem;
}

.project-card p {
  margin-top: 0.75rem;
  flex: 1;
  font-size: 0.875rem;
  color: rgb(from var(--foreground) r g b / 0.7);
}

.tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags span {
  border-radius: 999px;
  background: var(--accent-soft);
  padding: 0.1rem 0.5rem;
  font-size: 0.65rem;
  color: var(--accent);
}

.project-link {
  margin-top: 1.25rem;
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  font-family: inherit;
  background: none;
  color: var(--accent);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.project-link:hover {
  background: var(--accent-soft);
}

.project-link svg {
  height: 0.75em;
  width: 0.75em;
}

/* project modal */

.project-modal {
  position: fixed;
  margin: auto;
  padding: 0;
  width: calc(100% - 2rem);
  max-width: 46rem;
  max-height: calc(100vh - 3rem);
  overflow: auto;
  border: none;
  border-radius: 0.75rem;
  background: var(--background);
  color: var(--foreground);
}

.project-modal::backdrop {
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(2px);
}

.project-modal-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
}

.project-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgb(from var(--background) r g b / 0.7);
  backdrop-filter: blur(2px);
}

.project-modal-body {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.project-modal-body h3 {
  margin-top: 0.5rem;
  font-size: 1.5rem;
}

.project-modal-body p {
  margin-top: 0.75rem;
  color: rgb(from var(--foreground) r g b / 0.7);
}

.project-modal-body .tags {
  margin-top: 1rem;
}

.project-modal-link {
  margin-top: 1.25rem;
  align-self: flex-end;
}

/* contact */

#contact {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#contact p {
  margin-top: 1rem;
  max-width: 28rem;
  color: rgb(from var(--foreground) r g b / 0.7);
}

.email-link {
  margin-top: 2rem;
  align-self: flex-start;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  text-decoration: underline;
  text-decoration-color: rgb(from var(--foreground) r g b / 0.3);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s ease;
}

.email-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

#contact .links {
  margin-top: 2.5rem;
}

/* footer */

footer {
  border-top: 1px solid rgb(from var(--foreground) r g b / 0.1);
  background: rgb(from var(--background) r g b / 0.8);
  backdrop-filter: blur(8px);
  padding: 1.75rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 2rem;
  font-size: 0.875rem;
  color: rgb(from var(--foreground) r g b / 0.6);
}

@media (min-width: 480px) {
  footer {
    justify-content: space-between;
  }
}

footer .links {
  margin-top: 0;
  display: flex;
  gap: 1rem;
}

footer a:hover {
  color: var(--accent);
}

/* reveal on scroll */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

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

  html {
    scroll-behavior: auto;
  }
}
