/* css/style.css */

/* === Reset & Custom Properties === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0a1a;
  --bg-card: rgba(30, 20, 50, 0.7);
  --accent-pink: #f75c7e;
  --accent-violet: #7c3aed;
  --accent-bright: #ff7eb3;
  --gradient: linear-gradient(135deg, #f75c7e, #7c3aed);
  --text-primary: #e8e0f0;
  --text-secondary: #a09bb5;
  --font-heading: "Noto Sans SC", "PingFang SC", sans-serif;
  --font-body: "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", monospace;
  --nav-height: 88px;
  --section-padding: 138px 0;
}

html {
  font-size: 22px;
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* === Grid Overlay (fades on scroll) === */
#grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(124, 58, 237, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(124, 58, 237, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 1;
  transition: opacity 0.1s linear;
}

/* === Bottom glow (initial, on body) === */
body {
  --glow-opacity: 1;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 40% at 50% 100%, rgba(247, 92, 126, 0.12), transparent 70%);
  opacity: var(--glow-opacity);
  transition: opacity 0.1s linear;
}

/* === Top highlight (appears on scroll) === */
#top-highlight {
  position: fixed;
  top: -60px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 35% at 50% 0%, rgba(124, 58, 237, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.1s linear;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color 0.3s;
}

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

.section {
  padding: var(--section-padding);
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: left;
  margin-bottom: 1.5rem;
  color: #f06e8e;
}

/* === Particle Canvas === */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* === Navigation === */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.75rem 0;
  transition: opacity 0.5s ease;
}

#navbar::before,
#navbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 140%;
  pointer-events: none;
}

#navbar::before {
  z-index: -2;
  background: linear-gradient(to bottom, rgba(15, 10, 26, 0.85), transparent);
}

#navbar::after {
  z-index: -1;
  mask: linear-gradient(0deg, transparent 0%, #000 80%);
  -webkit-mask: linear-gradient(0deg, transparent 0%, #000 80%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#navbar.hidden {
  opacity: 0;
  pointer-events: none;
}

.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transform: scale(0.7);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

#navbar:not(.hidden) .nav-logo {
  transform: scale(1);
  opacity: 1;
}

.nav-logo img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 999px;
  padding: 0.3rem 0.4rem;
}

.nav-item {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  transition: color 0.3s, background 0.3s;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.15);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.2);
}

.nav-pill.animate-in .nav-item {
  opacity: 0;
  animation: navItemIn 0.4s ease forwards;
}

.nav-pill.animate-in .nav-item:nth-of-type(1) { animation-delay: 0s; }
.nav-pill.animate-in .nav-item:nth-of-type(2) { animation-delay: 0.08s; }
.nav-pill.animate-in .nav-item:nth-of-type(3) { animation-delay: 0.16s; }
.nav-pill.animate-in .nav-item:nth-of-type(4) { animation-delay: 0.24s; }
.nav-pill.animate-in .nav-item:nth-of-type(5) { animation-delay: 0.32s; }

@keyframes navItemIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.3s, opacity 0.3s;
}

/* === Card base === */
.card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 40px rgba(247, 92, 126, 0.12);
  border-color: rgba(247, 92, 126, 0.25);
}

/* === Scroll reveal === */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(.16, 1, .3, 1), transform 0.7s cubic-bezier(.16, 1, .3, 1);
}

.reveal[data-reveal="scale"] {
  transform: scale(0.92);
}

.reveal[data-reveal="slide-left"] {
  transform: translateX(-40px);
}

.reveal[data-reveal="slide-right"] {
  transform: translateX(40px);
}

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

/* === Hero === */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  max-width: 900px;
  width: 100%;
}

