/* === Custom Styles - Xu Liyao Portfolio === */

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a0b; }
::-webkit-scrollbar-thumb { background: #363639; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #48484a; }

/* Noise overlay */
#noise-overlay {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat; background-size: 256px 256px;
}

/* Navigation */
.nav-link {
  position: relative; color: rgba(255,255,255,0.6);
  font-size: 0.9rem; transition: color 0.3s;
  padding: 0.25rem 0;
}
.nav-link::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 0; height: 1.5px; background: #2997ff;
  transition: width 0.3s ease;
}
.nav-link:hover { color: rgba(255,255,255,0.9); }
.nav-link:hover::after { width: 100%; }

.project-card {
  position: relative;
  padding: 28px; border-radius: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.4s ease;
}

.project-card::before {
  content: '';
  position: absolute; inset: -1px; border-radius: 24px;
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: all 0.5s ease;
  pointer-events: none;
}

.project-card:hover {
  background: rgba(255,255,255,0.04);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.project-card:hover::before {
  background: linear-gradient(135deg, #0071e3, #2997ff, #0071e3, #2997ff);
  background-size: 300% 100%;
  animation: borderGlow 2s ease infinite;
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Glass card */
.glass-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  transition: all 0.4s ease;
}
.glass-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 28px; border-radius: 14px;
  background: #0071e3; color: white; font-weight: 500;
  transition: all 0.3s ease;
}
.btn-primary:hover { background: #2997ff; transform: translateY(-1px); box-shadow: 0 8px 30px rgba(0,113,227,0.3); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 28px; border-radius: 14px;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.12); font-weight: 500;
  transition: all 0.3s ease;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }

/* Hero section */
.hero-title {
  background: linear-gradient(135deg, #ffffff 0%, #aeaeb2 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}
.hero-subtitle { letter-spacing: -0.01em; }
.hero-badge {
  padding: 6px 16px; border-radius: 100px;
  background: rgba(0,113,227,0.15); border: 1px solid rgba(0,113,227,0.25);
  color: #2997ff; font-size: 0.85rem; font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Section styles */
.section-tag {
  display: inline-block; padding: 6px 16px; border-radius: 100px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5); font-size: 0.85rem; font-weight: 500;
  margin-bottom: 16px; letter-spacing: 0.05em;
}
.section-title {
  font-size: 2.5rem; font-weight: 700; margin-bottom: 16px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #aeaeb2 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
@media (min-width: 768px) { .section-title { font-size: 3.5rem; } }

/* Avatar ring */
.avatar-ring {
  animation: pulseRing 2s ease-in-out infinite;
}
@keyframes pulseRing {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* Stat cards */
.stat-card {
  position: relative; text-align: center;
  padding: 20px 12px; border-radius: 16px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden; transition: all 0.3s ease;
}
.stat-card:hover { border-color: rgba(0,113,227,0.3); transform: translateY(-2px); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: linear-gradient(90deg, transparent, #0071e3, transparent);
}
.stat-number {
  font-size: 2.5rem; font-weight: 800;
  background: linear-gradient(135deg, #2997ff, #0071e3);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline;
}
.stat-plus, .stat-unit {
  font-size: 1.5rem; font-weight: 700;
  color: #0071e3; margin-left: 1px;
}
.stat-label { display: block; color: rgba(255,255,255,0.4); font-size: 0.85rem; margin-top: 4px; }

/* Project cards */


.project-tag {
  padding: 4px 12px; border-radius: 8px;
  background: rgba(0,113,227,0.15); color: #2997ff;
  font-size: 0.8rem; font-weight: 500;
}
.project-role {
  padding: 4px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5);
  font-size: 0.8rem; font-weight: 500;
}
.tech-tag {
  padding: 4px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.45); font-size: 0.75rem;
  transition: all 0.3s ease;
}
.tech-tag:hover { border-color: rgba(0,113,227,0.3); color: #2997ff; background: rgba(0,113,227,0.08); }

/* Strength cards */
.strength-card {
  padding: 28px; border-radius: 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.4s ease;
}
.strength-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}
.strength-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px; transition: all 0.3s ease;
}
.strength-card:hover .strength-icon { transform: scale(1.1); }

/* Timeline */
.timeline-line {
  position: absolute; left: 7px; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(180deg, #0071e3, transparent);
}
@media (min-width: 768px) { .timeline-line { left: 11px; } }
.timeline-item { position: relative; }
.timeline-dot {
  position: absolute; left: 0; top: 24px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #0071e3; border: 3px solid #1c1c1e;
  box-shadow: 0 0 12px rgba(0,113,227,0.5);
}
@media (min-width: 768px) { .timeline-dot { width: 24px; height: 24px; left: 0; top: 22px; } }

/* Contact cards */
.contact-card { cursor: pointer; transition: all 0.3s ease; text-decoration: none; }
.contact-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0,113,227,0.3);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.scroll-reveal.revealed { opacity: 1; transform: translateY(0); }

/* Mobile menu animation */
#mobileMenu { transition: all 0.3s ease; }
#mobileMenu.show { display: block; }

/* Navbar scroll effect */
.navbar-scrolled {
  background: rgba(10,10,11,0.85) !important;
  backdrop-filter: blur(30px) !important;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 1px 20px rgba(0,0,0,0.3);
}

/* Responsive fine-tuning */
@media (max-width: 640px) {
  .hero-title { font-size: 3rem !important; }
  .section-title { font-size: 2rem !important; }
  .stat-number { font-size: 2rem !important; }
  .project-card { padding: 20px; }
}
/* === Header action buttons === */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  color: rgba(255,255,255,0.86);
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.tool-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-color: rgba(255,255,255,0.35);
}
.tool-btn:active { transform: scale(0.94); }
.tool-btn svg { width: 17px; height: 17px; }
.lang-toggle { min-width: 44px; letter-spacing: 0.04em; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle.dark-mode .icon-sun { display: none; }
.theme-toggle.dark-mode .icon-moon { display: block; }
.share-btn { min-width: 40px; padding: 0 12px; }

/* === Hero word cloud === */
.word-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 18px;
  max-width: 780px;
  margin-inline: auto;
}
.word-cloud span {
  color: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.85rem;
  animation: cloudFloat 5s ease-in-out infinite;
}
.word-cloud span:nth-child(3n) {
  font-size: 1.05rem;
  color: rgba(41,151,255,0.92);
  border-color: rgba(41,151,255,0.38);
}
.word-cloud span:nth-child(4n) { animation-delay: 1.2s; }
.word-cloud span:nth-child(5n) { animation-delay: 2.1s; }
@keyframes cloudFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* === Toast === */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  z-index: 300;
  max-width: min(420px, calc(100% - 40px));
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(0,0,0,0.9);
  color: #fff;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 12px 34px rgba(0,0,0,0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* === Timeline bullet list === */
.tl-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.tl-list li {
  position: relative;
  padding-left: 18px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.55);
}
.tl-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0071e3;
  opacity: 0.7;
}

/* === Light theme === */
html[data-theme="light"] body {
  background: #f5f5f7 !important;
  color: #1d1d1f !important;
}
html[data-theme="light"] .section-bg {
  background: #eef1f6 !important;
}
html[data-theme="light"] .section-bg-2 {
  background: transparent !important;
}
html[data-theme="light"] .project-card,
html[data-theme="light"] .glass-card,
html[data-theme="light"] .strength-card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .contact-card {
  background: #ffffff !important;
  border-color: #e3e3e6 !important;
}
html[data-theme="light"] .project-card:hover {
  background: #ffffff !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}
html[data-theme="light"] .glass-card:hover {
  background: #ffffff !important;
  border-color: #d2d2d7 !important;
}
html[data-theme="light"] .strength-card:hover {
  background: #ffffff !important;
  border-color: #d2d2d7 !important;
}
html[data-theme="light"] [class*="bg-white/5"] {
  background: #f3f4f6 !important;
}
html[data-theme="light"] .bg-apple-900 {
  background: #ffffff !important;
  border: 1px solid #e3e3e6 !important;
}
html[data-theme="light"] .section-title {
  background: linear-gradient(135deg, #111827 0%, #6b7280 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme="light"] .tech-tag {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.6);
}
html[data-theme="light"] .tech-tag:hover {
  background: rgba(0,113,227,0.08);
  border-color: rgba(0,113,227,0.3);
  color: #005bbf;
}
html[data-theme="light"] .project-role {
  background: rgba(0,0,0,0.05);
  color: rgba(0,0,0,0.55);
}
html[data-theme="light"] .project-tag {
  background: rgba(0,113,227,0.12);
  color: #005bbf;
}
html[data-theme="light"] .tl-list li {
  color: rgba(0,0,0,0.6);
}
html[data-theme="light"] .timeline-dot {
  border-color: #ffffff;
}
html[data-theme="light"] body > section:not(#hero) [class*="text-white/"] {
  color: #4b5563 !important;
}
html[data-theme="light"] body > section:not(#hero) .text-white\/90 { color: #111827 !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/80 { color: #1f2937 !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/70 { color: #374151 !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/60 { color: #4b5563 !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/50 { color: #4b5563 !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/40 { color: #6b7280 !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/30 { color: #9ca3af !important; }
html[data-theme="light"] body > section:not(#hero) .text-white\/20 { color: #9ca3af !important; }
html[data-theme="light"] .navbar-scrolled {
  background: rgba(255,255,255,0.88) !important;
  border-bottom: 1px solid #e3e3e6;
}
html[data-theme="light"] .navbar-scrolled .nav-link {
  color: rgba(0,0,0,0.7) !important;
}
html[data-theme="light"] .navbar-scrolled .nav-link:hover {
  color: #000 !important;
}
html[data-theme="light"] .navbar-scrolled .text-white\/90 {
  color: #111827 !important;
}
html[data-theme="light"] #mobileMenu {
  background: rgba(255,255,255,0.96) !important;
  border-color: #e3e3e6 !important;
}
html[data-theme="light"] #mobileMenu .text-white\/70 {
  color: #374151 !important;
}
html[data-theme="light"] #mobileMenu .text-white\/70:hover {
  color: #111827 !important;
}
html[data-theme="light"] .tool-btn {
  color: rgba(0,0,0,0.75);
  border-color: rgba(0,0,0,0.18);
  background: rgba(0,0,0,0.04);
}
html[data-theme="light"] .tool-btn:hover {
  background: rgba(0,0,0,0.08);
  color: #000;
  border-color: rgba(0,0,0,0.3);
}
html[data-theme="light"] .word-cloud span {
  color: rgba(0,0,0,0.65);
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
}
html[data-theme="light"] .word-cloud span:nth-child(3n) {
  color: #0071e3;
  border-color: rgba(0,113,227,0.35);
}

@media (max-width: 640px) {
  .nav-actions { gap: 6px; }
  .tool-btn { min-width: 36px; height: 34px; padding: 0 8px; }
  .lang-toggle { min-width: 40px; }
  .word-cloud { gap: 8px 10px; }
  .word-cloud span { padding: 6px 12px; font-size: 0.75rem; }
  .word-cloud span:nth-child(3n) { font-size: 0.9rem; }
}
/* === Mouse scroll indicator === */
.mouse-scroll {
  width: 26px;
  height: 44px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  display: flex;
  justify-content: center;
  padding-top: 7px;
}
.mouse-scroll span {
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: #2997ff;
  animation: wheelDrop 1.8s ease-in-out infinite;
}
@keyframes wheelDrop {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(8px); opacity: 0.35; }
}

/* === Back to top === */
.back-to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 180;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.82);
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, background 0.2s;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.back-to-top:hover {
  background: #0071e3;
}

