/* ============================================================
   Shangjie Du — Personal Site
   Deep-space / cosmic aesthetic
   ============================================================ */

:root {
  --bg: #050410;
  --bg-soft: #0a0918;
  /* Muted starlight & nebula tones (no neon). The legacy --cyan name is
     kept as the primary accent so existing rules pick up the new color. */
  --cyan: #aab2e0;        /* soft periwinkle starlight */
  --cyan-dim: #5b5488;    /* dim nebula violet */
  --blue: #7b82c4;        /* muted indigo */
  --violet: #8a7bb8;      /* faint nebula violet */
  --text: #d2d4e6;
  --text-dim: #7c7f99;
  --line: rgba(150, 158, 210, 0.12);
  --glass: rgba(13, 13, 28, 0.58);
  --glass-brd: rgba(150, 158, 210, 0.14);
  --glow: 0 0 22px rgba(150, 160, 220, 0.20);
  --maxw: 1120px;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Background layers ---------- */
.bg-image,
.bg-overlay,
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
}
.bg-image {
  background: url('../assets/background.jpg') center/cover no-repeat;
  filter: grayscale(0.6) brightness(0.32) contrast(1.05) saturate(0.75);
  transform: scale(1.05);
}
.bg-overlay {
  z-index: -2;
  /* Faint nebula clouds fading into the deep-space void. */
  background:
    radial-gradient(70% 55% at 72% 12%, rgba(120, 110, 175, 0.16), transparent 60%),
    radial-gradient(80% 60% at 12% 78%, rgba(80, 90, 150, 0.16), transparent 58%),
    radial-gradient(50% 40% at 85% 70%, rgba(140, 95, 130, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(5, 4, 16, 0.80) 0%, rgba(5, 4, 16, 0.93) 55%, rgba(5, 4, 16, 0.98) 100%);
}
.bg-grid {
  z-index: -2;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(150, 158, 210, 0.10), transparent 70%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 85%);
}
#starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Glass utility ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: 16px;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 60px);
  background: linear-gradient(180deg, rgba(4, 7, 15, 0.7), transparent);
  backdrop-filter: blur(6px);
}
.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--text);
  text-decoration: none;
  text-shadow: var(--glow);
}
.nav__brand span { color: var(--cyan); }
.nav__links { display: flex; gap: clamp(14px, 3vw, 34px); }
.nav__links a {
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  transition: color 0.25s;
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 1px;
  background: var(--cyan);
  box-shadow: var(--glow);
  transition: width 0.3s;
}
.nav__links a:hover { color: var(--cyan); }
.nav__links a:hover::after { width: 100%; }

/* ---------- Layout ---------- */
main { width: 100%; }
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(70px, 11vh, 130px) clamp(20px, 5vw, 40px);
}
.section__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 36px;
}
.section__index {
  font-family: var(--font-mono);
  color: var(--cyan);
  font-size: 0.95rem;
  opacity: 0.8;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: 1px;
}
.section__lead {
  color: var(--text-dim);
  max-width: 60ch;
  margin: -16px 0 36px;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 0 20px;
}
.hero__inner { max-width: 820px; animation: rise 1s ease both; }
.hero__eyebrow {
  font-family: var(--font-mono);
  color: var(--cyan);
  letter-spacing: 3px;
  font-size: 0.8rem;
  margin-bottom: 22px;
  opacity: 0.85;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 10vw, 6rem);
  line-height: 1;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #ffffff 0%, var(--cyan) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(150, 160, 220, 0.25);
}
.hero__subtitle {
  margin: 26px auto 0;
  max-width: 56ch;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}
.hero__cta {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 1px;
  padding: 13px 28px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.2s, box-shadow 0.25s, background 0.25s;
}
.btn--primary {
  background: linear-gradient(120deg, var(--cyan), var(--blue));
  color: #03121a;
  font-weight: 500;
  box-shadow: var(--glow);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 0 34px rgba(150, 160, 220, 0.6); }
