/*-----------------------------------*\
  #style.css - Personal Website Styles
\*-----------------------------------*/

/**
 * Mobile-first responsive design for Wuchen Li's personal website
 * Clean and optimized styles
 */

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

/* Main Content Area */
.main-content {
  background: linear-gradient(135deg, #eff6ff, #ffffff, #faf5ff);
  min-height: 100vh;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
  color: #374151;
  background: linear-gradient(135deg, #eff6ff, #ffffff, #faf5ff);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Safe area variables for iOS */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  
  /* Custom properties for theming */
  --primary-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --secondary-gradient: linear-gradient(135deg, #10b981, #3b82f6);
  --accent-gradient: linear-gradient(135deg, #f59e0b, #ef4444);
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.18);
  --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Custom animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* Utility classes */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.5s ease-out;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse-soft {
  animation: pulse 2s infinite;
}

/* Glass morphism effect */
.glass {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

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

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* Mobile Header Styles */
.mobile-header {
  padding-top: max(0.5rem, var(--sat));
  padding-bottom: 0.5rem;
}

.mobile-header .avatar-box {
  display: none;
}

.mobile-header .avatar-box:hover {
  transform: scale(1.05);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  padding-bottom: max(0.5rem, var(--sab));
  padding-top: 0.5rem;
}

.mobile-bottom-nav .nav-item {
  color: #6b7280;
  text-decoration: none;
  min-height: 60px;
  min-width: 60px;
  border-radius: 12px;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item:hover,
.mobile-bottom-nav .nav-item.active {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.mobile-bottom-nav .nav-item ion-icon {
  transition: transform 0.3s ease;
}

.mobile-bottom-nav .nav-item:hover ion-icon,
.mobile-bottom-nav .nav-item.active ion-icon {
  transform: scale(1.1);
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  transition: left 0.3s ease;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem;
  padding-top: max(1rem, var(--sat));
  padding-bottom: max(1rem, var(--sab));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Enhanced Sidebar Styles */
.sidebar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Profile Section */
.profile-section {
  position: relative;
}

.avatar-container {
  position: relative;
  display: inline-block;
}

.avatar-container:hover {
  transform: scale(1.02);
  transition: transform 0.3s ease;
}

/* Contact Cards */
.contact-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.icon-wrapper {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.icon-wrapper:hover {
  transform: scale(1.05);
}

/* Social Cards */
.social-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.social-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Section Titles */
.section-title {
  position: relative;
}

/* Section title styles */
.section-title::after,
.section-title::before {
  display: none !important;
  content: none !important;
}

.sidebar.active {
  left: 0;
}

/* Sidebar overlay */
.sidebar::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar.active::before {
  opacity: 1;
}

/* Contact items in sidebar */
.contact-item {
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.contact-item:hover {
  transform: translateX(4px);
}

.contact-item .icon-box {
  transition: transform 0.3s ease;
}

.contact-item:hover .icon-box {
  transform: scale(1.1);
}

/* Social links */
.social-link {
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.social-link:hover {
  transform: translateY(-3px) scale(1.1);
}

/* Section Styles */
section {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

section:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Section headers */
.article-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1.5rem;
  position: relative;
}

/* Article title styles */
.article-title::after,
.article-title::before,
h2.article-title::after,
h2.article-title::before,
.h2.article-title::after,
.h2.article-title::before {
  display: none !important;
  content: none !important;
  background: none !important;
  border: none !important;
  height: 0 !important;
  width: 0 !important;
}

/* Service items */
.service-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.service-item {
  padding: 1.25rem;
  border-radius: 16px;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.service-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.service-item .service-icon {
  transition: transform 0.3s ease;
}

.service-item:hover .service-icon {
  transform: scale(1.1);
}

.service-item .service-item-title {
  font-size: 1.1rem;
}

.service-item .service-item-text {
  font-size: 0.9rem;
}



/* Partners/Institutions */
.clients-list {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 1rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.clients-list::-webkit-scrollbar {
  display: none;
}

.clients-item {
  flex-shrink: 0;
  padding: 0.75rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.clients-item:hover {
  background: rgba(59, 130, 246, 0.05);
  transform: scale(1.05);
}

.clients-item img {
  height: 3rem;
  width: auto;
  transition: all 0.3s ease;
  filter: grayscale(100%);
}

.clients-item:hover img {
  filter: grayscale(0%);
  transform: scale(1.1);
}

/* Resume section */
.timeline-list {
  margin-left: 1rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  background: var(--primary-gradient);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 1.5rem;
  width: 2px;
  height: calc(100% + 1rem);
  background: var(--primary-gradient);
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-item .timeline-item-title {
  font-size: 1.1rem;
}

.timeline-item .timeline-text {
  font-size: 0.9rem;
}

/* Skills grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.skill-box {
  padding: 0.875rem;
  border-radius: 12px;
  text-align: center;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.skill-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Project items */
.project-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.project-item {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.project-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.project-item .project-title {
  font-size: 1.1rem;
}

.project-item .project-category {
  font-size: 0.875rem;
}

.project-img {
  position: relative;
  overflow: hidden;
}

.project-img img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-item:hover .project-img img {
  transform: scale(1.05);
}

.project-item-icon-box {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-item:hover .project-item-icon-box {
  opacity: 1;
}

/* Contact section */
.contact-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.contact-item {
  padding: 1.25rem;
  border-radius: 16px;
  transition: all 0.3s ease;
}

.contact-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.contact-item .contact-title {
  font-size: 1rem;
}

.contact-item .contact-link,
.contact-item .contact-address {
  font-size: 0.9rem;
}

/* Map container */
.mapbox iframe {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Filter buttons */
.filter-list {
  display: none;
}

.filter-select-box {
  margin-bottom: 1.5rem;
}

.filter-select {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.select-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
}

.select-item button {
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.select-item button:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* Download button */
.download-btn {
  background: var(--primary-gradient);
  color: white;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
  -webkit-tap-highlight-color: transparent;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Remove focus outline for interactive elements */
.service-item:focus,
.project-item:focus,
.skill-box:focus,
.nav-item:focus {
  outline: none;
}

/* Selection styles */
::selection {
  background: #b3d4fc;
  color: inherit;
}

::-moz-selection {
  background: #b3d4fc;
  color: inherit;
}

/* Desktop styles */
@media (min-width: 768px) {
  .service-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  
  .project-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
  
  .contact-info {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .filter-list {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
  }
  
  .filter-select-box {
    display: none;
  }
  
  .article-title {
    font-size: 2rem;
  }
  
  section {
    padding: 2rem;
    margin-bottom: 3rem;
  }
  
  .service-item {
    padding: 1.5rem;
  }
  
  .service-item .service-item-title {
    font-size: 1.25rem;
  }
  
  .service-item .service-item-text {
    font-size: 1rem;
  }
  

  
  .timeline-item .timeline-item-title {
    font-size: 1.25rem;
  }
  
  .timeline-item .timeline-text {
    font-size: 1rem;
  }
  
  .skill-box {
    padding: 1rem;
    font-size: 1rem;
  }
  
  .project-item .project-title {
    font-size: 1.25rem;
  }
  
  .project-item .project-category {
    font-size: 1rem;
  }
  
  .contact-item {
    padding: 1.5rem;
  }
  
  .contact-item .contact-title {
    font-size: 1.125rem;
  }
  
  .contact-item .contact-link,
  .contact-item .contact-address {
    font-size: 1rem;
  }
}

@media (min-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    overflow: hidden;
    z-index: 50;
    transform: translateX(0);
  }
  
  .navbar {
    position: fixed;
    top: 0;
    left: 320px;
    right: 0;
    z-index: 40;
  }
  
  .main-content {
    margin-left: 320px;
    background: linear-gradient(135deg, #eff6ff, #ffffff, #faf5ff);
    min-height: 100vh;
  }
  
  /* Main content sections styling */
  .main-content section {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #374151 !important;
  }
  
  .mobile-header,
  .mobile-bottom-nav {
    display: none;
  }
  
  .service-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .project-list {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Ensure proper scroll margin for desktop */
  section[id] {
    scroll-margin-top: 5rem;
  }
}

/* Large desktop */
@media (min-width: 1280px) {
  .service-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .project-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* iPhone specific adjustments */
@supports (padding: max(0px)) {
  .mobile-header {
    padding-top: max(1rem, var(--sat));
  }
  
  .mobile-bottom-nav {
    padding-bottom: max(0.5rem, var(--sab));
  }
  
  .sidebar {
    padding-top: max(1rem, var(--sat));
    padding-bottom: max(1rem, var(--sab));
  }
}

/* Prevent iOS Safari zoom on input focus */
input, select, textarea {
  font-size: 16px;
}

/* Touch improvements */
.service-item,
.project-item,
.skill-box,
.nav-item,
.contact-item {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Mobile hover state improvements */
@media (hover: none) {
  .service-item:hover,
  .project-item:hover,
  .skill-box:hover,
  .nav-item:hover {
    transform: none;
  }
  
  .service-item:active,
  .project-item:active,
  .skill-box:active,
  .nav-item:active {
    transform: scale(0.98);
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1e293b, #334155, #475569);
    color: #f1f5f9;
  }
  
  .glass {
    background: rgba(30, 41, 59, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* Override dark mode for main content sections */
  .main-content section {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #374151 !important;
  }
  
  .mobile-header,
  .mobile-bottom-nav {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .glass {
    background: white;
    border: 2px solid #000;
  }
  
  .gradient-text {
    background: #000;
    -webkit-text-fill-color: #000;
  }
}

/* Print styles */
@media print {
  .mobile-header,
  .mobile-bottom-nav,
  .sidebar-info_more,
  .filter-list,
  .filter-select-box {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .glass {
    background: white !important;
    border: 1px solid #e5e7eb !important;
  }
  
  section {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: none !important;
  }
}