/* -- Hero Left: Large Avatar -- */
.hero-left {
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-ring-lg {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  padding: 4px;
  background: var(--gradient);
  opacity: 0;
  animation:
    avatar-enter 0.8s cubic-bezier(.34, 1.56, .64, 1) 0.1s forwards,
    ring-glow 3s ease-in-out 0.9s infinite alternate;
}

@keyframes avatar-enter {
  0% { opacity: 0; transform: scale(0.3) rotate(-8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes ring-glow {
  from { box-shadow: 0 0 30px rgba(247, 92, 126, 0.3); }
  to { box-shadow: 0 0 60px rgba(124, 58, 237, 0.5); }
}


.avatar-ring-lg img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* -- Hero Right: Terminal (embedded in background) -- */
.hero-right {
  display: flex;
  flex-direction: column;
}

.hero-terminal {
  font-family: var(--font-mono);
  padding: 0;
}

/* Entrance animations for terminal elements */
.terminal-cmdline {
  font-size: 0.85rem;
  opacity: 0;
  margin-bottom: 0.5rem;
  animation: slideInRight 0.5s cubic-bezier(.16, 1, .3, 1) 0.2s forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.terminal-user {
  color: var(--accent-pink);
}

.terminal-sep {
  color: var(--text-secondary);
  opacity: 0.5;
}

.terminal-path {
  color: var(--accent-violet);
}

.terminal-cmd {
  color: var(--text-primary);
  margin-left: 0.5rem;
}

.terminal-output {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.2;
  opacity: 0;
  animation: fadeIn 0.4s ease 0.3s forwards;
}

.typing-text {
  background: linear-gradient(
    90deg,
    #e0dfe4 0%,
    #e0dfe4 2%,
    #f0a6c0 12%,
    #ff7eb3 30%,
    #ffa4c6 45%,
    #ff7eb3 60%,
    #f0a6c0 78%,
    #e0dfe4 90%,
    #e0dfe4 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite;
  animation-delay: 2.5s;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: -200% center; }
}

.terminal-gt {
  color: var(--text-secondary);
  margin-right: 0.25rem;
}

.typing-cursor {
  font-weight: 300;
  animation: blink 1s step-end infinite;
  color: var(--accent-bright);
  text-shadow: 0 0 8px rgba(255, 126, 179, 0.8), 0 0 20px rgba(255, 126, 179, 0.4);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.terminal-role {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  opacity: 0;
  animation: slideInRight 0.5s cubic-bezier(.16, 1, .3, 1) 0.35s forwards;
}

.terminal-bracket {
  color: var(--text-secondary);
  opacity: 0.5;
}

.tag-item {
  display: inline-block;
  border: 1px solid var(--text-secondary);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0 0.3em;
}

.terminal-quote {
  font-size: 0.95rem;
  color: var(--text-primary);
  padding-left: 1rem;
  border-left: 3px solid var(--accent-violet);
  margin-bottom: 0.75rem;
  white-space: nowrap;
  line-height: 1.6;
  opacity: 0;
  animation: slideInRight 0.5s cubic-bezier(.16, 1, .3, 1) 0.4s forwards;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* -- Hero Site Buttons -- */
.hero-sites {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  animation: slideInRight 0.5s cubic-bezier(.16, 1, .3, 1) 0.4s forwards;
}

/* -- Icon Bounce Keyframe -- */
@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
  70% { transform: translateY(1px); }
}

/* -- Hero Blog -- */
.hero-blog {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  margin-bottom: 0.6rem;
  border-radius: 6px;
  background: rgba(247, 92, 126, 0.85);
  color: #fff;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  text-decoration: none;
  width: fit-content;
  transition: background 0.3s, box-shadow 0.3s, color 0.3s;
}

.hero-blog:visited {
  color: #fff;
}

.hero-blog:hover {
  background: rgba(247, 92, 126, 1);
  color: #fff;
  box-shadow: 0 0 12px rgba(247, 92, 126, 0.5), 0 0 30px rgba(247, 92, 126, 0.25);
}

.hero-blog:hover svg {
  animation: iconBounce 0.4s ease;
}

/* -- Hero Social -- */
.hero-social {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  opacity: 0;
  animation: slideInRight 0.5s cubic-bezier(.16, 1, .3, 1) 0.45s forwards;
}

.hero-social a {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.25);
  white-space: nowrap;
  transition: color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.social-label {
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.hero-social a:last-child .social-label {
  font-family: 'Noto Sans SC', sans-serif;
}

.hero-social a:hover {
  color: var(--accent-pink);
  border-color: var(--accent-pink);
  box-shadow: 0 0 12px rgba(247, 92, 126, 0.4), 0 0 25px rgba(247, 92, 126, 0.15);
}

.hero-social a:hover svg {
  animation: iconBounce 0.4s ease;
}

.scroll-indicator {
  color: var(--text-secondary);
  opacity: 0.6;
  text-align: center;
}

.bounce {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(10px); }
  60% { transform: translateY(5px); }
}

@media (max-width: 1024px) {
  .avatar-ring-lg {
    width: 220px;
    height: 220px;
  }
}


/* === Works (featured projects) === */
.featured-projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}


/* === Works === */
.featured-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.featured-card:hover {
  border-color: rgba(247, 92, 126, 0.25);
  box-shadow: 0 0 40px rgba(247, 92, 126, 0.12);
}

.featured-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
}

.featured-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-pink);
}

.featured-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.featured-name a {
  color: var(--text-primary);
}

.featured-name a:hover {
  color: var(--accent-bright);
}

.featured-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.featured-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.25);
  color: var(--accent-violet);
}