/* === Light theme contrast fixes === */
html[data-theme="light"] .stat-label {
  color: #6b7280 !important;
}
html[data-theme="light"] .section-tag {
  color: rgba(0,0,0,0.58) !important;
  background: rgba(0,0,0,0.05) !important;
  border-color: rgba(0,0,0,0.08) !important;
}
html[data-theme="light"] .avatar-ring {
  opacity: 0.55;
}

@media (max-width: 640px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
}
/* === Light palette refresh (blue-tinted) === */
html[data-theme="light"] body {
  background: #f8fafc !important;
}
html[data-theme="light"] .section-bg {
  background: #eef4fb !important;
}
html[data-theme="light"] .project-card,
html[data-theme="light"] .glass-card,
html[data-theme="light"] .strength-card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .contact-card {
  border-color: #e2e8f0 !important;
}
html[data-theme="light"] [class*="bg-white/5"] {
  background: #f1f5f9 !important;
}

/* === Light hero === */
html[data-theme="light"] #hero {
  background: linear-gradient(135deg, #eef4ff 0%, #ffffff 50%, #f0f7ff 100%) !important;
}
html[data-theme="light"] #hero > div.absolute {
  background: transparent !important;
  opacity: 1 !important;
}
html[data-theme="light"] #hero .hero-title {
  background: linear-gradient(135deg, #111827 0%, #0071e3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme="light"] #hero .hero-badge {
  background: rgba(0,113,227,0.1);
  border-color: rgba(0,113,227,0.25);
  color: #0071e3;
}
html[data-theme="light"] #hero [class*="text-white/"] {
  color: #334155 !important;
}
html[data-theme="light"] #hero .text-white\/40 {
  color: #475569 !important;
}
html[data-theme="light"] .mouse-scroll {
  border-color: rgba(15,23,42,0.4);
}
html[data-theme="light"] .mouse-scroll span {
  background: #0071e3;
}