.btn--ghost {
  border-color: var(--glass-brd);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.btn--ghost:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }

.hero__scroll {
  position: absolute;
  bottom: 34px;
  width: 26px; height: 42px;
  border: 2px solid var(--glass-brd);
  border-radius: 14px;
  display: flex;
  justify-content: center;
}
.hero__scroll span {
  width: 4px; height: 8px;
  margin-top: 7px;
  background: var(--cyan);
  border-radius: 2px;
  animation: scroll 1.6s infinite;
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
}
.about__text { padding: 32px; }
.about__text p { margin-bottom: 16px; color: var(--text); }
.about__text strong { color: var(--cyan); font-weight: 600; }

/* Inline text links (e.g. Pony.ai) */
.ilink {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid var(--cyan-dim);
  transition: color 0.2s, border-color 0.2s, text-shadow 0.25s;
}
.ilink:hover {
  color: #fff;
  border-bottom-color: var(--cyan);
  text-shadow: var(--glow);
}
.about__tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.about__tags li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 6px 14px;
  border: 1px solid var(--glass-brd);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(150, 160, 220, 0.05);
}
.about__stats { display: flex; flex-direction: column; gap: 24px; }
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
}
.stat__num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  color: var(--cyan);
  text-shadow: var(--glow);
  line-height: 1;
}
.stat__label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-top: 8px;
  text-transform: uppercase;
}

/* ---------- Timeline ---------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  padding-left: 26px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, var(--cyan), transparent);
}
.timeline__item {
  padding: 24px 28px;
  position: relative;
  transition: transform 0.25s, border-color 0.25s;
}
.timeline__item::before {
  content: '';
  position: absolute;
  left: -26px; top: 30px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: var(--glow);
}
.timeline__item:hover { transform: translateX(6px); border-color: var(--cyan); }
.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan);
  letter-spacing: 1px;
}
.timeline__role {
  font-size: 1.2rem;
  margin: 6px 0 2px;
  font-weight: 600;
}
.timeline__org { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 10px; }
.timeline__desc { color: var(--text); font-size: 0.95rem; }

/* ---------- Notes ---------- */
.notes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}
.note-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.note-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(150, 160, 220, 0.10), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
}
.note-card:hover {
  transform: translateY(-6px);
  border-color: var(--cyan);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(150, 160, 220, 0.18);
}
.note-card:hover::after { opacity: 1; }
.note-card__tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.note-card__title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 14px;
  flex: 1;
}
.note-card__open {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.25s, gap 0.25s;
}
.note-card:hover .note-card__open { color: var(--cyan); gap: 14px; }

/* ---------- Connect ---------- */
.connect {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: center;
  padding: 40px;
}
.connect__avatar {
  position: relative;
  width: 150px; height: 150px;
}
.connect__avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--glass-brd);
  position: relative;
  z-index: 2;
}
.connect__ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed var(--cyan-dim);
  animation: spin 18s linear infinite;
}
.connect__ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(150, 160, 220, 0.2);
}
.connect__body h3 { font-size: 1.35rem; margin-bottom: 6px; }
.connect__body > p { color: var(--text-dim); margin-bottom: 22px; }
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.social {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid var(--glass-brd);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s, border-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.social:hover {
  transform: translateY(-3px);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: var(--glow);
}
.social__icon {
  font-family: var(--font-mono);
  font-weight: 500;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(150, 160, 220, 0.12);
  color: var(--cyan);
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes scroll { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.js-reveal .reveal { opacity: 0; transform: translateY(34px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js-reveal .reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .nav__links { gap: 14px; }
  .nav__links a { font-size: 0.78rem; }
  .about { grid-template-columns: 1fr; }
  .about__stats { flex-direction: row; }
  .connect { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .socials { justify-content: center; }
}
@media (max-width: 540px) {
  .nav__links { display: none; }
  .about__stats { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
