/* Asaqe Tech Theme - Main Stylesheet */
/* CSS Variables for Enhanced Theme System */
:root {
  /* Primary Colors */
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #5a67d8;

  /* Text Colors */
  --text-color: #1f2937;
  --text-light-color: #6b7280;
  --text-muted: #9ca3af;

  /* Background Colors */
  --background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --body-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;

  /* Code Colors */
  --code-bg: rgba(102, 126, 234, 0.08);
  --code-color: #e53e3e;

  /* Layout */
  --max-width: 1200px;
  --header-height: 80px;

  /* Animation */
  --animation-duration: 0.6s;
  --animation-delay: 0.1s;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(102, 126, 234, 0.2);
  --shadow-xl: 0 25px 50px rgba(102, 126, 234, 0.25);
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --text-color: #e2e8f0;
  --text-light-color: #a0aec0;
  --text-muted: #718096;
  --body-bg: #0f1419;
  --card-bg: #1e293b;
  --border-color: #334155;
  --code-bg: rgba(102, 126, 234, 0.15);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 25px 50px rgba(0, 0, 0, 0.6);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--body-bg);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
}

/* Site Background */
.site-background {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background);
  opacity: 0.03;
  z-index: -2;
  pointer-events: none;
}

/* Main Layout */
.site-main {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.main-content-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Enhanced Loading Animation */
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-container.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  text-align: center;
  position: relative;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid transparent;
  border-top: 4px solid var(--primary-color);
  border-right: 4px solid var(--secondary-color);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin: 0 auto 1.5rem;
  position: relative;
}

.spinner::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 2px solid transparent;
  border-top: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  animation: spin 2s linear infinite reverse;
}

.loading-spinner p {
  color: var(--text-color);
  font-weight: 500;
  font-size: 1.1rem;
  background: var(--background);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse-text 2s ease-in-out infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-color);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* Code Styles */
code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  background: var(--code-bg, rgba(102, 126, 234, 0.08));
  color: var(--code-color, #e53e3e);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 2rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 2rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, Monaco, monospace;
  line-height: 1.7;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Enhanced code block for wide screens */
.post-content-wrapper pre {
  margin: 2.5rem -1rem;
  border-radius: 16px;
  padding: 2.5rem;
  background: linear-gradient(135deg, #1a1a1a 0%, #1e1e1e 100%);
  box-shadow:
    var(--shadow-xl),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Code block header */
pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--background);
  border-radius: 12px 12px 0 0;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--primary-color);
  background: rgba(102, 126, 234, 0.05);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Removed back-to-top and reading progress styles */

/* Basic Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Simple animation classes */
.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.3s ease;
}

/* Enhanced Dark Mode */
[data-theme="dark"] body {
  background: var(--body-bg);
  color: var(--text-color);
}

[data-theme="dark"] .site-background {
  opacity: 0.15;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

[data-theme="dark"] .loading-container {
  background: var(--body-bg);
  color: var(--text-color);
}

[data-theme="dark"] .spinner {
  border-color: transparent;
  border-top-color: var(--primary-color);
  border-right-color: var(--secondary-color);
}

[data-theme="dark"] pre {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  border: 1px solid rgba(102, 126, 234, 0.2);
  color: #e6edf3;
}

[data-theme="dark"] .post-content-wrapper pre {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] blockquote {
  background: rgba(102, 126, 234, 0.15);
  border-left-color: var(--primary-color);
}

[data-theme="dark"] table {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] th {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

[data-theme="dark"] tr:hover {
  background: rgba(102, 126, 234, 0.15);
}

[data-theme="dark"] code {
  background: var(--code-bg);
  color: #f97316;
}

/* Dark mode card enhancements */
[data-theme="dark"] .enhanced-card,
[data-theme="dark"] .skill-card,
[data-theme="dark"] .project-card,
[data-theme="dark"] .post-card {
  background: var(--card-bg);
  border: 1px solid rgba(102, 126, 234, 0.2);
  color: var(--text-color);
}

[data-theme="dark"] .enhanced-card:hover,
[data-theme="dark"] .skill-card:hover,
[data-theme="dark"] .project-card:hover,
[data-theme="dark"] .post-card:hover {
  border-color: rgba(102, 126, 234, 0.4);
  box-shadow:
    var(--shadow-xl),
    0 0 30px rgba(102, 126, 234, 0.2);
}

/* Dark mode text colors */
[data-theme="dark"] .skill-name,
[data-theme="dark"] .project-name,
[data-theme="dark"] .post-title {
  color: var(--text-color);
}

[data-theme="dark"] .skill-description,
[data-theme="dark"] .project-description,
[data-theme="dark"] .post-excerpt {
  color: var(--text-light-color);
}

/* Dark mode tag styles */
[data-theme="dark"] .skill-tag,
[data-theme="dark"] .project-tag,
[data-theme="dark"] .post-tag {
  background: rgba(102, 126, 234, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .skill-tag:hover,
[data-theme="dark"] .project-tag:hover,
[data-theme="dark"] .post-tag:hover {
  background: rgba(102, 126, 234, 0.3);
  color: #c4b5fd;
}

/* Dark mode icon colors */
[data-theme="dark"] .skill-icon,
[data-theme="dark"] .project-icon {
  color: #a78bfa;
}

[data-theme="dark"] .skill-icon i,
[data-theme="dark"] .project-icon i {
  color: #a78bfa;
}

/* Dark mode section titles */
[data-theme="dark"] .section-title {
  color: #a78bfa;
}

[data-theme="dark"] .section-title i {
  color: #a78bfa;
}

/* Dark mode hero title */
[data-theme="dark"] .hero-title {
  background: linear-gradient(135deg, #a78bfa, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Dark mode buttons */
[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

[data-theme="dark"] .btn-secondary {
  border-color: #a78bfa;
  color: #a78bfa;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #a78bfa;
  color: #1e293b;
}

/* Responsive Design */
@media (max-width: 1400px) {
  .main-content {
    max-width: 1200px;
  }
}

@media (max-width: 1200px) {
  .container {
    max-width: 100%;
  }

  .main-content {
    max-width: 100%;
    padding: 0 1.5rem;
  }

  .content-area {
    width: 75%; /* 在中等屏幕上增加内容区域宽度 */
  }

  .post-content-wrapper {
    max-width: 100%;
    padding: 2rem;
  }
}

@media (max-width: 1000px) {
  .content-area {
    width: 78%; /* 进一步增加内容区域宽度 */
  }
}

@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
    padding: 0 1rem;
  }

  .content-area {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .main-content {
    padding: 0 1rem;
  }

  .post-content-wrapper {
    padding: 1.5rem;
    max-width: 100%;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
}

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

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* Print Styles */
@media print {
  .site-header,
  .back-to-top,
  .reading-progress {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .container {
    max-width: none !important;
    padding: 0 !important;
  }
}
