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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background: #0b1121;
}

a { text-decoration: none; }
ul { list-style: none; }

/* ===== Background ===== */
#bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0b1121 0%, #162033 50%, #1c2a47 100%);
  z-index: -5;
}

#bg-anim {
  position: fixed;
  inset: 0;
  z-index: -4;
  overflow: hidden;
}

.star {
  position: absolute;
  background: rgba(148, 163, 184, 0.5);
  border-radius: 50%;
  animation: float linear infinite;
}

@keyframes float {
  0% { transform: translateY(100vh) translateX(0) scale(1); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) translateX(50px) scale(0.5); opacity: 0; }
}

.shooting-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #e2e8f0;
  border-radius: 50%;
  box-shadow: 0 0 6px 2px rgba(148, 163, 184, 0.3);
  animation: shoot linear infinite;
}

@keyframes shoot {
  0% { transform: translateX(0) translateY(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateX(-300px) translateY(300px); opacity: 0; }
}

/* Glow orbs */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -3;
  pointer-events: none;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: rgba(45, 125, 154, 0.08);
  top: -200px;
  left: -200px;
  animation: glowMove 10s ease-in-out infinite alternate;
}

.glow-2 {
  width: 400px;
  height: 400px;
  background: rgba(56, 189, 248, 0.06);
  bottom: -150px;
  right: -100px;
  animation: glowMove 12s ease-in-out infinite alternate-reverse;
}

.glow-3 {
  width: 300px;
  height: 300px;
  background: rgba(45, 125, 154, 0.05);
  top: 50%;
  left: 50%;
  animation: glowPulse 8s ease-in-out infinite alternate;
}

@keyframes glowMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 40px); }
}

@keyframes glowPulse {
  0% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* ===== Loading ===== */
#loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  background: rgba(11, 17, 33, 0.95);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loading-spinner {
  display: flex;
  justify-content: space-between;
  width: 60px;
}
.loading-spinner div {
  width: 12px;
  height: 12px;
  background: #2d7d9a;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}
.loading-spinner div:nth-child(1) { animation-delay: -0.32s; }
.loading-spinner div:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.loading-text {
  margin-top: 30px;
  color: rgba(148, 163, 184, 0.8);
  font-size: 1em;
  letter-spacing: 0.2em;
}

/* ===== Main Card ===== */
#container { display: none; width: 100%; height: 100%; position: relative; }

main {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5em;
}

.card {
  display: flex;
  background: rgba(255, 255, 255, 0.93);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  width: 56em;
  max-width: 100%;
  height: 34em;
  max-height: 90vh;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  animation: cardIn 0.8s ease 0.5s forwards;
}

@keyframes cardIn { to { opacity: 1; transform: translateY(0) scale(1); } }

.avatar-placeholder:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* ===== Left Panel ===== */
.left {
  width: 30%;
  min-width: 200px;
  background: linear-gradient(160deg, #2d7d9a 0%, #236b84 50%, #1a5263 100%);
  padding: 2em 1.5em;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.avatar { margin-top: 0.5em; }

.avatar img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  object-fit: cover;
  display: block;
}

.avatar-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  color: rgba(255, 255, 255, 0.85);
  transition: all 0.3s ease;
}

.nav-menu { margin-top: 2em; width: 100%; flex: 1; }
.nav-menu li { margin-bottom: 0.7em; }

.nav-menu li a {
  display: block;
  padding: 0.6em 1em;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9em;
  letter-spacing: 0.12em;
  border-radius: 10px;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.nav-menu li a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 50%;
  background: #6bc5d8;
  border-radius: 2px;
  transition: transform 0.3s ease;
}

.nav-menu li a:hover,
.nav-menu li a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-menu li a.active::before { transform: translateY(-50%) scaleY(1); }

.left-footer {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7em;
  text-align: center;
  margin-top: auto;
  line-height: 1.6;
}
.left-footer a { color: rgba(255, 255, 255, 0.6); }
.left-footer i { color: #f87171; }

/* ===== Right Panel ===== */
.right {
  flex: 1;
  padding: 2em 2.8em;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.right section {
  display: none;
  animation: fadeIn 0.45s ease;
}
.right section.active { display: block; }

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

/* ===== Section: Home ===== */
#home { text-align: center; padding: 1em 0; }

#home .greeting {
  font-size: 0.85em;
  color: #2d7d9a;
  letter-spacing: 0.2em;
  margin-bottom: 0.3em;
}

#home h1 {
  font-size: 2.6em;
  color: #0f172a;
  margin-bottom: 0.2em;
  letter-spacing: 0.03em;
}

#home .subtitle {
  color: #64748b;
  font-size: 1em;
  margin-bottom: 1.5em;
}

#home .bio {
  color: #475569;
  font-size: 0.9em;
  line-height: 2;
  max-width: 32em;
  margin: 0 auto;
  padding: 0.5em 0;
}

.quote-card {
  margin-top: 2em;
  background: linear-gradient(135deg, rgba(45, 125, 154, 0.06), rgba(56, 189, 248, 0.05));
  border-radius: 12px;
  padding: 1.2em 1.8em;
  border: 1px solid rgba(45, 125, 154, 0.1);
  transition: all 0.3s ease;
}

.quote-card .quote-text {
  color: #64748b;
  font-style: italic;
  font-size: 0.9em;
  line-height: 1.7;
}
.quote-card .quote-author {
  color: #94a3b8;
  font-size: 0.75em;
  margin-top: 0.5em;
  text-align: right;
}