/* === Light nav over hero === */
html[data-theme="light"] .nav-link {
  color: rgba(15,23,42,0.72) !important;
}
html[data-theme="light"] .nav-link:hover {
  color: #0f172a !important;
}
html[data-theme="light"] #navbar .text-white\/90 {
  color: #0f172a !important;
}

/* === Project visual readability === */
.project-visual-label {
  color: rgba(255,255,255,0.95) !important;
  text-shadow: 0 1px 10px rgba(0,0,0,0.35);
}
html[data-theme="light"] .project-visual {
  border-color: rgba(255,255,255,0.14) !important;
}
html[data-theme="light"] .project-card:nth-child(1) .project-visual {
  background: linear-gradient(135deg, #0e7490, #155e75, #134e4a) !important;
}
html[data-theme="light"] .project-card:nth-child(2) .project-visual {
  background: linear-gradient(135deg, #047857, #065f46, #14532d) !important;
}
html[data-theme="light"] .project-card:nth-child(3) .project-visual {
  background: linear-gradient(135deg, #b45309, #92400e, #78350f) !important;
}
html[data-theme="light"] .project-card:nth-child(4) .project-visual {
  background: linear-gradient(135deg, #1d4ed8, #4338ca, #312e81) !important;
}
html[data-theme="light"] .project-card:nth-child(5) .project-visual {
  background: linear-gradient(135deg, #059669, #047857, #365314) !important;
}
html[data-theme="light"] .project-card:nth-child(6) .project-visual {
  background: linear-gradient(135deg, #be123c, #9f1239, #831843) !important;
}
