/* ===== CSS Custom Properties ===== */
:root {
  --bg-primary: #06060f;
  --bg-secondary: #0e0c1a;
  --bg-card: #131026;
  --accent: #b87ce0;
  --accent-secondary: #e071d3;
  --accent-glow: rgba(184, 124, 224, 0.25);
  --text-primary: #e8e0f0;
  --text-muted: #8a8098;
  --border: rgba(184, 124, 224, 0.12);
  --radius: 12px;
  --transition: 0.25s ease;
  --max-width: 1100px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(170deg, #0a0818 0%, #06060f 30%, #0e0a1a 60%, #06040f 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  animation: pageFadeIn 0.5s ease;
}

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

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

@media (hover: hover) {
  a:hover {
    color: var(--accent-secondary);
  }
}

img {
  max-width: 100%;
  display: block;
}

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(6, 6, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  position: relative;
  transition: color 0.2s ease;
}

.nav-links a.active {
  color: var(--text-primary);
}

@media (hover: hover) {
  .nav-links a:hover {
    color: var(--text-primary);
  }
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.nav-links a.active::after {
  width: 100%;
}

@media (hover: hover) {
  .nav-links a:hover::after {
    width: 100%;
  }
}

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

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===== Container ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Night Sky Background ===== */
.night-sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Moon */
.moon {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f5f0d0, #e8d88e 40%, #c4b56a 100%);
  box-shadow:
    0 0 40px rgba(245, 240, 208, 0.3),
    0 0 80px rgba(245, 240, 208, 0.15),
    0 0 120px rgba(200, 180, 120, 0.1);
  animation: moonPulse 4s ease-in-out infinite;
}

.moon::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(200, 180, 130, 0.4);
  box-shadow:
    28px 8px 0 -3px rgba(200, 180, 130, 0.3),
    42px 22px 0 -4px rgba(200, 180, 130, 0.2),
    10px 30px 0 -4px rgba(200, 180, 130, 0.25);
}

/* Star Layers */
.stars-layer {
  position: absolute;
  inset: 0;
}

.stars-slow {
  --star-size: 1.5px;
  --star-count: 60;
  animation: twinkleSlow 3s ease-in-out infinite;
}

.stars-mid {
  --star-size: 1px;
  --star-count: 80;
  animation: twinkleMid 2s ease-in-out infinite;
}

.stars-fast {
  --star-size: 1px;
  --star-count: 50;
  animation: twinkleFast 1.5s ease-in-out infinite;
}

.stars-layer::before {
  content: '';
  position: absolute;
  width: var(--star-size);
  height: var(--star-size);
  border-radius: 50%;
  background: white;
  top: 5%;
  left: 8%;
  box-shadow:
    15vw 12vh 0 white,
    28vw 8vh 0 white,
    42vw 18vh 0 white,
    58vw 5vh 0 white,
    72vw 22vh 0 white,
    88vw 10vh 0 white,
    8vw 28vh 0 white,
    22vw 38vh 0 white,
    35vw 30vh 0 white,
    52vw 35vh 0 white,
    65vw 45vh 0 white,
    80vw 32vh 0 white,
    92vw 48vh 0 white,
    5vw 55vh 0 white,
    18vw 50vh 0 white,
    30vw 62vh 0 white,
    48vw 55vh 0 white,
    60vw 68vh 0 white,
    75vw 52vh 0 white,
    85vw 65vh 0 white,
    95vw 58vh 0 white,
    12vw 72vh 0 white,
    25vw 78vh 0 white,
    40vw 70vh 0 white,
    55vw 82vh 0 white,
    68vw 75vh 0 white,
    82vw 85vh 0 white,
    90vw 78vh 0 white,
    20vw 88vh 0 white,
    38vw 92vh 0 white,
    50vw 88vh 0 white,
    70vw 90vh 0 white,
    6vw 18vh 0 white,
    32vw 20vh 0 white,
    44vw 32vh 0 white,
    62vw 28vh 0 white,
    78vw 38vh 0 white,
    10vw 42vh 0 white,
    26vw 55vh 0 white,
    36vw 44vh 0 white;
}

.stars-mid::before {
  top: 3%;
  left: 12%;
  box-shadow:
    10vw 8vh 0 rgba(255,255,255,0.7),
    20vw 16vh 0 rgba(255,255,255,0.5),
    33vw 6vh 0 rgba(255,255,255,0.8),
    46vw 14vh 0 rgba(255,255,255,0.6),
    60vw 8vh 0 rgba(255,255,255,0.7),
    76vw 20vh 0 rgba(255,255,255,0.5),
    90vw 6vh 0 rgba(255,255,255,0.6),
    7vw 32vh 0 rgba(255,255,255,0.7),
    18vw 25vh 0 rgba(255,255,255,0.5),
    30vw 40vh 0 rgba(255,255,255,0.8),
    45vw 28vh 0 rgba(255,255,255,0.6),
    56vw 38vh 0 rgba(255,255,255,0.7),
    70vw 30vh 0 rgba(255,255,255,0.5),
    84vw 42vh 0 rgba(255,255,255,0.6),
    94vw 28vh 0 rgba(255,255,255,0.7),
    4vw 48vh 0 rgba(255,255,255,0.5),
    16vw 55vh 0 rgba(255,255,255,0.8),
    28vw 48vh 0 rgba(255,255,255,0.6),
    42vw 58vh 0 rgba(255,255,255,0.7),
    54vw 50vh 0 rgba(255,255,255,0.5),
    68vw 60vh 0 rgba(255,255,255,0.6),
    80vw 48vh 0 rgba(255,255,255,0.7),
    92vw 58vh 0 rgba(255,255,255,0.5),
    10vw 68vh 0 rgba(255,255,255,0.6),
    22vw 72vh 0 rgba(255,255,255,0.7),
    38vw 65vh 0 rgba(255,255,255,0.5),
    50vw 75vh 0 rgba(255,255,255,0.8),
    64vw 68vh 0 rgba(255,255,255,0.6),
    78vw 78vh 0 rgba(255,255,255,0.7),
    88vw 70vh 0 rgba(255,255,255,0.5),
    32vw 82vh 0 rgba(255,255,255,0.6),
    46vw 88vh 0 rgba(255,255,255,0.7),
    60vw 82vh 0 rgba(255,255,255,0.5);
}

/* Star Twinkle Animations */
@keyframes twinkleSlow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes twinkleMid {
  0%, 100% { opacity: 0.5; }
  25% { opacity: 0.9; }
  75% { opacity: 0.4; }
}

@keyframes twinkleFast {
  0%, 100% { opacity: 0.6; }
  33% { opacity: 1; }
  66% { opacity: 0.3; }
}

@keyframes moonPulse {
  0%, 100% { box-shadow: 0 0 40px rgba(245, 240, 208, 0.3), 0 0 80px rgba(245, 240, 208, 0.15), 0 0 120px rgba(200, 180, 120, 0.1); }
  50% { box-shadow: 0 0 55px rgba(245, 240, 208, 0.4), 0 0 100px rgba(245, 240, 208, 0.22), 0 0 140px rgba(200, 180, 120, 0.15); }
}

/* ===== Hero Section ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  position: relative;
  z-index: 1;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  width: 100%;
}

.hero-content {
  animation: fadeInUp 0.8s ease;
}

.hero-greeting {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.hero-name {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero-name span {
  display: block;
  color: var(--accent);
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 460px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

@media (hover: hover) {
  .btn-primary:hover {
    background: #9e5fc7;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(184, 124, 224, 0.35);
  }
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

@media (hover: hover) {
  .btn-outline:hover {
    background: rgba(184, 124, 224, 0.08);
    color: var(--accent);
    transform: translateY(-1px);
  }
}

/* Photo placeholder (sub-pages) */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeInUp 0.8s ease 0.15s both;
}

