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

:root {
  --fg: #f4f4f5;
  --fg-muted: #a1a1aa;
  --bg: #0a0a0b;
  --accent: #ee72f1;
  --accent-secondary: #ec4899;
  --link: #f4f4f5;
  --link-hover: var(--accent);
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
}

html {
  font-size: clamp(16px, 1.6vw, 28px);
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Film grain overlay --- */

.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: 10;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  animation: grain-shift 0.4s steps(3) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-30px, 20px); }
  66%  { transform: translate(15px, -25px); }
  100% { transform: translate(-10px, 10px); }
}

/* --- Dionysian blobs --- */

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  will-change: transform, opacity;
  transition: translate 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.blob-1 {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, #ee72f1, rgba(238, 114, 241, 0.6), transparent 70%);
  opacity: 0.45;
  top: -10%;
  left: -5%;
  animation:
    drift-1 14s ease-in-out infinite alternate,
    pulse-1 3.2s ease-in-out infinite;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #ec4899, rgba(236, 72, 153, 0.6), transparent 70%);
  opacity: 0.4;
  bottom: -10%;
  right: -5%;
  animation:
    drift-2 16s ease-in-out infinite alternate,
    pulse-2 4s ease-in-out infinite;
}

.blob-3 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #a855f7, rgba(168, 85, 247, 0.5), transparent 70%);
  opacity: 0.35;
  top: 40%;
  left: 50%;
  animation:
    drift-3 11s ease-in-out infinite alternate,
    pulse-3 2.8s ease-in-out infinite;
}

.blob-4 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #ee72f1, rgba(236, 72, 153, 0.5), transparent 70%);
  opacity: 0.3;
  top: 10%;
  right: 20%;
  animation:
    drift-4 18s ease-in-out infinite alternate,
    pulse-4 3.6s ease-in-out infinite;
}

/* Heartbeat pulses — each blob on its own rhythm */

@keyframes pulse-1 {
  0%, 100% { opacity: 0.45; filter: blur(80px); }
  15%      { opacity: 0.65; filter: blur(60px); }
  30%      { opacity: 0.4;  filter: blur(85px); }
  45%      { opacity: 0.55; filter: blur(70px); }
  60%      { opacity: 0.42; filter: blur(82px); }
}

@keyframes pulse-2 {
  0%, 100% { opacity: 0.4;  filter: blur(80px); }
  20%      { opacity: 0.6;  filter: blur(55px); }
  40%      { opacity: 0.35; filter: blur(90px); }
  55%      { opacity: 0.5;  filter: blur(65px); }
}

@keyframes pulse-3 {
  0%, 100% { opacity: 0.35; filter: blur(80px); }
  10%      { opacity: 0.55; filter: blur(50px); }
  25%      { opacity: 0.3;  filter: blur(88px); }
  40%      { opacity: 0.5;  filter: blur(60px); }
  55%      { opacity: 0.32; filter: blur(85px); }
}

@keyframes pulse-4 {
  0%, 100% { opacity: 0.3;  filter: blur(80px); }
  18%      { opacity: 0.5;  filter: blur(58px); }
  35%      { opacity: 0.28; filter: blur(85px); }
  50%      { opacity: 0.45; filter: blur(65px); }
}

/* Drift paths */

@keyframes drift-1 {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate(160px, 100px) scale(1.25) rotate(8deg); }
  50%  { transform: translate(-80px, 220px) scale(0.8) rotate(-5deg); }
  75%  { transform: translate(130px, 60px) scale(1.2) rotate(10deg); }
  100% { transform: translate(40px, 150px) scale(1.1) rotate(-3deg); }
}

@keyframes drift-2 {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate(-140px, -100px) scale(1.2) rotate(-8deg); }
  50%  { transform: translate(100px, -180px) scale(0.85) rotate(6deg); }
  75%  { transform: translate(-70px, -80px) scale(1.15) rotate(-10deg); }
  100% { transform: translate(60px, -130px) scale(0.9) rotate(5deg); }
}