.featured-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.featured-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.featured-preview {
  overflow: hidden;
  aspect-ratio: 16/10;
  background: rgba(30, 20, 50, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--text-primary);
}

.project-card:hover {
  color: var(--text-primary);
}

.project-card-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.lang-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

@media (max-width: 1024px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* === About === */
.about-content {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.about-content p {
  margin-bottom: 1rem;
}

.about-content a {
  color: var(--accent-bright);
  text-decoration: none;
}

.about-content a:hover {
  text-decoration: underline;
}

.about-content .link-tag {
  color: var(--accent-bright);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-bright);
  transition: border-bottom-color 0.2s;
}

.about-content .link-tag:hover {
  border-bottom-style: solid;
}

.about-content del {
  color: var(--text-secondary);
  text-decoration: line-through;
}

.about-content blockquote {
  margin-top: 0.5rem;
  font-style: italic;
  color: var(--text-muted);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
}

/* === Footer === */
#footer {
  padding: 4rem 0 2.5rem;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.footer-glow {
  position: absolute;
  bottom: -30%;
  left: 0;
  right: 0;
  height: 70%;
  background: radial-gradient(ellipse 80% 60% at 50% 100%, rgba(124, 58, 237, 0.15), rgba(247, 92, 126, 0.06), transparent 70%);
  pointer-events: none;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.footer-counter img {
  height: 80px;
  opacity: 0.9;
}

/* === Back to Top === */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(240, 110, 142, 0.85);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease, color 0.3s, border-color 0.3s, box-shadow 0.3s;
  z-index: 999;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: rgba(240, 110, 142, 1);
  box-shadow: 0 0 15px rgba(240, 110, 142, 0.5);
}

/* === Hamburger animation === */
.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(240, 110, 142, 0.6);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(240, 110, 142, 0.9);
}

/* === Selection === */
::selection {
  background: rgba(247, 92, 126, 0.3);
}

/* === Responsive: Mobile === */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  :root {
    --section-padding: 50px 0;
    --nav-height: 60px;
  }

  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-pill {
    position: fixed;
    top: calc(0.75rem + 0.75rem + 50px);
    left: 1rem;
    right: 1rem;
    flex-direction: column;
    padding: 0.8rem;
    gap: 0;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    pointer-events: none;
  }

  .nav-pill.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-pill.open .nav-item {
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
  }

  .nav-name {
    display: none;
  }

  .section-title {
    font-size: 1.5rem;
  }

  /* Navbar: show immediately on mobile */
  #navbar.hidden {
    opacity: 1;
    pointer-events: auto;
  }

  /* Hero mobile */
  .hero-split {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 100%;
  }

  .hero-left {
    justify-content: center;
  }

  .hero-right {
    width: 100%;
    align-items: stretch;
  }

  .avatar-ring-lg {
    width: 160px;
    height: 160px;
  }

  .hero-sites {
    flex-wrap: wrap;
    width: 100%;
  }

  .terminal-output {
    font-size: 1.6rem;
  }

  .terminal-role {
    flex-wrap: wrap;
  }

  .terminal-quote {
    white-space: normal;
    font-size: 0.85rem;
  }

  .hero-social {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .hero-blog {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
  }

  .social-label {
    font-size: 0.75rem;
  }

  /* About mobile */
  .about-content {
    font-size: 0.9rem;
  }

  /* Works mobile */
  .featured-projects {
    grid-template-columns: 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  /* Footer mobile */
  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  .footer-counter img {
    height: 50px;
  }

  /* Back to top mobile */
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
}