.photo-placeholder {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.photo-placeholder::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent-secondary), var(--accent));
  opacity: 0.3;
  filter: blur(20px);
}

.photo-placeholder .placeholder-icon {
  position: relative;
  z-index: 1;
  font-size: 5rem;
  color: var(--text-muted);
  opacity: 0.5;
}

/* Character Frame */
.character-frame {
  position: relative;
  width: 280px;
  height: 380px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-frame::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--accent), var(--accent-secondary), transparent 70%);
  opacity: 0.3;
  z-index: 0;
}

.character-placeholder {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.character-placeholder span {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.character-placeholder small {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-weight: 400;
}

.character-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  display: block;
}

.character-glow {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 60px;
  background: radial-gradient(ellipse, rgba(224, 113, 211, 0.2), transparent);
  filter: blur(8px);
}

/* ===== About Page ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text {
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.9;
}

.about-skills-title {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--accent);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ===== Section Styles (shared) ===== */
.page-section {
  padding: 100px 0;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.section-line {
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 40px;
}

/* ===== Skill Tags ===== */
.skill-tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all var(--transition);
}

@media (hover: hover) {
  .skill-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* ===== Projects Grid ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

@media (hover: hover) {
  .project-card:hover {
    border-color: var(--accent);
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(184, 124, 224, 0.15);
  }
}

.project-image {
  height: 200px;
  background: linear-gradient(145deg, var(--bg-secondary), var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-placeholder {
  font-size: 3.5rem;
  opacity: 0.6;
  transition: transform var(--transition);
}

@media (hover: hover) {
  .project-card:hover .project-placeholder {
    transform: scale(1.1);
  }
}

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

.project-image video.project-img {
  object-fit: contain;
  background: #000;
  padding: 16px;
}

.project-info {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.project-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.project-tags span {
  font-size: 0.78rem;
  padding: 4px 10px;
  background: rgba(184, 124, 224, 0.1);
  color: var(--accent);
  border-radius: 4px;
}

.project-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: wrap;
}

/* ===== Contact Form ===== */
.contact-intro {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin-bottom: 40px;
}

.contact-form {
  max-width: 600px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(138, 128, 152, 0.5);
}

/* Contact Links */
.contact-links {
  margin-top: 48px;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all var(--transition);
  word-break: break-all;
}

@media (hover: hover) {
  .contact-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(184, 124, 224, 0.05);
  }
}

.contact-icon {
  font-size: 1.1rem;
}

/* Form Status */
.form-status {
  min-height: 22px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-status.success {
  color: #6ee07e;
}

.form-status.error {
  color: #e0716e;
}

/* ===== Footer ===== */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .page-section {
    padding: 80px 0;
    min-height: auto;
    min-height: 100dvh;
    align-items: flex-start;
  }

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

  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }

  .hero-visual {
    order: -1;
  }

  .photo-placeholder,
  .character-frame {
    width: 200px;
    height: 260px;
  }

  .hero-greeting {
    font-size: 0.85rem;
  }

  .hero-name {
    font-size: 2.4rem;
  }

  .hero-tagline {
    margin: 0 auto 32px;
    font-size: 1rem;
  }

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

  .project-links .btn-outline {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .about-text {
    font-size: 1.05rem;
  }

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

  .project-image {
    height: 140px;
  }

  .moon {
    width: 50px;
    height: 50px;
    top: 6%;
    right: 8%;
    animation: none;
  }

  .stars-fast {
    animation: none;
  }

  .stars-fast::before {
    width: 0;
    height: 0;
  }

  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(6, 6, 15, 0.95);
    backdrop-filter: blur(12px);
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
  }

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

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 14px 0;
    font-size: 1.05rem;
  }

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .page-section {
    padding: 60px 0;
  }

  .hero-greeting {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
  }

  .hero-name {
    font-size: 1.7rem;
  }

  .hero-tagline {
    font-size: 0.9rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .character-frame {
    width: 180px;
    height: 240px;
  }

  .project-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .project-links .btn-outline {
    width: 100%;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .contact-links {
    flex-direction: column;
    gap: 12px;
  }

  .contact-link {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
  }

  .contact-intro {
    font-size: 0.95rem;
  }

  .moon {
    width: 36px;
    height: 36px;
    top: 5%;
    right: 6%;
  }
}