@keyframes drift-3 {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate(-200px, 80px) scale(1.35) rotate(12deg); }
  50%  { transform: translate(130px, -120px) scale(0.75) rotate(-7deg); }
  75%  { transform: translate(-100px, -50px) scale(1.15) rotate(15deg); }
  100% { transform: translate(80px, 100px) scale(0.9) rotate(-10deg); }
}

@keyframes drift-4 {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate(90px, 130px) scale(1.25) rotate(-9deg); }
  50%  { transform: translate(-160px, 70px) scale(0.8) rotate(8deg); }
  75%  { transform: translate(40px, -90px) scale(1.2) rotate(-12deg); }
  100% { transform: translate(-80px, 40px) scale(1.05) rotate(6deg); }
}

/* --- Layout --- */

main {
  position: relative;
  z-index: 1;
  max-width: 80vw;
  width: 100%;
  padding: 4rem clamp(1.5rem, 5vw, 6rem);
}

/* --- Header --- */

header {
  margin-bottom: clamp(2.5rem, 4vw, 5rem);
}

h1 {
  font-size: clamp(2rem, 5vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: clamp(0.75rem, 2vw, 2.5rem);
  animation: subtle-glitch 8s ease-in-out infinite;
}

@keyframes subtle-glitch {
  0%, 92%, 100% { transform: translate(0, 0) skewX(0deg); }
  93%           { transform: translate(-2px, 1px) skewX(-0.5deg); }
  94%           { transform: translate(1px, -1px) skewX(0.3deg); }
  95%           { transform: translate(0, 0) skewX(0deg); }
}

.tagline {
  color: var(--fg-muted);
  font-size: clamp(0.9rem, 1.4vw, 1.5rem);
  max-width: 90ch;
}

/* --- Projects --- */

.projects {
  margin-bottom: clamp(2.5rem, 4vw, 5rem);
}

.projects h2 {
  font-size: clamp(0.75rem, 1vw, 1.1rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
}

.projects ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 1.8vw, 2rem);
}

.projects li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.projects li:hover {
  transform: translateX(6px);
}

.projects a {
  color: var(--link);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

.projects a .title {
  font-size: clamp(1.1rem, 2.2vw, 2.4rem);
  font-weight: 600;
  position: relative;
  display: inline-block;
}

.projects a .title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--hover-color, var(--accent));
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.projects a:hover {
  color: var(--link-hover);
}

.projects a:hover .title::after {
  width: 100%;
}

.desc {
  font-size: clamp(0.8rem, 1.2vw, 1.3rem);
  color: var(--fg-muted);
  transition: opacity 0.3s ease;
}

.projects li:hover .desc {
  opacity: 0.7;
}

/* --- Footer --- */

footer {
  display: flex;
  gap: clamp(1.5rem, 2.5vw, 3rem);
  flex-wrap: wrap;
}

footer a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: clamp(0.85rem, 1.2vw, 1.3rem);
  letter-spacing: 0.05em;
  transition: color 0.3s ease, letter-spacing 0.4s ease;
}

footer a:hover {
  color: var(--accent);
  letter-spacing: 0.12em;
}

/* --- Responsive --- */

@media (max-width: 480px) {
  body {
    align-items: flex-start;
  }

  main {
    padding-top: 2rem;
  }

  main {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 2rem;
  }

  h1 {
    font-size: clamp(1.4rem, 8vw, 2rem);
    white-space: nowrap;
  }

  .blob-1 { width: 350px; height: 350px; }
  .blob-2 { width: 320px; height: 320px; }
  .blob-3 { width: 260px; height: 260px; }
  .blob-4 { width: 220px; height: 220px; }
}

@media (min-width: 1400px) {
  .blob-1 { width: 900px; height: 900px; }
  .blob-2 { width: 800px; height: 800px; }
  .blob-3 { width: 650px; height: 650px; }
  .blob-4 { width: 550px; height: 550px; }
}
