:root {
  --bg: #0a0a14;
  --bg-card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e9e9f3;
  --text-dim: #9a9ab0;
  --c1: #7c3aed;
  --c2: #06b6d4;
  --c3: #f43f5e;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Sarabun", system-ui, sans-serif;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* ===== Animated background blobs ===== */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  z-index: -1;
  animation: float 16s ease-in-out infinite;
}
.blob-1 {
  width: 420px; height: 420px;
  background: var(--c1);
  top: -100px; left: -120px;
  animation-delay: 0s;
}
.blob-2 {
  width: 380px; height: 380px;
  background: var(--c2);
  bottom: -120px; right: -100px;
  animation-delay: -5s;
}
.blob-3 {
  width: 300px; height: 300px;
  background: var(--c3);
  top: 40%; left: 60%;
  animation-delay: -10s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 8%;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 20, 0.5);
}
.logo {
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 1px;
}
.logo .dot { color: var(--c2); }
nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 28px;
  font-size: 0.95rem;
  transition: color 0.25s ease;
  position: relative;
}
nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  transition: width 0.25s ease;
}
nav a:hover { color: var(--text); }
nav a:hover::after { width: 100%; }

/* ===== Hero ===== */
.hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 8%;
  animation: fadeUp 0.9s ease both;
}
.hero-tag {
  color: var(--text-dim);
  margin-bottom: 12px;
  animation: fadeUp 0.9s ease 0.05s both;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  line-height: 1.15;
}
.gradient-text {
  background: linear-gradient(90deg, var(--c1), var(--c2), var(--c3), var(--c1));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}
@keyframes shine {
  to { background-position: 300% center; }
}
.typed-line {
  margin-top: 10px;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--c2);
  min-height: 2.2rem;
}
.cursor {
  display: inline-block;
  margin-left: 2px;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  margin-top: 18px;
  max-width: 560px;
  color: var(--text-dim);
  line-height: 1.7;
}
.hero-buttons {
  margin-top: 30px;
  display: flex;
  gap: 16px;
}
.btn {
  padding: 12px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn-primary {
  background: linear-gradient(90deg, var(--c1), var(--c2));
  color: #fff;
  box-shadow: 0 0 0 rgba(124, 58, 237, 0);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.45);
}
.btn-ghost {
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: var(--c2);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Sections ===== */
.section {
  padding: 90px 8%;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.section.in-view {
  opacity: 1;
  transform: translateY(0);
}
.section-title {
  font-size: 1.8rem;
  margin-bottom: 36px;
}
.hashtag {
  background: linear-gradient(90deg, var(--c1), var(--c2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  max-width: 760px;
  line-height: 1.8;
  color: var(--text-dim);
}

/* ===== Blog cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.post-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.post-card:hover {
  transform: translateY(-8px);
  border-color: var(--c2);
}
.post-card-glow {
  position: absolute;
  inset: -2px;
  background: linear-gradient(120deg, var(--c1), var(--c2));
  opacity: 0;
  filter: blur(20px);
  z-index: -1;
  transition: opacity 0.3s ease;
}
.post-card:hover .post-card-glow { opacity: 0.35; }
.post-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--c2);
  margin-bottom: 12px;
}
.post-card h4 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  line-height: 1.4;
}
.post-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 16px;
}
.post-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.25s ease, transform 0.25s ease;
  display: inline-block;
}
.post-link:hover {
  color: var(--c2);
  transform: translateX(4px);
}

/* ===== Skills ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.tag {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.9rem;
  transition: all 0.25s ease;
}
.tag:hover {
  color: #fff;
  border-color: var(--c2);
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.35);
  transform: translateY(-3px);
}

.contact-card { text-align: left; }

footer {
  text-align: center;
  padding: 36px 0 50px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .navbar { padding: 18px 6%; }
  nav a { margin-left: 16px; font-size: 0.85rem; }
  .hero, .section { padding-left: 6%; padding-right: 6%; }
}