.social-links-home {
  margin-top: 2em;
  display: flex;
  justify-content: center;
  gap: 1em;
}

.social-links-home a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #2d7d9a;
  font-size: 1.2em;
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
}

.social-links-home a:hover {
  color: #fff;
  background: #2d7d9a;
  border-color: #2d7d9a;
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(45, 125, 154, 0.3);
}

/* ===== Section: About ===== */
#about h2 {
  font-size: 1.5em;
  margin-bottom: 0.8em;
  color: #0f172a;
  padding-bottom: 0.5em;
  border-bottom: 2px solid rgba(45, 125, 154, 0.1);
}
#about h2 i { color: #2d7d9a; margin-right: 0.4em; }

.about-content {
  color: #475569;
  font-size: 0.9em;
  line-height: 2;
}
.about-content p { margin-bottom: 1em; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em;
  margin: 1.5em 0;
}
.info-item {
  display: flex;
  align-items: center;
  gap: 0.6em;
  color: #475569;
  font-size: 0.85em;
}
.info-item i { width: 20px; color: #2d7d9a; }

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

.skill-tag {
  padding: 0.25em 0.8em;
  border-radius: 20px;
  font-size: 0.75em;
  color: #2d7d9a;
  background: rgba(45, 125, 154, 0.06);
  border: 1px solid rgba(45, 125, 154, 0.12);
  transition: all 0.3s ease;
}

.skill-tag:hover {
  background: #2d7d9a;
  color: #fff;
  border-color: #2d7d9a;
}

/* ===== Section: Projects ===== */
#projects h2 {
  font-size: 1.5em;
  margin-bottom: 0.8em;
  color: #0f172a;
  padding-bottom: 0.5em;
  border-bottom: 2px solid rgba(45, 125, 154, 0.1);
}
#projects h2 i { color: #2d7d9a; margin-right: 0.4em; }

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


.project-card {
  padding: 1.2em 1.4em;
  border-radius: 14px;
  background: rgba(45, 125, 154, 0.04);
  border: 1px solid rgba(45, 125, 154, 0.08);
  transition: all 0.3s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(45, 125, 154, 0.1);
  border-color: rgba(45, 125, 154, 0.18);
}

.project-card h3 {
  font-size: 0.95em;
  color: #0f172a;
  margin-bottom: 0.4em;
}

.project-card p {
  font-size: 0.8em;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 0.6em;
}

.project-card .project-links a {
  color: #2d7d9a;
  font-size: 0.8em;
  margin-right: 0.8em;
}

.project-card .project-links a:hover { text-decoration: underline; }

/* ===== Section: Contact ===== */
#contact h2 {
  font-size: 1.5em;
  margin-bottom: 0.8em;
  color: #0f172a;
  padding-bottom: 0.5em;
  border-bottom: 2px solid rgba(45, 125, 154, 0.1);
}
#contact h2 i { color: #2d7d9a; margin-right: 0.4em; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1em;
  margin-top: 1em;
  max-width: 34em;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.4em 0.5em;
  border-radius: 14px;
  background: rgba(45, 125, 154, 0.04);
  border: 1px solid rgba(45, 125, 154, 0.08);
  color: #475569;
  transition: all 0.3s ease;
  gap: 0.5em;
  text-decoration: none;
}

.contact-item i {
  font-size: 1.6em;
  color: #2d7d9a;
  transition: transform 0.3s ease;
}

.contact-item span { font-size: 0.8em; }

.contact-item:hover {
  background: #2d7d9a;
  color: #fff;
  transform: translateY(-4px);
  border-color: #2d7d9a;
  box-shadow: 0 6px 20px rgba(45, 125, 154, 0.2);
}

.contact-item:hover i { color: #fff; transform: scale(1.1); }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  color: rgba(148, 163, 184, 0.8);
  font-size: 0.75em;
  position: fixed;
  bottom: 1em;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}
.site-footer a { color: rgba(148, 163, 184, 0.9); }
.site-footer a:hover { color: #fff; }

/* ===== Scrollbar ===== */
.right::-webkit-scrollbar { width: 4px; }
.right::-webkit-scrollbar-track { background: transparent; }
.right::-webkit-scrollbar-thumb { background: rgba(45, 125, 154, 0.2); border-radius: 2px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body { overflow-y: auto; }
  #container { height: auto; min-height: 100%; }
  main { align-items: flex-start; padding: 1em; }

  .card {
    flex-direction: column;
    height: auto;
    max-height: none;
    width: 100%;
    max-width: 24em;
    margin: 4em 0 2em;
    border-radius: 12px;
  }

  .card { overflow: visible; }

  .left {
    width: 100%;
    min-width: unset;
    padding: 2em 1.5em 1em;
    border-radius: 12px 12px 0 0;
    overflow: visible;
  }
  .avatar { margin-top: 0; }
  .avatar img, .avatar-placeholder { width: 80px; height: 80px; }

  .nav-menu {
    margin-top: 1em;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3em;
  }
  .nav-menu li { margin-bottom: 0; }
  .nav-menu li a { padding: 0.4em 0.8em; font-size: 0.8em; }
  .nav-menu li a::before { display: none; }
  .left-footer { display: none; }
  .right {
    flex: none;
    padding: 1.5em;
    overflow-y: visible;
    display: block;
  }

  #home h1 { font-size: 1.8em; }
  .quote-card { padding: 0.8em 1em; }
  .info-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }

  .site-footer {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin-top: 1em;
    margin-bottom: 1em;
    color: rgba(148, 163, 184, 0.8);
  }
}